Skip to content

Commit

Permalink
Update pronounce.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wannaphong committed Oct 18, 2023
1 parent 7ddeb04 commit 1cd22ba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pythainlp/util/pronounce.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@


kv = KhaveeVerifier()
all_thai_words_dict = [i for i in list(thai_words()) if len(syllable_tokenize(i))==1]
all_thai_words_dict = [
i for i in list(thai_words()) if len(syllable_tokenize(i)) == 1
]


def rhyme(word: str)->List[str]:
def rhyme(word: str) -> List[str]:
"""
Find Thai rhyme
Expand All @@ -38,8 +40,8 @@ def rhyme(word: str)->List[str]:
print(rhyme("จีบ"))
# output: ['กลีบ', 'กีบ', 'ครีบ', ...]
"""
list_sumpus=[]
list_sumpus = []
for i in all_thai_words_dict:
if kv.is_sumpus(word,i) and i!=word:
if kv.is_sumpus(word, i) and i != word:
list_sumpus.append(i)
return sorted(list_sumpus)

0 comments on commit 1cd22ba

Please sign in to comment.