Code Monkey home page Code Monkey logo

pinyin's Introduction

🦮 Keep it simple, and stupid.
🐂 保持简单,保持拙朴。

github contribution grid snake animation

prettier 是毫无品味的程序员的裹脚布。

pinyin's People

Contributors

alephpi avatar aqiongbei avatar baijunyao avatar belinchung avatar bitdeli-chef avatar chloe88 avatar chrisyip avatar dayudodo avatar doyoonkim12345 avatar elvisqi avatar fanofxiaofeng avatar fourteendp avatar fuyuan9 avatar hczhcz avatar hotoo avatar imeoer avatar intijk avatar isayme avatar lancercomet avatar mozillazg avatar simonleeee avatar starsugar avatar ultravires avatar yanyiwu avatar zhuangya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pinyin's Issues

localeCompare 研究及相关算法尝试

建立在 localeCompare() 以中文拼音顺序排序的基础上(如果这个可靠性不能保证,崩塌)。

  1. 排序后,每个相同的拼音序列只保存第一个字及其拼音作为关键字,得到有序的关键字序列
  2. 二分法,将目标汉字 A 与排序后的关键字序列 B 进行 localeCompare() 比较,找到 A 在 B 序列中的位置,并由此得到 A 的拼音。

缺陷

  • localeCompare() 可靠性问题,及 locale 参数支持程度。
  • 无法支持多音字。

参考

没有实例页面

好像没有实例页面。我的项目不是用nodejs写,该怎么引用,求指教

github page被打包到npm里 -> _site目录

total 88
drwxr-xr-x  17 fdhuang  staff   578B Nov 19 13:36 .
drwxr-xr-x   4 fdhuang  staff   136B Nov 19 13:36 ..
-rw-r--r--   1 fdhuang  staff   5.0K Aug 23 08:29 .eslintrc
-rw-r--r--   1 fdhuang  staff    56B Oct 22  2014 .npmignore
-rw-r--r--   1 fdhuang  staff   2.4K Aug 25 09:33 CHANGELOG.md
-rw-r--r--   1 fdhuang  staff   1.9K Aug 25 09:36 Makefile
-rw-r--r--   1 fdhuang  staff   4.4K Aug  4 08:42 README-us_EN.md
-rw-r--r--   1 fdhuang  staff   5.0K Aug  4 08:42 README.md
drwxr-xr-x  17 fdhuang  staff   578B Nov 19 13:35 _site
drwxr-xr-x   3 fdhuang  staff   102B Aug 24 10:12 bin
drwxr-xr-x   6 fdhuang  staff   204B Nov 19 13:35 coverage
drwxr-xr-x   3 fdhuang  staff   102B Jun  9 07:44 dist
drwxr-xr-x   3 fdhuang  staff   102B Aug 24 10:12 examples
-rw-r--r--   1 fdhuang  staff    43B Aug 24 10:12 index.js
drwxr-xr-x   4 fdhuang  staff   136B Nov 19 13:36 node_modules
-rw-r--r--   1 fdhuang  staff   1.9K Nov 19 13:36 package.json
drwxr-xr-x   9 fdhuang  staff   306B Nov 19 13:36 src

error.log is not gitignored or npmignored

This file is large 8029.931 kb but
https://github.com/hotoo/pinyin/blob/master/tools/dict/error.log

