Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including cantonese with all npm packages installed. Try it out:

var cantonese = require("cantonese")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cantonese v0.0.0

Cantonese romanization. Cantonese to Latin conversion.

cantonese

Cantonese romanization. Cantonese to Latin conversion. Supports Traditional and Simplified Chinese characters.

Install via npm:

npm i cantonese

The Cantonese pronunciation data are from www.kawa.net. Please note that not all Chinese characters have corresponding pronunciations in Cantonese.

Usage

  • Function toLatin ( a Chinese character ) returns Array

    Returns possible pronunciations of a Chinese character in Cantonese.

  • Function fromLatin ( a Latin word ) returns Array

    Returns all Chinese characters with specific pronunciation in Cantonese.

Example

var cantonese = require('cantonese'); console.log(cantonese.toLatin('長')); // [ 'cheung', 'jeung' ] console.log(cantonese.fromLatin('cheung')); // [ '倡', '呛', '唱', '嗆', '场', '場', '墙', '娼', '戕', '抢', // '搶', '昌', '暢', '枪', '槍', '牆', '猖', '畅', '祥', '窗', // '翔', '肠', '腸', '蔷', '薔', '詳', '详', '長', '长' ]

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free