0.2.0 • Published 4 years ago

cjk-readings v0.2.0

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

cjk-readings

Generates readings for CJK text. Currently only supports pinyin, but support for other languages is planned.

Exports modules for use in Node apps, as well as a server which can be queries via HTTP.

npm install -g cjk-readings

Usage with node

const { generatePinyin } = require('cjk-readings')

const readings = generatePinyin("🇨🇳 汉字拼音 ➜ hàn zì pīn yīn")

console.log(readings)
// [["🇨🇳 ",[]],["汉",["hàn"]],["字",["zì"]],["拼",["pīn"]],["音",["yīn"]],[" ➜ hàn zì pīn yīn",[]]]

Usage via http

PORT=7346 cjk-readings-service
curl http://localhost:7346/pinyin?text=%F0%9F%87%A8%F0%9F%87%B3%20%E6%B1%89%E5%AD%97%E6%8B%BC%E9%9F%B3%20%E2%9E%9C%20h%C3%A0n%20z%C3%AC%20p%C4%ABn%20y%C4%ABn

# [["🇨🇳 ",[]],["汉",["hàn"]],["字",["zì"]],["拼",["pīn"]],["音",["yīn"]],[" ➜ hàn zì pīn yīn",[]]]~

Acknowledgements

Based on MIT Licensed work at:

License

MIT License