gpt4 book ai didi

search - Elasticsearch:促进某些条款的缺失

转载 作者:行者123 更新时间:2023-12-03 00:11:29 25 4
gpt4 key购买 nike

如果没有某些条款,我该如何积极提升?我在here之前问过这个问题,但是响应不令人满意,因为它的推广性不够。

让我们再试一次,更多细节。

我希望能够将笔记本电脑与其配件区分开来。在人类语言中,这是通过缺少术语来完成的。就是说,当您说lenovo thinkpad时,您知道通过省略单词battery意味着您想要的是真正的笔记本电脑。将其与有人说lenovo thinkpad battery的意思(表示电池)进行比较。

因此,假设我们有索引:

PUT test_index
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 1
}
}
}

带有映射:
PUT test_index/_mapping/merchant
{
"properties": {
"title": {
"type": "string"
},
"category": {
"type": "string",
"index": "not_analyzed"
}
}
}

放入两个项目:
PUT test_index/merchant/3
{
"title": "macbook battery",
"category": "laptops accessories"
}
PUT test_index/merchant/2
{
"title": "lenovo thinkpad battery",
"category": "laptops accessories"
}
PUT test_index/merchant/1
{
"title": "lenovo thinkpad white/black",
"category": "laptops"
}

现在搜索 lenovo thinkpad:
POST test_index/_search
{
"query":{
"match": { "title": "lenovo thinkpad" }
}
}

结果是:
"hits": [
{
"_index": "test_index",
"_type": "merchant",
"_id": "2",
"_score": 0.70710677,
"_source": {
"title": "lenovo thinkpad battery",
"category": "laptops accessories"
}
},
{
"_index": "test_index",
"_type": "merchant",
"_id": "1",
"_score": 0.70710677,
"_source": {
"title": "lenovo thinkpad white/black",
"category": "laptops"
}
}
]

在这里注意 lenovo thinkpad batterylenovo thinkpad white/black高。

现在,我可以看到至少两种合理的方法可以做到这一点。

A)在每个类别的基础上使用术语频率来影响 title匹配的相关性。例如,如果您为每个类别提取了95%的百分位词,那么 batterylaptops accessories中的一个高频术语,因此在所有 battery查询中 title这个词都应加负数。

B)在每个类别的基础上使用术语频率来影响 category匹配的相关性。例如,除了标题匹配之外,您还可以自动将其类别中包含95%百分位数的术语(结果不包含在 title匹配中)的结果进行负提升。

A和B并不完全相同,但是它们都基于这样的想法,即应该考虑某些缺席的单词的相关性。

那么……有什么想法吗?

最佳答案

我的投票是
C)
固定类别,以使电池不具有“笔记本电脑”作为类别(它是“laptopAccessory”或仅仅是“accessory”)。或者,创建一个附加类别(不称为“laptops”)来指示实际的机器本身。

在搜索中,您可以尝试对“笔记本电脑”类别(不再模棱两可)进行提升,而不是尝试降低附件的排名。如您在“lenovo thinkpad”的示例中那样,这将导致最初的搜索将实际机器移至配件上方。更精确的搜索(“lenovo Thinkpad Battery”)仍然可以按照您的期望工作。

另一个不错的UI / UX体验是获取结果中返回的总类别,并提供简单的过滤器链接。因此,如果您的初始搜索返回“笔记本电脑”,“配件”,“付款计划”,那么您将把它们中的每一个作为使用原始搜索加上该类别过滤器的重新查询的链接。

祝好运!

关于search - Elasticsearch:促进某些条款的缺失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40268146/

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