Skip to content

shiki-tm/pinyin-split

 
 

Repository files navigation

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.

About

Split up any kind of Pinyin into an array of syllables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%