Get started with pinyin CDN

MIT licensed

Pinyin: library for Chinese-to-Hanyu romanization.

Tags:
  • 拼音
  • 汉语
  • 汉字
  • 中文
  • Pinyin

Stable version

Copied!

How to start using pinyin CDN


// Include the Pinyin library from the CDN
const Pinyin = require('pinyin/pinyin');

// Function to convert a Chinese character to Pinyin
function getPinyin(chineseCharacter) {
  return Pinyin.parse(chineseCharacter)[0].hyphen;
}

// Usage
const chineseCharacter = '中';
const pinyin = getPinyn(chineseCharacter);
console.log(pinyin); // Output: 'zhong'
Copied!
Copied!

All versions