1.11.0 • Published 5 years ago

pinyin-convert v1.11.0

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

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.

1.11.0

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.0

6 years ago

1.7.0

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago