Remove Punct
The removepunct
filter strips away punctuation marks, spaces, and line breaks that some tokenizers—such as jieba
, lindera
, and icu
—normally keep. Use it when you want a cleaner token stream that contains only meaningful text tokens, free of commas, periods, and other punctuation.
Configuration
The removepunct
filter is built into Milvus. To use it, simply specify its name in the filter
section within analyzer_params
.
{
"tokenizer": "jieba",
"filter": ["removepunct"]
}
// java
// node
// go
# restful
The removepunct
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.
Examples
Before applying the analyzer configuration to your collection schema, verify its behavior using the run_analyzer
method.
Analyzer configuration
{
"tokenizer": "icu",
"filter": ["removepunct"]
}
// java
// node
// go
# restful
Verification using run_analyzer
# Sample text to analyze
sample_text = "Привет! Как дела?"
# Run the standard analyzer with the defined configuration
result = MilvusClient.run_analyzer(sample_text, analyzer_params)
print(result)
// java
// javascript
// go
# restful
Expected output
['Привет', 'Как', 'дела']