Russian analyzer
출처: 문서
본문
러시아어 분석기
내장된 russian 분석기는 다음 명령을 사용해 텍스트 필드에 적용할 수 있어요:
PUT /russian-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "russian"
}
}
}
}
{% include copy-curl.html %}
어간 제외
stem_exclusion은 다음 명령을 사용해 이 언어 분석기와 함께 사용할 수 있어요:
PUT index_with_stem_exclusion_russian_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_russian_analyzer": {
"type": "russian",
"stem_exclusion": ["авторитет", "одобрение"]
}
}
}
}
}
{% include copy-curl.html %}
러시아어 분석기 내부 구조
russian 분석기는 다음 구성 요소로 만들어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- lowercase
- stop (Russian)
- keyword
- stemmer (Russian)
커스텀 러시아어 분석기
다음 명령을 사용해 커스텀 러시아어 분석기를 만들 수 있어요:
PUT /russian-index
{
"settings": {
"analysis": {
"filter": {
"russian_stop": {
"type": "stop",
"stopwords": "_russian_"
},
"russian_stemmer": {
"type": "stemmer",
"language": "russian"
},
"russian_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"russian_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"russian_stop",
"russian_keywords",
"russian_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "russian_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해 분석기가 생성한 토큰을 살펴볼 수 있어요:
POST /russian-index/_analyze
{
"field": "content",
"text": "Студенты учатся в университетах России. Их номера 123456."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{
"token": "студент",
"start_offset": 0,
"end_offset": 8,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "учат",
"start_offset": 9,
"end_offset": 15,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "университет",
"start_offset": 18,
"end_offset": 31,
"type": "<ALPHANUM>",
"position": 3
},
{
"token": "росс",
"start_offset": 32,
"end_offset": 38,
"type": "<ALPHANUM>",
"position": 4
},
{
"token": "номер",
"start_offset": 43,
"end_offset": 49,
"type": "<ALPHANUM>",
"position": 6
},
{
"token": "123456",
"start_offset": 50,
"end_offset": 56,
"type": "<NUM>",
"position": 7
}
]
}