python 汉字转拼音 实例
来源:互联网 发布:机械模拟仿真软件 编辑:程序博客网 时间:2024/06/06 19:47
python 汉字转拼音
首先是安装第三方库:
$ pip install pinyin
使用的话:
>>> import pinyin>>> print pinyin.get('你 好')nǐ hǎo>>> print pinyin.get('你好', format="strip", delimiter=" ")ni hao>>> print pinyin.get('你好', format="numerical")ni3hao3>>> print pinyin.get_initial('你好')n h
而且还提供了汉字转英语的方法:Prototype Chinese->English
>>> import pinyin.cedict>>> pinyin.cedict.translate_word('你')['you (informal, as opposed to courteous 您[nin2])']>>> pinyin.cedict.translate_word('你好')['Hello!', 'Hi!', 'How are you?']>>> list(pinyin.cedict.all_phrase_translations('你好'))[['你', ['you (informal, as opposed to courteous 您[nin2])']], ['你好', ['Hello!', 'Hi!', 'How are you?']], ['好', ['to be fond of', 'to have a tendency to', 'to be prone to']]]
如果需要tar包的话可以去这里下载:
阅读全文
0 0
- python 汉字转拼音 实例
- python中文(汉字)转拼音
- python中文(汉字)转拼音
- python得到汉字拼音首字母
- python获取汉字的拼音
- 汉字转拼音
- 汉字转拼音缩写
- 汉字转拼音缩写
- 实用汉字转拼音
- 汉字转拼音
- 汉字转拼音 asp
- 汉字转拼音缩写
- 汉字转拼音
- 汉字转拼音缩写
- 汉字转拼音
- PHP汉字转拼音
- PHP汉字转拼音
- php汉字转拼音
- 求一组数中的最大最小数以及源码分析
- [DUBBO] Unexpected error occur at send statistic, cause: Forbid consumer 192.168.3.151 access servic
- linux find
- ASP.NET Core 2.0 自定义 _ViewStart 和 _ViewImports 的目录位置
- Brick Wall问题及解法
- python 汉字转拼音 实例
- QT 如何在其他类中修改UI控件的属性?
- HDU 4998 Rotate(计算几何/绕弧度旋转/模板的巧用)
- 差分约束初步
- SGISTL源码探究-内存池
- CSS的一些基础(有待改进)
- Codeforces 854C Planning【贪心+并查集】
- ubuntu 解决unable to resolve host的问题
- Rotate (hdu4998) 几何