11 releases

Uses old Rust 2015

0.5.0 Mar 17, 2023
0.4.0 May 28, 2021
0.3.0 Jan 11, 2018
0.2.0 Jan 31, 2017
0.1.4 Feb 20, 2016

#867 in Text processing

Download history 839/week @ 2024-07-22 834/week @ 2024-07-29 720/week @ 2024-08-05 1089/week @ 2024-08-12 1006/week @ 2024-08-19 910/week @ 2024-08-26 927/week @ 2024-09-02 843/week @ 2024-09-09 1057/week @ 2024-09-16 2129/week @ 2024-09-23 1680/week @ 2024-09-30 2239/week @ 2024-10-07 1824/week @ 2024-10-14 1243/week @ 2024-10-21 1192/week @ 2024-10-28 1058/week @ 2024-11-04

5,534 downloads per month
Used in 6 crates (2 directly)

MIT license

22KB
351 lines

rust-bk-tree

A BK-tree implementation in Rust.

Build Status Crates.io Clippy Linting Result

Documentation

Examples

Here's some example usages:

use bk_tree::{BKTree, metrics};

// A BK-tree using the Levenshtein distance metric.
let mut tree: BKTree<&str> = BKTree::new(metrics::levenshtein);

tree.add("foo");
tree.add("bar");
tree.add("baz");
tree.add("bup");

tree.find("bar", 0); // returns vec!["bar"]
tree.find("bar", 1); // returns vec!["bar", "baz"]
tree.find("bup", 2); // returns vec!["bar", "baz", "bup"]

Benchmarks

To run benchmarks, you need to have the nightly version of Rust installed. If you do (and use multirust, for example), then you can run

rustup run nightly cargo bench

to run benchmarks.

Dependencies

~225–395KB