GithubHelp home page GithubHelp logo

wxianfeng / hanzi_to_pinyin_node Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 0.0 99 KB

chinese hanzi to pinyin via node.js

Home Page: http://wxianfeng.com/2013/08/31/node-js-hanzi-to-pinyin

License: MIT License

JavaScript 100.00%

hanzi_to_pinyin_node's Introduction

hanzi_to_pinyin_node

chinese hanzi to pinyin via node.js, copied from hanzi_to_pinyin ruby gem.

Install

npm install hanzi_to_pinyin

Usage

var hz_to_py = require("hanzi_to_pinyin");
hz_to_py.hanzi_to_pinyin("测试");

Terminal bin

>hanzi_to_pin "测试"
=>ce;shi

Sample

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");

Licence

MIT

hanzi_to_pinyin_node's People

Contributors

dennishu001 avatar wxianfeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

hanzi_to_pinyin_node's Issues

unnecessary global variable usage.

你好,我在使用这个库,首先表示感谢。

lib/hanzi_to_pinyin.js第42行的i忘记加var,导致暴露i为全局变量,我在npm的包里做了手工修改,建议此包作者能把这个var加上。

New word and error handling

I just encountered a word not in your dictionary. I added the word and added some error handling for unfound words. You may want to check out my fork.

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.