跳到主要内容

Stop
公测版

stop 过滤器删除分词文本中的指定停用词,帮助消除常见且意义不大的词。您可以使用 stop_words 参数配置停用词列表。

配置

stop 过滤器是 Zilliz Cloud 中的自定义过滤器,通过在过滤器配置中设置 "type": "stop" 来指定。

analyzer_params = {
"tokenizer": "standard",
"filter":[{
"type": "stop", # Specifies the filter type as stop
"stop_words": ["of", "to", "_english_"], # Defines custom stop words and includes the English stop word list
}],
}

stop 过滤器接受以下可选参数。

参数

描述

stop_words

要从分词中移除的单词列表。默认情况下,使用预定义的 english 列表,其中包含常见的英语停用词。有关 english 的详细信息,请查看这里

stop 过滤器作用于分词器生成的词项,因此必须与分词器结合使用。有关 Zilliz Cloud 中可用的分词器列表,请参阅分词器参考

定义 analyzer_params 后,您可以在定义 Collection Schema 时将其应用于 VARCHAR 字段。这使得 Zilliz Cloud 能够使用指定的分析器处理该字段中的文本,以实现高效的分词和过滤。更多信息,请参阅使用示例

示例输出

以下是 stop 过滤器处理文本的示例:

原始文本

"The stop filter allows control over common stop words for text processing."

预期输出stop_words:["the","over","_english_"]):

["The", "stop", "filter", "allows", "control", "common", "stop", "words", "text", "processing"]