jdlorimer / chinese-support-redux

Anki add-on providing support for Chinese study
https://ankiweb.net/shared/info/1128979221
GNU General Public License v3.0
100 stars 50 forks source link

capital letters in syllables in reading field (imported previously) are not recognized as real chinese syllables and shown as tone 5 letters. #112

Open rudyeikichi opened 4 years ago

rudyeikichi commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Specs (please complete the following information):

Additional context Add any other context about the problem here.

jdlorimer commented 3 years ago

If you can give an example, I'll take a look at it.

rudyeikichi commented 3 years ago

Example (from txt files which I use to import cards): 凯文 Kai3wen2 Kevin (person name)

(I added spaces only to visually render the 3 fields) The second field is the reading field, the one that when has capital letters is rendered with "tone5" syllables: Kǎiwén

alchzh commented 3 years ago

changing PINYIN_INITIALS to 'zh|Zh|sh|Sh|ch|Ch|chu|Chu|[bpmfdtnlgkhjqxrzscwyBPMFDTNLGKHJQXRZSCWY]' should fix this

rudyeikichi commented 3 years ago

What do you mean? Changing one by one all initials? That is what I have already been doing, but of course is time consuming Or maybe what you've written is some sort of code that will do it automatically? (in the latter case I don't know how to implement it)

alchzh commented 3 years ago

@rudyeikichi if you need to fix it quickly, edit the file consts.py in the add-on folder and replace the line

PINYIN_INITIALS = 'zh|sh|ch|chu|[bpmfdtnlgkhjqxrzscwy]'

with

PINYIN_INITIALS = 'zh|Zh|sh|Sh|ch|Ch|chu|Chu|[bpmfdtnlgkhjqxrzscwyBPMFDTNLGKHJQXRZSCWY]'

rudyeikichi commented 3 years ago

Thank you! I didn't know this coding trick! Now it works perfectly! thank you very much

alchzh commented 3 years ago

@rudyeikichi can you keep issue open because it is still an issue with the add-on? Looks like @luoliyan may be inactive and it is time for fork-of-a-fork (I am happy to maintain)

rudyeikichi commented 3 years ago

Ok. Keep open. Anyway it still doesn't work with all letters. I input some words that start with the hanzi of Australia and it gave me A with tone 5, and "o" with the correct tone. I added the letter A to the list of initials in that file but still not working. Anyway not big problem, if I have to change just the words starting with a capital A, it's still much better than change all capital letters by hand. If I see other letters that don't work properly I'll write them down here. Anyway for I'm really happy with this correction of the initials.