Get started with pinyin-pro CDN

MIT licensed

Pinyin-pro is a library that converts Chinese characters into their corresponding Pinyin pronunciations.

Tags:
  • 拼音
  • pinyin
  • 汉字
  • 中文
  • 首字母
  • 韵母
  • 声母
  • 音调

Stable version

Copied!

How to start using pinyin-pro CDN


// Import the pinyin-pro library
const Pinyin = require('pinyin-pro/dist/index.js');

// Create an instance of the Pinyin class
const pinyin = new Pinyin();

// Convert a Chinese character to Pinyin
const chineseCharacter = '中';
const pinyinResult = pinyn.getFullPinyin(chineseCharacter, { tone: 2 });
console.log(pinyinResult); // zhōng (tones: 2)

// Convert a Chinese word to Pinyin
const chineseWord = '中国';
const pinyinResultWord = pinyn.getFullPinyin(chineseWord);
console.log(pinyinResultWord); // zhōngguó
Copied!
Copied!

All versions