Crates.io | ejdict_rs |
lib.rs | ejdict_rs |
version | 0.0.4 |
source | src |
created_at | 2020-01-06 14:54:09.130927 |
updated_at | 2020-01-12 09:41:08.172076 |
description | This library is an English-Japanese dictionary that can be used via implemented API by Rust language. |
homepage | |
repository | https://github.com/tomo3110/ejdict-rs |
max_upload_size | |
id | 195783 |
size | 4,684,465 |
This library is an English-Japanese dictionary that can be used via implemented API by Rust language.
DEMO
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
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(())
}
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.
Thanks for the great crates and dictionary data.
This software is under MIT License.