Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- spring 장점
- ElasticSearch NGram
- Servlet Life Cycle
- 동의어 파일
- ContextLoaderListener란
- H2
- Servlet과 Thread
- ElasticSearch 토큰필터
- Java
- H2 DB
- Servlet Container란
- Spring Handler
- elasticSearch
- 자바
- ApplicationContext란
- 계산기
- Spring Servlet이란
- Spring Container란
- Servlet 멀티 스레딩
- layout
- Bean Factory란
- 토큰필터
- ElasticSearch 동의어 사전
- ElasticSearch EdgeNGram
- 안드로이드
- Dispathcher Servlet이란
- 안드로이드스튜디오
- ElasticSearch 동의어 파일
- ElasticSearch Shingle
- 인텔리제이
Archives
- Today
- Total
결국 무엇이든 해내는 사람
ElasticSearch - standard, letter, whitespace 토크나이저 [ 예제, 설명 ] 본문
두서없는 공부 노트/ElasticSearch
ElasticSearch - standard, letter, whitespace 토크나이저 [ 예제, 설명 ]
kkm8257 2021. 12. 14. 15:40반응형
-- standard 토크나이저
GET _analyze
{
"tokenizer": "standard",
"text": "THE quick.brown_FOx jumped! @ 3.5 meters."
}
-- 결과
-- 공백으로 텀을 구분하면서 "@"와 같은 특수문자 제거
-- 단어 끝에 있는 느낌표나 "."는 제거 되지만, 중간에 있는 마침표나 밑줄 등은 제거되거나 분리되지 않는다.
{
"tokens" : [
{
"token" : "THE",
"start_offset" : 0,
"end_offset" : 3,
"type" : "<ALPHANUM>",
"position" : 0
},
{
"token" : "quick.brown_FOx",
"start_offset" : 4,
"end_offset" : 19,
"type" : "<ALPHANUM>",
"position" : 1
},
{
"token" : "jumped",
"start_offset" : 20,
"end_offset" : 26,
"type" : "<ALPHANUM>",
"position" : 2
},
{
"token" : "3.5",
"start_offset" : 30,
"end_offset" : 33,
"type" : "<NUM>",
"position" : 3
},
{
"token" : "meters",
"start_offset" : 34,
"end_offset" : 40,
"type" : "<ALPHANUM>",
"position" : 4
}
]
}
-- letter 토크나이저
GET _analyze
{
"tokenizer": "letter",
"text": "THE quick.brown_FOx jumped! @ 3.5 meters."
}
-- 결과
-- 알파벳을 제외한 모든 공백, 숫자, 기호들을 기준으로 텀을 분리한다.
-- 특수문자, 숫자, 기호들은 제거
{
"tokens" : [
{
"token" : "THE",
"start_offset" : 0,
"end_offset" : 3,
"type" : "word",
"position" : 0
},
{
"token" : "quick",
"start_offset" : 4,
"end_offset" : 9,
"type" : "word",
"position" : 1
},
{
"token" : "brown",
"start_offset" : 10,
"end_offset" : 15,
"type" : "word",
"position" : 2
},
{
"token" : "FOx",
"start_offset" : 16,
"end_offset" : 19,
"type" : "word",
"position" : 3
},
{
"token" : "jumped",
"start_offset" : 20,
"end_offset" : 26,
"type" : "word",
"position" : 4
},
{
"token" : "meters",
"start_offset" : 34,
"end_offset" : 40,
"type" : "word",
"position" : 5
}
]
}
-- whitespace 토크나이저
GET _analyze
{
"tokenizer": "whitespace",
"text": "THE quick.brown_FOx jumped! @ 3.5 meters."
}
-- 결과
-- 스페이스, 탭, 줄바꿈, 공백 만을 기준으로 텀을 분리한다
-- 특수문자나 마지막에 있는 마침표도 사라지지 않고 그대로 남아있다
{
"tokens" : [
{
"token" : "THE",
"start_offset" : 0,
"end_offset" : 3,
"type" : "word",
"position" : 0
},
{
"token" : "quick.brown_FOx",
"start_offset" : 4,
"end_offset" : 19,
"type" : "word",
"position" : 1
},
{
"token" : "jumped!",
"start_offset" : 20,
"end_offset" : 27,
"type" : "word",
"position" : 2
},
{
"token" : "@",
"start_offset" : 28,
"end_offset" : 29,
"type" : "word",
"position" : 3
},
{
"token" : "3.5",
"start_offset" : 30,
"end_offset" : 33,
"type" : "word",
"position" : 4
},
{
"token" : "meters.",
"start_offset" : 34,
"end_offset" : 41,
"type" : "word",
"position" : 5
}
]
}
-- letter 토크나이저의 경우 검색 범위가 넓어져서 원하는 결과가 많이 나올 수 있음
-- whitespace 토크나이저는 특수문자를 거르지 않기 때문에 정확하게 검색하지 않으면 검색결과가 안 나올 수 있음
-- 주로 standard 토크나이저를 많이 사용
반응형
'두서없는 공부 노트 > ElasticSearch' 카테고리의 다른 글
ElasticSearch - Path Hierarchy 토크나이저 [ 예제, 설명 ] (0) | 2021.12.14 |
---|---|
ElasticSearch - uax_url_email 토크나이저 [ 예제, 설명 ] (0) | 2021.12.14 |
ElasticSearch - Full Text Query [ 예제, 설명 ] (0) | 2021.12.14 |
ElasticSearch - pattern replace란 [ 예제, 설명 ] (0) | 2021.12.14 |
ElasticSearch - 캐릭터 필터 매핑 ( char_filter ) 단어 치환 [ 예제, 설명 ] (0) | 2021.12.14 |
Comments