Skip to content

Commit 4f5b0cf

Browse files
authored
Merge pull request #852 from BLKSerene/fix_duplicate_key
Fix duplicate key in IPA to RTGS phoneme mapping
2 parents 913f103 + 78b7b8c commit 4f5b0cf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pythainlp/util/phoneme.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,13 @@ def nectec_to_ipa(pronunciation: str) -> str:
125125
"d":"d",
126126
"f":"f",
127127
"h":"h",
128-
"j":"y",
128+
# The conversion of j depends on its position in the syllable.
129+
# But, unfortunately, the current implementation cannot handle both cases.
130+
# To remove confusions without changing the behavior and breaking existing codes,
131+
# it is suggested that the first key-value mapping of j be simply commented out,
132+
# as it would be overridden by the second one and thus never take effect from the beginning.
133+
# See #846 for a more detailed discussion: https://github.com/PyThaiNLP/pythainlp/issues/846
134+
# "j":"y",
129135
"k":"k",
130136
"kʰ":"kh",
131137
"l":"l",
@@ -198,7 +204,7 @@ def ipa_to_rtgs(ipa: str) -> str:
198204
Docs: https://en.wikipedia.org/wiki/Help:IPA/Thai
199205
200206
:param str ipa: IPA phoneme
201-
:return: The RTGS that is converted
207+
:return: The RTGS that is converted, according to rules listed in the Wikipedia page
202208
:rtype: str
203209
204210
:Example:

0 commit comments

Comments
 (0)