본문 바로가기
WIKI 기술 지식 베이스

Bulgarian analyzer

원문 보기 위키 갱신

출처: 문서

본문

불가리아어 분석기

내장된 bulgarian 분석기는 다음 명령어를 사용해 텍스트 필드에 적용할 수 있어요:

PUT /bulgarian-index
{
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "bulgarian"
      }
    }
  }
}

{% include copy-curl.html %}

어간 제외

다음 명령어를 사용하면 이 언어 분석기에서 stem_exclusion을 사용할 수 있어요:

PUT index_with_stem_exclusion_bulgarian_analyzer
{
  "settings": {
    "analysis": {
      "analyzer": {
        "stem_exclusion_bulgarian_analyzer": {
          "type": "bulgarian",
          "stem_exclusion": ["авторитет", "одобрение"]
        }
      }
    }
  }
}

{% include copy-curl.html %}

불가리아어 분석기 내부 구조

bulgarian 분석기는 다음 구성 요소들로 이루어져 있어요:

  • 토크나이저: standard

  • 토큰 필터:

    • lowercase
    • stop (Bulgarian)
    • keyword
    • stemmer (Bulgarian)

커스텀 불가리아어 분석기

다음 명령어를 사용해 커스텀 불가리아어 분석기를 만들 수 있어요:

PUT /bulgarian-index
{
  "settings": {
    "analysis": {
      "filter": {
        "bulgarian_stop": {
          "type": "stop",
          "stopwords": "_bulgarian_"
        },
        "bulgarian_stemmer": {
          "type": "stemmer",
          "language": "bulgarian"
        },
        "bulgarian_keywords": {
          "type":       "keyword_marker",
          "keywords":   [] 
        }
      },
      "analyzer": {
        "bulgarian_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "bulgarian_stop",
            "bulgarian_keywords",
            "bulgarian_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "bulgarian_analyzer"
      }
    }
  }
}

{% include copy-curl.html %}

생성된 토큰

다음 요청을 사용해 분석기가 생성한 토큰을 살펴볼 수 있어요:

POST /bulgarian-index/_analyze
{
  "field": "content",
  "text": "Студентите учат в българските университети. Техните номера са 123456."
}

{% include copy-curl.html %}

응답에는 생성된 토큰이 담겨 있어요:

{
  "tokens": [
    {"token": "студент","start_offset": 0,"end_offset": 10,"type": "<ALPHANUM>","position": 0},
    {"token": "учат","start_offset": 11,"end_offset": 15,"type": "<ALPHANUM>","position": 1},
    {"token": "българск","start_offset": 18,"end_offset": 29,"type": "<ALPHANUM>","position": 3},
    {"token": "университят","start_offset": 30,"end_offset": 42,"type": "<ALPHANUM>","position": 4},
    {"token": "техн","start_offset": 44,"end_offset": 51,"type": "<ALPHANUM>","position": 5},
    {"token": "номер","start_offset": 52,"end_offset": 58,"type": "<ALPHANUM>","position": 6},
    {"token": "123456","start_offset": 62,"end_offset": 68,"type": "<NUM>","position": 8}
  ]
}

더 알아보기 (Learn more)