Turkish analyzer
출처: 문서
본문
터키어 분석기
내장된 turkish 분석기는 다음 명령어를 사용해 텍스트 필드에 적용할 수 있어요:
PUT /turkish-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "turkish"
}
}
}
}
{% include copy-curl.html %}
어간 제외
다음 명령어를 사용하면 이 언어 분석기에서 stem_exclusion을 사용할 수 있어요:
PUT index_with_stem_exclusion_turkish_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_turkish_analyzer": {
"type": "turkish",
"stem_exclusion": ["otorite", "onay"]
}
}
}
}
}
{% include copy-curl.html %}
터키어 분석기 내부
turkish 분석기는 다음 구성 요소로 이루어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- apostrophe
- lowercase (터키어)
- stop (터키어)
- keyword
- stemmer (터키어)
사용자 지정 터키어 분석기
다음 명령어를 사용해 사용자 지정 터키어 분석기를 만들 수 있어요:
PUT /turkish-index
{
"settings": {
"analysis": {
"filter": {
"turkish_stop": {
"type": "stop",
"stopwords": "_turkish_"
},
"turkish_stemmer": {
"type": "stemmer",
"language": "turkish"
},
"turkish_lowercase": {
"type": "lowercase",
"language": "turkish"
},
"turkish_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"turkish_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"apostrophe",
"turkish_lowercase",
"turkish_stop",
"turkish_keywords",
"turkish_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "turkish_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해 분석기가 생성한 토큰을 확인해 보세요:
POST /turkish-index/_analyze
{
"field": "content",
"text": "Öğrenciler Türk üniversitelerinde öğrenim görüyor. Numara 123456."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{"token": "öğrenci","start_offset": 0,"end_offset": 10,"type": "<ALPHANUM>","position": 0},
{"token": "türk","start_offset": 11,"end_offset": 15,"type": "<ALPHANUM>","position": 1},
{"token": "üniversite","start_offset": 16,"end_offset": 33,"type": "<ALPHANUM>","position": 2},
{"token": "öğre","start_offset": 34,"end_offset": 41,"type": "<ALPHANUM>","position": 3},
{"token": "görüyor","start_offset": 42,"end_offset": 49,"type": "<ALPHANUM>","position": 4},
{"token": "numar","start_offset": 51,"end_offset": 57,"type": "<ALPHANUM>","position": 5},
{"token": "123456","start_offset": 58,"end_offset": 64,"type": "<NUM>","position": 6}
]
}