# 3.3.1.Anatomy of an analyzer（分析器的分析）

分析器（无论是内置还是自定义）只是一个包含三个较底层组件的包：字符过滤器，分词器，和令牌过滤器。

内置分析器将这些组件预先封装成适用于不同语言和文本类型的分析器。Elasticsearch还暴露了各个组件，以便它们可以组合起来定义新的定制分析器。

## **Character filters（字符过滤器）** <a href="#anatomyofananalyzer-fen-xi-qi-de-fen-xi-characterfilters-zi-fu-guo-lv-qi" id="anatomyofananalyzer-fen-xi-qi-de-fen-xi-characterfilters-zi-fu-guo-lv-qi"></a>

字符过滤器接收原始文本作为字符流，并可以通过添加、删除和更改字符来转换流。例如，可以使用字符过滤器将印度-阿拉伯数字（0123456789）转换成阿拉伯-拉丁语中的（0123456789），或从流中剥离`<b>`等HTML元素。

分析器可能有零个或多个字符过滤器，它们会按顺序应用。

## **Tokenizer（分词器）** <a href="#anatomyofananalyzer-fen-xi-qi-de-fen-xi-tokenizer-fen-ci-qi" id="anatomyofananalyzer-fen-xi-qi-de-fen-xi-tokenizer-fen-ci-qi"></a>

分词器接收到一串字符，将其分解为单独的词语（通常是单个单词），并输出词语流。例如，空白分词器每当看到任何空格时，将文本分解成词语。它将文本"Quick brown fox" 转换为词语\[Quick,brown,fox!]。

分词器还负责记录每个词语的顺序或位置以及体现词语的原始单词开始和结束字符偏移量。

分析器必须只有一个分词器。

## **Token filters（词语过滤器）** <a href="#anatomyofananalyzer-fen-xi-qi-de-fen-xi-tokenfilters-ci-yu-guo-lv-qi" id="anatomyofananalyzer-fen-xi-qi-de-fen-xi-tokenfilters-ci-yu-guo-lv-qi"></a>

词语过滤器接收词语流，并可以添加，删除和修改词语。例如，小写词语过滤器将所有词语转换为小写，停止词语过滤器会从词语流中删除常用字（停止字），同义词词语过滤器会将同义词引入到词语流中。

词语过滤器不允许改变每个词语的位置或字符偏移量。

分析器可以具有零个或多个词语过滤器，它们会按顺序应用。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xiaoxiami.gitbook.io/elasticsearch/ji-chu/33-analysisfen-679029/331anatomy-of-an-analyzerff08-fen-xi-qi-de-fen-xi-ff09.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
