爱沙尼亚语分析器
内置的 estonian
分析器可以使用以下命令应用于文本字段
PUT /estonian-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "estonian"
}
}
}
}
词干排除
您可以使用以下命令将 stem_exclusion
与此语言分析器一起使用
PUT index_with_stem_exclusion_estonian_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_estonian_analyzer": {
"type": "estonian",
"stem_exclusion": ["autoriteet", "kinnitus"]
}
}
}
}
}
爱沙尼亚语分析器内部结构
estonian
分析器由以下组件构建而成
-
分词器:
standard
-
词元过滤器
- 小写
- 停用词 (爱沙尼亚语)
- 关键词
- 词干提取器 (爱沙尼亚语)
自定义爱沙尼亚语分析器
您可以使用以下命令创建自定义爱沙尼亚语分析器
PUT /estonian-index
{
"settings": {
"analysis": {
"filter": {
"estonian_stop": {
"type": "stop",
"stopwords": "_estonian_"
},
"estonian_stemmer": {
"type": "stemmer",
"language": "estonian"
},
"estonian_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"estonian_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"estonian_stop",
"estonian_keywords",
"estonian_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "estonian_analyzer"
}
}
}
}
生成的词元
使用以下请求检查使用该分析器生成的词元
POST /estonian-index/_analyze
{
"field": "content",
"text": "Õpilased õpivad Tallinnas ja Eesti ülikoolides. Nende numbrid on 123456."
}
响应包含生成的词元
{
"tokens": [
{"token": "õpilase","start_offset": 0,"end_offset": 8,"type": "<ALPHANUM>","position": 0},
{"token": "õpi","start_offset": 9,"end_offset": 15,"type": "<ALPHANUM>","position": 1},
{"token": "tallinna","start_offset": 16,"end_offset": 25,"type": "<ALPHANUM>","position": 2},
{"token": "eesti","start_offset": 29,"end_offset": 34,"type": "<ALPHANUM>","position": 4},
{"token": "ülikooli","start_offset": 35,"end_offset": 46,"type": "<ALPHANUM>","position": 5},
{"token": "nende","start_offset": 48,"end_offset": 53,"type": "<ALPHANUM>","position": 6},
{"token": "numbri","start_offset": 54,"end_offset": 61,"type": "<ALPHANUM>","position": 7},
{"token": "on","start_offset": 62,"end_offset": 64,"type": "<ALPHANUM>","position": 8},
{"token": "123456","start_offset": 65,"end_offset": 71,"type": "<NUM>","position": 9}
]
}