Italian analyzer
출처: 문서
본문
이탈리아어 분석기
내장된 italian 분석기는 다음 명령어를 사용해 텍스트 필드에 적용할 수 있어요:
PUT /italian-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "italian"
}
}
}
}
{% include copy-curl.html %}
어간 제외
다음 명령어를 사용하면 이 언어 분석기에서 stem_exclusion을 사용할 수 있어요:
PUT index_with_stem_exclusion_italian_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_italian_analyzer": {
"type": "italian",
"stem_exclusion": ["autorità", "approvazione"]
}
}
}
}
}
{% include copy-curl.html %}
이탈리아어 분석기 내부 구조
italian 분석기는 다음 구성 요소로 만들어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- elision (Italian)
- lowercase
- stop (Italian)
- keyword
- stemmer (Italian)
커스텀 이탈리아어 분석기
다음 명령어를 사용해 커스텀 이탈리아어 분석기를 만들 수 있어요:
PUT /italian-index
{
"settings": {
"analysis": {
"filter": {
"italian_stop": {
"type": "stop",
"stopwords": "_italian_"
},
"italian_elision": {
"type": "elision",
"articles": [
"c", "l", "all", "dall", "dell",
"nell", "sull", "coll", "pell",
"gl", "agl", "dagl", "degl", "negl",
"sugl", "un", "m", "t", "s", "v", "d"
],
"articles_case": true
},
"italian_stemmer": {
"type": "stemmer",
"language": "light_italian"
},
"italian_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"italian_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"italian_elision",
"lowercase",
"italian_stop",
"italian_keywords",
"italian_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "italian_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해 분석기가 생성한 토큰을 살펴보세요:
POST /italian-index/_analyze
{
"field": "content",
"text": "Gli studenti studiano nelle università italiane. I loro numeri sono 123456."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 포함되어 있어요:
{
"tokens": [
{"token": "student","start_offset": 4,"end_offset": 12,"type": "<ALPHANUM>","position": 1},
{"token": "studian","start_offset": 13,"end_offset": 21,"type": "<ALPHANUM>","position": 2},
{"token": "universit","start_offset": 28,"end_offset": 38,"type": "<ALPHANUM>","position": 4},
{"token": "italian","start_offset": 39,"end_offset": 47,"type": "<ALPHANUM>","position": 5},
{"token": "numer","start_offset": 56,"end_offset": 62,"type": "<ALPHANUM>","position": 8},
{"token": "123456","start_offset": 68,"end_offset": 74,"type": "<NUM>","position": 10}
]
}