#ngrams #fuzzy-search #fuzzy #shingles

noodler

A port of the python-ngram project that provides fuzzy search using N-gram

1 unstable release

0.1.0 Apr 11, 2023

#1335 in Text processing

Download history 29/week @ 2024-03-11 25/week @ 2024-03-18 26/week @ 2024-03-25 47/week @ 2024-04-01 25/week @ 2024-04-08 8/week @ 2024-04-15 13/week @ 2024-04-22 15/week @ 2024-04-29 14/week @ 2024-05-06 14/week @ 2024-05-13 33/week @ 2024-05-20 13/week @ 2024-05-27 24/week @ 2024-06-03 30/week @ 2024-06-10 22/week @ 2024-06-17 13/week @ 2024-06-24

91 downloads per month

MIT/Apache

25KB
596 lines

🍜 Noodler

In computer science, "noodler" is used to describe programs that handle text. Because algorithms like n-grams are typically used to extract information from text, similar to pulling strands of noodles out of a pile of dough, "noodler" can be associated with algorithms that extract information from text because they can be seen as "processing" programs for text, just as noodle makers "produce" noodles from dough.

ChatGPT

A port of the python-ngram project that provides fuzzy search using N-gram.

✍️ Example

use noodler::NGram;

let ngram = NGram::<&str>::builder()
    .arity(2)
    .warp(3.0)
    .threshold(0.75)
    .build()
    // Feed with known words
    .fill(vec!["pie", "animal", "tomato", "seven", "carbon"]);

// Try an unknown/misspelled word, and find a similar match
let word = "tomacco";
let top = ngram.search_sorted(word).next();
if let Some((text, similarity)) = top {
    if similarity > 0.99 {
        println!("{}", text);
    } else {
        println!(
            "{} (did you mean {}? [{:.0}% match])",
            word,
            text,
            similarity * 100.0
        );
    }
} else {
    println!("🗙 {}", word);
}

💭 Inspired by

Please check out these awesome works that helped a lot in the creation of noodler:

  • python-ngram: Set that supports searching by ngram similarity.
  • ngrammatic: A rust crate providing fuzzy search/string matching using N-grams.

🚩 Minimal supported Rust version

All tests passed with rustc v1.41, earlier versions may not compile.

⚖️ License

Licensed under either of

at your option.

No runtime deps