2012-02-14 22 views
2

我想做一些类似gmail的“考虑包括”我的博客上的建议,但带有标签。Gmail如何实施“考虑包括”功能?

我想存储标签的设置是这样的: three tables

,我认为以下算法:

//a blog post is published 
//it has the tags "A", "B" & "C" : 
if the tag set "A,B,C" doesn't exist 
    create it 
else 
    add 1 to "number of times used" 

,并建议标签:

//a blog post is being written. 
//the author includes the tags "A" and "C" 
//which tags should I suggest ? 
find all the tags sets that contain "A" and "C" 
    among them, find the one with the highest "number of times used" 
    suggest the tags of the set not already picked (A & C) 

有一个更好/更聪明的方式来完成这项任务?数据库模型呢?我可以优化它,使像“包含A & C”的搜索不会太慢吗?

+1

“建议朋友使用内隐社会图表”http://research.google.com/pubs/pub36371.html – 2012-02-14 15:50:56

+0

哇,很好:D – Manu 2012-02-14 17:14:37

回答

1

搜索模式问题:
您的模型似乎有点过于简化对我来说,因为很常见的标签是最有可能永远是建议的,即使有标签更关系到对A,C。

你或许应该海外商品会有tf-idf模式,这提振罕见而言,如果他们也连接到“查询” [在这里查询A and B],因为如果一个难得的术语通常与A and B使用 - 这可能与他们非常相关。

这个想法很简单:如果标签经常与A and B一起使用 - 给它一个提升。 [TF]
此外,如果一个术语是少见[该标签的总使用次数] - 给它一个升压[IDF]
的“分数”为每个标签将合并的TF-IDF评分

性能问题:
您也可以为此任务进行拼接创建inverted index - 以加快搜索速度。
如果您使用java,apache lucene是一个成熟的库,可以帮助您。

+0

tf * idf看起来不错,谢谢! – Manu 2012-02-14 17:13:50

1

我觉得这是典型的数据关联挖掘和推荐问题。您可以尝试谷歌Apriori算法进行数据挖掘,并提出TOP N建议。

您的解决方案可以在我的选择中运行但不全面。如设置“A,B”和设置“A,B,C”不是独立的集合。