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

声母 Y 和 W 的问题 #27

Open
ultimate010 opened this Issue Oct 21, 2015 · 9 comments

Comments

Projects
None yet
7 participants
@ultimate010

ultimate010 commented Oct 21, 2015

类似

pinyin(u'中心', style=pypinyin.INITIALS) # 设置拼音风格
[['zh'], ['x']]

代码中声母表

_INITIALS = 'b,p,m,f,d,t,n,l,g,k,h,j,q,x,zh,ch,sh,r,z,c,s,'.split(',')

没有y和w。如果碰到Y和W开头的字,相应的字会返回空。
例如:

pinyin(u'火影忍者', style=pypinyin.INITIALS)
[[u'h'], [u''], [u'r'], [u'zh']]

我查了下资料,有的说声母不包括Y和W,所以这个返回是正常,但这样处理导致应用不好做,只能用首字母模式替代。是否新加一个接口,加上Y和W的返回,或者,说明上告知这个情况,以免别人使用的时候碰到问题。

@mozillazg

This comment has been minimized.

Owner

mozillazg commented Oct 21, 2015

嗯,谢谢你的建议。我之后会加一个 FAQ ,并把这个问题加到 FAQ 中。

@mozillazg

This comment has been minimized.

Owner

mozillazg commented Nov 12, 2015

@hotoo

This comment has been minimized.

hotoo commented Mar 23, 2016

@ultimate010 你的需求是否使用首字母风格更合适点?

不仅是 y, w 开头的拼音有这个问题,还有些没有声母的(比如 啊,饿,按,昂 等)情况也可能会给你带来困扰。

@ultimate010

This comment has been minimized.

ultimate010 commented Mar 24, 2016

@hotoo 嗯,我的需求首字母确实更合适,不过一般情况下可能不知道声母中的Y、W问题,导致想当然的使用声母模式,结果出错。

@Artoria2e5

This comment has been minimized.

Contributor

Artoria2e5 commented Sep 19, 2016

有的说声母不包括Y和W

汉语拼音的声母当然包含 y, w……又不是注音里面要另分一类介母容纳 [iy] [uw]。

@gumblex

This comment has been minimized.

Contributor

gumblex commented Sep 19, 2016

@Artoria2e5 汉语拼音的声母当然不包含 y, w。参见《汉语拼音方案》

@Artoria2e5

This comment has been minimized.

Contributor

Artoria2e5 commented Sep 19, 2016

@gumblex 欸,也算介母吗……(

@mozillazg mozillazg added the question label Sep 23, 2016

@zaqzrh

This comment has been minimized.

zaqzrh commented Feb 15, 2017

应严格按《汉字拼音方案》来做才是正道的!

@zgdlime

This comment was marked as off-topic.

zgdlime commented Sep 1, 2018

@ultimate010
请问python-pinyin如何批量处理?

运行环境
操作系统:Windows10
Python 版本:python-3.4.3
pypinyin 版本:v0.33.0

我有一个文本文件b.txt,utf-8格式,文件里面有内容:
这个
进行
因为
还是
时候
看到
……
想把转换成汉语拼音,该如何操作?

能批处理、拖叠文件等一步到位吗?
指教一下吧!谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment