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

English

Zilliz Cloud の english analyzer は、英語テキストを処理するために設計されており、tokenization と filtering に言語固有のルールを適用します。

定義​

english analyzer は以下のコンポーネントを使用します。

  • Tokenizer: standard tokenizer を使用して、テキストを個別の単語単位に分割します。

  • Filters: 包括的なテキスト処理のために複数の filter を含みます。

    • lowercase: すべての token を小文字に変換し、大文字と小文字を区別しない検索を可能にします。

    • stemmer: より広い一致をサポートするために単語を語幹形に変換します(例: "running" は "run" になります)。

    • stop_words: 一般的な英語の stop words を削除し、テキスト内の重要な語に焦点を当てます。

english analyzer の機能は、次のカスタム analyzer 設定と同等です。

python
analyzer_params = {
"tokenizer": "standard",
"filter": [
"lowercase",
{
"type": "stemmer",
"language": "english"
}, {
"type": "stop",
"stop_words": ["_english_"]
}
]
}

設定​

english analyzer を field に適用するには、analyzer_params で type を english に設定し、必要に応じてオプションのパラメータを含めるだけです。

python
analyzer_params = {
"type": "english",
}

english analyzer は次のオプションパラメータを受け入れます。

ParameterDescription
stop_wordsstop words のリストを含む配列で、tokenization から削除されます。デフォルトは _english_ で、一般的な英語の stop words の組み込みセットです。

カスタム stop words を使用した設定例:

python
analyzer_params = {
"type": "english",
"stop_words": ["a", "an", "the"]
}

After defining analyzer_params, you can apply them to a VARCHAR field when defining a コレクション スキーマ. This allows Zilliz Cloud to process the text in that field using the specified analyzer for efficient tokenization and filtering. For details, refer to Example use.

例​

Before applying the analyzer configuration to your コレクション スキーマ, verify its behavior using the run_analyzer method.

Analyzer 設定​

python
analyzer_params = {
"type": "english",
"stop_words": ["a", "an", "the"]
}

run_analyzer を使用した検証​

python
from pymilvus import (
MilvusClient,
)

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

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

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

期待される出力​

python
English analyzer output: ['milvus', 'vector', 'databas', 'built', 'scale']