Basque analyzer
출처: 문서
본문
바스크어 분석기
내장된 basque 분석기는 다음 명령어를 사용해 텍스트 필드에 적용할 수 있어요:
PUT /basque-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "basque"
}
}
}
}
{% include copy-curl.html %}
어간 제외
다음 명령어를 사용하면 이 언어 분석기에서 stem_exclusion을 사용할 수 있어요:
PUT index_with_stem_exclusion_basque_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_basque_analyzer": {
"type": "basque",
"stem_exclusion": ["autoritate", "baldintza"]
}
}
}
}
}
{% include copy-curl.html %}
바스크어 분석기 내부 구조
basque 분석기는 다음 구성 요소로 만들어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- lowercase
- stop (Basque)
- keyword
- stemmer (Basque)
커스텀 바스크어 분석기
다음 명령어를 사용해 커스텀 바스크어 분석기를 만들 수 있어요:
PUT /basque-index
{
"settings": {
"analysis": {
"filter": {
"basque_stop": {
"type": "stop",
"stopwords": "_basque_"
},
"basque_stemmer": {
"type": "stemmer",
"language": "basque"
},
"basque_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"basque_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"basque_stop",
"basque_keywords",
"basque_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "basque_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해 분석기가 생성한 토큰을 살펴볼 수 있어요:
POST /basque-index/_analyze
{
"field": "content",
"text": "Ikasleek euskal unibertsitateetan ikasten dute. Haien zenbakiak 123456 dira."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{"token": "ikasle","start_offset": 0,"end_offset": 8,"type": "<ALPHANUM>","position": 0},
{"token": "euskal","start_offset": 9,"end_offset": 15,"type": "<ALPHANUM>","position": 1},
{"token": "unibertsi","start_offset": 16,"end_offset": 33,"type": "<ALPHANUM>","position": 2},
{"token": "ikas","start_offset": 34,"end_offset": 41,"type": "<ALPHANUM>","position": 3},
{"token": "haien","start_offset": 48,"end_offset": 53,"type": "<ALPHANUM>","position": 5},
{"token": "zenba","start_offset": 54,"end_offset": 63,"type": "<ALPHANUM>","position": 6},
{"token": "123456","start_offset": 64,"end_offset": 70,"type": "<NUM>","position": 7}
]
}