A package to convert pinyin to hanzi (Chinese character) eg: "nihao" -> "你好"
- Using a large Chinese corpus scan the most frequently occuring words
- Order the words based on frequency
- When the user types in pinyin find the most common characters
- If no matching values return the top partial matching values
- Uses WASM for speed
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