【发布时间】:2016-04-22 09:17:12
【问题描述】:
我正在研究支持折叠非标准 ASCII 字符,例如 this guide 建议。
PUT /my_index
{
"settings": {
"analysis": {
"analyzer": {
"folding": {
"tokenizer": "standard",
"filter": [ "lowercase", "asciifolding" ]
}
}
}
}
}
奇怪的是,我无法在代码的第一个 sn-p 中复制示例。
当我执行时
GET /my_index/_analyze?analyzer=folding&text=My œsophagus caused a débâcle
返回以下标记:
sophagus, caused, a, d, b, cle
我想要实现的是:
“école”等单词的拼写变体(例如,ecole、ècole)应视为同一个单词。
现在,如果我执行
GET /my_index/_analyze?analyzer=folding&text=école ecole
我得到令牌cole, ecole
这些是我目前用于文档文本分析的设置
"analysis": {
"filter": {
"french_stop": {
"type": "stop",
"stopwords": "_french_"
},
"french_elision": {
"type": "elision",
"articles": [
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"c",
"jusqu",
"quoiqu",
"lorsqu",
"puisqu"
]
},
"french_stemmer": {
"type": "stemmer",
"language": "light_french"
}
},
"analyzer": {
"index_French": {
"filter": [
"french_elision",
"lowercase",
"french_stop",
"french_stemmer"
],
"char_filter": [
"html_strip"
],
"type": "custom",
"tokenizer": "standard"
},
"sort_analyzer": {
"type": "custom",
"filter": [
"lowercase"
],
"tokenizer": "keyword"
}
}
}
我的想法是更改 index_French 分析器的过滤器,以便列表如下:
"filter": ["french_elision","lowercase","asciifolding","french_stop","french_stemmer"]
感谢您的帮助。
【问题讨论】:
-
你显然需要使用
asciifolding令牌过滤器,试试看,你会看到。 -
如果你指的是更大的分析仪,你是对的。但我无法使用我链接的文档页面中的小样本进行正确折叠。
-
我刚试过,效果很好。你可以试试这个吗?
curl -XGET 'localhost:9200/my_index/_analyze?analyzer=folding&pretty' -d 'My œsophagus caused a débâcle' -
好吧奇怪的事情:如果我在 Sense 中运行,我会遇到同样的问题。如果我使用 Powershell,我会收到
my, oesophagus, caused, a, debacle... 我错过了将集群指定为 Amazon Elasticsearch Service 域。命令:(iwr -Uri "http://xxxxxxx/my_index/_analyze?analyzer=folding&pretty&text=My œsophagus caused a débâcle").Content
标签: elasticsearch text-analysis