spatium

Crates.iospatium
lib.rsspatium
version0.1.1
sourcesrc
created_at2020-01-21 12:51:35.735656
updated_at2020-01-21 13:23:39.106573
descriptionSpatium. Calc distance between sequences.
homepagehttps://github.com/dyens/spatium
repositoryhttps://github.com/dyens/spatium
max_upload_size
id200751
size65,076
Alexander Kapustin (dyens)

documentation

https://docs.rs/spatium

README

Spatium

Spatium logo

Build Status

Spatium -- library for comparing distance between sequences.

Algorithms

Edit based

Example

For example, Levenshtein:

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);

License

Spatium is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Commit count: 40

cargo fmt