Last login: Mon Feb 17 11:56:33 on ttys004
[hotoo@hotoo node-pinyin]$make dict-node
404, Not Matched. 0x3404 㐄 http://www.zdic.net/z/e/js/3404.htm
404, Not Matched. 0x3403 㐃 http://www.zdic.net/z/e/js/3403.htm
404, Not Matched. 0x3415 㐕 http://www.zdic.net/z/e/js/3415.htm
404, Not Matched. 0x341b 㐛 http://www.zdic.net/z/e/js/341b.htm
404, Not Matched. 0x3420 㐠 http://www.zdic.net/z/e/js/3420.htm
404, Not Matched. 0x3427 㐧 http://www.zdic.net/z/e/js/3427.htm
404, Not Matched. 0x342a 㐪 http://www.zdic.net/z/e/js/342a.htm
404, Not Matched. 0x342e 㐮 http://www.zdic.net/z/e/js/342e.htm
404, Not Matched. 0x342f 㐯 http://www.zdic.net/z/e/js/342f.htm
404, Not Matched. 0x3434 㐴 http://www.zdic.net/z/e/js/3434.htm
404, Not Matched. 0x3435 㐵 http://www.zdic.net/z/e/js/3435.htm
404, Not Matched. 0x3436 㐶 http://www.zdic.net/z/e/js/3436.htm
404, Not Matched. 0x343d 㐽 http://www.zdic.net/z/e/js/343d.htm
404, Not Matched. 0x343f 㐿 http://www.zdic.net/z/e/js/343f.htm
404, Not Matched. 0x3441 㑁 http://www.zdic.net/z/e/js/3441.htm
404, Not Matched. 0x3446 㑆 http://www.zdic.net/z/e/js/3446.htm
404, Not Matched. 0x344c 㑌 http://www.zdic.net/z/e/js/344c.htm
404, Not Matched. 0x3450 㑐 http://www.zdic.net/z/e/js/3450.htm

At least it's not ok to be put into npm module. I think it's better to remove it from the repo:
http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-git-repo

是否尝试使用Redis或Mongodb?

测试了下虽然性能不错,但对于经常要查询拼音的应用,最好还是后端有个DB异步查询。是否可以加入Redis或Mongodb做为字典存储的功能?

转换速度很慢

nodejs下,转换四个汉字比如“新建文档”需要1秒左右,有提高的空间吗
code: wordsGroups = pinyin(hanzi, { heteronym: true, style: pinyin.STYLE_NORMAL })

npm 2.3 版本压缩包哈希有问题.. 建议重新上传..

下载的时候发现哈希值不对...

npm http GET https://registry.npmjs.org/pinyin
npm http 304 https://registry.npmjs.org/pinyin
npm http GET https://registry.npmjs.org/pinyin/-/pinyin-2.3.0.tgz
npm http 200 https://registry.npmjs.org/pinyin/-/pinyin-2.3.0.tgz
npm ERR! Error: shasum check failed for C:\Users\ADMINI~1\AppData\Local\Temp\npm-10888-PvyKzWjp\1400
305010327-0.3144137696363032\tmp.tgz
npm ERR! Expected: c33d179d6edebee2a82c06f8c7e2750f0ec080df
npm ERR! Actual:   26ddf7356672b9aa8810f88a6e977eca85d39906
npm ERR! From:     https://registry.npmjs.org/pinyin/-/pinyin-2.3.0.tgz

在Centos 6.5+iojs 2.2.1 环境下npm install pinyin出现错误,还请帮助看看

 [root@pan miniyunjs]# npm install pinyin 
npm WARN engine [email protected]: wanted: {"node":"0.10.x"} (current: > {"node":"2.2.1","npm":"2.11.0"})
 |
[email protected] install /home/data/miniyunjs/node_modules/pinyin/node_modules/nodejieba
node-gyp rebuild

make: Entering directory `/home/data/miniyunjs/node_modules/pinyin/node_modules/nodejieba/build'
  CXX(target) Release/obj.target/segment/src/segment.o
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_algobase.h:66,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/char_traits.h:41,
                 from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/string:42,
                 from ../node_modules/nan/nan.h:37,
                 from ../src/utils.h:6,
                 from ../src/mix_segment.h:4,
                 from ../src/segment.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h: In constructor ‘std::pair<_T1, _T2>::pair(_U1&&, _U2&&) [with _U1 = size_t&, _U2 = long int, _T1 = long unsigned int, _T2 = const CppJieba::DictUnit*]’:
../src/CppJieba/Trie.hpp:101:   instantiated from here
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/stl_pair.h:90: 错误:从类型‘long int’到类型‘const CppJieba::DictUnit*’的转换无效
make: *** [Release/obj.target/segment/src/segment.o] 错误 1
make: Leaving directory `/home/data/miniyunjs/node_modules/pinyin/node_modules/nodejieba/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/data/iojs-v2.2.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:199:12)
gyp ERR! System Linux 2.6.32-504.16.2.el6.x86_64
gyp ERR! command "/home/data/iojs-v2.2.1-linux-x64/bin/iojs" "/home/data/iojs-v2.2.1-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/data/miniyunjs/node_modules/pinyin/node_modules/nodejieba
gyp ERR! node -v v2.2.1
gyp ERR! node-gyp -v v1.0.3
gyp ERR! not ok 
npm ERR! Linux 2.6.32-504.16.2.el6.x86_64
npm ERR! argv "/home/data/iojs-v2.2.1-linux-x64/bin/iojs" "/usr/local/bin/npm" "install" "pinyin"
npm ERR! node v2.2.1
npm ERR! npm  v2.11.0
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the nodejieba package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls nodejieba
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/data/miniyunjs/npm-debug.log

