Skip to content

Commit

Permalink
Moved sandhi and delimiter defining logic to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
andreihar committed Apr 28, 2024
1 parent cbf0654 commit 6ee0b6b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions taibun/taibun.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def __init__(self, system='Tailo', dialect='south', format='mark', delimiter=DEF
self.system = system.lower()
self.dialect = dialect.lower()
self.format = format
self.delimiter = delimiter
self.sandhi = sandhi
self.delimiter = delimiter if delimiter != self.DEFAULT_DELIMITER else self.__set_default_delimiter()
self.sandhi = sandhi if sandhi != self.DEFAULT_SANDHI else self.__set_default_sandhi()
self.punctuation = punctuation
self.convert_non_cjk = convert_non_cjk

Expand All @@ -65,9 +65,6 @@ def __init__(self, system='Tailo', dialect='south', format='mark', delimiter=DEF

# Convert tokenised text into specified transliteration system
def get(self, input):
self.delimiter = self.delimiter if self.delimiter != self.DEFAULT_DELIMITER else self.__set_default_delimiter()
self.sandhi = self.sandhi if self.sandhi != self.DEFAULT_SANDHI else self.__set_default_sandhi()

converted = Tokeniser().tokenise(to_traditional(input))
converted = ' '.join(self.__convert_tokenised(i).strip() for i in self.__tone_sandhi_position(converted)).strip()
if self.punctuation == 'format':
Expand Down

0 comments on commit 6ee0b6b

Please sign in to comment.