1.0.10 • Published 6 years ago
chinese-transform-pinyin v1.0.10
What Is It
It is a tool which you can input chinese, the tool can transform your input to pinyin. You will have a good time to use it.
npm install chinese-transform-pinyinThanks zhujun24 dictionary. It's very good
Have Three Options
firstCharonly save the first char of the pinyinonlyToneonly save the tone of the pinyinremoveTonethis option can transform the tone to the English charkeepOriginsave punctuation, number and English
You can use the three options together or only use the one of them, also you can choose any two options to use together.
For Example
import Pinyin from 'chinese-transform-pinyin'
Pinyin('拼音库第一次尝试') // pīn yīn kù dì yī cì cháng shìor
import Pinyin from 'chinese-transform-pinyin'
Pinyin('拼音库第一次尝试', { removeTone: true }) // pin yin ku di yi ci chang shior
import Pinyin from 'chinese-transform-pinyin'
Pinyin('今天天气不错哟', { firstChar: true }) // j t t q b c yalso you can
import Pinyin from 'chinese-transform-pinyin'
Pinyin('今天天气不错哟', { firstChar: true, onlyTone: true }) // jī tā tā qì bù cò yōnow you can save any which except Chinese
Pinyin('今天天气不错,一起出去吧?', { keepOrigin: true }) // jīn tiān tiān qì bù cuò , yì qǐ chū qù ba?
Pinyin('拼音库第1次尝试', { keepOrigin: true }) // pīn yīn kù dì 1 cì cháng shìA Tip
you may choose the firstChar option and the removeTone option to use together, but the result may be same when you use three options together, so I just recommend you to use three option together when you want to do this, because I do not make it happen in this version