テキスト要約コンポーネントは、TextRank モデルに基づく自動要約アルゴリズムを使用して、ドキュメントからキーセンテンスを抽出します。このプロセスにより、元のドキュメントの主旨を正確に捉えた、簡潔で一貫性のあるまとめが生成されます。このトピックでは、テキスト要約コンポーネントを設定する方法について説明します。
制限事項
サポートされているコンピューティングエンジンは MaxCompute です。
注意事項
テキストを1行につき1文に分割するには、アップストリームに 文分割 コンポーネントを追加します。
コンポーネント設定
コンポーネントパラメーターは、次のいずれかの方法で設定できます。
方法 1: GUI の使用
Designer ワークフローページでコンポーネントパラメーターを設定できます。
|
タブ |
パラメーター |
説明 |
|
[フィールド設定] |
[ドキュメント ID 用の列] |
ドキュメント ID を含む列の名前を入力します。 |
|
文章列 |
1つの列を指定します。 |
|
|
[パラメーター設定] |
[出力するキーセンテンスの数] |
デフォルト値は 3 です。 |
|
[文類似度計算方法] |
文類似度を計算する方法:
|
|
|
[一致する文字列の重み] |
このパラメーターは、[文の類似度計算方法] が [ssk] に設定されているときにアクティブになります。デフォルト値は 0.5 です。 |
|
|
[部分文字列の長さ] |
このパラメーターは、[文の類似度計算方法] が [ssk] または [cosine] に設定されているときにアクティブになります。デフォルト値は 2 です。 |
|
|
減衰係数 |
デフォルト値は 0.85 です。 |
|
|
[最大反復回数] |
デフォルト値は 100 です。 |
|
|
[収束係数] |
デフォルト値は 0.000001 です。 |
|
|
[実行チューニング] |
コア数 |
自動的に割り当てられます。 |
|
[コアあたりのメモリ] |
自動的に割り当てられます。 |
方法 2: PAI コマンドの使用
PAI コマンドを使用してコンポーネントパラメーターを設定できます。これを行うには、SQL スクリプトコンポーネントを使用して PAI コマンドを呼び出します。詳細については、「SQL スクリプト」をご参照ください。
PAI -name TextSummarization
-project algo_public
-DinputTableName="test_input"
-DoutputTableName="test_output"
-DdocIdCol="doc_id"
-DsentenceCol="sentence"
-DtopN=2
-Dlifecycle=30;
|
パラメーター |
必須 |
説明 |
デフォルト値 |
|
inputTableName |
はい |
入力テーブル名。 |
なし |
|
inputTablePartitions |
いいえ |
計算に使用する入力テーブルのパーティション。 |
入力テーブルのすべてのパーティション |
|
outputTableName |
はい |
出力テーブル名。 |
なし |
|
docIdCol |
はい |
ドキュメント ID を含む列の名前。 |
なし |
|
sentenceCol |
はい |
文列。1つの列のみを指定できます。 |
なし |
|
topN |
いいえ |
出力は最初のいくつかのキーセンテンスで構成されます。 |
3 |
|
similarityType |
いいえ |
文類似度を計算する方法:
|
lcs_sim |
|
lambda |
いいえ |
一致する文字列の重み。このパラメーターは、`similarityType` が [ssk] に設定されている場合に使用できます。 |
0.5 |
|
k |
いいえ |
部分文字列の長さです。このパラメーターは、`similarityType` が [ssk] または [余弦] に設定されている場合に使用できます。 |
2 |
|
dampingFactor |
いいえ |
ダンピングファクター。 |
0.85 |
|
maxIter |
いいえ |
最大反復回数。 |
100 |
|
epsilon |
いいえ |
収束係数。 |
0.000001 |
|
lifecycle |
いいえ |
出力テーブルのライフサイクル。 |
なし |
|
coreNum |
いいえ |
計算用のコア数。 |
システムによって自動的に割り当てられます |
|
memSizePerCore |
いいえ |
各コアに必要なメモリ。 |
システムによって自動的に割り当てられます |
例
-
入力テーブル `test_input` を準備します。次の表にサンプルデータを示します。
MaxCompute クライアントを使用してテーブルを作成し、Tunnel コマンドを使用してデータをアップロードできます。MaxCompute クライアントのインストールと設定の詳細については、「ローカルクライアント (odpscmd) を使用した接続」をご参照ください。Tunnel コマンドの詳細については、「Tunnel コマンド」をご参照ください。
doc_id
sentence
1000897
Since the COVID-19 outbreak, the consumption of wild animals has become a prominent issue. This poses a great risk to public health and has drawn widespread social concern. Public security, forestry, and market regulation departments across the country have launched special campaigns to combat the illegal hunting, trafficking, and consumption of wild animals, achieving notable success. While cracking down on these illegal activities, law enforcement found that a large consumer base, enormous poaching profits, and the difficulty and high cost of identification are key reasons the illegal wildlife trade continues to thrive.
以下に示すとおり:
-
doc_id: ドキュメント ID 列。
-
sentence: 文列。
-
-
文分割コンポーネントを使用して、`sentence` 列のテキストを1行につき1文に分割します。出力テーブルは `test_output` という名前です。次の表に内容を示します。詳細については、「文分割」をご参照ください。
doc_id
sentence
1000897
Since the COVID-19 outbreak, the consumption of wild animals has become a prominent issue.
1000897
This poses a great risk to public health and has drawn widespread social concern.
1000897
Public security, forestry, and market regulation departments across the country have launched special campaigns to combat the illegal hunting, trafficking, and consumption of wild animals, achieving notable success.
1000897
While cracking down on these illegal activities, law enforcement found that a large consumer base, enormous poaching profits, and the difficulty and high cost of identification are key reasons the illegal wildlife trade continues to thrive.
-
次の PAI コマンドを実行して、テキスト要約を生成します。
SQL Script コンポーネントまたは ODPS SQL ノード コンポーネントを使用して、以下の PAI コマンドを実行できます。
PAI -name TextSummarization -project algo_public -DinputTableName="test_output" -DoutputTableName="test_output1" -DdocIdCol="doc_id" -DsentenceCol="sentence" -DtopN=2 -Dlifecycle=30;出力テーブルには、doc_id と abstract の2つの列があります。
doc_id
abstract
1000897
Since the COVID-19 outbreak, the consumption of wild animals has become a prominent issue. Public security, forestry, and market regulation departments across the country have launched special campaigns to combat the illegal hunting, trafficking, and consumption of wild animals, achieving notable success.
関連ドキュメント
-
文分割コンポーネントは、テキストセグメントを1行につき1文に分割することでデータを前処理します。詳細については、「文分割」をご参照ください。
-
Designer の詳細については、「Designer の概要」をご参照ください。