Skip to content

Commit 087fafd

Browse files
authored
Optimize consonant filtering in word formation
1 parent 8c05e8d commit 087fafd

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pythainlp/morpheme/word_formation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def nighit(w1: str, w2: str) -> str:
3838
newword = []
3939
newword.append(list_w1[0])
4040
newword.append("ั")
41-
consonants_in_w2 = [i for i in list_w2 if i in set(thai_consonants)]
41+
_consonants = set(thai_consonants)
42+
consonants_in_w2 = [i for i in list_w2 if i in _consonants]
4243
if not consonants_in_w2:
4344
raise ValueError(
4445
f"w2 {w2!r} contains no Thai consonants."

0 commit comments

Comments
 (0)