@@ -184,7 +184,7 @@ def syllable_length(syllable: str) -> str:
184184 # output: short
185185 """
186186 consonants = [i for i in syllable if i in list (thai_consonants )]
187- if len (consonants ) < 3 and any ((c in set (short )) for c in syllable ):
187+ if len (consonants ) <= 3 and any ((c in set (short )) for c in syllable ):
188188 return "short"
189189 elif bool (re_short .search (syllable )):
190190 return "short"
@@ -259,15 +259,15 @@ def tone_detector(syllable: str) -> str:
259259 and tone_mark == "่"
260260 ):
261261 r = "l"
262- elif initial_consonant == "อ" and consonant_ending and s == "dead" :
263- r = "l"
264262 elif (
265263 initial_consonant == "ห"
266264 and consonant_ending
267265 and s == "live"
268266 and tone_mark == "่"
269267 ):
270268 r = "l"
269+ elif initial_consonant == "อ" and consonant_ending and s == "dead" :
270+ r = "l"
271271 elif (
272272 initial_consonant == "ห"
273273 and consonant_ending
@@ -279,6 +279,22 @@ def tone_detector(syllable: str) -> str:
279279 r = "l"
280280 elif initial_consonant == "ห" and consonant_ending and s == "live" :
281281 r = "r"
282+ elif initial_consonant_type == "high" and s == "live" and tone_mark == "่" :
283+ r = "l"
284+ elif initial_consonant_type == "mid" and s == "live" and tone_mark == "่" :
285+ r = "l"
286+ elif initial_consonant_type == "low" and tone_mark == "้" :
287+ r = "h"
288+ elif initial_consonant_type == "mid" and tone_mark == "๋" :
289+ r = "r"
290+ elif initial_consonant_type == "mid" and tone_mark == "๊" :
291+ r = "h"
292+ elif initial_consonant_type == "low" and tone_mark == "่" :
293+ r = "f"
294+ elif initial_consonant_type == "mid" and tone_mark == "้" :
295+ r = "f"
296+ elif initial_consonant_type == "high" and tone_mark == "้" :
297+ r = "f"
282298 elif (
283299 initial_consonant_type == "low"
284300 and syllable_check_length == "short"
@@ -299,22 +315,6 @@ def tone_detector(syllable: str) -> str:
299315 and syllable_check == "open"
300316 ):
301317 r = "h"
302- elif initial_consonant_type == "high" and s == "live" and tone_mark == "่" :
303- r = "l"
304- elif initial_consonant_type == "mid" and s == "live" and tone_mark == "่" :
305- r = "l"
306- elif initial_consonant_type == "low" and tone_mark == "้" :
307- r = "h"
308- elif initial_consonant_type == "mid" and tone_mark == "๋" :
309- r = "r"
310- elif initial_consonant_type == "mid" and tone_mark == "๊" :
311- r = "h"
312- elif initial_consonant_type == "low" and tone_mark == "่" :
313- r = "f"
314- elif initial_consonant_type == "mid" and tone_mark == "้" :
315- r = "f"
316- elif initial_consonant_type == "high" and tone_mark == "้" :
317- r = "f"
318318 elif initial_consonant_type == "mid" and s == "dead" :
319319 r = "l"
320320 elif initial_consonant_type == "high" and s == "dead" :
0 commit comments