spatium 0.1.1

Spatium. Calc distance between sequences.
Documentation
  • Coverage
  • 100%
    28 out of 28 items documented4 out of 17 items with examples
  • Size
  • Source code size: 64.7 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.96 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • dyens/spatium
    1 0 4
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • dyens

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.