sublime_fuzzy

Fuzzy matching algorithm based on Sublime Text's string search. Iterates through characters of a search string and calculates a score based on matching consecutive/close groups of characters. Tries to find the best match by scoring multiple match paths.

Documentation

Usage

Basic usage:

```rust use sublimefuzzy::bestmatch;

let s = "some search thing"; let search = "something"; let result = best_match(search, s).unwrap();

// Output: score: 368 println!("score: {:?}", result.score()); ```

Simple formatting:

```rust use sublimefuzzy::{bestmatch, format_simple};

let s = "some search thing"; let search = "something"; let result = best_match(search, s).unwrap();

// Output: some search thing println!("formatted: {:?}", format_simple(&result, s, "", "")); ```

Adjust scoring:

```rust use sublime_fuzzy::FuzzySearcher;

let mut search = FuzzySearcher::new();

search.setsearch("something"); search.settarget("some search thing");

// Weight consecutive matching chars less. search.setscoreconsecutive(4);

println!("result: {:?}", search.best_match()); ```