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

Bengali analyzer

원문 보기 위키 갱신

출처: 문서

본문

벵골어 분석기

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

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

{% include copy-curl.html %}

스템 제외

stem_exclusion은 다음 명령어를 사용해 이 언어 분석기와 함께 사용할 수 있어요.

PUT index_with_stem_exclusion_bengali_analyzer
{
  "settings": {
    "analysis": {
      "analyzer": {
        "stem_exclusion_bengali_analyzer": {
          "type": "bengali",
          "stem_exclusion": ["কর্তৃপক্ষ", "অনুমোদন"]
        }
      }
    }
  }
}

{% include copy-curl.html %}

벵골어 분석기 내부

bengali 분석기는 다음 구성 요소로 만들어져 있어요.

  • 토크나이저: standard

  • 토큰 필터:

    • lowercase
    • decimal_digit
    • indic_normalization
    • normalization (Bengali)
    • stop (Bengali)
    • keyword
    • stemmer (Bengali)

커스텀 벵골어 분석기

다음 명령어를 사용해 커스텀 벵골어 분석기를 만들 수 있어요.

PUT /bengali-index
{
  "settings": {
    "analysis": {
      "filter": {
        "bengali_stop": {
          "type": "stop",
          "stopwords": "_bengali_"
        },
        "bengali_stemmer": {
          "type": "stemmer",
          "language": "bengali"
        },
        "bengali_keywords": {
          "type":       "keyword_marker",
          "keywords":   [] 
        }
      },
      "analyzer": {
        "bengali_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "decimal_digit",
            "bengali_keywords",
            "indic_normalization",
            "bengali_normalization",
            "bengali_stop",
            "bengali_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "bengali_analyzer"
      }
    }
  }
}

{% include copy-curl.html %}

생성된 토큰

다음 요청을 사용해 분석기로 생성된 토큰을 확인해 보세요.

POST /bengali-index/_analyze
{
  "field": "content",
  "text": "ছাত্ররা বিশ্ববিদ্যালয়ে পড়াশোনা করে। তাদের নম্বরগুলি ১২৩৪৫৬।"
}

{% include copy-curl.html %}

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

{
  "tokens": [
    {"token": "ছাত্র","start_offset": 0,"end_offset": 7,"type": "<ALPHANUM>","position": 0},
    {"token": "বিসসবিদালয়","start_offset": 8,"end_offset": 23,"type": "<ALPHANUM>","position": 1},
    {"token": "পরাসোন","start_offset": 24,"end_offset": 32,"type": "<ALPHANUM>","position": 2},
    {"token": "তা","start_offset": 38,"end_offset": 43,"type": "<ALPHANUM>","position": 4},
    {"token": "নমমর","start_offset": 44,"end_offset": 53,"type": "<ALPHANUM>","position": 5},
    {"token": "123456","start_offset": 54,"end_offset": 60,"type": "<NUM>","position": 6}
  ]
}

더 알아보기 (Learn more)