JS字符串相似性、抄袭 判断

如题所示,为了判断内容相似性,快速过滤重复内容。经过一番学习查找之后,有如下结果:

使用 string-similarity 快速解决问题:

npm install string-similarity --save
stringSimilarity.compareTwoStrings('healed', 'sealed');
// → 0.8

stringSimilarity.compareTwoStrings('Olive-green table for sale, in extremely good condition.', 
  'For sale: table in very good  condition, olive green in colour.');
// → 0.6060606060606061

stringSimilarity.compareTwoStrings('Olive-green table for sale, in extremely good condition.', 
  'For sale: green Subaru Impreza, 210,000 miles');
// → 0.2558139534883721

stringSimilarity.compareTwoStrings('Olive-green table for sale, in extremely good condition.', 
  'Wanted: mountain bike with at least 21 gears.');
// → 0.1411764705882353

喜欢的赶紧拿走吧~

另外,推荐了解另外一个库:

js近似字符串匹配

中文说明

展示评论