Stemmer
The stemmer
filter reduces words to their base or root form (known as stemming), making it easier to match words with similar meanings across different inflections. The stemmer
filter supports multiple languages, allowing for effective search and indexing in various linguistic contexts.
Configuration
The stemmer
filter is a custom filter in Milvus. To use it, specify "type": "stemmer"
in the filter configuration, along with a language
parameter to select the desired language for stemming.
analyzer_params = {
"tokenizer": "standard",
"filter":[{
"type": "stemmer", # Specifies the filter type as stemmer
"language": "english", # Sets the language for stemming to English
}],
}
The stemmer
filter accepts the following configurable parameters.
Parameter | Description |
---|---|
| Specifies the language for the stemming process. Supported languages include: |
The stemmer
filter operates on the terms generated by the tokenizer, so it must be used in combination with a tokenizer.
After defining analyzer_params
, you can apply them to a VARCHAR
field when defining a collection schema. This allows Milvus to process the text in that field using the specified analyzer for efficient tokenization and filtering. For details, refer to Example use.
Example output
Here’s an example of how the stemmer
filter processes text:
Original text:
"running runs looked ran runner"
Expected output (with language: "english"
):
["run", "run", "look", "ran", "runner"]