From 1f0feaa55bffab958f6e489bc9f76bdea5ddfb3c Mon Sep 17 00:00:00 2001 From: Robin <167366979+allrob23@users.noreply.github.com> Date: Sat, 29 Mar 2025 14:22:02 -0300 Subject: [PATCH] refactor: use set for thai_consonants_all instead of list --- pythainlp/util/syllable.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pythainlp/util/syllable.py b/pythainlp/util/syllable.py index c8e5fb272..e91812e11 100644 --- a/pythainlp/util/syllable.py +++ b/pythainlp/util/syllable.py @@ -21,7 +21,7 @@ "กบ": list("บปภพฟ"), } -thai_consonants_all = list(thai_consonants) +thai_consonants_all = set(thai_consonants) thai_consonants_all.remove("อ") _temp = list("".join(["".join(v) for v in spelling_class.values()])) @@ -87,7 +87,7 @@ def sound_syllable(syllable: str) -> str: return "dead" # get consonants - consonants = [i for i in syllable if i in list(thai_consonants_all)] + consonants = [i for i in syllable if i in thai_consonants_all] if ( (len(consonants) == 0) and ("อ" in syllable)