3 releases
Uses new Rust 2024
| 0.1.2 | Aug 21, 2025 |
|---|---|
| 0.1.1 | Aug 6, 2025 |
| 0.1.0 | Jul 12, 2025 |
#3 in #romaji
Used in ib-matcher
2MB
32K
SLoC
ib-romaji
A fast Japanese romanizer.
Usage
use ib_romaji::HepburnRomanizer;
let romanizer = HepburnRomanizer::default();
let mut romajis = Vec::new();
romanizer.romanize_and_try_for_each("日本語", |len, romaji| {
romajis.push((len, romaji));
None::<()>
});
assert_eq!(romajis, vec![(9, "nippongo"), (3, "a"), (3, "aki"), (3, "bi"), (3, "chi"), (3, "he"), (3, "hi"), (3, "iru"), (3, "jitsu"), (3, "ka"), (3, "kou"), (3, "ku"), (3, "kusa"), (3, "nchi"), (3, "ni"), (3, "nichi"), (3, "nitsu"), (3, "su"), (3, "tachi")]);
assert_eq!(romanizer.romanize_vec("日本語"), vec![(9, "nippongo"), (3, "a"), (3, "aki"), (3, "bi"), (3, "chi"), (3, "he"), (3, "hi"), (3, "iru"), (3, "jitsu"), (3, "ka"), (3, "kou"), (3, "ku"), (3, "kusa"), (3, "nchi"), (3, "ni"), (3, "nichi"), (3, "nitsu"), (3, "su"), (3, "tachi")]);
Comparison with other crates
-
kakasi's dictionary is a bit outdated and it's licensed under GPL-3. Whileib-romajiuses the latest JMdict and licensed under MIT.ib-romajialso supports querying all possible romajis of a word.
The following crates are kana (仮名) only. They don't support kanjis like 日本語:
Dependencies
~1–2.5MB
~50K SLoC