#levenshtein #distance #compiler #find #match #best #lev

lev_distance

从Rust编译器中复制Levenshtein距离实现

2个版本

0.1.1 2021年12月6日
0.1.0 2021年11月9日

2075算法 中排名

Download history 801/week @ 2024-04-08 1138/week @ 2024-04-15 1403/week @ 2024-04-22 1113/week @ 2024-04-29 910/week @ 2024-05-06 788/week @ 2024-05-13 1087/week @ 2024-05-20 928/week @ 2024-05-27 1080/week @ 2024-06-03 887/week @ 2024-06-10 1067/week @ 2024-06-17 866/week @ 2024-06-24 722/week @ 2024-07-01 719/week @ 2024-07-08 870/week @ 2024-07-15 891/week @ 2024-07-22

3,273 每月下载量
7 crate(直接使用2个)中使用

MIT 协议

13KB
182

lev_distance

Rust编译器中复制Levenshtein距离实现。

此包使用String而不是Rust编译器中的Symbol,以便于通用使用。

示例

use lev_distance::find_best_match_for_name;

fn main() {
    let v = vec!["aaa", "bbb"];
    let lookup = "aa";
    
    if let Some(sugg) = match find_best_match_for_name(v.iter(), "aa", None) {
        Some(sugg) if sugg == lookup => None,
        sugg => sugg,
    } {
        println!("Did you mean `{}`?", sugg);
    }
}
$ cargo run
Did you mean `aaa`?

许可证

此包在Rust编译器下以MIT许可证发布。

Rust编译器

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

此包的许可证放在这里

无运行时依赖