Romanian analyzer
The built-in romanian
analyzer can be applied to a text field using the following command:
PUT /romanian-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "romanian"
}
}
}
}
copy
Stem exclusion
You can use stem_exclusion
with this language analyzer using the following command:
PUT index_with_stem_exclusion_romanian_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_romanian_analyzer": {
"type": "romanian",
"stem_exclusion": ["autoritate", "aprobat"]
}
}
}
}
}
copy
Romanian analyzer internals
The romanian
analyzer is built using the following components:
Tokenizer:
standard
Token filters:
- lowercase
- stop (Romanian)
- keyword
- stemmer (Romanian)
Custom Romanian analyzer
You can create a custom Romanian analyzer using the following command:
PUT /romanian-index
{
"settings": {
"analysis": {
"filter": {
"romanian_stop": {
"type": "stop",
"stopwords": "_romanian_"
},
"romanian_stemmer": {
"type": "stemmer",
"language": "romanian"
},
"romanian_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"romanian_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"romanian_stop",
"romanian_keywords",
"romanian_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "romanian_analyzer"
}
}
}
}
copy
Generated tokens
Use the following request to examine the tokens generated using the analyzer:
POST /romanian-index/_analyze
{
"field": "content",
"text": "Studenții învață la universitățile din România. Numerele lor sunt 123456."
}
copy
The response contains the generated tokens:
{
"tokens": [
{
"token": "studenț",
"start_offset": 0,
"end_offset": 9,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "învaț",
"start_offset": 10,
"end_offset": 16,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "universităț",
"start_offset": 20,
"end_offset": 34,
"type": "<ALPHANUM>",
"position": 3
},
{
"token": "român",
"start_offset": 39,
"end_offset": 46,
"type": "<ALPHANUM>",
"position": 5
},
{
"token": "numer",
"start_offset": 48,
"end_offset": 56,
"type": "<ALPHANUM>",
"position": 6
},
{
"token": "123456",
"start_offset": 66,
"end_offset": 72,
"type": "<NUM>",
"position": 9
}
]
}
当前内容版权归 OpenSearch 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 OpenSearch .