jmdict-furigana

Crates.iojmdict-furigana
lib.rsjmdict-furigana
version0.1.0
created_at2025-06-11 07:27:05.259908+00
updated_at2025-06-11 07:27:05.259908+00
descriptionGenerate Japanese furigana for headword/reading pairs via JmdictFurigana
homepage
repositoryhttps://github.com/aecsocket/wordbase
max_upload_size
id1708273
size5,021,223
(aecsocket)

documentation

README

Generate Japanese furigana for headword/reading pairs via JmdictFurigana

crates.io docs.rs

JmdictFurigana is a project which links Japanese kanji and kana readings with the right kana portions for each kanji in a dictionary word. This mapping lets you segment a kanji+kana reading pair into a list of kanji/kana pairs correctly. jmdict-furigana provides access to this mapping from Rust, by bundling the released JmdictFurigana archive and parsing it.

The current bundled archive is 2.3.1+2024-11-25

Features

  • Readings for individual kanji are mapped correctly
    • 面白い[おもしろい] becomes 面[おも]白[しろ]い
    • 関係無い[かんけいない] becomes 関[かん]係[けい]無[な]い
  • Special readings are mapped correctly
    • 大人[おとな] becomes 大人[おとな]

If a headword/reading pair is missing from the dictionary, None is returned. In this case, you either have no furigana reading available, or you will need to use some kind of fallback method like [wordbase-api].

async fn main() {
    // make sure to call `init` first to parse and load the dictionary
    // otherwise `get` calls will panic
    jmdict_furigana::init().await;

    let segments: &[(&str, &str)] = jmdict_furigana::get("関係無い", "かんけいない").unwrap();

    assert_eq!(segments, [("関", "かん"), ("係", "けい"), ("無", "な"), ("い", "")]);
}

License

The source code is dual-licensed under MIT or Apache-2.0.

The JmdictFurigana archive is licensed under Creative Commons Attribution-ShareAlike Licence, same as JmdictFurigana and JMDict itself.

Commit count: 332

cargo fmt