Crates.io | jmdict-furigana |
lib.rs | jmdict-furigana |
version | 0.1.0 |
created_at | 2025-06-11 07:27:05.259908+00 |
updated_at | 2025-06-11 07:27:05.259908+00 |
description | Generate Japanese furigana for headword/reading pairs via JmdictFurigana |
homepage | |
repository | https://github.com/aecsocket/wordbase |
max_upload_size | |
id | 1708273 |
size | 5,021,223 |
Generate Japanese furigana for headword/reading pairs via JmdictFurigana
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
面白い[おもしろい]
becomes 面[おも]白[しろ]い
関係無い[かんけいない]
becomes 関[かん]係[けい]無[な]い
大人[おとな]
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, [("関", "かん"), ("係", "けい"), ("無", "な"), ("い", "")]);
}
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.