gpt4 book ai didi

elasticsearch - 同义词 token 过滤器

转载 作者:行者123 更新时间:2023-12-03 02:26:17 27 4
gpt4 key购买 nike

我用同义词标记过滤器创建了一个测试索引

 PUT /synonyms-index
{

"settings": {

"analysis": {

"filter": {

"my_synonym_filter": {

"type": "synonym",

"synonyms": [

"shares","equity","stock"

]

}

},

"analyzer": {

"my_synonyms": {

"tokenizer": "standard",

"filter": [

"lowercase",

"my_synonym_filter"

]

}

}

}

}

}

然后我分析了API,
post synonyms-index/_analyze
{
"analyzer":"my_synonyms",
"text":"equity awesome"
}

我收到以下响应,以查看什么代币进入了反向索引,并且我期望按照同义词规则需要添加“股票”和“股票”,但事实并非如此。我在这里想念什么吗?
{
"tokens": [
{
"token": "equity",
"start_offset": 0,
"end_offset": 6,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "awesome",
"start_offset": 7,
"end_offset": 14,
"type": "<ALPHANUM>",
"position": 1
}
]
}

最佳答案

发布社区答案-

JSON是常见的陷阱,

我们需要将其设置为(将所有内容都用双引号引起来,这构成一个规则并且遵循简单的扩展。)

"synonyms": [ "shares,equity,stock" ]

而不是
"synonyms": [

"shares","equity","stock"

]

关于elasticsearch - 同义词 token 过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60967313/

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