单词纠错算法 字符串编辑距离 Levenshtein.docVIP

  • 154
  • 0
  • 约3.03千字
  • 约 5页
  • 2018-12-19 发布于贵州
  • 举报

单词纠错算法 字符串编辑距离 Levenshtein.doc

单词纠错算法 字符串编辑距离 Levenshtein

单词纠错算法 字符串编辑距离 Levenshtein 单词纠错算法:字符串编辑距离(Levenshtein distance)2011-01-31 23:45如何计算单词相似度(编辑距离:Levenshtein Distance 几种编辑距离算法的比较入如下: Levenshtein distance 允许插入,删除,替换单个字符. 允许插入,删除,但是不可以替换 允许插入,删除,替换,交换相邻位置的字符 只是允许替换,所以只能用于等长字符串 例子: kitten和sitting的编辑距离为3,因为至少经过三次编辑才可以将其中一个单词变为另一个单词. kitten→sitten(substitution ofkwiths) sitten→sittin(substitution ofewithi) sittin→sitting(insertgat the end). 以下网址有Levenshtein distance的多种语言的实现:这里我关注的是C++,先抄过来,以后验证一下. 源代码: const unsigned int cost_del=1; const unsigned int cost_ins=1; const unsigned int cost_sub=1; unsigned int edit_distance(const std:strings1,const std

文档评论(0)

1亿VIP精品文档

相关文档