Skip to content

bug: tone_detector wrongly detect falling tone for ครับ #1004

@antlossway

Description

@antlossway

Description

print(tone_detector("ครับ"))
result: f

print(tone_detector("ค่ะ"))
result: h

Expected results

"ครับ" should be high tone
"ค่ะ" should be falling tone

Current results

"ครับ": falling tone
"ค่ะ": high tone

Steps to reproduce

print(tone_detector("ครับ"))
print(tone_detector("ค่ะ"))

PyThaiNLP version

5.0.4

Python version

3.10.15

Operating system and version

macOS 15.1.1

More info

No response

Possible solution

the falling tone result for "ครับ" is derived from below code block in syllable.py
elif ( initial_consonant_type == "low" and syllable_check_length == "long" and syllable_check == "close" and s == "dead" ): r = "f"

Files

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbugs in the library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions