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 handling of attached retroflex in pinyinize #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noe
Copy link

@noe noe commented Jun 21, 2021

The CC-CEDICT syntax wiki describes the retroflex finals as:

There are 3 kinds of R-ised words that use the 兒/儿 character:

兒/儿 is not-optional because it's its own syllable (usually meaning “son,” so daughter is actually “girl son”) - 女兒/女儿 nǚ'ér
兒/儿 is not-optional because it changes the definition of the word and is tacked on to the preceding syllable - 头兒/头儿 tóur (leader) as opposed to 头 tóu (head)
兒/儿 is an optional northern pronunciation (er2hua4) and is tacked on to the preceding syllable - 花兒/花儿 huār (flower) as opposed to 花 huā (flower)
These 3 cases should be formatted as follows:

女兒 女儿 [nu:3 er2] /daughter/
頭兒 头儿 [tou2 r5] /leader/
花兒 花儿 [hua1 r5] /erhua variant of 花/flower/

However, in pycedict, cases 2 and 3 are not properly handled by pinyinize. The problem is two fold:

  1. pinyinize assumes the syllable has vowels, so with r5 it fails at vowels = list(vowels).
  2. The final retroflex is not attached to the previous sillable.

This problem was raised as issue #2.

This PR aims at fixing both problems by:

  1. Moving the offending vowels = list(vowels) after the already existing special handling of r5.
  2. Attaching any final retroflex with a regular expression.

A diff between the results with and without the fix did not show any breaking cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant