Skip to main content

Crate moine

Crate moine 

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

ja
Japanese kana, romaji, override, and UniDic adapters.
zh
Chinese pinyin and CC-CEDICT adapters.

Structs§

Arc
Directed arc between two lattice nodes.
DistanceTrace
Edit distance plus one best sequence of edit operations.
Lattice
A directed acyclic lattice with one start node and one end node.
TraceStep
One operation in a reconstructed edit-distance trace.

Enums§

DistanceError
Errors returned by fallible distance functions.
EditOp
Edit operation represented in a trace step.
LatticeError
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.
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_levenshtein_str
Computes optimal string alignment Damerau-Levenshtein distance with explicit matrix-size validation.
try_distance
Computes lattice edit distance with explicit matrix-size validation.
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.