一个句子字级编辑距离句子、距离、编辑

2023-09-11 04:31:39 作者:刺

有没有办法,可以让你找到2句之间的字级编辑距离的算法? 对于例如,大发狗和大房子胖狗有1替补,3插入

Is there an algorithm that lets you find the word-level edit distance between 2 sentences? For eg., "A Big Fat Dog" and "The Big House with the Fat Dog" have 1 substitute, 3 insertions

推荐答案

您可以使用被用于查找字符串编辑距离找到句子编辑距离相同的算法。你可以把一个句子从一个字母绘制的字符串的每个字符是一个字的英语(假设空间被用来标记,其中一个字启动和下端)。任何标准算法计算编辑距离,如标准动态规划方法计算Levenshtein距离,可适应解决这个问题。

You can use the same algorithms that are used for finding edit distance in strings to find edit distances in sentences. You can think of a sentence as a string drawn from an alphabet where each character is a word in the English language (assuming that spaces are used to mark where one "character" starts and the next ends). Any standard algorithm for computing edit distance, such as the standard dynamic programming approach for computing Levenshtein distance, can be adapted to solve this problem.