gpt4 book ai didi

algorithm - Gmail中的 "Consider including"特性是如何实现的?

转载 作者:塔克拉玛干 更新时间:2023-11-03 03:53:06 24 4
gpt4 key购买 nike

我想在我的博客上做一些类似于 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 的集合” 这样的搜索不会太慢吗?

最佳答案

搜索模型问题:
你的模型对我来说似乎有点过于简化,因为非常频繁的标签很可能总是建议的标签,即使有与 A、C 对更相关的标签也是如此。

您可能应该考虑 tf-idf模型,如果稀有词也连接到“查询”[这里的查询是 A 和 B],它会提升稀有词,因为如果稀有词通常与 一起使用A 和 B - 它可能与它们非常相关。

这个想法很简单:如果一个标签经常与 A 和 B 一起使用 - 给它一个提升。 [翻译]
另外,如果一个词很少见[这个标签的总使用次数] - 给它一个提升[idf]
每个标签的“分数”将是组合的 tf-idf 分数

性能问题:
您也可以考虑为此任务创建一个 inverted index - 加快搜索速度。
如果你使用java,apache lucene是一个成熟的图书馆,可以帮助你。

关于algorithm - Gmail中的 "Consider including"特性是如何实现的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9277683/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com