2.X/3. Dealing with Human Language

3-4-4. Choosing a Stemmer

drscg 2017. 9. 24. 13:15

The documentation for the stemmer token filter lists multiple stemmers for some languages. For English we have the following:

stemmer token filter에 대한 문서에서는, 특정 언어에 대한 여러 가지 형태소 분석기를 나열하고 있다. 예를 들어 영어를 보면,

english
The porter_stem token filter.
light_english
The kstem token filter.
minimal_english

The EnglishMinimalStemmer in Lucene, which removes plurals

복수형을 제거하는 Lucene의 English Minimal Stemmer

lovins

The Snowball based Lovins stemmer, the first stemmer ever produced.

Lovins 형태소 분석기 기반의 Snowball, 처음 만들어진 형태소 분석기

porter

The Snowball based Porter stemmer

Porter 형태소 분석기 기반의 Snowball

porter2

The Snowball based Porter2 stemmer

Porter2 형태소 분석기 기반의 Snowball

possessive_english

The EnglishPossessiveFilter in Lucene which removes 's

's 를 제거하는 Lucene의 English Possessive Filter

Add to that list the Hunspell stemmer with the various English dictionaries that are available.

이용할 수 있는 다양한 영어 사전을 hunspell 형태소 분석기의 목록에 추가한다.

One thing is for sure: whenever more than one solution exists for a problem, it means that none of the solutions solves the problem adequately. This certainly applies to stemming — each stemmer uses a different approach that overstems and understems words to a different degree.

한 가지는 확실하다. 어떤 문제에 대해 하나 이상의 해결책이 존재한다는 것은, 그 문제를 해결할 수 있는 적절한 해결책이 없다는 것을 의미한다. 이것은 형태소 분석에도 분명히 적용된다. 각 형태소 분석기는, 각각 다른 정도로, 과하거나 부족하게, 단어를 형태소 분석하는, 다른 접근 방식을 사용한다.

The stemmer documentation page highlights the recommended stemmer for each language in bold, usually because it offers a reasonable compromise between performance and quality. That said, the recommended stemmer may not be appropriate for all use cases. There is no single right answer to the question of which is the best stemmer — it depends very much on your requirements. There are three factors to take into account when making a choice: performance, quality, and degree.

형태소 분석기(stemmer) 참조 문서는, 각 언어에 대해, 추천하는 형태소 분석기를 굵은 글씨로 강조하고 있다. 왜냐하면, 일반적으로 그것은 성능과 품질 사이의 합리적인 안을 제공하기 때문이다. 그렇지만, 추천하는 형태소 분석기가 모든 사용 사례에 적절하지 않을 수도 있다. 최고의 형태소 분석기는 어느 것인가 라는 질문에 대한 하나의 정답은 없다. 요구사항에 매우 의존적이다. 선택 시에 고려해야 하는, 세가지 요소가 있다. 성능(performance), 품질(quality), 정도(degree)

Stemmer Performanceedit

Algorithmic stemmers are typically four or five times faster than Hunspell stemmers. "Handcrafted" algorithmic stemmers are usually, but not always, faster than their Snowball equivalents. For instance, the porter_stem token filter is significantly faster than the Snowball implementation of the Porter stemmer.

알고리즘 형태소 분석기는 hunspell 형태소 분석기보다 보통 4~5배 빠르다. "만들어진(Hand crafted)" 알고리즘 형태소 분석기는 일반적으로, 항상 그런 것은 아니지만, 대응하는 snowball 형태소 분석기보다 더 빠르다. 예를 들어, porter_stem token filter는, porter 형태소 분석기를 snowball에서 구현한 것보다, 훨씬 더 빠르다.

Hunspell stemmers have to load all words, prefixes, and suffixes into memory, which can consume a few megabytes of RAM. Algorithmic stemmers, on the other hand, consist of a small amount of code and consume very little memory.

hunspell 형태소 분석기는 모든 단어, 접두사, 접미사를 메모리에 올려야 한다. 이것은 수 MB의 RAM을 소비할 수 있다. 반면에, 알고리즘 형태소 분석기는 적은 양의 코드로 구성되어 있고, 매우 적은 메모리를 소비한다.

Stemmer Qualityedit

All languages, except Esperanto, are irregular. While more-formal words tend to follow a regular pattern, the most commonly used words often have irregular rules. Some stemming algorithms have been developed over years of research and produce reasonably high-quality results. Others have been assembled more quickly with less research and deal only with the most common cases.

Esperanto를 제외한, 모든 언어는 불규칙적이다. 조금 형식적인 단어는 규칙적인 패턴을 따르기도 하지만, 가장 일반적으로 사용되는 단어는 흔히 불규칙적이다. 몇몇 형태소 분석 알고리즘은 수년간의 연구를 통해 개발되었고, 합리적이고 고품질인 결과를 만든다. 기타 다른 것들은 부족한 연구로 급하게 만들어졌고, 대부분의 일반적인 경우만을 처리한다.

