メインコンテンツまでスキップ

Whitespace

whitespace tokenizer は、単語間にスペースがあるたびにテキストを用語に分割します。

Configuration

whitespace tokenizer を使用する analyzer を設定するには、analyzer_paramstokenizerwhitespace に設定します。

python
analyzer_params = {
"tokenizer": "whitespace",
}

whitespace tokenizer は、1 つ以上の filter と組み合わせて動作できます。たとえば、次のコードは whitespace tokenizer と lowercase filter を使用する analyzer を定義しています。

python
analyzer_params = {
"tokenizer": "whitespace",
"filter": ["lowercase"]
}

analyzer_params を定義した後、collection schema を定義する際にそれらを VARCHAR field に適用できます。これにより、Zilliz Cloud はその field 内のテキストを、効率的な tokenization と filtering のために指定された analyzer を使用して処理できます。詳細については、使用例 を参照してください。

Examples

analyzer 設定を collection schema に適用する前に、run_analyzer メソッドを使用してその動作を確認してください。

Analyzer configuration

python
analyzer_params = {
"tokenizer": "whitespace",
"filter": ["lowercase"]
}

run_analyzer を使用した検証

python
from pymilvus import (
MilvusClient,
)

client = MilvusClient(
uri="YOUR_CLUSTER_ENDPOINT",
token="YOUR_CLUSTER_TOKEN"
)

# Sample text to analyze
sample_text = "The Milvus vector database is built for scale!"

# Run the standard analyzer with the defined configuration
result = client.run_analyzer(sample_text, analyzer_params)
print("Standard analyzer output:", result)

Expected output

sql
['the', 'milvus', 'vector', 'database', 'is', 'built', 'for', 'scale!']