项目作者: pepebecker

项目描述 :
API for the pinyin-rest server.
高级语言: JavaScript
项目地址: git://github.com/pepebecker/pinyin-api.git
创建时间: 2017-05-21T13:56:49Z
项目社区:https://github.com/pepebecker/pinyin-api

开源协议:MIT License

下载


Pinyin API

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

Install

  1. npm install pepebecker/pinyin-api

Usage

  1. const api = require('pinyin-api')
  2. api.convert('我的猫喜欢喝牛奶')
  3. .then(console.log)
  4. // {
  5. // text: 'wǒ de māo xǐhuan hē niúnǎi',
  6. // data: [
  7. // 'wǒ ',
  8. // [ 'de', 'dī', 'dí', 'dì' ],
  9. // ' māo xǐhuan ',
  10. // [ 'hē', 'hè' ],
  11. // ' niúnǎi'
  12. // ]
  13. // }
  14. api.convert('wo3 de mao1 xi3huan he1 niu2nai3')
  15. .then(console.log)
  16. // {
  17. // text: 'wǒ de māo xǐhuan hē niúnǎi',
  18. // data: 'wǒ de māo xǐhuan hē niúnǎi'
  19. // }
  20. api.convert('wǒ de māo xǐhuan hē niúnǎi')
  21. .then(console.log)
  22. // {
  23. // text: 'wo3 de5 mao1 xi3huan5 he1 niu2nai3',
  24. // data: 'wo3 de5 mao1 xi3huan5 he1 niu2nai3'
  25. // }
  26. api.split('wodemaoxihuanheniunai')
  27. .then(console.log)
  28. // {
  29. // text: 'wo de mao xi huan he niu nai',
  30. // data: [ 'wo', 'de', 'mao', 'xi', 'huan', 'he', 'niu', 'nai' ]
  31. // }

Contributing

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