Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wlwl2/chinese-utils
Utility functions for working with simplified/traditional Chinese characters and Pinyin in Node.js (npm package).
https://github.com/wlwl2/chinese-utils
Last synced: about 2 months ago
JSON representation
Utility functions for working with simplified/traditional Chinese characters and Pinyin in Node.js (npm package).
- Host: GitHub
- URL: https://github.com/wlwl2/chinese-utils
- Owner: wlwl2
- License: mit
- Created: 2019-08-09T19:15:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-11T05:23:30.000Z (over 4 years ago)
- Last Synced: 2024-10-12T09:08:13.790Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chinese-utils
Utility tools for working with simplified/traditional Chinese characters and
Pinyin in Node.js.## Installation
```bash
npm i chinese-utils --save
```## Usage
### pinyinToAlphabet()
`ChineseUtils.pinyinToAlphabet(string)`
Removes the tone marks from a Pinyin `string` and keeps the original case of the
Pinyin and any spaces/whitespace. This is also known as accent folding.Returns a `string` with just plain English and no tone marks (keeps the original
case of the Pinyin).#### Example:
```js
const ChineseUtils = require('chinese-utils');const examplePinyin = ChineseUtils.pinyinToAlphabet('wǒ mèi mei');
console.log(examplePinyin); // logs 'wo mei mei'
```