Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 2.56 KB

README.md

File metadata and controls

57 lines (44 loc) · 2.56 KB

Pinyin Split

npm version Travis Build Status dependency status dev dependency status ISC-licensed

Install

npm install pinyin-split

Usage

import split from 'pinyin-split'

console.log(split('本:wodemaoxihuanheniunai!'))
// ['wo', 'de', 'mao', 'xi', 'huan', 'he', 'niu', 'nai']

console.log(split('本:wo de mao xihuan he niunai!'))
// ['wo', 'de', 'mao', 'xi', 'huan', 'he', 'niu', 'nai']

// return everything and wrap pinyin into lists
console.log(split('本:ni jiao shenme mingzi?', true, true))
// ['本:'['ni'], ' ', ['jiao'], ' ', ['shen'], ['me'], ' ', ['ming'], ['zi'], '?']

// return everything and don't wrap pinyin into lists
console.log(split('Nǐ huì shuō Yīngwén ma?', true))
// ['Nǐ', ' ', 'huì', ' ', 'shuō', ' ', 'Yīng', 'wén', ' ', 'ma', '?']

Related

Contributing

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