Added close-matches example
This commit is contained in:
parent
42437ce3d7
commit
182a998e0f
2 changed files with 19 additions and 0 deletions
|
|
@ -31,3 +31,7 @@ required-features = ["text"]
|
|||
[[example]]
|
||||
name = "udiff"
|
||||
required-features = ["text"]
|
||||
|
||||
[[example]]
|
||||
name = "close-matches"
|
||||
required-features = ["text"]
|
||||
|
|
|
|||
15
examples/close-matches.rs
Normal file
15
examples/close-matches.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
use similar::text::get_close_matches;
|
||||
|
||||
fn main() {
|
||||
let words = vec![
|
||||
"apple",
|
||||
"appu",
|
||||
"appal",
|
||||
"apparitor",
|
||||
"beer",
|
||||
"beeb",
|
||||
"beeline",
|
||||
];
|
||||
println!("{:?}", get_close_matches("app", &words, 3, 0.7));
|
||||
println!("{:?}", get_close_matches("bee", &words, 3, 0.7));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue