diff --git a/Cargo.toml b/Cargo.toml index 2039036..33a11cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,3 +31,7 @@ required-features = ["text"] [[example]] name = "udiff" required-features = ["text"] + +[[example]] +name = "close-matches" +required-features = ["text"] diff --git a/examples/close-matches.rs b/examples/close-matches.rs new file mode 100644 index 0000000..b88c9a9 --- /dev/null +++ b/examples/close-matches.rs @@ -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)); +}