Code Monkey home page Code Monkey logo

pinyin-convert's Introduction

Pinyin Convert

npm version Travis Build Status Greenkeeper badge dependency status dev dependency status MIT-licensed chat on gitter

Checkout the pinyin-webinterface which uses this module in the backend.

Install

npm install pinyin-convert

Usage

const convert = require('pinyin-convert')

convert('Test: wǒ de māo xǐhuān hē niúnǎi')
.then(console.log) // Te wo3 de mao1 xi3 huan1 he1 niu2 nai3

convert('Test: wo3 de mao1 xi3huan1 he1 niu2nai3')
.then(console.log) // Te wǒ de māo xǐ huān hē niú nǎi

convert('Test: wǒ de māo xǐhuān hē niúnǎi', { everything: true })
.then(console.log) // Test: wo3 de mao1 xi3huan1 he1 niu2nai3

convert('Test: wo3 de mao1 xi3huan1 he1 niu2nai3', { everything: true })
.then(console.log) // Test: wǒ de māo xǐhuān hē niúnǎi

convert('我的猫喜欢喝牛奶')
.then(console.log)
// [ 'wǒ ', [ 'de', 'dī', 'dí', 'dì' ], ' māo xǐ huan ', [ 'hē', 'hè' ], ' niú nǎi' ]

convert('我的猫喜欢喝牛奶', { segmented: true })
.then(console.log)
// [ 'wǒ ', [ 'de', 'dī', 'dí', 'dì' ], ' māo xǐhuan ', [ 'hē', 'hè' ], ' niúnǎi' ]

convert('我的猫喜欢喝牛奶', { numbered: true, segmented: true })
.then(console.log)
// [ 'wo3 ', ['de5', 'di1', 'di2', 'di4'], ' mao1 xǐ5huan1 ', ['he1', 'he4'], ' niu2nai3' ]

convert('Test: 我的猫喜欢喝牛奶', { everything: true, segmented: true })
.then(console.log)
// [ 'test: wǒ ', [ 'de', 'dī', 'dí', 'dì' ], ' māo xǐhuan ', [ 'hē', 'hè' ], ' niúnǎi' ]

Related

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.

pinyin-convert's People

Contributors

greenkeeper[bot] avatar pepebecker avatar

Stargazers

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

Watchers

 avatar  avatar

Forkers

shymelon echu18

pinyin-convert's Issues

An in-range update of pinyin-split is breaking the build 🚨

The dependency pinyin-split was updated from 1.53.0 to 1.54.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

pinyin-split is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of hanzi-to-pinyin is breaking the build 🚨

The dependency hanzi-to-pinyin was updated from 1.18.0 to 1.19.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

hanzi-to-pinyin is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of pinyin-utils is breaking the build 🚨

The dependency pinyin-utils was updated from 1.38.0 to 1.39.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

pinyin-utils is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of pinyin-utils is breaking the build 🚨

The dependency pinyin-utils was updated from 1.7.0 to 1.8.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

pinyin-utils is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 1 commits.

  • b35b113 Remove capitalize, update code, convert tests to TypeScript

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Feature Request : Support pinyin->hanzi

Hi @pepebecker , I came across this node module after a lot of searching. Could you please tell me if you know of a tool that converts pinyin to hanzi?

I have a ton of text that requires, a bit of processing and then conversion to hanzi


Ng, wˇo yˇe sh`ı!  Wˇo j ̄ınni ́an zu`ı zh`ongy`ao de j`ıhu`a ji`ush`ı
y ̄ıd`ıng y`ao bˇa y ̄ıngyˇu xu ́e hˇao. Wˇo ju ́ed`ıng c ̄anji ̄a Y ̄ıngyˇu
fˇudˇaob ̄an, mˇeiti ̄an b`ei z`ıdiˇan, d ́u y ̄ıngyˇu b`aozhˇı. Wˇo ji`u b`u
x`ın xu ́e b`u hˇao! Y ̄ınw`ei yˇuy ́an de w`ent ́ı, wˇo yˇıj ̄ıng cu`ogu`o
le hˇao jˇıge sh ̄engzh ́ı j ̄ıhu`ı.

The current state of the text.

If there's isn't such a tool, could you add this functionality to this module itself?

Great job with this one though 👍

An in-range update of pinyin-or-hanzi is breaking the build 🚨

The dependency pinyin-or-hanzi was updated from 1.39.0 to 1.40.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

pinyin-or-hanzi is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of pinyin-split is breaking the build 🚨

The dependency pinyin-split was updated from 1.12.0 to 1.13.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

pinyin-split is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 3 commits.

  • c191891 Combine non-pinyin chars and update tests
  • 7223315 Revert to pepebecker's algorithm, adjust it to work without pinyin-utils and make pinyin list wrapping optional; Add new tests
  • f1f7bbd Rewrite split algorithm and allow returning everything without pinyin list wrapping; Remove unnecessary dependencies; Update tests and README.md accordingly

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

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.