Google Cloud コンソールでドキュメント サマライザーを構築する

Document AI を使用してサマライザ プロセッサを作成し、ドキュメントのコンテンツを要約できます。出力は、長さ形式に基づいてカスタマイズできます。

生成されたエンティティの JSON 出力例を次に示します。

{
  "type": "summary",
  "mentionText": " Superconductivity is a phenomenon in which a material conducts
  electricity with no resistance. It was discovered in 1911 by Dutch physicist Heike
  Kamerlingh Onnes. In 1986, a new class of materials was discovered that can superconduct
  at much higher temperatures. These materials are called high-temperature superconductors.
  They have the potential to revolutionize the way we use electricity. However,
  high-temperature superconductors are still very expensive to produce. Scientists
  are working on ways to make them more affordable.",
  "normalizedValue": {
    "text": " Superconductivity is a phenomenon in which a material conducts
    electricity with no resistance. It was discovered in 1911 by Dutch physicist
    Heike Kamerlingh Onnes. In 1986, a new class of materials was discovered that
    can superconduct at much higher temperatures. These materials are called
    high-temperature superconductors. They have the potential to revolutionize
    the way we use electricity. However, high-temperature superconductors are
    still very expensive to produce. Scientists are working on ways to make
    them more affordable."
  }
}

手順

このクイックスタートでは、ドキュメントの要約プロセッサを作成し、処理するサンプル ドキュメントをアップロードして、要約の構造を調整するカスタム プロセッサ バージョンを作成します。


このタスクを Google Cloud コンソールで直接行う際の順を追ったガイダンスについては、[ガイドを表示] をクリックしてください。

ガイドを表示


始める前に

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Document AI, Cloud Storage APIs.

    Enable the APIs

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Document AI, Cloud Storage APIs.

    Enable the APIs

要約プロセッサを作成する

Google Cloud コンソールを使用して、サマライザー プロセッサを作成します。詳細については、プロセッサの作成と管理をご覧ください。

  1. Google Cloud コンソールの Document AI セクションで、[Workbench] ページに移動します。

    Workbench

  2. [サマライザー] で、[プロセッサを作成] を選択します。 summarizer-1

  3. [プロセッサを作成] メニューで、プロセッサの名前を入力します(例: quickstart-summarizer)。

  4. 最も近いリージョンを選択します。

  5. [作成] を選択します。

これでプロセッサが作成されました。

プロセッサをテストする

作成したプロセッサの [プロセッサの概要] ページが表示されます。

summarizer-2

  1. [カスタマイズして構築] タブを選択して、プロセッサをテストします。

    summarizer-3

  2. サンプル ドキュメントをダウンロードする

    超伝導に関する Wikipedia ページを含む PDF ファイルです。

  3. [テスト ドキュメントをアップロード] を選択し、ダウンロードしたドキュメントを選択します。

  4. [サマリー] ページが表示されます。OCR で検出されたテキストとドキュメントのアノテーションを表示できます。

    summarizer-4

  5. [長さ] と [形式] をそれぞれ [] と [箇条書き] に設定し、[書き換え] を選択して結果を確認します。

  6. [カスタマイズして構築] ページに戻ります。

プロセッサ バージョンをデプロイする

API でドキュメントを処理するときに特定の要約設定を使用する場合は、それらの設定に対応するプロセッサ バージョンを作成します。

  1. [要約の設定] は、前のページで最後に使用した値に設定されます。

  2. [新しいバージョンを作成] をクリックして、指定した [要約の設定] でプロセッサ バージョンを作成します。

  3. プロセッサ バージョンの名前(quickstart-moderate-bulleted など)を入力し、[バージョンを作成] を選択します。

  4. [デプロイと使用] タブに移動して、デプロイのステータスを確認します。デプロイには数分かかります。

  5. デプロイされたバージョンを [デフォルト バージョン] として設定するか、API でドキュメントを処理するときにバージョン ID を指定できます。

  6. Document AI API を使用するには:

Document AI を正しく使用して、ドキュメントからテキストを抽出し、要約できました。

クリーンアップ

このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、次の手順を行います。

不要な Google Cloud 料金が発生しないようにするには、Google Cloud コンソールを使用して、不要なプロセッサやプロジェクトを削除します。

次のステップ