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

Decompounder

decompounder フィルターは、指定された辞書に基づいて複合語を個々の構成要素に分割し、複合語の一部を検索しやすくします。このフィルターは、ドイツ語のように複合語を頻繁に使用する言語で特に有用です。

Configuration

decompounder フィルターは、word_list パラメーターを介してインラインで構成要素辞書を受け取るか、word_list_file パラメーターを介して登録済みのファイルリソースから受け取ります。

Inline word list

decompounder フィルターは Zilliz Cloud のカスタムフィルターです。これを使用するには、フィルター設定で "type": "decompounder" を指定し、認識する単語構成要素の辞書を提供する word_list パラメーターをあわせて指定します。

python
analyzer_params = {
"tokenizer": "standard",
"filter":[{
"type": "decompounder", # Specifies the filter type as decompounder
"word_list": ["dampf", "schiff", "fahrt", "brot", "backen", "automat"],
}],
}

decompounder フィルターは、以下の設定可能なパラメーターを受け入れます。

ParameterDescription
word_list複合語を分割するために使用される単語構成要素のリストです。この辞書によって、複合語をどのように個別の語に分解するかが決まります。

decompounder フィルターは tokenizer によって生成された terms に対して動作するため、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":[{
"type": "decompounder", # Specifies the filter type as decompounder
"word_list": ["dampf", "schiff", "fahrt", "brot", "backen", "automat"],
}],
}

run_analyzer を使用した検証

python
from pymilvus import (
MilvusClient,
)

client = MilvusClient(uri="YOUR_CLUSTER_ENDPOINT")

# Sample text to analyze
sample_text = "dampfschifffahrt brotbackautomat"

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

Expected output

python
['dampf', 'schiff', 'fahrt', 'brotbackautomat']
Ctrl I