{"title":"Algorithms for approximate string matching","authors":"Esko Ukkonen","doi":"10.1016/S0019-9958(85)80046-2","DOIUrl":null,"url":null,"abstract":"<div><p>The edit distance between strings <em>a</em><sub>1</sub> … <em>a<sub>m</sub></em> and <em>b</em><sub>1</sub> … <em>b<sub>n</sub></em> is the minimum cost <em>s</em> of a sequence of editing steps (insertions, deletions, changes) that convert one string into the other. A well-known tabulating method computes <em>s</em> as well as the corresponding editing sequence in time and in space <em>O</em>(<em>mn</em>) (in space <em>O</em>(min(<em>m, n</em>)) if the editing sequence is not required). Starting from this method, we develop an improved algorithm that works in time and in space <em>O</em>(<em>s</em> · min(<em>m, n</em>)). Another improvement with time <em>O</em>(<em>s</em> · min(<em>m, n</em>)) and space <em>O</em>(<em>s</em> · min(<em>s, m, n</em>)) is given for the special case where all editing steps have the same cost independently of the characters involved. If the editing sequence that gives cost <em>s</em> is not required, our algorithms can be implemented in space <em>O</em>(min(<em>s, m, n</em>)). Since <em>s</em> = <em>O</em>(max(<em>m, n</em>)), the new methods are always asymptotically as good as the original tabulating method. As a by-product, algorithms are obtained that, given a threshold value <em>t</em>, test in time <em>O</em>(<em>t</em> · min(<em>m, n</em>)) and in space <em>O</em>(min(<em>t, m, n</em>)) whether <em>s</em> ⩽ <em>t</em>. Finally, different generalized edit distances are analyzed and conditions are given under which our algorithms can be used in conjunction with extended edit operation sets, including, for example, transposition of adjacent characters.</p></div>","PeriodicalId":38164,"journal":{"name":"信息与控制","volume":null,"pages":null},"PeriodicalIF":0.0000,"publicationDate":"1985-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://sci-hub-pdf.com/10.1016/S0019-9958(85)80046-2","citationCount":"676","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"信息与控制","FirstCategoryId":"1093","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0019995885800462","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q4","JCRName":"Mathematics","Score":null,"Total":0}
引用次数: 676
Abstract
The edit distance between strings a1 … am and b1 … bn is the minimum cost s of a sequence of editing steps (insertions, deletions, changes) that convert one string into the other. A well-known tabulating method computes s as well as the corresponding editing sequence in time and in space O(mn) (in space O(min(m, n)) if the editing sequence is not required). Starting from this method, we develop an improved algorithm that works in time and in space O(s · min(m, n)). Another improvement with time O(s · min(m, n)) and space O(s · min(s, m, n)) is given for the special case where all editing steps have the same cost independently of the characters involved. If the editing sequence that gives cost s is not required, our algorithms can be implemented in space O(min(s, m, n)). Since s = O(max(m, n)), the new methods are always asymptotically as good as the original tabulating method. As a by-product, algorithms are obtained that, given a threshold value t, test in time O(t · min(m, n)) and in space O(min(t, m, n)) whether s ⩽ t. Finally, different generalized edit distances are analyzed and conditions are given under which our algorithms can be used in conjunction with extended edit operation sets, including, for example, transposition of adjacent characters.
字符串a1…am和b1…bn之间的编辑距离是将一个字符串转换为另一个字符串的一系列编辑步骤(插入,删除,更改)的最小成本s。一种著名的制表方法在时间和空间O(mn)中计算s以及相应的编辑顺序(如果不需要编辑顺序,则在空间O(min(m, n))中计算)。在此基础上,我们开发了一种改进的算法,该算法在时间和空间上都是O(s·min(m, n))。另一个改进是在时间为O(s·min(m, n))和空间为O(s·min(s, m, n))的特殊情况下给出的,即所有编辑步骤的代价与所涉及的字符无关。如果不需要代价为s的编辑序列,我们的算法可以在空间O(min(s, m, n))中实现。由于s = O(max(m, n)),新方法总是与原始制表方法渐近地一样好。在给定阈值t的情况下,得到了在时间O(t·min(m, n))和空间O(min(t, m, n))上测试s≤t的算法。最后,分析了不同的广义编辑距离,并给出了我们的算法可以与扩展编辑操作集结合使用的条件,包括相邻字符的换位。