Classic token filter
출처: 문서
본문
Classic 토큰 필터
Classic 토큰 필터의 주요 기능은 classic 토크나이저와 함께 동작하는 거예요. 텍스트 분석과 검색에 도움이 되는 다음과 같은 일반적인 변환을 적용해서 토큰을 처리해요:
- 's 같은 소유격 어미를 제거해요. 예를 들어 John's는 John이 돼요.
- 두문자어에서 마침표를 제거해요. 예를 들어 *D.A.R.P.A.*는 DARPA가 돼요.
예제
다음 예제 요청은 custom_classic_filter라는 새 인덱스를 만들고 classic 필터로 애널라이저를 설정해요:
PUT /custom_classic_filter
{
"settings": {
"analysis": {
"analyzer": {
"custom_classic": {
"type": "custom",
"tokenizer": "classic",
"filter": ["classic"]
}
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해서 애널라이저로 생성된 토큰을 살펴보세요:
POST /custom_classic_filter/_analyze
{
"analyzer": "custom_classic",
"text": "John's co-operate was excellent."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{
"token": "John",
"start_offset": 0,
"end_offset": 6,
"type": "<APOSTROPHE>",
"position": 0
},
{
"token": "co",
"start_offset": 7,
"end_offset": 9,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "operate",
"start_offset": 10,
"end_offset": 17,
"type": "<ALPHANUM>",
"position": 2
},
{
"token": "was",
"start_offset": 18,
"end_offset": 21,
"type": "<ALPHANUM>",
"position": 3
},
{
"token": "excellent",
"start_offset": 22,
"end_offset": 31,
"type": "<ALPHANUM>",
"position": 4
}
]
}