1 | # Pinyin Split
|
2 |
|
3 | [![npm version](https://img.shields.io/npm/v/pinyin-split.svg)](https://www.npmjs.com/package/pinyin-split)
|
4 | [![Travis Build Status](https://travis-ci.org/pepebecker/pinyin-split.svg)](https://travis-ci.org/pepebecker/pinyin-split)
|
5 | [![dependency status](https://img.shields.io/david/pepebecker/pinyin-split.svg)](https://david-dm.org/pepebecker/pinyin-split)
|
6 | [![dev dependency status](https://img.shields.io/david/dev/pepebecker/pinyin-split.svg)](https://david-dm.org/pepebecker/pinyin-split#info=devDependencies)
|
7 | [![ISC-licensed](https://img.shields.io/github/license/pepebecker/pinyin-split.svg)](https://choosealicense.com/licenses/isc/)
|
8 |
|
9 | ## Install
|
10 |
|
11 | ```shell
|
12 | npm install pinyin-split
|
13 | ```
|
14 |
|
15 | ## Usage
|
16 |
|
17 | ```js
|
18 | import split from 'pinyin-split'
|
19 |
|
20 | console.log(split('本:wodemaoxihuanheniunai!'))
|
21 | // ['wo', 'de', 'mao', 'xi', 'huan', 'he', 'niu', 'nai']
|
22 |
|
23 | console.log(split('本:wo de mao xihuan he niunai!'))
|
24 | // ['wo', 'de', 'mao', 'xi', 'huan', 'he', 'niu', 'nai']
|
25 |
|
26 | // return everything and wrap pinyin into lists
|
27 | console.log(split('本:ni jiao shenme mingzi?', true, true))
|
28 | // ['本:'['ni'], ' ', ['jiao'], ' ', ['shen'], ['me'], ' ', ['ming'], ['zi'], '?']
|
29 |
|
30 | // return everything and don't wrap pinyin into lists
|
31 | console.log(split('Nǐ huì shuō Yīngwén ma?', true))
|
32 | // ['Nǐ', ' ', 'huì', ' ', 'shuō', ' ', 'Yīng', 'wén', ' ', 'ma', '?']
|
33 | ```
|
34 |
|
35 | ## Related
|
36 |
|
37 | - [`pinyin-utils`](https://github.com/pepebecker/pinyin-utils)
|
38 | - [`find-hanzi`](https://github.com/pepebecker/find-hanzi)
|
39 | - [`hsk-words`](https://github.com/pepebecker/hsk-words)
|
40 | - [`cedict`](https://github.com/pepebecker/cedict)
|
41 | - [`mdbg`](https://github.com/pepebecker/mdbg)
|
42 | - [`pinyin-or-hanzi`](https://github.com/pepebecker/pinyin-or-hanzi)
|
43 | - [`hanzi-to-pinyin`](https://github.com/pepebecker/hanzi-to-pinyin)
|
44 | - [`pinyin-convert`](https://github.com/pepebecker/pinyin-convert)
|
45 | - [`pinyin-rest`](https://github.com/pepebecker/pinyin-rest)
|
46 | - [`pinyin-api`](https://github.com/pepebecker/pinyin-api)
|
47 | - [`pinyin-bot-core`](https://github.com/pepebecker/pinyin-bot-core)
|
48 | - [`pinyin-telegram`](https://github.com/pepebecker/pinyin-telegram)
|
49 | - [`pinyin-messenger`](https://github.com/pepebecker/pinyin-messenger)
|
50 | - [`pinyin-line`](https://github.com/pepebecker/pinyin-line)
|
51 | - [`pinyin-chrome`](https://github.com/pepebecker/pinyin-chrome)
|
52 | - [`pinyin-cli`](https://github.com/pepebecker/pinyin-cli)
|
53 | - [`hanzi-cli`](https://github.com/pepebecker/hanzi-cli)
|
54 |
|
55 | ## Contributing
|
56 |
|
57 | 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-split/issues).
|