npm install pinyin出问题

npm WARN engine [email protected]: wanted: {"node":"0.10.x"} (current: {"node":"0.12.0","npm":"2.5.1"})
-
> [email protected] install /home/rccoder/code/HIT-International/node_modules/pinyin/node_modules/nodejieba
> node-gyp rebuild

child_process: customFds option is deprecated, use stdio instead.
Usage: gyp_main.py [options ...] [build_file ...]

gyp_main.py: error: no such option: --no-parallel
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:343:16)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Linux 3.19.0-18-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/rccoder/code/HIT-International/node_modules/pinyin/node_modules/nodejieba
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 
npm ERR! Linux 3.19.0-18-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "pinyin"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the nodejieba package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls nodejieba
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/rccoder/code/HIT-International/npm-debug.log

有不依赖Seajs的版本吗?

有不依赖Seajs的版本或者编译选项嗎?
或者node版本做成像别的库那种兼容web和node的方式也成.现在node版本直接外部依赖segment,所以也不太容易手工改成web版本.

无声调模式的一个小BUG

当使用无声调的几种转换模式的时候
[āáǎà] 这几个字符会直接在结果中输出,并不会转化为a
我使用的是压缩过的字典,并工作在NodeJS环境下
这是否是一个BUG呢

算法优化尝试

@TooBug 有很好的一个 PR #26 ,这个 PR 其实早已经无法合并进来了,但是我一直没舍得关掉,因为有很好的参考价值。

  • 二进制字典。
  • 二分法查找。

我计划近期也尝试更新使用这两者,另外其他的一些技术(比如偏移量)也会进行尝试。

如果尝试的结果满足甚至超出预期,会合并且升级版本到 3.0.x

目前 @TooBug/pinyin 是每个汉字转换都会 fs.openSync 二进制字典,我计划只打开一次,必要的话直接装载到内存(不知道和现在直接装载整个 JSON 字典差异有多大)。

谢谢 @TooBug,并 Close #26.

设置style失效 ?

image

image

为何我设置style都没有,我想不带音标的,仅首字母的,返回的结果都是一样的

计划扩充 Web 版拼音库

Web 版目前是根据国家教育部发布的 《现代汉语常用字表》 收录的 2500个常用字,和 1000个次常用字表来做的字典,这导致很多不在常用和次常用字表中,但仍然挺常用的字无法进行转换。

例如 , #29 中提到的 , ,以及 #26

考虑到实用性,计划扩充 Web 版的拼音库:

  • 增加常用地名用字。
  • 增加常用姓氏用字。

如果有需要,可以回复本 issue,或者提交新的 issue 来讨论其他的非常用字是否默认添加到拼音库中。

另外你也可以自行处理这些非常用字。

参考

注音、笔顺、部首、结构、异体字、五笔、仓颉等数据

之前自己搜集了汉字包括拼音和注音、笔顺、部首、结构分析、异体字、五笔码、仓颉码等等方面的数据,虽然多出来的部分已经不在拼音的范畴内,传上来看能不能用得上,做扩展插件或者加强版之类的。

非常感谢这个项目!

http://pan.baidu.com/s/1dFcM5iD
2017.03.30 更新了一次,修正了一些数据中的错误。

如果不需要的话请管理员删除。

去除非多音字词组的拼音库

