OhMyCalc

编辑距离计算器

计算两个字符串之间的编辑距离,并查看将一个字符串转换为另一个字符串所需的操作。

How to Use the Levenshtein Distance Calculator

  1. 在第一个字符串字段中输入第一个字符串。
  2. 在第二个字符串字段中输入第二个字符串。
  3. 点击计算——编辑距离、相似度百分比、操作列表立即显示。
  4. 展开距离矩阵以查看用于计算的完整动态规划表。

快速参考

小猫 → 坐着距离:3
星期六 → 星期日距离:3
你好 → 你好距离:0(相同)
abc → xyz距离:3(全部替换)
猫 → 购物车距离:1(插入 r)
书 → 返回距离:2

使用场景

公式

两个字符串之间的编辑距离是将一个字符串转换为另一个字符串所需的单字符编辑(插入、删除或替换)的最小数量。

常见问题

编辑距离是什么?
编辑距离(也称为编辑距离)是用于测量两个字符串差异程度的度量。
如何根据编辑距离计算相似度百分比?
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.