Crates.io | noodler |
lib.rs | noodler |
version | 0.1.0 |
source | src |
created_at | 2023-04-11 11:31:13.744412 |
updated_at | 2023-04-11 11:31:13.744412 |
description | A port of the python-ngram project that provides fuzzy search using N-gram. |
homepage | |
repository | https://github.com/loichyan/noodler |
max_upload_size | |
id | 835962 |
size | 39,858 |
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.
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);
}
Please check out these awesome works that helped a lot in the creation of noodler:
All tests passed with rustc v1.41
, earlier versions may not compile.
Licensed under either of
at your option.