有一个优化点,词组的拼音库,可以只保留『有多音字的词组』,没有多音字的词组以普通的拼音转换即可。
不过工作量会比较大,希望大家能帮助找出有多音字的词组。 :)
#19 #20

0套转换失败

当包含"数字+套"字时 前者无法正确转换为缩写和拼音
例如:
0套价 -> 0套j 而不是 0tj

合并同音字拼音库

将拼音库中同音字进行合并。多音字多个拼音算一个拼音进行合并,避免多音字的多个拼音优先级不同,无法将更常用的拼音放在前面进行匹配。

每个汉字的拼音独立存储,334KB.
完全同音的汉字进行合并存储,115KB.
所有同音字合并存储(多音字的各个读音拆分合并),81KB.

chao2 yang2不能获得“朝阳”的汉字匹配

因为pinyin/src/phrases-dict.js中有这一航
···
"朝阳": [["zhāo"], ["yáng"]],
···

所以chao2 yang2不能找到“朝阳”,只有zhao yang才能找到“朝阳”。

**有好几个城市都有“朝阳区”,习惯上这些区都被叫做chao2 yang2区,而不是zhao1 yang2区。

删掉这一行能解决这个问题。

fix broken syntax errors in phrases-dict.js and dict-ci.js

> pinyin = require('pinyin');
{ [Function: pinyin]
  STYLE_NORMAL: 0,
  STYLE_TONE: 1,
  STYLE_TONE2: 2,
  STYLE_INITIALS: 3,
  STYLE_FIRST_LETTER: 4 }
> pinyin('经济'); // prints invalid pinyin below
[ [ 'jīngj&igrave;' ] ]
>


## here's a grep of invalid pinyin lookups
Darwin 2 kaizhu@kais-MacBook-Air:/tmp/node_modules/pinyin $ shGrep grave
./src/phrases-dict.js:7196:"节烈": [["ji&eacute;li&egrave;"]],
./src/phrases-dict.js:7517:"经济": [["jīngj&igrave;"]],
./src/phrases-dict.js:10697:"强韧": [["qi&aacute;ngr&egrave;n"]],
./src/phrases-dict.js:12421:"说话": [["shuōhu&agrave;"]],
./src/phrases-dict.js:15890:"怨毒": [["yu&agrave;nd&uacute;"]],
./src/phrases-dict.js:17052:"撰著": [["zhu&agrave;nzh&ugrave;"]],
./tools/dict/dict-ci.js:8648:"额定": ["&eacute;d&igrave;ng"],
./tools/dict/dict-ci.js:17387:"节烈": ["ji&eacute;li&egrave;"],
./tools/dict/dict-ci.js:18056:"经济": ["jīngj&igrave;"],
./tools/dict/dict-ci.js:18652:"跼促": ["j&uacute;c&ugrave;"],
./tools/dict/dict-ci.js:21645:"凌驾": ["l&iacute;ngji&agrave;"],
./tools/dict/dict-ci.js:24657:"涅槃": ["ni&egrave;p&aacute;n"],
./tools/dict/dict-ci.js:25698:"嘌呤": ["pi&agrave;ol&iacute;ng"],
./tools/dict/dict-ci.js:27018:"强韧": ["qi&aacute;ngr&egrave;n"],
./tools/dict/dict-ci.js:28866:"三废": ["sān-f&egrave;i"],
./tools/dict/dict-ci.js:32093:"说话": ["shuōhu&agrave;"],
./tools/dict/dict-ci.js:35466:"未定": ["w&egrave;id&igrave;ng"],
./tools/dict/dict-ci.js:42335:"怨毒": ["yu&agrave;nd&uacute;"],
./tools/dict/dict-ci.js:44660:"众望": ["zh&ograve;ngw&agrave;ng"],
./tools/dict/dict-ci.js:45315:"撰著": ["zhu&agrave;nzh&ugrave;"],
./tools/dict/dict-ci.js:47525:"报话机": ["b&agrave;ohu&agrave;jī"],
./tools/dict/dict-ci.js:62077:"警惕性": ["jǐngt&igrave;x&igrave;ng"],
Darwin 2 kaizhu@kais-MacBook-Air:/tmp/node_modules/pinyin $ 

