python中文字符串比较模块_作者姓名的近似字符串匹配模块与策略

我在我的电脑上运行了一个基准测试,在安装了C-native levenshtein backend和不安装C-native levenshtein backend的情况下,在~19k单词列表中找到8个单词的最佳候选词(使用pip install python_Levenshtein-0.12.0-cp34-none-win_amd64.whl),得到了以下计时:无C后端:

比较了151664个单词在48.591717004776秒(0.00032039058052521366秒/搜索)。在

已安装C后端:

比较了13.034106969833374秒(8.594067787895198e-05秒/搜索)中的151664个单词。在

这比我预期的快了4倍。在

结果如下:0 of 8: Compared 'Lemaire' > `[('L.', 90), ('Le', 90), ('A', 90), ('Re', 90), ('Em', 90)]`

1 of 8: Compared 'Peil' > `[('L.', 90), ('E.', 90), ('Pfeil', 89), ('Gampel', 76), ('Jo-pei', 76)]`

2 of 8: Compared 'Singleton' > `[('Eto', 90), ('Ng', 90), ('Le', 90), ('to', 90), ('On', 90)]`

3 of 8: Compared 'Tagoe' > `[('Go', 90), ('A', 90), ('T', 90), ('E.', 90), ('Sagoe', 80)]`

4 of 8: Compared 'Jgoun' > `[('Go', 90), ('Gon', 75), ('Journo', 73), ('Jaguin', 73), ('Gounaris', 72)]`

5 of 8: Compared 'Ben' > `[('Benfer', 90), ('Bence', 90), ('Ben-Amotz', 90), ('Beniaminov', 90), ('Benczak', 90)]`

6 of 8: Compared 'Porte' > `[('Porter', 91), ('Portet', 91), ('Porten', 91), ('Po', 90), ('Gould-Porter', 90)]`

7 of 8: Compared 'Nyla' > `[('L.', 90), ('A', 90), ('Sirichanya', 76), ('Neyland', 73), ('Greenleaf', 67)]`

下面是基准测试的python代码:

^{pr2}$

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值