npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pinyin-tone

v2.2.4

Published

Another wheel that converts pinyin tone numbers to pinyin marks.

Downloads

250

Readme

pinyin-tone

  • Another wheel that converts Hanyu pinyin "tone numbers" to "tone marks".

  • 又一个把“汉语拼音声调数字”转换成“声调符号”的轮子。

  • I assume you already know what 拼音(Pinyin) is and how to write correct pinyin.

  • 假设您已经知道什么是拼音(Pinyin)、知道如何写正确的拼音。

Setup

NPM

  • via npm:
  • 通过NPM安装:
npm install pinyin-tone

Usage (default)

// this module exports a function, name it as `pinyin` or what you like.
var pinyin_v1 = require('pinyin-tone');

// call the function
var hatsune_miku = pinyin_v1('chu1 yin1 wei4 lai2'); // ---> 'chū yīn wèi lái'
var megurine_luka = pinyin_v1("xun2 yin1 liu2 ge1"); // ---> 'xún yīn liú gē'
var han = pinyin_v1("han4 yu3 pin1 yin1 fang1 an4"); // ---> 'hàn yǔ pīn yīn fāng àn'

// 儿化音(ér huà yīn)
var huar = pinyin_v1("huar1 renr2 shuir3 yuer4"); // ---> 'huār rénr shuǐr yuèr'

// 声母(shēng mǔ)
var bpmf = pinyin_v1("b p m f"); // ---> 'b p m f'

// 韵母(yùn mǔ)
var yun = pinyin_v1("an1 vn2 ong3 uen4"); // ---> 'ān ǘn ǒng uèn'

// special
var liuyun = pinyin_v1("liou2 yuen2"); // ---> 'liú yún' // use in reality
var iou_uen = pinyin_v1("iou1 uen4"); // ---> 'iōu uèn' // only yùn mǔ

// or some pinyin that not used in reality.
var fantastic = pinyin_v1("bong1 tv2 pe3 wir4"); // ---> 'bōng tǘ pě wìr'

Usage v2 (exprimental)

As a result, there is ONE difference between v1 and v2. v2 does NOT support 儿化音 like hua1r (format: pinyin-number-r), it only supports the format pinyin-r-number like huar1.

var pinyin_v2 = require('pinyin-tone/v2');

console.log(pinyin_v2('qi3 lai2 bu2 yuan4 zuo4 nu2 li4 de ren2 men')); // --> 'qǐ lái bú yuàn zuò nú lì de rén men'
console.log(pinyin_v2('huar1 wei4 shen2 me zhe4 yang4 hong2')); // --> 'huār wèi shén me zhè yàng hóng'

Changelog

Tests

see test/test.js.

  • 重写了测试 Rewrite tests. 2020-11-11

Issues

License

  • MIT

About 汉语拼音方案(hàn yǔ pīn yīn fāng àn)

You can find 汉语拼音方案.pdf from http://www.moe.gov.cn/jyb_sjzl/ziliao/A19/195802/t19580201_186000.html