Polish analyzer
출처: 문서
본문
폴란드어 분석기
폴란드어 언어 분석기(polish)는 폴란드어 텍스트에 대한 분석을 제공해요. 이 분석기는 analysis-stempel 플러그인의 일부이므로, 사용하기 전에 반드시 설치해야 해요.
플러그인 설치하기
폴란드어 분석기를 사용하려면 먼저 다음 명령어를 실행해서 analysis-stempel 플러그인을 설치해야 해요:
./bin/opensearch-plugin install analysis-stempel
{% include copy.html %}
자세한 내용은 사용 가능한 OpenSearch 플러그인의 전체 목록이 정리된 추가 플러그인 문서를 참고하세요.
폴란드어 분석기 사용하기
인덱스를 매핑할 때 폴란드어 분석기를 사용하려면 analyzer 필드에 polish 값을 지정하세요:
PUT my-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "polish"
}
}
}
}
{% include copy-curl.html %}
커스텀 폴란드어 분석기 설정하기
폴란드어 스테머 토큰 필터를 사용하는 커스텀 분석기를 만들면 커스텀 폴란드어 분석기를 설정할 수 있어요. 기본 폴란드어 분석기는 다음과 같은 분석 체인을 적용해요:
- 토크나이저:
standard - 토큰 필터:
lowercasepolish_stop(폴란드어 불용어를 제거해요)polish_stem(폴란드어 스테밍을 적용해요)
예시: 커스텀 폴란드어 분석기
PUT my-polish-index
{
"settings": {
"analysis": {
"analyzer": {
"custom_polish": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"polish_stop",
"polish_stem"
]
}
}
}
},
"mappings": {
"properties": {
"title": {
"type": "text",
"analyzer": "custom_polish"
},
"content": {
"type": "text",
"analyzer": "polish"
}
}
}
}
{% include copy-curl.html %}
폴란드어 토큰 필터
analysis-stempel 플러그인은 폴란드어 처리를 위해 다음 토큰 필터를 제공해요.
polish_stop 토큰 필터
토큰 스트림에서 흔히 쓰이는 폴란드어 불용어를 제거해요.
polish_stem 토큰 필터
Stempel 스테밍 알고리즘을 사용해 폴란드어 전용 스테밍 규칙을 적용해서 단어를 어근 형태로 줄여줘요.
생성된 토큰
다음 요청을 사용해서 분석기가 생성한 토큰을 확인해 보세요:
POST _analyze
{
"analyzer": "polish",
"text": "Jestem programistą w Polsce i pracuję z OpenSearch"
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 담겨 있어요:
{
"tokens": [
{"token": "jest", "start_offset": 0, "end_offset": 6, "type": "<ALPHANUM>", "position": 0},
{"token": "prograć", "start_offset": 7, "end_offset": 18, "type": "<ALPHANUM>", "position": 1},
{"token": "polsce", "start_offset": 21, "end_offset": 27, "type": "<ALPHANUM>", "position": 3},
{"token": "pracować", "start_offset": 30, "end_offset": 37, "type": "<ALPHANUM>", "position": 5},
{"token": "opensearch", "start_offset": 40, "end_offset": 50, "type": "<ALPHANUM>", "position": 7}
]
}