String
文章目录
匹配工具
正则
糢糊匹配
工具
thefuzz (python >=3.7)
- 老名字叫 fuzzywuzzy(python <=3.6)
- GitHub - seatgeek/thefuzz: Fuzzy String Matching in Python
RapidFuzz
编辑距离
editdistance: GitHub - roy-ht/editdistance: Fast implementation of the edit distance(Levens…
- pip install editdistance
pylev: pylev · PyPI
- 纯 python 实现
- python-levenshtein 或者 levenshtein: GitHub - maxbachmann/Levenshtein: The Levenshtein Python C extension module c…
比较:
- 基础功能 python-levenshtein 和 editdistance 速度相差不大;pylev 最慢
- 功能分别有不同的特性 features
difflib
- https://docs.python.org/3/library/difflib.html
- 类似 linux diff 工具,文件文本比对
regex 三方库
thefuzz 和 fuzzywuzzy
问题
empty query 修复
参考:https://stackoverflow.com/a/63490931
问题描述:
FuzzyWuzzy error: WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '/']
修复方法:
| |
文章作者
上次更新 2024-01-05 (5c92d1c)