[][src]Crate spatium

Spatium

Spatium is a library for calcuting distances beetween sequences. The library allows you to run different algorithm implementations with various parameters

Examples

use spatium::edit_based::levenshtein;

// Get default algorithm for calc levenshtein distance.
let alg = levenshtein::Default::default();
let x = [1, 2, 3];
let y = [1, 2, 4];
let distance = alg.distance(&x, &y).unwrap();
assert_eq!(distance, 1.0);

// With normaliztion (normalized distance = distance / x.len())
let alg = levenshtein::Default::default().normalize_result(true);
let x = [1, 2, 3];
let y = [1, 2, 4];
let distance = alg.distance(&x, &y).unwrap();
assert_eq!(distance, 1.0 / 3.0);

// Use obviously algorithm (for example recursive version)

let alg = levenshtein::Recursive::default();
let x = [1, 2, 3];
let y = [1, 2, 4];
let distance = alg.distance(&x, &y).unwrap();
assert_eq!(distance, 1.0);

Algorithms:

Edit based:

Modules

edit_based

Edit Based algorithms

error

Library error class