nodejs里内存占用巨大

qq20140825-1
如图,在nodeJS里引入拼音库后node进程内存使用200M,去掉后变成100M,heap里显示占内存(图片里显示占用60M)的主要是一些常用的成语、pinyin里的node_modules里的object,请问有没有什么可以优化的办法?

「变调」“不”字的标音问题

基本信息

只有一个“不”字或“不”字后面紧接着的字为非第四声时,读音为四声bù;
例如:不(bù)法(fǎ)之徒
但是如果后面的字也是四声,需要变调,变成bú。
例如:不(bú)是;不(bú)对

但从标音角度讲,变调不应作为一种标音规则,不(bù)才是正确的标音。

建议提供一个不包含分词的npm包

现在依赖的node-jieba需要node-gyp,在Windows环境中非常麻烦。实际上很多应用可能并不需要分词,是否可以考虑提供一个不包含分词的npm包?比如名为pinyin-lite之类的。

非常感谢!

Electron 下报错。

screen shot 2015-11-19 at 08 52 23

错误代码:

if(isNode){
  // 拼音词库,node 版无需使用压缩合并的拼音库。
  PINYIN_DICT = module["require"]("./dict-zi");
}

内存问题

您好,在使用您的pinyin包时遇到了一些问题,您的包好像特别消耗内存,也可能是我们使用不对导致了内存的泄露,也可能是其他原因。下面是截图,前四个都是pinyin包的内存快照,我就是想问,您的包是否会导致内存泄露。
内存快照

npm shasum 错误

http://registry.npmjs.org/pinyin/2.3.1 上声明的是 "shasum": "5e2937083d2ab706331ed68a07ce9e4c691b8963" , 但下载下来实际是

$ shasum pinyin-2.3.1.tgz 03ec304233ddbc76b94bf1c2e11c3f328881d224 pinyin-2.3.1.tgz
$ npm install pinyin
npm http GET https://registry.npmjs.org/pinyin
npm http 200 https://registry.npmjs.org/pinyin
npm http GET https://registry.npmjs.org/pinyin/-/pinyin-2.3.1.tgz
npm http 200 https://registry.npmjs.org/pinyin/-/pinyin-2.3.1.tgz
npm ERR! Error: shasum check failed for /var/folders/5h/x4h0t8rs6w300g_wnzbx47km0000gn/T/npm-20912-4Ei4eW63/1401180705236-0.6836859425529838/tmp.tgz
npm ERR! Expected: 5e2937083d2ab706331ed68a07ce9e4c691b8963
npm ERR! Actual:   03ec304233ddbc76b94bf1c2e11c3f328881d224
npm ERR!     at /Users/mk2/node_modules/npm/node_modules/sha/index.js:38:8
npm ERR!     at ReadStream.<anonymous> (/Users/mk2/node_modules/npm/node_modules/sha/index.js:85:7)
npm ERR!     at ReadStream.EventEmitter.emit (events.js:126:20)
npm ERR!     at _stream_readable.js:895:16
npm ERR!     at process._tickCallback (node.js:339:11)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.2.0
npm ERR! command "node" "/Users/mk2/node_modules/.bin/npm" "install" "pinyin"
npm ERR! cwd /private/tmp
npm ERR! node -v v0.11.12
npm ERR! npm -v 1.4.6
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/tmp/npm-debug.log
npm ERR! not ok code 0

“酒坊”在设置option为STYLE_FIRST_LETTER时,返回JIǔFāNG

在词组字典中找到记录后,也加上toFixed处理

function phrases_pinyin(phrases, options){
    options = extend(DEFAULT_OPTIONS, options);
  if(PHRASES_DICT.hasOwnProperty(phrases)){
      pinyins = PHRASES_DICT[phrases];
      for (var i in pinyins) {
          pinyins[i] = toFixed(pinyins[i], options.style);
      }
    return pinyins;
  }
  var py = [];
  for(var i=0,l=phrases.length; i<l; i++){
    py.push(single_pinyin(phrases[i], options));
  }
  return py;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.