Catalan analyzer
출처: 문서
본문
카탈루냐어 애널라이저
내장된 catalan 애널라이저는 다음 명령어를 사용해 텍스트 필드에 적용할 수 있어요:
PUT /catalan-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "catalan"
}
}
}
}
{% include copy-curl.html %}
스템 제외
다음 명령어를 사용하면 이 언어 애널라이저에서 stem_exclusion을 사용할 수 있어요:
PUT index_with_stem_exclusion_catalan_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_catalan_analyzer": {
"type": "catalan",
"stem_exclusion": ["autoritat", "aprovació"]
}
}
}
}
}
{% include copy-curl.html %}
카탈루냐어 애널라이저 내부 구조
catalan 애널라이저는 다음 구성 요소로 이루어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- elision (카탈루냐어)
- lowercase
- stop (카탈루냐어)
- keyword
- stemmer (카탈루냐어)
커스텀 카탈루냐어 애널라이저
다음 명령어를 사용해 커스텀 카탈루냐어 애널라이저를 만들 수 있어요:
PUT /catalan-index
{
"settings": {
"analysis": {
"filter": {
"catalan_stop": {
"type": "stop",
"stopwords": "_catalan_"
},
"catalan_elision": {
"type": "elision",
"articles": [ "d", "l", "m", "n", "s", "t"],
"articles_case": true
},
"catalan_stemmer": {
"type": "stemmer",
"language": "catalan"
},
"catalan_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"catalan_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"catalan_elision",
"lowercase",
"catalan_stop",
"catalan_keywords",
"catalan_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "catalan_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해 애널라이저가 생성한 토큰을 확인해 보세요:
POST /catalan-index/_analyze
{
"field": "content",
"text": "Els estudiants estudien a les universitats catalanes. Els seus números són 123456."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{"token": "estud","start_offset": 4,"end_offset": 14,"type": "<ALPHANUM>","position": 1},
{"token": "estud","start_offset": 15,"end_offset": 23,"type": "<ALPHANUM>","position": 2},
{"token": "univer","start_offset": 30,"end_offset": 42,"type": "<ALPHANUM>","position": 5},
{"token": "catalan","start_offset": 43,"end_offset": 52,"type": "<ALPHANUM>","position": 6},
{"token": "numer","start_offset": 63,"end_offset": 70,"type": "<ALPHANUM>","position": 9},
{"token": "123456","start_offset": 75,"end_offset": 81,"type": "<NUM>","position": 11}
]
}