Crate ejdict_rs

Source
Expand description

§ejdict-rs

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

§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;

let word = ejdict_rs::look("apple", SearchMode::Exact)?;
assert_eq!(word.mean(), "『リンゴ』;リンゴの木");

case2: Candidate list from dictionary.

use ejdict_rs::SearchMode;

let candidates = ejdict_rs::candidates("apple", SearchMode::Fuzzy)?;
for word in candidates {
    // something ...
}

§Install

Write the following contents in Cargo.toml.

[dependencies]
ejdict_rs = { "0.0.4" }

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

Structs§

  • Dictionary struct This struct is holds all the words contained in the English-Japanese dictionary.
  • Error in this library
  • This Struct is that holds word translation information. words field is that holds similar English words.

Enums§

  • Kind of errors that occur in this library.
  • SearchMode specifies how to check if a word is a match.

Functions§

  • Get matching candidate words.
  • Look up words from an English-Japanese Dictionary.

Type Aliases§

  • List of candidates that can be obtained as search results
  • Short hand for Result type