Stop Analyzer(停止词分词器)
Stop Analyzer(停止分词器)是一样的simple
分析(查看Simple Analyzer(简单分析器)) ,但增加了对移除停止字的支持。它默认使用_english_
停止词。
解析:这个分析器类似于simple分析器,除了simple分析器的功能,还能基于所提供的停用词(stop word)过滤数据
定义
它包括:
Tokenizer(分词器)
Token filters(词语过滤器)
输出示例
POST _analyze
{
"analyzer": "stop",
"text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
}
上述示例产生以下术语:
[ quick, brown, foxes, jumped, over, lazy, dog, s, bone ]
配置
停止分词器接受以下参数:
stopwords
预定义的停止词列表,如_english_或包含停止词列表的数组。 默认为_english_。
stopwords_path
包含停止词的文件的路径。此路径是相对于Elasticsearch config
目录。
有关停止字配置的更多信息,请参阅Stop Token Filter。
配置示例
在本例中,我们将stop
分析器配置为使用指定的单词列表作为停止词:
PUT my_index
{
"settings": {
"analysis": {
"analyzer": {
"my_stop_analyzer": {
"type": "stop",
"stopwords": ["the", "over"]
}
}
}
}
}
POST my_index/_analyze
{
"analyzer": "my_stop_analyzer",
"text": "The 2 QUICK Brown-Foxes jumped over the lazy dog's bone."
}
上述示例产生以下术语:
[ quick, brown, foxes, jumped, lazy, dog, s, bone ]
Last updated
Was this helpful?