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

UAX URL email tokenizer

원문 보기 위키 갱신

출처: 문서

본문

UAX URL email 토크나이저

일반 텍스트 외에도 uax_url_email 토크나이저는 URL, 이메일 주소, 도메인 이름을 처리하도록 설계되었어요. 이 토크나이저는 Unicode Text Segmentation 알고리즘(UAX #29)을 기반으로 하기 때문에 URL과 이메일 주소가 포함된 복잡한 텍스트도 올바르게 토큰화할 수 있어요.

사용 예시

다음 예시 요청은 my_index라는 이름의 새 인덱스를 생성하고 uax_url_email 토크나이저로 애널라이저를 설정해요:

PUT /my_index
{
  "settings": {
    "analysis": {
      "tokenizer": {
        "uax_url_email_tokenizer": {
          "type": "uax_url_email"
        }
      },
      "analyzer": {
        "my_uax_analyzer": {
          "type": "custom",
          "tokenizer": "uax_url_email_tokenizer"
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "content": {
        "type": "text",
        "analyzer": "my_uax_analyzer"
      }
    }
  }
}

{% include copy-curl.html %}

생성된 토큰

애널라이저가 생성한 토큰을 확인하려면 다음 요청을 사용해 보세요:

POST /my_index/_analyze
{
  "analyzer": "my_uax_analyzer",
  "text": "Contact us at [email protected] or visit https://example.com for details."
}

{% include copy-curl.html %}

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

{
  "tokens": [
    {"token": "Contact","start_offset": 0,"end_offset": 7,"type": "<ALPHANUM>","position": 0},
    {"token": "us","start_offset": 8,"end_offset": 10,"type": "<ALPHANUM>","position": 1},
    {"token": "at","start_offset": 11,"end_offset": 13,"type": "<ALPHANUM>","position": 2},
    {"token": "[email protected]","start_offset": 14,"end_offset": 33,"type": "<EMAIL>","position": 3},
    {"token": "or","start_offset": 34,"end_offset": 36,"type": "<ALPHANUM>","position": 4},
    {"token": "visit","start_offset": 37,"end_offset": 42,"type": "<ALPHANUM>","position": 5},
    {"token": "https://example.com","start_offset": 43,"end_offset": 62,"type": "<URL>","position": 6},
    {"token": "for","start_offset": 63,"end_offset": 66,"type": "<ALPHANUM>","position": 7},
    {"token": "details","start_offset": 67,"end_offset": 74,"type": "<ALPHANUM>","position": 8}
  ]
}

파라미터

uax_url_email 토크나이저는 다음 파라미터를 사용해 설정할 수 있어요.

파라미터 필수/선택 데이터 타입 설명
max_token_length 선택 Integer 생성되는 토큰의 최대 길이를 설정해요. 이 길이를 초과하면 토큰이 max_token_length에 설정된 길이를 기준으로 여러 토큰으로 분할돼요. 기본값은 255예요.

더 알아보기 (Learn more)