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 |
Tags
- ElasticSearch 동의어 파일
- Servlet과 Thread
- Servlet Container란
- ContextLoaderListener란
- ElasticSearch Shingle
- spring 장점
- ElasticSearch EdgeNGram
- 안드로이드스튜디오
- Bean Factory란
- 안드로이드
- elasticSearch
- Dispathcher Servlet이란
- Servlet 멀티 스레딩
- H2
- 자바
- ApplicationContext란
- layout
- 토큰필터
- Spring Handler
- Spring Container란
- 인텔리제이
- H2 DB
- Spring Servlet이란
- ElasticSearch NGram
- ElasticSearch 토큰필터
- 계산기
- ElasticSearch 동의어 사전
- Java
- 동의어 파일
- Servlet Life Cycle
Archives
- Today
- Total
결국 무엇이든 해내는 사람
ElasticSearch - Stop 토큰필터 [ 예제, 설명 ] 본문
반응형
-- 기사나 포스팅 글에서는 의미없는 조사나 전치사 등이 많음
-- 영문에서도 마찬가지 the , a , an ,,,
-- 이러한 단어들은 대부분 검색어로 쓰이지 않는데, 이런 단어를 한국어로는 [ 불용어 ]라고 한다
-- 불용어는 영어로 stopword 라고 한다.
-- [ Stop ] 토큰 필터를 적용하면 불용어에 해당하는 텀들을 제거한다.
-- "_english_" , "_german_" 같이 언어를 지정해서 해당 언어팩에 있는 불용어를 지정할 수도 있다.
-- 한,중,일어 등은 별도의 형태소 분석기를 사용해야한다.
-- 불용어 목록을 별도의 텍스트 파일로 저장하고 저장된 파일경로를 stopwords_path 항목의 값으로 지정하여 사용하는 것도 가능하다.
-- 불용어 in,the,days로 지정
PUT my_stop
{
"settings": {
"analysis": {
"filter": {
"my_stop_filter": {
"type": "stop",
"stopwords": [
"in",
"the",
"days"
]
}
}
}
}
}
GET my_stop/_analyze
{
"tokenizer": "whitespace",
"filter": [
"lowercase",
"my_stop_filter"
],
"text": [ "Around the World in Eighty Days" ]
}
-- 불용어에 해당된 단어들은 없어지고 나머지만 출력된다.
{
"tokens" : [
{
"token" : "around",
"start_offset" : 0,
"end_offset" : 6,
"type" : "word",
"position" : 0
},
{
"token" : "world",
"start_offset" : 11,
"end_offset" : 16,
"type" : "word",
"position" : 2
},
{
"token" : "eighty",
"start_offset" : 20,
"end_offset" : 26,
"type" : "word",
"position" : 4
}
]
}
-- 불용어를 txt 파일로 관리할 경우, config 폴더 하위에 생성하여 관리한다.
-- 파일에 불용어는 줄바꿈으로 구분한다
-- 인덱스는 삭제 후 재생성한다.
DELETE my_stop
PUT my_stop
{
"settings": {
"analysis": {
"filter": {
"my_stop_filter": {
"type": "stop",
"stopwords_path": "엘라스틱서치경로/config/analysis/my_stop_dic.txt"
}
}
}
}
}
GET my_stop/_analyze
{
"tokenizer": "whitespace",
"filter": [
"lowercase",
"my_stop_filter"
],
"text": [ "Around the World in Eighty Days" ]
}
아래는 결과 창
반응형
'두서없는 공부 노트 > ElasticSearch' 카테고리의 다른 글
ElasticSearch - NGram, EdgeNGram, Shingle 토큰 필터 [ 예제, 설명 ] (0) | 2021.12.14 |
---|---|
ElasticSearch - Synonym 토큰필터, 동의어 사전 파일 [ 예제, 설명 ] (0) | 2021.12.14 |
ElasticSearch - lowercase, uppercase 토큰 필터 [ 예제, 설명 ] (0) | 2021.12.14 |
ElasticSearch - Path Hierarchy 토크나이저 [ 예제, 설명 ] (0) | 2021.12.14 |
ElasticSearch - uax_url_email 토크나이저 [ 예제, 설명 ] (0) | 2021.12.14 |
Comments