Decimal digit token filter
출처: 문서
본문
Decimal digit 토큰 필터
decimal_digit 토큰 필터는 다양한 문자 체계에서 10진수 숫자 문자(0--9)를 그에 대응하는 ASCII 문자로 정규화하는 데 사용해요. 이 필터는 숫자가 어떤 문자 체계로 작성되었는지와 상관없이 텍스트 분석에서 모든 숫자를 동일하게 처리하고 싶을 때 유용해요.
예제
다음 예제 요청은 my_index라는 새 인덱스를 생성하고 decimal_digit 필터가 적용된 애널라이저를 구성해요:
PUT /my_index
{
"settings": {
"analysis": {
"filter": {
"my_decimal_digit_filter": {
"type": "decimal_digit"
}
},
"analyzer": {
"my_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": ["my_decimal_digit_filter"]
}
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해 애널라이저가 생성한 토큰을 확인해 보세요:
POST /my_index/_analyze
{
"analyzer": "my_analyzer",
"text": "123 ١٢٣ १२३"
}
{% include copy-curl.html %}
text 구성:
- "123" (ASCII 숫자)
- "١٢٣" (아라비아-인도 숫자)
- "१२३" (데바나가리 숫자)
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{
"token": "123",
"start_offset": 0,
"end_offset": 3,
"type": "<NUM>",
"position": 0
},
{
"token": "123",
"start_offset": 4,
"end_offset": 7,
"type": "<NUM>",
"position": 1
},
{
"token": "123",
"start_offset": 8,
"end_offset": 11,
"type": "<NUM>",
"position": 2
}
]
}