ejdict_rs

Crates.ioejdict_rs
lib.rsejdict_rs
version0.0.4
sourcesrc
created_at2020-01-06 14:54:09.130927
updated_at2020-01-12 09:41:08.172076
descriptionThis library is an English-Japanese dictionary that can be used via implemented API by Rust language.
homepage
repositoryhttps://github.com/tomo3110/ejdict-rs
max_upload_size
id195783
size4,684,465
(tomo3110)

documentation

README

ejdict-rs

Build and test ejdict_rs at crates.io ejdict_rs at docs.rs MIT licensed

This library is an English-Japanese dictionary that can be used via implemented API by Rust language.

DEMO DEMO

Overview

This library is available through a simple API. Since the dictionary data to be referenced is embedded in this crate, The Japanese-English dictionary can be used immediately by simply obtaining the crate from crates.io without depending on the database or file.

The dictionary data of this library is "ejdict" which is a public domain dictionary. See the following URL for details.

https://github.com/kujirahand/EJDict

Examples

This library is used through two functions.

case1: Look up words from dictionary.

use ejdict_rs::SearchMode;

fn main() -> ejdict_rs::Result<()> {
    let word = ejdict_rs::look("apple", SeachMode::Exact)?;
    assert_eq!(word.mean(), "『リンゴ』;リンゴの木");
    Ok(())
}

case2: Candidate list from dictionary.

use ejdict_rs::SearchMode;

fn main() -> ejdict_rs::Result<()> {
    let candidates = ejdict_rs::candidates("apple", SeachMode::Fuzzy)?;
    for word in candidates {
        // something ...
    }
    Ok(())
}

Install

Write the following contents in Cargo.toml.

[dependencies]
ejdict_rs = "0.0.3"

If you use the development version or a specific version, write as follows.

[dependencies]
ejdict_rs = { git = "https://github.com/tomo3110/ejdict-rs" }

For details, check the following URL.

https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-git-repositories

Dependencies

  • crates
    • failure
      • Apache 2.0, MIT
      • Error management
    • lazy_static
      • Apache 2.0, MIT
      • Copyright (c) 2010 The Rust Project Developers
      • A small macro for defining lazy evaluated static variables in Rust.
    • serde_json
      • Apache 2.0, MIT
      • Strongly typed JSON library.
  • dictionary data
    • ejdict-hand
      • MIT
      • Copyright (c) 2016 kujirahand
      • English-Japanese Dictionary data (Public Domain)

Thanks for the great crates and dictionary data.

License

This software is under MIT License.

Author

tomo3110

Commit count: 42

cargo fmt