Arabic analyzer
출처: 문서
본문
아랍어 분석기
내장된 arabic 분석기는 다음 명령을 사용하여 텍스트 필드에 적용할 수 있어요.
PUT /arabic-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "arabic"
}
}
}
}
{% include copy-curl.html %}
어간 제외
이 언어 분석기에서 stem_exclusion을 다음 명령을 사용하여 사용할 수 있어요.
PUT index_with_stem_exclusion_arabic
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_arabic_analyzer":{
"type":"arabic",
"stem_exclusion":["تكنولوجيا","سلطة "]
}
}
}
}
}
{% include copy-curl.html %}
아랍어 분석기 내부 구조
arabic 분석기는 다음 구성 요소를 사용하여 만들어져요.
-
토크나이저:
standard -
토큰 필터:
- lowercase
- decimal_digit
- stop (Arabic)
- normalization (Arabic)
- keyword
- stemmer (Arabic)
사용자 정의 아랍어 분석기
다음 명령을 사용하여 사용자 정의 아랍어 분석기를 만들 수 있어요.
PUT /arabic-index
{
"settings": {
"analysis": {
"filter": {
"arabic_stop": {
"type": "stop",
"stopwords": "_arabic_"
},
"arabic_stemmer": {
"type": "stemmer",
"language": "arabic"
},
"arabic_normalization": {
"type": "arabic_normalization"
},
"decimal_digit": {
"type": "decimal_digit"
},
"arabic_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"arabic_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"decimal_digit",
"arabic_stop",
"arabic_normalization",
"arabic_keywords",
"arabic_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "arabic_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용하여 분석기로 생성된 토큰을 확인할 수 있어요.
POST /arabic-index/_analyze
{
"field": "content",
"text": "الطلاب يدرسون في الجامعات العربية. أرقامهم ١٢٣٤٥٦."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 포함되어 있어요.
{
"tokens": [
{
"token": "طلاب",
"start_offset": 0,
"end_offset": 6,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "يدرس",
"start_offset": 7,
"end_offset": 13,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "جامع",
"start_offset": 17,
"end_offset": 25,
"type": "<ALPHANUM>",
"position": 3
},
{
"token": "عرب",
"start_offset": 26,
"end_offset": 33,
"type": "<ALPHANUM>",
"position": 4
},
{
"token": "ارقامهم",
"start_offset": 35,
"end_offset": 42,
"type": "<ALPHANUM>",
"position": 5
},
{
"token": "123456",
"start_offset": 43,
"end_offset": 49,
"type": "<NUM>",
"position": 6
}
]
}