编辑距离计算器
计算两个字符串之间的编辑距离,并查看将一个字符串转换为另一个字符串所需的操作。
How to Use the Levenshtein Distance Calculator
- 在第一个字符串字段中输入第一个字符串。
- 在第二个字符串字段中输入第二个字符串。
- 点击计算——编辑距离、相似度百分比、操作列表立即显示。
- 展开距离矩阵以查看用于计算的完整动态规划表。
快速参考
| 从 | 到 |
|---|---|
| 小猫 → 坐着 | 距离:3 |
| 星期六 → 星期日 | 距离:3 |
| 你好 → 你好 | 距离:0(相同) |
| abc → xyz | 距离:3(全部替换) |
| 猫 → 购物车 | 距离:1(插入 r) |
| 书 → 返回 | 距离:2 |
使用场景
- •通过查找最接近拼写错误的输入的字典单词来构建拼写检查建议。
- •在生物信息学研究中比较 DNA 或蛋白质序列。
- •在数据库和搜索引擎中实现模糊搜索。
- •测量教育应用程序中用户提交的文本和参考答案之间的相似性。
公式
两个字符串之间的编辑距离是将一个字符串转换为另一个字符串所需的单字符编辑(插入、删除或替换)的最小数量。
常见问题
编辑距离是什么?
编辑距离(也称为编辑距离)是用于测量两个字符串差异程度的度量。
如何根据编辑距离计算相似度百分比?
Similarity is derived from the Levenshtein distance using the formula: similarity = (1 − distance / max(len1, len2)) × 100%.
What are common applications of Levenshtein distance?
Levenshtein distance is widely used in spell checkers to suggest corrections, in DNA sequence alignment for bioinformatics, in fuzzy string matching for search engines, in plagiarism detection tools, and in natural language processing for tasks such as named entity recognition and machine translation evaluation.