2.X/3. Dealing with Human Language 49

3. Dealing with Human Language

"I know all those words, but that sentence makes no sense to me.""나는 저 단어 모두를 알고 있다. 하지만 저 문장은 내 상식으로는 이해가 가지 않는다." -- Matt GroeningFull-text search is a battle between precision—returning as few irrelevant documents as possible—and recall—returning as many relevant documents as possible. While matching only the exact words that the user has queried would be precise, it is not enough. We would m..

3-1. Getting Started with Languages

Elasticsearch ships with a collection of language analyzers that provide good, basic, out-of-the-box support for many of the world’s most common languages:Elasticsearch는 세상의 대부분의 공용 언어에 대해, 적절하고 기본적인, 즉시 사용 가능한 language analyzer collection(언어 분석기 모음)을 가지고 있다.Arabic, Armenian, Basque, Brazilian, Bulgarian, Catalan, Chinese, Czech, Danish, Dutch, English, Finnish, French, Galician, German, Greek, ..

3-1-1. Using Language Analyzers

The built-in language analyzers are available globally and don’t need to be configured before being used. They can be specified directly in the field mapping:내장된 language analyzer는 범용적으로 이용할 수 있고, 사용하기 전에 설정할 필요가 없다. field mapping에서 바로 지정할 수 있다.PUT /my_index { "mappings": { "blog": { "properties": { "title": { "type": "string", "analyzer": "english" } } } } }title field는, 기본값인 standard analyzer ..

3-1-2. Configuring Language Analyzers

While the language analyzers can be used out of the box without any configuration, most of them do allow you to control aspects of their behavior, specifically:language analyzer는, 어떤 설정 없이, 즉시 사용할 수 있지만, 대부분은 특별히 작동 방식을 제어할 수 있다.Stem-word exclusionImagine, for instance, that users searching for the "World Health Organization" are instead getting results for "organ health". The reason for this co..

3-1-3. Pitfalls of Mixing Languages

If you have to deal with only a single language, count yourself lucky. Finding the right strategy for handling documents written in several languages can be challenging.단일 언어만 다룬다면, 운이 아주 좋은 경우이다. 여러 가지 언어로 작성된 document를 다루는 올바른 방법을 찾는다는 것은 쉽지 않다.At Index TimeeditMultilingual documents come in three main varieties:다국어 document는 3가지 정도로 나눌 수 있다.One predominant language per document, which may con..

3-1-4. One Language per Document

A single predominant language per document requires a relatively simple setup. Documents from different languages can be stored in separate indices—blogs-en, blogs-fr, and so forth—that use the same type and the same fields for each index, just with different analyzers:document별로 하나의 두드러진 언어가 있으면, 상대적으로 간단한 설정이 요구된다. 서로 다른 언어로 된 document는 개별 indices(blog-en, blog-fr 등)에 저장할 수 있다. 이들은 각 index에서 동..

3-1-5. One Language per Field

For documents that represent entities like products, movies, or legal notices, it is common for the same text to be translated into several languages. Although each translation could be represented in a single document in an index per language, another reasonable approach is to keep all translations in the same document:상품, 영화, 법적 고지같은 요소를 나타내는 document의 경우, 동일한 문장(text)을 여러 가지 언어로 번역하는 것이 일반적이다..

3-1-6. Mixed-Language Fields

Usually, documents that mix multiple languages in a single field come from sources beyond your control, such as pages scraped from the Web:일반적으로, 하나의 field에 여러 가지 언어가 섞여 있는 document는, web에서 스크랩한 페이지처럼, 통제할 수 없는 소스에서 나타난다.{ "body": "Page not found / Seite nicht gefunden / Page non trouvée" }They are the most difficult type of multilingual document to handle correctly. Although you can simply use ..

3-2. Identifying Words

A word in English is relatively simple to spot: words are separated by whitespace or (some) punctuation. Even in English, though, there can be controversy: is you’re one word or two? What about o’clock, cooperate, half-baked, or eyewitness?영어에서 단어를 찾는 것은 상대적으로 간단하다. 단어는 공백이나 (어떤) 문장 부호(쉼표, 마침표 등)로 구분된다. 영어이긴 하지만 논란이 있을 수 있다. you’re 는 한 단어인가 두 단어인가? o’clock, cooperate, half-baked, eyewitness 도 마찬..

3-2-1. standard Analyzer

The standard analyzer is used by default for any full-text analyzed string field. If we were to reimplement the standard analyzer as a custom analyzer, it would be defined as follows:standard analyzer는 모든 full-text analyzed string field에 대해 기본적으로 사용된다. standard analyzer를 사용자 정의(custom) analyzer로 다시 구현한다면, 아래와 같이 정의된다.{ "type": "custom", "tokenizer": "standard", "filter": [ "lowercase", "stop" ] ..