Skip to content

Commit

Permalink
Merge pull request #924 from pavaris-pm/transliterate
Browse files Browse the repository at this point in the history
Add preprocess function to split whitespace before `romanize`
  • Loading branch information
wannaphong authored Oct 7, 2024
2 parents 53ae444 + 0910d72 commit 3fea2f7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pythainlp/transliterate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ def select_romanize_engine(engine: str):
fallback = select_romanize_engine(fallback_engine)
return romanize(text, fallback_func=fallback)
else:
return select_romanize_engine(engine)(text)
rom_engine = select_romanize_engine(engine)
trans_word = []
for word in text.split(' '):
trans_word.append(rom_engine(word))
new_word = ''.join(trans_word)
return new_word


def transliterate(
Expand Down

0 comments on commit 3fea2f7

Please sign in to comment.