5

我使用 tf/idf 来计算两个文档之间的余弦相似度。它有一些限制,性能不是很好。

我寻找 LDA(潜在狄利克雷分配)来计算文档相似度。我对此知之甚少。我也找不到太多关于我的问题的东西。

您能否提供与我的问题相关的任何教程?或者你能给我一些建议,我怎样才能用 LDA 完成这个任务???

谢谢

PS:还有什么源代码可以用 LDA 执行这样的任务吗?

4

4 回答 4

1

你看过 Lucene 和 Mahout 吗?

这可能很有用 -使用 Lucene 和 Mahout进行潜在 Dirichlet 分配。

于 2010-02-17T01:57:37.343 回答
0

A bit old, but for anyone still interested, take a look at this blog post (disclaimer: this is my own blog). The algorithm described there and the linked code will probably do what you need if you don't have your heart set on any specific approach.

Regarding Shashikant's comment, the cosine similarity may not be a good option because the signatures are proportional in length to the documents. Constant length signatures are preferable.

于 2012-05-26T01:03:08.017 回答
0

试试这个服务来计算两个文档之间的余弦相似度

http://www.scurtu.it/documentSimilarity.html

import urllib,urllib2
import json
API_URL="http://www.scurtu.it/apis/documentSimilarity"
inputDict={}
inputDict['doc1']='Document with some text'
inputDict['doc2']='Other document with some text'
params = urllib.urlencode(inputDict)    
f = urllib2.urlopen(API_URL, params)
response= f.read()
responseObject=json.loads(response)  
print responseObject
于 2013-02-12T11:38:58.587 回答
0

您可能会想到LSA(潜在语义分析),它是此类问题的一种非常常见的解决方案。

于 2010-02-17T01:57:13.603 回答