Stop
stop 필터는 토큰화된 텍스트에서 지정된 중지 단어를 제거하여 의미가 덜한 일반적인 단어를 제거하는 데 도움을 줍니다. stop_words 매개변수를 사용하여 중지 단어 목록을 구성할 수 있습니다.
구성
stop 필터는 Milvus의 사용자 지정 필터입니다. 이 필터를 사용하려면 필터 구성에 "type": "stop" 을 stop_words 매개변수와 함께 지정하여 중지 단어 목록을 제공합니다.
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_"
]
}
]
}'
stop 필터는 다음과 같은 구성 가능한 매개변수를 허용합니다.
파라미터 |
설명 |
|---|---|
|
토큰화에서 제거할 단어 목록입니다. 기본적으로 필터는 기본 제공
|
stop 필터는 토큰화 도구에서 생성된 용어에 대해 작동하므로 토큰화 도구와 함께 사용해야 합니다. Milvus에서 사용할 수 있는 토큰화기 목록은 표준 토큰화기와 그 자매 페이지를 참조하세요.
analyzer_params 을 정의한 후 컬렉션 스키마를 정의할 때 VARCHAR 필드에 적용할 수 있습니다. 이렇게 하면 Milvus가 지정된 분석기를 사용하여 해당 필드의 텍스트를 처리하여 효율적인 토큰화 및 필터링을 수행할 수 있습니다. 자세한 내용은 사용 예시를 참조하세요.
예제
분석기 구성을 컬렉션 스키마에 적용하기 전에 run_analyzer 메서드를 사용하여 그 동작을 확인하세요.
분석기 구성
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
다음을 사용하여 확인 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
예상 출력
['The', 'stop', 'filter', 'allows', 'control', 'over', 'common', 'stop', 'words', 'text', 'processing']