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

ASCII folding

asciifolding フィルターは、Basic Latin Unicode block(最初の 127 個の ASCII 文字)外の文字を対応する ASCII 文字に変換します。たとえば、í のような文字を i に変換し、特に多言語コンテンツにおけるテキスト処理をよりシンプルで一貫性のあるものにします。

Configuration

asciifolding フィルターは Zilliz Cloud に組み込まれています。使用するには、analyzer_params 内の filter セクションでその名前を指定するだけです。

python
analyzer_params = {
"tokenizer": "standard",
"filter": ["asciifolding"],
}

asciifolding フィルターは tokenizer によって生成された term に対して動作するため、tokenizer と組み合わせて使用する必要があります。Zilliz Cloud で使用可能な tokenizer の一覧については、Standard Tokenizer および関連ページを参照してください。

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

Examples

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

Analyzer configuration

python
analyzer_params = {
"tokenizer": "standard",
"filter": ["asciifolding"],
}

Verification using run_analyzer

python
from pymilvus import (
MilvusClient,
)

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

# Sample text to analyze
sample_text = "Café Möller serves crème brûlée and piñatas."

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

Expected output

python
['Cafe', 'Moller', 'serves', 'creme', 'brulee', 'and', 'pinatas']
Ctrl I