-
Notifications
You must be signed in to change notification settings - Fork 936
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
Cmn voice not correctly translated #1370
Comments
I think the problem is that eSpeak not correctly handle diphthongs in cmn. It inserts a low level tone 11 between diphthongs in cmn. Current situaltion is: It should be translated as: |
"此电脑" in the cmn_list is translated as "ci3 dian4 nao3" in Pinyin. As I have mentioned above, the pronunciation of "此电脑" in the old version (i.e. 1.50) is correct: The latest pronunciation of "此电脑" is not correct: So I try to make some changes to phsource/ph_cmn:
After applying the changes and rebuild, it sounds fine:
@jaacoppi Change 3 should not work. I just don't understand how the rules work. How does eSpeak know when to use phoneme "i[" or "i." instead of "i"? I suppose this is not defined by the comment "//after ts tsh s" or "//after ts. ts.h s. z.". How do I write a rule for "i after c"? Thank you very much! |
I see. In yue_rules, the rules are quite simple:
In cmn_rules, the rules are complicated. Selecting "i", "i[" or "i." is defined in cmn_rules. After defining
@jaacoppi |
@hgneng I speak very little chinese. If you think it sounds better then you should do a PR. Just remember to test with both combinations: chinese characters with english text and chinese characters with pinyin text. Syntax for rules is explained in docs/dictionary.md. For "i" aftter "c", use something like: |
@jaacoppi Thank you for replying. Since the current cmn_rules is complicate, I think adding English rules basing on Mandarin rules is easier than the reverse one. I will try to revert cmn dictrules to 2 and fix English reading. The following test case seems works. I will write more test cases and fix other rules.
|
I have rewritten most of the rules of cmn. Vowel will be spoken as Mandarin only when it's with a tone number. Otherwise, it will be regarded as English. This will make English words translated more correctly.
However, there is one more thing that can be improved. All English vowel is added with a tone 55. Cantonese also has the same problem. I don't know how to fix it. It should be more natural without the tone for English. |
Excellent work!
The tone marker 55 is probably somewhere in the code, not in the rules.
|
@ssb22 For example, there is an item in cmn_listx: But it is still matching the default item in cmn_list:
I pick up another word The Cantonese extra dictionary yue_listx doesn't have this issue. espeak-ng can translate Cantonese words correctly. This issue seems exists for a long time at least since 1.50. Could you help to confirm it? And do you have any idea why cmn_listx doesn't work? I also find that there are meaningless items in cmn_listx. For example there is an item |
Single character in cmn_listx is correctly loaded. For example, 㐀 doesn't exists in cmn_list but only in cmn_listx. espeak-ng can translate 㐀 correctly.
|
I test with eSpeak 1.47.11 and get correct result:
eSpeak 1.47 with Chinese dictionaries can be downloaded from eSpeak-Chinese: https://sourceforge.net/projects/e-guidedog/files/eSpeak-Chinese/1.47.11/ (I no longer maintained eSpeak-Chinese since 2013) It seems that the problem lies in "Replace" stage. |
Cantonese goes another route "Found" different from Mandarin's "Replace".
|
Following code can fix the Mandarin dictionary word matching issue:
However, the second character of the word is read twice. It seems that the string pointer doesn't advance correctly for Mandarin word. I haven't found the cause yet.
|
Might be a multibyte character issue. Those have known to cause problems in the past. Some index or offset is wrong.. somewhere.
|
@jaacoppi
|
Tests are in tests/ and are run with `make check`.
Your patch looks interesting. Let's see what happens. It might be that the current tests are faulty and this should have been the correct behavior all along.
|
make check passed in both my branch and latest espeak-ng master. I will do some more testings and commit later. |
Sorry I'm away from my computer and haven't been able to look into this properly. I have not used espeak-ng myself. |
Regarding unnecessary items in zh_listx (now cmn_listx), my script was programmed not to include words which would have been correctly pronounced anyway, but it also looked out for situations like: if there exists a 2-character word AB which needs no override, but there also exists a word BC which requires C to be overridden, and yet in the 3-character combination ABC the C should not be overridden because it's AB + C rather than A + BC, then do include the "unnecessary" word AB in the dictionary just to prevent eSpeak from using the overridden version of BC if there's an A before it. I need to get back to my computer before I can check the specific reason why 天主 is included, but if my script did it then it will be because there exists another word starting with 主 with an override which should have lower priority than 天主. But it is also possible that the script was faulty or the word was put in at another time. I should probably redo that script anyway and double-check the licensing of all sources it uses. It's on an old recordable CD in our loft when we get back to Cambridge. |
Oh and I also seem to remember putting in a rule about words ending with third tone to help with sandhi. Beginners are taught "if there are two third-tones together, then the first one becomes a second tone" and "if there are three third-tones together, then the middle one becomes a second tone". Generalisation: if there are N third-tones together, then the N-2x-1 becomes second tone. But, crucially, this rule stops at word boundaries. So for example 给你好消息 is read with gei2 ni3 hao3, not gei3 ni2 hao3, because 给你 acts as one word and 好消息 acts as another, and the sandhi inside each is treated separately. I have verified this by asking multiple native speakers to record various phrases involving 3 or more tone-3 sequences and not telling them why I was asking before they recorded, to see how they naturally read it. (Some of the speakers did more complex things, like using a high tone-2 for the first and a low tone-2 for the second, but I assumed that was a regional variation and it would require a lower-level code change to implement, plus we wouldn't be able to do it in Ekho without PRATT-processing all the tone 2s into high tone 2s, so I only focused on the recordings that used a normal tone 2 to replace tone 3 in some places.) I implemented this in Gradint ( |
I have compared code of espeak and espeak-ng. The dictionary bug should be injected when re-structing method TranslateWord3. I have made a patch for it and seems work. I am afraid that I have never thought that third tone rules would be such complicated. I am still at beginner level :( I see. I find another interesting item |
@hgneng can you make a PR of all your current changes? I think they could be merged already. For 主 体, check out intonation.c and especially this code block: espeak-ng/src/libespeak-ng/intonation.c Lines 849 to 850 in 97e557a
|
1. Rewrite cmn_rules. Vowel will be spoken as Mandarin only when it's with a tone number. Otherwise, it will be regarded as English. This will make English words translated more correctly. 2. Fix issue of word item in cmn_listx not taking effect. 3. Fix dictionary_skipwords bug. It should be injected when re-structing method TranslateWord3.
@jaacoppi I have make a PR. Could you please have a review? |
I have already reviewed it. See the comment in the PR:
#1404
|
@jaacoppi
This is a following issue of #1044.
I apologize for my not careful test. I find issues after @cary-rowen tell me that there are still problems with Chinese Mandarin voice.
Here is the current voice output:
And following output from older version is much better than current situation:
Maybe this is why you had comment: #1044 (comment)
Here is the revert code:
cmn_revert.patch.txt
In fact, it's a temporary solution of #1163 .
I will try to compare the rules of Cantonese and Mandarin to find whether there are clues to make both Mandarin and English read correctly.
The text was updated successfully, but these errors were encountered: