A basic BK tree implementation in Haxe
Haxe
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
LICENSE
README.md
haxelib.json

README.md

bktree (Haxe Library)

A basic BK tree implementation in Haxe, based on the C# version from https://nullwords.wordpress.com/2013/03/13/the-bk-tree-a-data-structure-for-spell-checking/

Installation

haxelib install bktree

Usage

class Main {
	static function main() {
		var bk = new BKTree();
		
		for (i in ["boot", "goat", "wolf", "cabbage"]) {
			bk.set(i);
		}
		
		trace(bk.search("toad", 2));
		// > [goat]
		
		trace(bk.search("toad", 3));
		// > [boot, wolf, goat]
		
		trace(BKTree.LevenshteinDistance("toad", "cabbage"));
		// > 6
	}
}