Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate key in IPA to RTGS phoneme mapping #852

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions pythainlp/util/phoneme.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ def nectec_to_ipa(pronunciation: str) -> str:
"d":"d",
"f":"f",
"h":"h",
"j":"y",
# The conversion of j depends on its position in the syllable.
# But, unfortunately, the current implementation cannot handle both cases.
# To remove confusions without changing the behavior and breaking existing codes,
# it is suggested that the first key-value mapping of j be simply commented out,
# as it would be overridden by the second one and thus never take effect from the beginning.
# See #846 for a more detailed discussion: https://github.com/PyThaiNLP/pythainlp/issues/846
# "j":"y",
"k":"k",
"kʰ":"kh",
"l":"l",
Expand Down Expand Up @@ -198,7 +204,7 @@ def ipa_to_rtgs(ipa: str) -> str:
Docs: https://en.wikipedia.org/wiki/Help:IPA/Thai

:param str ipa: IPA phoneme
:return: The RTGS that is converted
:return: The RTGS that is converted, according to rules listed in the Wikipedia page
:rtype: str

:Example:
Expand Down
Loading