Hindi analyzer
출처: 문서
본문
Hindi 분석기
내장된 hindi 분석기는 다음 명령을 사용하여 텍스트 필드에 적용할 수 있어요.
PUT /hindi-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "hindi"
}
}
}
}
{% include copy-curl.html %}
어간 제외
이 언어 분석기에서 stem_exclusion을 사용하려면 다음 명령을 사용할 수 있어요.
PUT index_with_stem_exclusion_hindi_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_hindi_analyzer": {
"type": "hindi",
"stem_exclusion": ["अधिकार", "अनुमोदन"]
}
}
}
}
}
{% include copy-curl.html %}
Hindi 분석기 내부 구성
hindi 분석기는 다음 구성 요소를 사용하여 구축되었어요.
-
토크나이저:
standard -
토큰 필터:
- lowercase
- decimal_digit
- keyword
- normalization (indic)
- normalization (Hindi)
- stop (Hindi)
- stemmer (Hindi)
사용자 정의 Hindi 분석기
다음 명령을 사용하여 사용자 정의 Hindi 분석기를 만들 수 있어요.
PUT /hindi-index
{
"settings": {
"analysis": {
"filter": {
"hindi_stop": {
"type": "stop",
"stopwords": "_hindi_"
},
"hindi_stemmer": {
"type": "stemmer",
"language": "hindi"
},
"hindi_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"hindi_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"decimal_digit",
"hindi_keywords",
"indic_normalization",
"hindi_normalization",
"hindi_stop",
"hindi_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "hindi_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용하여 분석기에서 생성된 토큰을 확인할 수 있어요.
POST /hindi-index/_analyze
{
"field": "content",
"text": "छात्र भारतीय विश्वविद्यालयों में पढ़ते हैं। उनके नंबर १२३४५६ हैं।"
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 포함되어 있어요.
{
"tokens": [
{
"token": "छातर",
"start_offset": 0,
"end_offset": 5,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "भारतिय",
"start_offset": 6,
"end_offset": 12,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "विशवविदयालय",
"start_offset": 13,
"end_offset": 28,
"type": "<ALPHANUM>",
"position": 2
},
{
"token": "पढ",
"start_offset": 33,
"end_offset": 38,
"type": "<ALPHANUM>",
"position": 4
},
{
"token": "नंबर",
"start_offset": 49,
"end_offset": 53,
"type": "<ALPHANUM>",
"position": 7
},
{
"token": "123456",
"start_offset": 54,
"end_offset": 60,
"type": "<NUM>",
"position": 8
}
]
}