Sorani analyzer
출처: 문서
본문
Sorani 분석기
내장된 sorani 분석기는 다음 명령을 사용해 text 필드에 적용할 수 있어요:
PUT /sorani-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "sorani"
}
}
}
}
{% include copy-curl.html %}
어간 제외
다음 명령을 사용하면 이 언어 분석기에서 stem_exclusion을 사용할 수 있어요:
PUT index_with_stem_exclusion_sorani_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_sorani_analyzer": {
"type": "sorani",
"stem_exclusion": ["مؤسسه", "اجازه"]
}
}
}
}
}
{% include copy-curl.html %}
Sorani 분석기 내부
sorani 분석기는 다음 구성 요소들로 이루어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- normalization (Sorani)
- lowercase
- decimal_digit
- stop (Sorani)
- keyword
- stemmer (Sorani)
커스텀 Sorani 분석기
다음 명령을 사용해 커스텀 Sorani 분석기를 만들 수 있어요:
PUT /sorani-index
{
"settings": {
"analysis": {
"filter": {
"sorani_stop": {
"type": "stop",
"stopwords": "_sorani_"
},
"sorani_stemmer": {
"type": "stemmer",
"language": "sorani"
},
"sorani_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"sorani_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"sorani_normalization",
"lowercase",
"decimal_digit",
"sorani_stop",
"sorani_keywords",
"sorani_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "sorani_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
분석기로 생성된 토큰을 살펴보려면 다음 요청을 사용해 보세요:
POST /sorani-index/_analyze
{
"field": "content",
"text": "خوێندنی فەرمی لە هەولێرەوە. ژمارەکان ١٢٣٤٥٦."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{
"token": "خوێندن",
"start_offset": 0,
"end_offset": 7,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "فەرم",
"start_offset": 8,
"end_offset": 13,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "هەولێر",
"start_offset": 17,
"end_offset": 26,
"type": "<ALPHANUM>",
"position": 3
},
{
"token": "ژمار",
"start_offset": 28,
"end_offset": 36,
"type": "<ALPHANUM>",
"position": 4
},
{
"token": "123456",
"start_offset": 37,
"end_offset": 43,
"type": "<NUM>",
"position": 5
}
]
}