French analyzer
출처: 문서
본문
프랑스어 분석기
내장된 french 분석기는 다음 명령을 사용해 텍스트 필드에 적용할 수 있어요:
PUT /french-index
{
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "french"
}
}
}
}
{% include copy-curl.html %}
스템 제외
다음 명령을 사용하면 이 언어 분석기에서 stem_exclusion을 사용할 수 있어요:
PUT index_with_stem_exclusion_french_analyzer
{
"settings": {
"analysis": {
"analyzer": {
"stem_exclusion_french_analyzer": {
"type": "french",
"stem_exclusion": ["autorité", "acceptation"]
}
}
}
}
}
{% include copy-curl.html %}
프랑스어 분석기 내부 구조
french 분석기는 다음 구성 요소를 사용해 만들어져 있어요:
-
토크나이저:
standard -
토큰 필터:
- elision (French)
- lowercase
- stop (French)
- keyword
- stemmer (French)
커스텀 프랑스어 분석기
다음 명령을 사용해 커스텀 프랑스어 분석기를 만들 수 있어요:
PUT /french-index
{
"settings": {
"analysis": {
"filter": {
"french_stop": {
"type": "stop",
"stopwords": "_french_"
},
"french_elision": {
"type": "elision",
"articles_case": true,
"articles": [
"l", "m", "t", "qu", "n", "s",
"j", "d", "c", "jusqu", "quoiqu",
"lorsqu", "puisqu"
]
},
"french_stemmer": {
"type": "stemmer",
"language": "light_french"
},
"french_keywords": {
"type": "keyword_marker",
"keywords": []
}
},
"analyzer": {
"french_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"french_elision",
"lowercase",
"french_stop",
"french_keywords",
"french_stemmer"
]
}
}
}
},
"mappings": {
"properties": {
"content": {
"type": "text",
"analyzer": "french_analyzer"
}
}
}
}
{% include copy-curl.html %}
생성된 토큰
다음 요청을 사용해 분석기가 생성한 토큰을 확인해 보세요:
POST /french-index/_analyze
{
"field": "content",
"text": "Les étudiants étudient à Paris et dans les universités françaises. Leurs numéros sont 123456."
}
{% include copy-curl.html %}
응답에는 생성된 토큰이 포함되어 있어요:
{
"tokens": [
{"token": "etudiant","start_offset": 4,"end_offset": 13,"type": "<ALPHANUM>","position": 1},
{"token": "etudient","start_offset": 14,"end_offset": 22,"type": "<ALPHANUM>","position": 2},
{"token": "pari","start_offset": 25,"end_offset": 30,"type": "<ALPHANUM>","position": 4},
{"token": "universit","start_offset": 43,"end_offset": 54,"type": "<ALPHANUM>","position": 8},
{"token": "francais","start_offset": 55,"end_offset": 65,"type": "<ALPHANUM>","position": 9},
{"token": "numero","start_offset": 73,"end_offset": 80,"type": "<ALPHANUM>","position": 11},
{"token": "123456","start_offset": 86,"end_offset": 92,"type": "<NUM>","position": 13}
]
}