@goliapkg/pinyin (WASM)
Browser / Node bindings for inputx-pinyin — a
self-developed Mandarin Pinyin input engine with segmenter, fuzzy
syllables, FST dict, and L0 user-learning. Pre-built into a ~100 KB
WebAssembly module (bootstrap dict embedded by default; full 9 MB dict
available behind a build feature).
The web surface of the Inputx IME.
License: MIT OR Apache-2.0.
Install
Usage
import init from "@goliapkg/pinyin";
await ; // load + instantiate the .wasm
const eng = ;
// Exact-syllable lookup
console.log; // ["中国", "中过", ...]
// Prefix completion (used for partial-input IME suggestions)
const hits = eng.;
hits..;
// User picks a candidate → engine learns. 3 picks → auto-pin to L0.
eng.;
// Char → pinyin reverse lookup
console.log; // "zhong"
// Persistence — caller chooses storage
const state = eng.;
localStorage.;
// later:
eng.;
What ships
golia_pinyin_wasm_bg.wasm— engine + bootstrap FST (~100 KB)golia_pinyin_wasm.js— ES-module wrappergolia_pinyin_wasm.d.ts— TypeScript types
For the full 414K-entry dict (9 MB), rebuild without the
bootstrap_only feature — see Build below.
Build from source
Default (small bootstrap dict, ~100 KB total bundle):
# output in core/crates/inputx-pinyin-wasm/pkg/
Full dict (~9 MB, all 414K entries):
See also
- Native Rust crate:
inputx-pinyin - Parent IME repo: Inputx
- Sibling wubi engine:
@goliapkg/wubi