Javascript文本相似度算法 [英] Javascript text similarity algorithm

查看:53
本文介绍了Javascript文本相似度算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个网站,该网站应该收集各种新闻提要,并希望对文本进行相似性比较.我需要的是某种新闻文本相似度算法.我知道 php 有 similar_text 函数,但我不确定它有多好 + 我需要它用于 javascript.因此,如果有人可以向我指出一个示例或插件或任何有关如何实现这一点的说明,或者至少可以从哪里查看并开始调查.

I'm building a website that should collect various news feeds and would like the texts to be compared for similarity. What i need is some sort of a news text similarity algorithm. I know that php has the similar_text function and am not sure how good it is + i need it for javascript. So if anyone could point me to an example or a plugin or any instruction on how this is possible or at least where to look and start investigating.

推荐答案

Levenshtein 距离的 javascript 实现metric,通常用于文本比较.如果您想比较整篇文章或标题,您最好查看构成文本的词组(以及这些词的频率)之间的交集,而不仅仅是字符串相似性度量.

There's a javascript implementation of the Levenshtein distance metric, which is often used for text comparisons. If you want to compare whole articles or headlines though you might be better off looking at intersections between the sets of words that make up the text (and frequencies of those words) rather than just string similarity measures.

这篇关于Javascript文本相似度算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