Brazilian analyzer
출처: 문서
본문
Brazilian 애널라이저
내장된 brazilian 애널라이저는 다음 명령을 사용해 텍스트 필드에 적용할 수 있어요:
PUT /brazilian-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "brazilian"
}
}
}
}
{% include copy-curl.html %}
어간 제외(Stem exclusion)
이 언어 애널라이저에 stem_exclusion을 사용하려면 다음 명령을 쓰면 돼요:
PUT index_with_stem_exclusion_brazilian_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_brazilian_analyzer": {
"type": "brazilian",
"stem_exclusion": ["autoridade", "aprovação"]
}
}
}
}
}
{% include copy-curl.html %}
Brazilian 애널라이저 내부 구조
brazilian 애널라이저는 다음 구성 요소로 이루어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- lowercase
- stop (Brazilian)
- keyword
- stemmer (Brazilian)
커스텀 Brazilian 애널라이저
다음 명령을 사용해 커스텀 Brazilian 애널라이저를 만들 수 있어요:
PUT /brazilian-index
{
"settings": {
"analysis": {
"filter": {
"brazilian_stop": {
"type": "stop",
"stopwords": "_brazilian_"
},
"brazilian_stemmer": {
"type": "stemmer",
"language": "brazilian"
},
"brazilian_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"brazilian_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"brazilian_stop",
"brazilian_keywords",
"brazilian_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "brazilian_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
애널라이저가 생성한 토큰을 살펴보려면 다음 요청을 사용하세요:
POST /brazilian-index/_analyze
{
"field": "content",
"text": "Estudantes estudam em universidades brasileiras. Seus números são 123456."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{"token": "estudant","start_offset": 0,"end_offset": 10,"type": "<ALPHANUM>","position": 0},
{"token": "estud","start_offset": 11,"end_offset": 18,"type": "<ALPHANUM>","position": 1},
{"token": "univers","start_offset": 22,"end_offset": 35,"type": "<ALPHANUM>","position": 3},
{"token": "brasileir","start_offset": 36,"end_offset": 47,"type": "<ALPHANUM>","position": 4},
{"token": "numer","start_offset": 54,"end_offset": 61,"type": "<ALPHANUM>","position": 6},
{"token": "sao","start_offset": 62,"end_offset": 65,"type": "<ALPHANUM>","position": 7},
{"token": "123456","start_offset": 66,"end_offset": 72,"type": "<NUM>","position": 8}
]
}