Apply suggestions from code review

pull/3972/head
张春乔 8 months ago committed by GitHub
parent 6757cec50b
commit 906467118d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -303,7 +303,7 @@ class ToneSandhi():
for (word, pos) in seg:
orig_finals = lazy_pinyin(
word, neutral_tone_with_five=True, style=Style.FINALS_TONE3)
# after pypinyin==0.41.0, 嗯 will be processed as "", so we need to change it to "n2"
# after pypinyin==0.44.0, '嗯' need to be n2, cause the initial and final consonants cannot be empty at the same time
en_index = [index for index, c in enumerate(word) if c == ""]
for i in en_index:
orig_finals[i] = "n2"

@ -173,7 +173,7 @@ class Frontend():
word, neutral_tone_with_five=True, style=Style.INITIALS)
orig_finals = lazy_pinyin(
word, neutral_tone_with_five=True, style=Style.FINALS_TONE3)
# after pypinyin==0.41.0, 嗯 will be processed as "", so we need to change it to "n2"
# after pypinyin==0.44.0, '嗯' need to be n2, cause the initial and final consonants cannot be empty at the same time
en_index = [index for index, c in enumerate(word) if c == ""]
for i in en_index:
orig_finals[i] = "n2"

Loading…
Cancel
Save