2.X/3. Dealing with Human Language

3-5-1. Pros and Cons of Stopwords

drscg 2017. 9. 24. 13:05

We have more disk space, more RAM, and better compression algorithms than existed back in the day. Excluding the preceding 33 common words from the index will save only about 4MB per million documents. Using stopwords for the sake of reducing index size is no longer a valid reason. (However, there is one caveat to this statement, which we discuss in Stopwords and Phrase Queries.)

우리는 과거에 존재했던 것보다 더 많은 디스크 공간, 더 많은 RAM, 더 나은 압축 알고리즘을 가지고 있다. 위의 33가지 흔한 단어를 색인에서 제외하는 것은, 백만 개의 document당 약 4MB 정도를 절약할 뿐이다. index 크기를 줄이기 위해, 불용어를 사용하는 것은, 더 이상 타당한 이유가 되지 않는다. (그러나, Stopwords and Phrase Queries에서 이야기하겠지만, 이것에 대한 한가지 유의 사항이 있다.)

On top of that, by removing words from the index, we are reducing our ability to perform certain types of searches. Filtering out the words listed previously prevents us from doing the following:

그 뿐만 아니라, index에서 단어를 제거하면, 특정 유형의 검색 능력이 감소된다. 위에 나열된 단어들을 거르면, 아래 사항들을 할 수 없다.

  • Distinguishing happy from not happy.

    happy 와 not happy 를 구분하는 것

  • Searching for the band The The.

    밴드 The The 를 검색하는 것

  • Finding Shakespeare’s quotation "To be, or not to be"

    Shakespeare의 인용문 "To be, or not to be" 를 찾는 것

  • Using the country code for Norway: no

    노르웨이의 국가 코드 no 를 사용하는 것

The primary advantage of removing stopwords is performance. Imagine that we search an index with one million documents for the word fox. Perhaps fox appears in only 20 of them, which means that Elasticsearch has to calculate the relevance _score for 20 documents in order to return the top 10. Now, we change that to a search for the OR fox. The word the probably occurs in almost all the documents, which means that Elasticsearch has to calculate the _score for all one million documents. This second query simply cannot perform as well as the first.

불용어 제거의 주요 장점은 성능이다. 백만 건의 document를 가진 index에서 단어 fox 를 검색한다고 가정해 보자. fox 가 20회 정도만 나타난다고 가정하면, Elasticsearch는 상위 10개를 반환하기 위해, 20개 document의 relevance _score 를 계산해야 한다. 이제, the 또는 fox 를 검색해 보자. 아마도 단어 the는 거의 모든 document에 나타날 것이다. 즉, Elasticsearch는 백만 건의 document 모두에 대한 _score를 계산해야 한다. 이 두 번째 query는 첫 번째만큼 간단하게 수행할 수 없다.

Fortunately, there are techniques that we can use to keep common words searchable, while still maintaining good performance. First, we’ll start with how to use stopwords.

다행히도, 양호한 성능을 유지하면서, 흔한 단어를 검색하는데 사용할 수 있는 기술이 있다. 먼저, 불용어를 사용하는 방법으로 시작해 보자.

'2.X > 3. Dealing with Human Language' 카테고리의 다른 글

3-4-6. Stemming in situ  (0) 2017.09.24
3-5. Stopwords: Performance Versus Precision  (0) 2017.09.24
3-5-2. Using Stopwords  (0) 2017.09.24
3-5-3. Stopwords and Performance  (0) 2017.09.24
3-5-4. Divide and Conquer  (0) 2017.09.24