Skip to content

Commit 4cb0c32

Browse files
committed
Fixed romanize function
1 parent 415d00e commit 4cb0c32

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pythainlp/transliterate/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def romanize(
12-
word: str,
12+
text: str,
1313
engine: str = DEFAULT_ROMANIZE_ENGINE,
1414
fallback_engine: str = DEFAULT_ROMANIZE_ENGINE,
1515
) -> str:
@@ -19,7 +19,7 @@ def romanize(
1919
[#rtgs_transcription]_. RTGS is the official system published
2020
by the Royal Institute of Thailand. (Thai: ถอดเสียงภาษาไทยเป็นอักษรละติน)
2121
22-
:param str word: A Thai word to be romanized. \
22+
:param str text: A Thai word to be romanized. \
2323
The input should not include whitespace because \
2424
the function is support subwords by spliting whitespace.
2525
:param str engine: One of 'royin' (default), 'thai2rom', 'thai2rom_onnx, 'tltk', and 'lookup'. See more in options for engine section.
@@ -81,18 +81,18 @@ def select_romanize_engine(engine: str):
8181

8282
return romanize
8383

84-
if not word or not isinstance(word, str):
84+
if not text or not isinstance(text, str):
8585
return ""
8686

8787
if engine == "lookup":
8888
from pythainlp.transliterate.lookup import romanize
8989

9090
fallback = select_romanize_engine(fallback_engine)
91-
return romanize(word, fallback_func=fallback)
91+
return romanize(text, fallback_func=fallback)
9292
else:
9393
rom_engine = select_romanize_engine(engine)
9494
trans_word = []
95-
for subword in word.split(' '):
95+
for subword in text.split(' '):
9696
trans_word.append(rom_engine(subword))
9797
new_word = ' '.join(trans_word)
9898
return new_word

0 commit comments

Comments
 (0)