npm install pepebecker/pinyin-api
const api = require('pinyin-api')
api.convert('我的猫喜欢喝牛奶')
.then(console.log)
// {
// text: 'wǒ de māo xǐhuan hē niúnǎi',
// data: [
// 'wǒ ',
// [ 'de', 'dī', 'dí', 'dì' ],
// ' māo xǐhuan ',
// [ 'hē', 'hè' ],
// ' niúnǎi'
// ]
// }
api.convert('wo3 de mao1 xi3huan he1 niu2nai3')
.then(console.log)
// {
// text: 'wǒ de māo xǐhuan hē niúnǎi',
// data: 'wǒ de māo xǐhuan hē niúnǎi'
// }
api.convert('wǒ de māo xǐhuan hē niúnǎi')
.then(console.log)
// {
// text: 'wo3 de5 mao1 xi3huan5 he1 niu2nai3',
// data: 'wo3 de5 mao1 xi3huan5 he1 niu2nai3'
// }
api.split('wodemaoxihuanheniunai')
.then(console.log)
// {
// text: 'wo de mao xi huan he niu nai',
// data: [ 'wo', 'de', 'mao', 'xi', 'huan', 'he', 'niu', 'nai' ]
// }
pinyin-utils
pinyin-split
find-hanzi
hsk-words
pinyin-or-hanzi
hanzi-to-pinyin
pinyin-convert
pinyin-rest
pinyin-bot-core
pinyin-telegram
pinyin-messenger
If you have a question, found a bug or want to propose a feature, have a look at the issues page.