A pinyin to hanzi WASM npm package that returns the most likely Chinese characters and words based on a frequency corpus
A package to convert pinyin to hanzi (Chinese characters). ๐จ๐ณ For example, "nihao" โก๏ธ "ไฝ ๅฅฝ"
- ๐ Using a large Chinese corpus, scan the most frequently occurring words.
- ๐ Order the words based on frequency.
- ๐ง When the user types in pinyin, find the most common characters.
- ๐ If no matching values are found, return the top partial matching values.
- โก Uses WebAssembly (WASM) for blazing-fast performance.
import init, { pinyin_to_hanzi } from "./pinyin_to_hanzi.js";
async function initializeWASM() {
await init(); // Initialize the WASM module
}
async function runTest(pinyinInput) {
const result = pinyin_to_hanzi(pinyinInput);
// Result is a list of strings
}
initializeWASM(); // Initialize WASM as soon as the script loads