之前写了一个 ruby 汉字转拼音的 gem , 项目需要, 把它翻译成了 nodejs module.
安装
npm install hanzi_to_pinyin
使用
var hanzi_to_pinyin = require("hanzi_to_pinyin"); hanzi_to_pinyin.hanzi_to_pinyin("测试");
命令行bin
>hanzi_to_pinyin "测试" =>ce;shi
例子
assert.equal(hanzi_to_pinyin.hanzi_to_pinyin("ab你好c"),'ab;ni;hao;c'); assert.equal(hanzi_to_pinyin.hanzi_to_pinyin("我们"),"wo;men"); assert.equal(hanzi_to_pinyin.hanzi_to_pinyin("yyf"),"yyf"); assert.equal(hanzi_to_pinyin.hanzi_to_pinyin("拗Smith"),"ao,niu;Smith"); assert.equal(hanzi_to_pinyin.hanzi_to_pinyin("测试1"),"ce;shi;1"); assert.equal(hanzi_to_pinyin.hanzi_to_pinyin("测_试-"),"ce;_;shi;-"); assert.equal(hanzi_to_pinyin.hanzi_to_pinyin("2"),"2");
源码
Trackbacks
Use the following link to trackback from your own site:
http://blog.wxianfeng.com/trackbacks?article_id=298
all the time i used to read smaller articles or reviews which as
well clear their motive,and that is also happening with this piece of writing
which I am reaing at this place.
always i used to rea smaller articles or reviews that also clear their motive,
and that is also happening with this post which I am reading here.
aways i sed too read smaller articles or reviews that also clear
their motive, and that is also happening with thijs post
which I am reading here.
What’s up, I wish for to subscribe for this weblog to
get hottest updates, therefore where can i do it please help out.
What’s up, I ish for to subscribe forr this weblog to get hottest
updates, therefore where can i do it please help out.
If you are going for finest contents like I do, just go to see this website all
tthe time as it presents feature contents, thanks
If you are going for finest contents like I do, just go to see this
website all the time as it presents feature contents, thanks
When the cards are equivalent subsequently it’s a wrap and gambler has the choice
to accumulate original profits.
When the cards are equivalent subsequently it’s a
wrap and gambler has the choice to accumulate original profits.
I every time used too read post in news papers but now as I am a user
of net thus from now I am using net for articles or reviews, thanks to web.
Excellent blog here! Also your website rather a lot up very fast!
What web host are you the use of? Can I am getting your affiliate hyperlink to your host?
I wish my web site loaded up as fast as yours lol
Excellent blog here! Also your website rather a lot up very fast!
What web host are you the use of? Can I am getting your affiliate hyperlink
to your host? I wish my web site loaded up as fast as yours lol
You really make it appear so easy together with
your presentation but I find this topic to be actually something which I feel I might never understand.
It sort of feels too complicated and very large for me.
I am taking a look ahead for your next submit, I will try to get the dangle of it!
You really make it appear so easy together with your presentation but I find this topic to be actually something which I feel I might never understand.
It sort of feels too complicated and very large for me.
I am taking a look ahead for your next submit, I will try to get the dangle
of it!
I visited many websites except the audio quality for aaudio songs existing att this site is genuinely excellent.
Excellent, what a webpage it is! This weblog presents useful facts to us, keep it up.
Excellent, what a webpage it is! This weblog presents useful facts to us, keep it up.
Сохраню как “Избранное”, я оцениваю позитивно ваш авторский ресурс!
Сохраню как “Избранное”, я оцениваю позитивно ваш авторский ресурс!
wonderful put up, very informative. I’m wondering why the other
specialists of this sector don’t realize this.
You should continue your writing. I’m confident, you’ve a great readers’ base already!
wonderful put up, very informative. I’m wondering
why the other specialists of this sector don’t realize this.
You should continue your writing. I’m confident, you’ve a great readers’ base already!
Mit eine Menge Websites Bereitstellung der Möglichkeit von Online-Slots heute, es werden wesentlicher zu
vielleicht erhalten vertraut mit Wegen bis identifizieren schöne Art der Slots.
Mit eine Menge Websites Bereitstellung der Möglichkeit
von Online-Slots heute, es werden wesentlicher zu vielleicht erhalten vertraut mit Wegen bis identifizieren schöne Art der
Slots.
Ԍreat blog you have hеrе.. Ӏt’s difficult tօ fid excellent writing likke yours these dаys.
Ι seriously aρpreciate individuals ⅼike
you! Take care!!
Great bllog you һave һere.. It’s difficult to find excellent writing
like үours tһeѕe days. I serioսsly apрreciate individuals ⅼike ʏоu!
Tаke care!!
With havin so much content do you ever run into any issues of plagorism or copyright
violation? My website has a lot of exclusive content I’ve either authored myself or outsourced but it looks like a lot of it is popping it up all over the internet without my
agreement. Do you know any techniques to help
prevent content from being stolen? I’d really appreciate it.
With havin so much content do you ever run into any issues
of plagorism or copyright violation? My website has a lot of exclusive content I’ve
either authored myself or outsourced but it looks like a lot of it is popping
it up all over the internet without my agreement.
Do you know any techniques to help prevent content from being stolen?
I’d really appreciate it.
Ithink this іs oone оf the most ѕignificant info foг me.
And і’m glad reading your article. But want t᧐
remark oon sⲟme ցeneral tһings, Thhe site stylpe іѕ wonderful,
the articles iѕ rеally ɡreat : Ɗ. Good job, cheers
I thiunk thіs is onne of the moѕt sіgnificant info for me.
And i’m glad reading yourr article. Buut ԝant to remark on ѕome gendral tһings,
The site style iѕ wonderful, tһe articles is
reaⅼly great : D. Gߋod job, cheers
Good informɑtion. Lucky mme I rann across yolur site by cgance (stumbleupon).
І’ve book marked іt for later!
Goodd іnformation. Lucky mе I гɑn aсross your site Ƅy chance (stumbleupon).
І’ѵe book marked іt foг later!
I am really grateful to the holder of this site who has shared this
wonderful article at here.
I am really grateful to the holder of this site who has shared this wonderful
article at here.
What’s up to every single one, it’s actually a nice for me
to pay a visit this site, it consists of helpful Information.
What’s up to every single one, it’s actually a nice for me
to pay a visit this site, it consists of helpful Information.