@budhash/gomanize
v1.2.1
Published
Romanize Hindi (Devanagari) into readable, diacritic-free Latin script — the gomanize engine compiled to WebAssembly.
Maintainers
Readme
@budhash/gomanize
Romanize Hindi (Devanagari) into readable, diacritic-free Latin script — the gomanize engine (Go) compiled to WebAssembly, with a thin JS/TS wrapper. It is the same engine as the CLI, so output is identical; nothing is reimplemented.
Live demo: https://budhash.com/gomanize
Install
npm install @budhash/gomanizeUse
import { load } from "@budhash/gomanize";
const g = await load(); // instantiate once
g.translit("नमस्ते दुनिया"); // "namaste duniya"
g.translit("गाना", { longVowels: true }); // "gaanaa"
g.translit("मेरे सपनों की रानी", { rerank: true }); // "mere sapnon ki rani"CommonJS works too: const { load } = require("@budhash/gomanize");
Options
All optional, default false:
| Group | Option | Effect |
|-------|--------|--------|
| rule tweak | longVowels | write "aa" for every ā (गाना → gaanaa) |
| rule tweak | simpleNasals | करें → karen, not karein |
| rule tweak | keepMedialSchwa | disable CCV deletion (जनता → janata) |
| learned | schwaModel | decision-tree schwa classifier |
| learned | lexicon | prefer attested spellings |
| learned | rerank | re-rank candidates with a char n-gram model |
Notes
load()is async (instantiates the wasm) and cached;translitis synchronous after.- The
.wasmis ~1.4 MB gzipped — it embeds the schwa model, lexicon, and n-gram data. - Runs on Node ≥ 18 and modern browsers/bundlers (the wasm +
wasm_exec.jsare resolved relative to the module). - Romanization, not strict transliteration — see the project README. MIT licensed.
