pinyin-split
TypeScript icon, indicating that this package has built-in type declarations

1.170.0 • Public • Published

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.

Package Sidebar

Install

npm i pinyin-split

Weekly Downloads

98

Version

1.170.0

License

ISC

Unpacked Size

17.7 kB

Total Files

9

Last publish

Collaborators

  • pepebecker