Expand description
Public Rust API for moine.
The crate keeps the language-independent edit-distance core available at the root and exposes language adapters under explicit modules.
The default feature includes the moine CLI binary for cargo install moine. Library users who want only the Rust APIs can depend on the crate
with default-features = false.
Dictionary data is distributed separately from the source crates. Rust users
load verified bundles explicitly through ja::load_bundle or
zh::load_bundle.
use moine::{distance, Lattice};
let left = Lattice::from_paths(["moine"]);
let right = Lattice::from_paths(["moinya"]);
assert_eq!(distance(&left, &right), 2);Modules§
- dot
- DOT rendering helpers for lattice comparison graphs.
- ja
- Japanese kana, romaji, override, UniDic, and Sudachi adapters.
- zh
- Chinese pinyin and CC-CEDICT adapters.
Structs§
- Arc
- Directed arc between two lattice nodes.
- Distance
Trace - Edit distance plus one best sequence of edit operations.
- Distance
Workspace - Reusable buffers for repeated lattice distance computations.
- Lattice
- A directed acyclic lattice with one start node and one end node.
- String
Distance Workspace - Reusable buffers for plain Unicode-scalar string distance computations.
- Trace
Step - One operation in a reconstructed edit-distance trace.
Enums§
- Distance
Error - Errors returned by fallible distance functions.
- EditOp
- Edit operation represented in a trace step.
- Lattice
Error - Errors returned when constructing an invalid lattice.
Constants§
- MAX_
DISTANCE_ MATRIX_ CELLS - Maximum DP matrix size accepted by non-trace distance functions.
- MAX_
TRACE_ MATRIX_ CELLS - Maximum DP matrix size accepted by trace reconstruction.
Functions§
- damerau_
distance - Computes lattice edit distance with adjacent transpositions.
- damerau_
levenshtein_ str - Computes optimal string alignment Damerau-Levenshtein distance.
- distance
- Computes lattice edit distance.
- distance_
with_ trace - Computes edit distance and one best trace.
- levenshtein_
str - Computes Levenshtein distance over Unicode scalar values.
- levenshtein_
str_ with_ cutoff - Computes Levenshtein distance over Unicode scalar values up to
threshold. - normalized_
similarity_ from_ distance - Converts an edit distance and sequence lengths to a similarity score.
- normalized_
similarity_ str - Computes normalized Levenshtein similarity for two strings.
- try_
damerau_ distance - Computes lattice edit distance with adjacent transpositions and explicit matrix-size validation.
- try_
damerau_ distance_ with_ cutoff - Computes lattice Damerau-Levenshtein distance up to
threshold. - try_
damerau_ levenshtein_ str - Computes optimal string alignment Damerau-Levenshtein distance with the fallible API shape used by lattice distances.
- try_
damerau_ levenshtein_ str_ with_ cutoff - Computes optimal string alignment Damerau-Levenshtein distance up to
threshold. - try_
distance - Computes lattice edit distance with explicit matrix-size validation.
- try_
distance_ with_ cutoff - Computes lattice edit distance up to
threshold. - try_
distance_ with_ trace - Computes edit distance and one best trace with explicit matrix-size validation.
- try_
within_ damerau_ distance - Returns whether lattice Damerau-Levenshtein distance is at most
threshold, with explicit matrix-size validation. - try_
within_ distance - Returns whether lattice edit distance is at most
threshold, with explicit matrix-size validation. - within_
damerau_ distance - Returns whether lattice Damerau-Levenshtein distance is at most
threshold. - within_
distance - Returns whether lattice edit distance is at most
threshold.
Type Aliases§
- Symbol
- Integer symbol stored on lattice arcs.