Vocab-Apps / pinyin-jyutping

Convert Chinese text to Pinyin or Jyutping
GNU General Public License v3.0
25 stars 4 forks source link

Error when process Chinese English mixed input #5

Closed JohnHerry closed 1 year ago

JohnHerry commented 1 year ago

Hi, I found that use this tool to convert graphme of Chinese to phoneme ( pinyin) for CnEn mixed text will get error result.

I tested that , each character of english word will be translated into a single char: 我来自MMT公司 -> wo3 lai2 zi4 M M T gong1 si1

Except the English character A, it is translated into a Chinese pinyin a5:

这是ATM -> zhe4 shi4 a5 T M

What I expected is the consistant rule to process the English word part. which, the character A will also mapped to pinyin result A.

luc-vocab commented 1 year ago

I agree this is a bug, let me see what I can try to fix

JohnHerry commented 1 year ago

I agree this is a bug, let me see what I can try to fix

Thank you very much, and adition, the English character E will be converted to "er", O will be converted to "o5", They are all unexpected result.

luc-vocab commented 1 year ago

Please try version 0.9

>>> import pinyin_jyutping
>>> p = pinyin_jyutping.PinyinJyutping()
>>> p.pinyin('这是ATM', tone_numbers=True, spaces=True)
'zhe4 shi4 ATM'
JohnHerry commented 1 year ago

Please try version 0.9

>>> import pinyin_jyutping
>>> p = pinyin_jyutping.PinyinJyutping()
>>> p.pinyin('这是ATM', tone_numbers=True, spaces=True)
'zhe4 shi4 ATM'

It tests good now, thank you for the good job!