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

Galician analyzer

원문 보기 위키 갱신

출처: 문서

본문

갈리시아어 분석기

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

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

{% include copy-curl.html %}

어간 제외

이 언어 분석기에 stem_exclusion을 사용하려면 다음 명령어를 사용하면 돼요:

PUT index_with_stem_exclusion_galician_analyzer
{
  "settings": {
    "analysis": {
      "analyzer": {
        "stem_exclusion_galician_analyzer": {
          "type": "galician",
          "stem_exclusion": ["autoridade", "aceptación"]
        }
      }
    }
  }
}

{% include copy-curl.html %}

갈리시아어 분석기 내부 구조

galician 분석기는 다음 컴포넌트들로 구성돼요:

  • 토크나이저: standard

  • 토큰 필터:

    • lowercase
    • stop (갈리시아어)
    • keyword
    • stemmer (갈리시아어)

커스텀 갈리시아어 분석기

커스텀 갈리시아어 분석기는 다음 명령어를 사용해서 만들 수 있어요:

PUT /galician-index
{
  "settings": {
    "analysis": {
      "filter": {
        "galician_stop": {
          "type": "stop",
          "stopwords": "_galician_"
        },
        "galician_stemmer": {
          "type": "stemmer",
          "language": "galician"
        },
        "galician_keywords": {
          "type": "keyword_marker",
          "keywords": []
        }
      },
      "analyzer": {
        "galician_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "galician_stop",
            "galician_keywords",
            "galician_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "galician_analyzer"
      }
    }
  }
}

{% include copy-curl.html %}

생성된 토큰

분석기를 사용해 생성된 토큰을 확인하려면 다음 요청을 사용해 보세요:

POST /galician-index/_analyze
{
  "field": "content",
  "text": "Os estudantes estudan en Santiago e nas universidades galegas. Os seus números son 123456."
}

{% include copy-curl.html %}

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

{
  "tokens": [
    {"token": "estud","start_offset": 3,"end_offset": 13,"type": "<ALPHANUM>","position": 1},
    {"token": "estud","start_offset": 14,"end_offset": 21,"type": "<ALPHANUM>","position": 2},
    {"token": "santiag","start_offset": 25,"end_offset": 33,"type": "<ALPHANUM>","position": 4},
    {"token": "univers","start_offset": 40,"end_offset": 53,"type": "<ALPHANUM>","position": 7},
    {"token": "galeg","start_offset": 54,"end_offset": 61,"type": "<ALPHANUM>","position": 8},
    {"token": "numer","start_offset": 71,"end_offset": 78,"type": "<ALPHANUM>","position": 11},
    {"token": "son","start_offset": 79,"end_offset": 82,"type": "<ALPHANUM>","position": 12},
    {"token": "123456","start_offset": 83,"end_offset": 89,"type": "<NUM>","position": 13}
  ]
}

더 알아보기 (Learn more)