While Hunspell offers the promise of dealing precisely with irregular words, it often falls short in practice. A dictionary stemmer is only as good as its dictionary. If Hunspell comes across a word that isn’t in its dictionary, it can do nothing with it. Hunspell requires an extensive, high-quality, up-to-date dictionary in order to produce good results; dictionaries of this caliber are few and far between. An algorithmic stemmer, on the other hand, will happily deal with new words that didn’t exist when the designer created the algorithm.

hunspell은, 불규칙한 단어에 대해, 정확한 처리의 방향을 제공하지만, 실제에서는 부족하다. 사전 형태소 분석기는 그것의 사전만큼만 좋다. hunspell이 사전에 없는 단어를 만나면, 그것으로 아무것도 할 수 없다. hunspell은, 좋은 결과를 만들어 내기 위하여, 엄청난, 고품질의, 최신의 사전이 필요하다. 이런 품질의 사전은 흔하지 않다. 반면에, 알고리즘 형태소 분석기는, 설계자가 알고리즘을 생성할 때에 존재하지 않았던, 새로운 단어도 만족스럽게 처리한다.

If a good algorithmic stemmer is available for your language, it makes sense to use it rather than Hunspell. It will be faster, will consume less memory, and will generally be as good or better than the Hunspell equivalent.

여러분의 언어에, 좋은 알고리즘 형태소 분석기를 이용할 수 있다면, hunspell보다는 그것을 이용하는 것이 합리적이다. 그것이 더 빠르고, 메모리를 덜 소비하고, 일반적으로 hunspell 보다 더 좋거나 더 나을 것이다.

If accuracy and customizability is important to you, and you need (and have the resources) to maintain a custom dictionary, then Hunspell gives you greater flexibility than the algorithmic stemmers. (See Controlling Stemming for customization techniques that can be used with any stemmer.)

정확성과 커스터마이징이 중요하고(, 자원을 가지고 있고), 사용자 정의 사전을 유지해야 한다면, hunspell이 알고리즘 형태소 분석기보다 더 많은 유연성을 제공할 것이다. (어떤 형태소 분석기에도 사용할 수 있는 커스터마이징 기술에 대해서는 Controlling Stemming를 참조하자.)

Stemmer Degreeedit

Different stemmers overstem and understem to a different degree. The light_ stemmers stem less aggressively than the standard stemmers, and the minimal_ stemmers less aggressively still. Hunspell stems aggressively.

각 형태소 분석기는, 서로 다른 정도로, 과하게 혹은 부족하게 형태소 분석한다. light_ 형태소 분석기는 표준 stemmer보다 덜 적극적인 형태소 분석을 한다. 그리고, minimal_ 형태소 분석기는 여전히 덜 적극적이다. hunspell은 적극적으로 형태소를 분석한다.

Whether you want aggressive or light stemming depends on your use case. If your search results are being consumed by a clustering algorithm, you may prefer to match more widely (and, thus, stem more aggressively). If your search results are intended for human consumption, lighter stemming usually produces better results. Stemming nouns and adjectives is more important for search than stemming verbs, but this also depends on the language.

적극적으로 형태소 분석하는 것의 여부는 사용 사례에 따라 다르다. 검색 결과가 클러스터링 알고리즘에 의해 결정된다면, 더 광범위하게 일치(그리고, 더 적극적으로 형태소를 분석하는)하길 바랄 것이다. 검색 결과가 인간의 소비를 대상으로 한다면, 일반적으로 덜 적극적인 형태소 분석을 하는 것이 더 나은 결과를 얻을 수 있다. 동사보다 명사나 형용사에 대한 형태소 분석이 검색에 더 중요하지만, 이것 또한 언어에 따라 다르다.

The other factor to take into account is the size of your document collection. With a small collection such as a catalog of 10,000 products, you probably want to stem more aggressively to ensure that you match at least some documents. If your collection is large, you likely will get good matches with lighter stemming.

고려해야 할 다른 요소는 document 집합의 크기이다. 10,000가지 제품의 목록 같은 작은 집합은, 아마도 최소 몇 개의 document가 일치하도록, 더 적극적으로 형태소 분석을 할 것이다. 집합이 크다면, 덜 적극적인 형태소 분석으로 좋은 결과를 얻을 것이다.

Making a Choiceedit

Start out with a recommended stemmer. If it works well enough, there is no need to change it. If it doesn’t, you will need to spend some time investigating and comparing the stemmers available for language in order to find the one that best suits your purposes.

추천하는 형태소 분석기로 시작하자. 충분히 잘 동작한다면, 변경할 필요가 없다. 그렇지 않다면, 목적에 가장 잘 맞는 형태소 분석기를 찾기 위해, 해당 언어에서 이용할 수 있는 형태소 분석기를 조사하고 비교하는데 시간을 투자해야 한다.


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

3-4-2. Dictionary Stemmers  (0) 2017.09.24
3-4-3. Hunspell Stemmer  (0) 2017.09.24
3-4-5. Controlling Stemming  (0) 2017.09.24
3-4-6. Stemming in situ  (0) 2017.09.24
3-5. Stopwords: Performance Versus Precision  (0) 2017.09.24