pinyin-formatter A utility for formatting pinyin text How it works The pinyin.js file contains functions for applying pinyin tone accents to a word that uses numeric tone indicators. Example ni3hao3. wo3 jiao4 wang2xian1sheng. becomes nĭhăo. wǒ jiào wángxiānsheng.