Thai tokenizer
출처: 문서
본문
Thai 토크나이저
thai 토크나이저는 태국어 텍스트를 토크나이즈해요. 태국어에서는 단어가 공백으로 구분되지 않기 때문에, 토크나이저가 언어별 규칙에 따라 단어 경계를 식별해야 해요.
사용 예시
다음 예시 요청은 thai_index라는 이름의 새 인덱스를 만들고 thai 토크나이저를 사용하는 애널라이저를 설정해요:
PUT /thai_index
{
"settings": {
"analysis": {
"tokenizer": {
"thai_tokenizer": {
"type": "thai"
}
},
"analyzer": {
"thai_analyzer": {
"type": "custom",
"tokenizer": "thai_tokenizer"
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "thai_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청으로 애널라이저가 생성한 토큰을 확인할 수 있어요:
POST /thai_index/_analyze
{
"analyzer": "thai_analyzer",
"text": "ฉันชอบไปเที่ยวที่เชียงใหม่"
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 포함되어 있어요:
{
"tokens": [
{
"token": "ฉัน",
"start_offset": 0,
"end_offset": 3,
"type": "word",
"position": 0
},
{
"token": "ชอบ",
"start_offset": 3,
"end_offset": 6,
"type": "word",
"position": 1
},
{
"token": "ไป",
"start_offset": 6,
"end_offset": 8,
"type": "word",
"position": 2
},
{
"token": "เที่ยว",
"start_offset": 8,
"end_offset": 14,
"type": "word",
"position": 3
},
{
"token": "ที่",
"start_offset": 14,
"end_offset": 17,
"type": "word",
"position": 4
},
{
"token": "เชียงใหม่",
"start_offset": 17,
"end_offset": 26,
"type": "word",
"position": 5
}
]
}