https://github.com/pepebecker/pinyin-api
API for the pinyin-rest server.
https://github.com/pepebecker/pinyin-api
chinese hacktoberfest hanzi mandarin pinyin pinyin-api
Last synced: 7 months ago
JSON representation
API for the pinyin-rest server.
- Host: GitHub
- URL: https://github.com/pepebecker/pinyin-api
- Owner: pepebecker
- License: mit
- Created: 2017-05-21T13:56:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-31T09:26:52.000Z (over 5 years ago)
- Last Synced: 2025-01-12T15:24:13.809Z (9 months ago)
- Topics: chinese, hacktoberfest, hanzi, mandarin, pinyin, pinyin-api
- Language: JavaScript
- Homepage: https://github.com/pepebecker/pinyin-api
- Size: 439 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pinyin API
[](https://travis-ci.org/pepebecker/pinyin-api)
[](https://coveralls.io/github/pepebecker/pinyin-api)
[](https://greenkeeper.io/)
[](https://david-dm.org/pepebecker/pinyin-api)
[](https://david-dm.org/pepebecker/pinyin-api#info=devDependencies)
[](https://opensource.org/licenses/MIT)
[](https://gitter.im/pepebecker)## Install
```shell
npm install pepebecker/pinyin-api
```## Usage
```js
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' ]
// }
```## Related
- [`pinyin-utils`](https://github.com/pepebecker/pinyin-utils)
- [`pinyin-split`](https://github.com/pepebecker/pinyin-split)
- [`find-hanzi`](https://github.com/pepebecker/find-hanzi)
- [`hsk-words`](https://github.com/pepebecker/hsk-words)
- [`pinyin-or-hanzi`](https://github.com/pepebecker/pinyin-or-hanzi)
- [`hanzi-to-pinyin`](https://github.com/pepebecker/hanzi-to-pinyin)
- [`pinyin-convert`](https://github.com/pepebecker/pinyin-convert)
- [`pinyin-rest`](https://github.com/pepebecker/pinyin-rest)
- [`pinyin-bot-core`](https://github.com/pepebecker/pinyin-bot-core)
- [`pinyin-telegram`](https://github.com/pepebecker/pinyin-telegram)
- [`pinyin-messenger`](https://github.com/pepebecker/pinyin-messenger)## Contributing
If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/pepebecker/pinyin-api/issues).