Skip to content

Commit 77e4b8c

Browse files
authored
Change return value for empty word case in thai.py
Update the return value for None or empty word in thai_word_tone_detector function.
1 parent d7a8213 commit 77e4b8c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

pythainlp/util/thai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def thai_word_tone_detector(word: Optional[str]) -> list[tuple[str, str]]:
224224
:param Optional[str] word: Thai word, or None
225225
:return: List of tuples containing Thai pronunciation with tones in each syllable.\
226226
Tone values: l (low), m (mid), h (high), r (rising), f (falling), or empty if it cannot be detected.\
227-
Returns [('', '')] if word is None or empty.
227+
Returns [] if word is None or empty.
228228
:rtype: list[tuple[str, str]]
229229
230230
:Example:
@@ -239,10 +239,10 @@ def thai_word_tone_detector(word: Optional[str]) -> list[tuple[str, str]]:
239239
# output: [('มือ', 'm'), ('ถือ', 'r')]
240240
241241
print(thai_word_tone_detector(None))
242-
# output: [('', '')]
242+
# output: []
243243
"""
244244
if not word:
245-
return [("", "")]
245+
return []
246246

247247
from ..transliterate import pronunciate
248248
from ..util.syllable import tone_detector

0 commit comments

Comments
 (0)