Detener
El filtro stop elimina las palabras de parada especificadas del texto tokenizado, lo que ayuda a eliminar las palabras comunes y menos significativas. Puede configurar la lista de palabras de parada utilizando el parámetro stop_words.
Configuración
El filtro stop es un filtro personalizado de Milvus. Para usarlo, especifique "type": "stop" en la configuración del filtro, junto con un parámetro stop_words que proporciona una lista de palabras de parada.
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
}],
}
Map<String, Object> analyzerParams = new HashMap<>();
analyzerParams.put("tokenizer", "standard");
analyzerParams.put("filter",
Collections.singletonList(
new HashMap<String, Object>() {{
put("type", "stop");
put("stop_words", Arrays.asList("of", "to", "_english_"));
}}
)
);
const 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
}],
};
analyzerParams = map[string]any{"tokenizer": "standard",
"filter": []any{map[string]any{
"type": "stop",
"stop_words": []string{"of", "to", "_english_"},
}}}
# restful
analyzerParams='{
"tokenizer": "standard",
"filter": [
{
"type": "stop",
"stop_words": [
"of",
"to",
"_english_"
]
}
]
}'
El filtro stop acepta los siguientes parámetros configurables.
Parámetro |
Descripción |
|---|---|
|
Una lista de palabras que deben eliminarse de la tokenización. Por defecto, el filtro utiliza el diccionario
|
El filtro stop funciona con los términos generados por el tokenizador, por lo que debe utilizarse en combinación con un tokenizador. Para obtener una lista de los tokenizadores disponibles en Milvus, consulte Standard Tokenizer y sus páginas hermanas.
Después de definir analyzer_params, puede aplicarlos a un campo VARCHAR al definir un esquema de colección. Esto permite a Milvus procesar el texto de ese campo utilizando el analizador especificado para una tokenización y filtrado eficientes. Para más detalles, consulte Ejemplo de uso.
Ejemplos
Antes de aplicar la configuración del analizador a su esquema de recopilación, verifique su comportamiento utilizando el método run_analyzer.
Configuración del analizador
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
}],
}
Map<String, Object> analyzerParams = new HashMap<>();
analyzerParams.put("tokenizer", "standard");
analyzerParams.put("filter",
Collections.singletonList(
new HashMap<String, Object>() {{
put("type", "stop");
put("stop_words", Arrays.asList("of", "to", "_english_"));
}}
)
);
// javascript
analyzerParams = map[string]any{"tokenizer": "standard",
"filter": []any{map[string]any{
"type": "stop",
"stop_words": []string{"of", "to", "_english_"},
}}}
# restful
Verificación mediante run_analyzerCompatible with Milvus 2.5.11+
# Sample text to analyze
sample_text = "The stop filter allows control over common stop words for text processing."
# Run the standard analyzer with the defined configuration
result = MilvusClient.run_analyzer(sample_text, analyzer_params)
print(result)
// java
// javascript
// go
# restful
Salida esperada
['The', 'stop', 'filter', 'allows', 'control', 'over', 'common', 'stop', 'words', 'text', 'processing']