Dictionary decompounder token filter
출처: 문서
본문
Dictionary decompounder token filter
dictionary_decompounder 토큰 필터는 미리 정의된 사전을 기반으로 복합어를 구성 요소로 분할하는 데 사용됩니다. 이 필터는 독일어, 네덜란드어, 핀란드어처럼 복합어가 흔한 언어에서 특히 유용하며, 복합어를 분해하면 검색 관련성을 높일 수 있습니다. dictionary_decompounder 토큰 필터는 각 토큰(단어)이 알려진 단어 목록을 기준으로 더 작은 토큰으로 분할될 수 있는지 판단합니다. 토큰이 알려진 단어로 분할될 수 있으면 필터는 해당 토큰에 대한 하위 토큰을 생성합니다.
매개변수
dictionary_decompounder 토큰 필터에는 다음과 같은 매개변수가 있습니다.
| 매개변수 | 필수/선택 | 데이터 타입 | 설명 |
|---|---|---|---|
word_list |
word_list_path가 설정되지 않은 경우 필수 |
Array of strings | 필터가 복합어를 분할하는 데 사용하는 단어 사전입니다. |
word_list_path |
word_list가 설정되지 않은 경우 필수 |
String | 사전 단어가 포함된 텍스트 파일의 경로입니다. 절대 경로 또는 config 디렉터리 기준 상대 경로를 사용할 수 있습니다. 사전 파일은 UTF-8로 인코딩되어야 하며, 각 단어는 별도의 줄에 나열되어야 합니다. |
min_word_size |
선택 | Integer | 분할 대상이 되는 전체 복합어의 최소 길이입니다. 복합어가 이 값보다 짧으면 분할되지 않습니다. 기본값은 5입니다. |
min_subword_size |
선택 | Integer | 하위 단어의 최소 길이입니다. 하위 단어가 이 값보다 짧으면 출력에 포함되지 않습니다. 기본값은 2입니다. |
max_subword_size |
선택 | Integer | 하위 단어의 최대 길이입니다. 하위 단어가 이 값보다 길면 출력에 포함되지 않습니다. 기본값은 15입니다. |
only_longest_match |
선택 | Boolean | true로 설정하면 가장 긴 일치 하위 단어만 반환됩니다. 기본값은 false입니다. |
예제
다음 예제 요청은 decompound_example이라는 이름의 새 인덱스를 생성하고 dictionary_decompounder 필터를 사용하여 분석기를 구성합니다.
PUT /decompound_example
{
"settings": {
"analysis": {
"filter": {
"my_dictionary_decompounder": {
"type": "dictionary_decompounder",
"word_list": ["slow", "green", "turtle"]
}
},
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase", "my_dictionary_decompounder"]
}
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용하여 분석기로 생성된 토큰을 확인합니다.
POST /decompound_example/_analyze
{
"analyzer": "my_analyzer",
"text": "slowgreenturtleswim"
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 포함됩니다.
{
"tokens": [
{
"token": "slowgreenturtleswim",
"start_offset": 0,
"end_offset": 19,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "slow",
"start_offset": 0,
"end_offset": 19,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "green",
"start_offset": 0,
"end_offset": 19,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "turtle",
"start_offset": 0,
"end_offset": 19,
"type": "<ALPHANUM>",
"position": 0
}
]
}