@@ -184,7 +184,7 @@ def syllable_length(syllable: str) -> str:
184
184
# output: short
185
185
"""
186
186
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 ):
188
188
return "short"
189
189
elif bool (re_short .search (syllable )):
190
190
return "short"
@@ -259,15 +259,15 @@ def tone_detector(syllable: str) -> str:
259
259
and tone_mark == "่"
260
260
):
261
261
r = "l"
262
- elif initial_consonant == "อ" and consonant_ending and s == "dead" :
263
- r = "l"
264
262
elif (
265
263
initial_consonant == "ห"
266
264
and consonant_ending
267
265
and s == "live"
268
266
and tone_mark == "่"
269
267
):
270
268
r = "l"
269
+ elif initial_consonant == "อ" and consonant_ending and s == "dead" :
270
+ r = "l"
271
271
elif (
272
272
initial_consonant == "ห"
273
273
and consonant_ending
@@ -279,6 +279,22 @@ def tone_detector(syllable: str) -> str:
279
279
r = "l"
280
280
elif initial_consonant == "ห" and consonant_ending and s == "live" :
281
281
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"
282
298
elif (
283
299
initial_consonant_type == "low"
284
300
and syllable_check_length == "short"
@@ -299,22 +315,6 @@ def tone_detector(syllable: str) -> str:
299
315
and syllable_check == "open"
300
316
):
301
317
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"
318
318
elif initial_consonant_type == "mid" and s == "dead" :
319
319
r = "l"
320
320
elif initial_consonant_type == "high" and s == "dead" :
0 commit comments