Skip to content

A Rust library based off Yomitan for parsing and querying from language dictionaries

License

Notifications You must be signed in to change notification settings

aramrw/yomichan_rs

Repository files navigation

yomichan-rs Crates.io

Rust library based off Yomitan & Yomichan

Caution

This library is unstable and will have breaking changes

Features/Roadmap

  • Dictionary Imports
    • Basic Dictionary Importing
      • Index
      • Tags
      • Term
      • TermMeta
      • Kanji
      • KanjiMeta
    • Advanced Importing
      • Dictionaries with Images/Media

Multi-Language Deinflector github Crates.io

  • Note creation
    • Basic Features
    • Notes
    • Create new from search
    • Edit Existing
    • Delete Existing
    • Overwrite Existing
  • Styling

Misc

  • Entry Definitions
    • Plain Text (String)
    • Html
    • styles.css

Examples

let mut ycd = Yomichan::new("db.ycd");
ycd.set_language("ja");
let res = ycd.search("今勉強中です");
dbg!(res);

Output example

[
    TermSearchResultsSegment {
        text: "今",
        results: Some(
            TermSearchResults {
                dictionary_entries: [
                    TermDictionaryEntry {
                        dictionary_alias: "旺文社国語辞典 第十一版 画像無し",
                        headwords: [
                            TermHeadword { term: "今", reading: "こん" },
                        ],
                        definitions: [
                            TermDefinition {
                                entries: [
                                    TermGlossaryContentGroup {
                                        plain_text: "こん【今】\n\
                                                     〔教2〕\n\
                                                     コン・キン㊥\n\
                                                     いま\n\
                                                     筆順:\n\n\
                                                     (字義)\n\
                                                     ① いま。現在。このごろ。最近。「今代(きんだい)・今人(こんじん)・今日(こんにち)・昨今・自今・当今」\n\
                                                     ⇔昔(1):昔(2)\n\
                                                     ② きょう。「今日(きよう)・今朝(けさ・こんちよう)・今夜」\n\
                                                     ③ こんど。このたび。「今回・今度・今年度」\n\
                                                     今宵(こよい)・今際(いまわ)",
                                    },
                                ],
                            },
                        ],
                    },
                    TermDictionaryEntry {
                        dictionary_alias: "旺文社国語辞典 第十一版 画像無し",
                        headwords: [
                            TermHeadword { term: "今", reading: "いま" },
                        ],
                        definitions: [
                            TermDefinition {
                                entries: [
                                    TermGlossaryContentGroup {
                                        plain_text: "いま【今】\n\
                                                     🈩 (名)\n\
                                                     ① 過去と現在との間の一瞬間。この瞬間。現在の時点。「逃げるなら―だ」\n\
                                                     ② 現代。「―も通用している」「―小町」\n\
                                                     ⇔昔\n\
                                                     🈔 (副)\n\
                                                     ① すぐに。じきに。「―行きます」\n\
                                                     ② 今よりほんの少し前。「―着いたばかりだ」\n\
                                                     ③ 前にあったことに加えて、この時に。さらに。そのうえに。「―一度言ってごらん」\n\
                                                     現在・ただ今・現今・今日(こんにち)・今日日(きようび)・現時・現下・目下・当今・当世・当節・今頃(いまごろ)・今時分",
                                    },
                                ],
                            },
                        ],
                    },
                    // ... another entry for the reading "きん"
                ],
            },
        ),
    },
    TermSearchResultsSegment {
        text: "勉強",
        results: Some(
            TermSearchResults {
                dictionary_entries: [
                    TermDictionaryEntry {
                        // ../ dictionary,
                        // ../ headwords,
                        definitions: [
                            TermDefinition {
                                entries: [
                                    TermGlossaryContentGroup {
                                        plain_text: "べん‐きょう【勉強】――キヤウ\n\
                                                     (名・自他スル)\n\
                                                     ① 学問や仕事など、物事に努め励むこと。\n\
                                                     ② 知識や技能を学ぶこと。「受験―」\n\
                                                     ③ 将来に役立つ経験や試練。「君にとっては、いい―だ」\n\
                                                     ④ 商品などを安く売ること。「端数は―します」",
                                    },
                                ],
                            },
                        ],
                    },
                ],
            },
        ),
    },
   ../ "中",
    ../ "です",
]

Other Examples

  1. yomichan_rs_gui (wip):

About

A Rust library based off Yomitan for parsing and querying from language dictionaries

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Languages