#japanese #dictionary #edict #edrdg

jmdict

The free Japanese dictionary database JMdict, pre-digested for use in Rust libs and apps

3 releases (stable)

2.0.0 Jul 19, 2021
1.0.0 Apr 18, 2021
0.99.1 Apr 18, 2021

#684 in Database interfaces

Download history 38/week @ 2024-06-10 44/week @ 2024-06-17 42/week @ 2024-06-24 58/week @ 2024-07-01 30/week @ 2024-07-08 49/week @ 2024-07-15 23/week @ 2024-07-22 22/week @ 2024-07-29 49/week @ 2024-08-05 77/week @ 2024-08-12 91/week @ 2024-08-19 53/week @ 2024-08-26 7/week @ 2024-09-02 36/week @ 2024-09-09 15/week @ 2024-09-16 54/week @ 2024-09-23

114 downloads per month
Used in 2 crates (via autoruby)

Apache-2.0

88KB
1.5K SLoC

WARNING: Licensing on database files

The database files compiled into the crate are licensed from the Electronic Dictionary Research and Development Group under Creative Commons licenses. Applications linking this crate directly oder indirectly must display appropriate copyright notices. Please refer to the EDRDG's license statement for details.

rust-jmdict

GitHub Actions Badge

The jmdict crate contains the data from the JMDict file, a comprehensive multilingual dictionary of the Japanese language. The original JMDict file, included in this repository (and hence, in releases of this crate) comes as XML. Instead of stuffing the XML in the binary directly, this crate parses the XML at compile-time and generates an optimized representation for inclusion in the final binary.

In short, this crate does:

  • parse the XML structure of the JMdict database file,
  • provide an API to access its entries, and
  • provide compile-time flags (via Cargo features) to select the amount of information included in the binary.

This crate does NOT:

  • provide fast lookup into the database. You get a list of entries and then you can build your own indexing on top as required by your application.

For specific examples, please check out the documentation on docs.rs.

Building

When packaging to crates.io, we cannot include the actual payload data (data/entrypack.json) because crates.io has a limit of 10 MiB per crate. (Technically, we could ship the data by depending on a series of data crates each slightly under 10 MiB, but I intend to be a good citizen and not abuse the shared infrastructure of crates.io needlessly.)

Hence the default strategy is to pull the entrypack (a preprocessed form of the JMdict contents) at build time from a server under the crate owner's control, currently https://dl.xyrillian.de/jmdict/. Each released crate version will have the most recent entrypack (as of the time of publication) hardcoded into its code, along with a SHA-256 checksum to ensure data integrity.

If downloading the entrypack at build time is not possible (e.g. because the build machine does not have internet access, or because curl is not installed on the build machine), download the entrypack beforehand and put its path in the RUST_JMDICT_ENTRYPACK environment variable when running cargo build.

For development purposes, when building from the repository, data/entrypack.json will be used instead. If this is not desired, set the value of the RUST_JMDICT_ENTRYPACK to default to force the normal download behavior.

Contributing

If you plan to open issues or write code, please have a look at CONTRIBUTING.md.

Dependencies

~165KB