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

Irish analyzer

원문 보기 위키 갱신

출처: 문서

본문

아일랜드어 분석기

내장된 irish 분석기는 다음 명령을 사용하여 텍스트 필드에 적용할 수 있어요.

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

{% include copy-curl.html %}

어간 제외

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

PUT index_with_stem_exclusion_irish_analyzer
{
  "settings": {
    "analysis": {
      "analyzer": {
        "stem_exclusion_irish_analyzer": {
          "type": "irish",
          "stem_exclusion": ["údarás", "faomhadh"]
        }
      }
    }
  }
}

{% include copy-curl.html %}

아일랜드어 분석기 내부 구조

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

  • Tokenizer: standard
  • Token filters:
    • hyphenation (아일랜드어)
    • elision (아일랜드어)
    • lowercase (아일랜드어)
    • stop (아일랜드어)
    • keyword
    • stemmer (아일랜드어)

사용자 정의 아일랜드어 분석기

다음 명령을 사용하여 사용자 정의 아일랜드어 분석기를 만들 수 있어요.

PUT /irish-index
{
  "settings": {
    "analysis": {
      "filter": {
        "irish_stop": {
          "type": "stop",
          "stopwords": "_irish_"
        },
        "irish_elision": {
          "type":       "elision",
          "articles":   [ "d", "m", "b" ],
          "articles_case": true
        },
        "irish_hyphenation": {
          "type":       "stop",
          "stopwords":  [ "h", "n", "t" ],
          "ignore_case": true
        },
        "irish_lowercase": {
          "type":       "lowercase",
          "language":   "irish"
        },
        "irish_stemmer": {
          "type": "stemmer",
          "language": "irish"
        },
        "irish_keywords": {
          "type": "keyword_marker",
          "keywords": []
        }
      },
      "analyzer": {
        "irish_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "irish_hyphenation",
            "irish_elision",
            "irish_lowercase",
            "irish_stop",
            "irish_keywords",
            "irish_stemmer"
          ]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "irish_analyzer"
      }
    }
  }
}

{% include copy-curl.html %}

생성된 토큰

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

POST /irish-index/_analyze
{
  "field": "content",
  "text": "Tá mic léinn ag staidéar in ollscoileanna na hÉireann. Is iad a gcuid uimhreacha ná 123456."
}

{% include copy-curl.html %}

응답에는 생성된 토큰이 포함되어 있어요.

{
  "tokens": [
    {"token": "tá","start_offset": 0,"end_offset": 2,"type": "<ALPHANUM>","position": 0},
    {"token": "mic","start_offset": 3,"end_offset": 6,"type": "<ALPHANUM>","position": 1},
    {"token": "léinn","start_offset": 7,"end_offset": 12,"type": "<ALPHANUM>","position": 2},
    {"token": "staidéar","start_offset": 16,"end_offset": 24,"type": "<ALPHANUM>","position": 4},
    {"token": "ollscoileanna","start_offset": 28,"end_offset": 41,"type": "<ALPHANUM>","position": 6},
    {"token": "héireann","start_offset": 45,"end_offset": 53,"type": "<ALPHANUM>","position": 8},
    {"token": "cuid","start_offset": 64,"end_offset": 69,"type": "<ALPHANUM>","position": 12},
    {"token": "uimhreacha","start_offset": 70,"end_offset": 80,"type": "<ALPHANUM>","position": 13},
    {"token": "123456","start_offset": 84,"end_offset": 90,"type": "<NUM>","position": 15}
  ]
}

더 알아보기 (Learn more)