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

串中含数字的bug #64

Closed
onsunsl opened this issue Mar 7, 2017 · 2 comments
Closed

串中含数字的bug #64

onsunsl opened this issue Mar 7, 2017 · 2 comments

Comments

@onsunsl
Copy link

onsunsl commented Mar 7, 2017

In [20]: p = pinyin('人家才刚学会中文。。这么快就要学2外呀', style=3)

In [21]: p
Out[21]:
[['r'],
['j'],
['c'],
['g'],
['x'],
['h'],
['zh'],
[''],
['。。'],
['zh'],
['m'],
['k'],
['j'],
[''],
['x'],
['2'],
[''],
['']]

@mozillazg
Copy link
Owner

@onsunsl 因为 y, w 不是声母. 详见 #27

@mozillazg
Copy link
Owner

你可能需要的是 style=pypinyin.FIRST_LETTER:

In [2]: p = pypinyin.pinyin('人家才刚学会中文。。这么快就要学2外呀', style=pypinyin.FIRST_LETTER)

In [3]: p
Out[3]:
[['r'],
 ['j'],
 ['c'],
 ['g'],
 ['x'],
 ['h'],
 ['z'],
 ['w'],
 ['。。'],
 ['z'],
 ['m'],
 ['k'],
 ['j'],
 ['y'],
 ['x'],
 ['2'],
 ['w'],
 ['y']]

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

No branches or pull requests

2 participants