Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Créer un outil de synthèse de documents dans la console Google Cloud
Vous pouvez créer un outil de synthèse à l'aide de Document AI pour résumer le contenu des documents. La sortie peut être personnalisée en fonction de la longueur et du format.
Voici un exemple de sortie JSON à partir de l'entité obtenue :
{"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."}}
Procédure
Dans ce guide de démarrage rapide, vous allez créer un outil de synthèse de documents, importer un exemple de document à traiter, puis créer une version personnalisée de l'outil pour ajuster la structure des résumés.
Pour obtenir des instructions détaillées sur cette tâche directement dans la console Google Cloud , cliquez sur Visite guidée :
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.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Sélectionnez Importer le document de test, puis sélectionnez le document que vous venez de télécharger.
Vous êtes maintenant sur la page récapitulative. Vous pouvez afficher les synthèses de texte et de document détectées avec la reconnaissance optique des caractères.
Réglez les paramètres Longueur et Format sur Modéré et À puces, puis sélectionnez Réécrire et observez les résultats.
Revenez à la page Personnaliser et créer.
Déployer la version de l'outil de traitement
Si vous souhaitez utiliser des paramètres de synthèse spécifiques lors du traitement de documents avec l'API, créez une version de l'outil de traitement pour ces paramètres.
Les paramètres de synthèse sont définis sur les dernières valeurs que vous avez utilisées sur la page précédente.
Sélectionnez Créer une version pour créer une version de l'outil de traitement avec les paramètres de synthèse spécifiés.
Attribuez un nom à la version de l'outil de traitement, par exemple quickstart-moderate-bulleted, puis sélectionnez Créer une version.
Accédez à l'onglet Déployer et utiliser pour afficher l'état du déploiement. Le déploiement prend quelques minutes.
Une fois la version déployée, vous pouvez la définir comme Version par défaut ou fournir l'ID de version lors du traitement des documents avec l'API.
Pour utiliser l'API Document AI :
Suivez les exemples de code décrits dans la section Envoyer une requête de traitement pour utiliser le traitement en ligne et par lot.
Reportez-vous à la section Quotas et limites pour connaître le nombre de pages compatibles avec le traitement en ligne et par lot.
Suivez les exemples de code dans le guide Gérer la réponse de traitement pour obtenir la réponse synthétisée auprès de l'outil de traitement.
Vous avez utilisé Document AI pour extraire du texte d'un document et le résumer.
Effectuer un nettoyage
Pour éviter que les ressources utilisées sur cette page soient facturées sur votre compte Google Cloud , procédez comme suit :
Pour éviter des frais inutiles Google Cloud , supprimez votre processeur et votre projet à l'aide deGoogle Cloud console si vous n'en avez plus besoin.
Étapes suivantes
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eDocument AI allows users to create a summarizer processor for summarizing document content, with customizable output length and format.\u003c/p\u003e\n"],["\u003cp\u003eUsers can test the summarizer by uploading a sample document, then adjust the length and format settings like 'Moderate' and 'Bulleted' to modify the summary output.\u003c/p\u003e\n"],["\u003cp\u003eA custom processor version with specific summarization settings can be created and deployed to process documents through the API.\u003c/p\u003e\n"],["\u003cp\u003eThe Document AI API enables online and batch processing, and provides code samples for sending requests and handling summarization responses.\u003c/p\u003e\n"],["\u003cp\u003eTo avoid unnecessary charges, users should delete the processor and project via the Google Cloud console when finished.\u003c/p\u003e\n"]]],[],null,["# Build a document summarizer in the Google Cloud console\n=======================================================\n\nYou can create a summarizer processor using Document AI to summarize the\ncontent of documents. The output can be customized based on [length](/document-ai/docs/reference/rest/v1beta3/projects.locations.processors.processorVersions#Length) and [format](/document-ai/docs/reference/rest/v1beta3/projects.locations.processors.processorVersions#Format).\n\nHere is some sample JSON output from the resulting entity: \n\n {\n \"type\": \"summary\",\n \"mentionText\": \" Superconductivity is a phenomenon in which a material conducts\n electricity with no resistance. It was discovered in 1911 by Dutch physicist Heike\n Kamerlingh Onnes. In 1986, a new class of materials was discovered that can superconduct\n at much higher temperatures. These materials are called high-temperature superconductors.\n They have the potential to revolutionize the way we use electricity. However,\n high-temperature superconductors are still very expensive to produce. Scientists\n are working on ways to make them more affordable.\",\n \"normalizedValue\": {\n \"text\": \" Superconductivity is a phenomenon in which a material conducts\n electricity with no resistance. It was discovered in 1911 by Dutch physicist\n Heike Kamerlingh Onnes. In 1986, a new class of materials was discovered that\n can superconduct at much higher temperatures. These materials are called\n high-temperature superconductors. They have the potential to revolutionize\n the way we use electricity. However, high-temperature superconductors are\n still very expensive to produce. Scientists are working on ways to make\n them more affordable.\"\n }\n }\n\nProcedure\n---------\n\nIn this quickstart, you create a document summarizer processor, upload a sample\ndocument for processing, and create a custom processor version to adjust the summary\nstructure.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nGoogle Cloud console, click **Guide me**:\n\n[Guide me](https://console.cloud.google.com/ai/document-ai?tutorial=document-ai--documentai-workbench_summarizer_console)\n\n*** ** * ** ***\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Document AI, Cloud Storage APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=documentai.googleapis.com,storage.googleapis.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Document AI, Cloud Storage APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=documentai.googleapis.com,storage.googleapis.com)\n\nCreate a summarizer processor\n-----------------------------\n\nUse the Google Cloud console to create a summarizer processor. See [creating and managing processors](/document-ai/docs/create-processor) for more information.\n\n1. In the Google Cloud console, in the Document AI section, go to the **Workbench** page.\n\n\n [Workbench](https://console.cloud.google.com/ai/document-ai/workbench)\n2. For **Summarizer** , select\n **Create processor**.\n\n\n3. In the **Create processor** menu, enter a name for your processor, such as `quickstart-summarizer`.\n\n4. Select the region closest to you.\n\n5. Select **Create**.\n\nYour processor has now been created.\n\nTest Processor\n--------------\n\nYou are on the **Processor overview** page of the processor you just created.\n\n\n1. Select on the **Customize \\& build** tab to experiment with the processor.\n\n\n2. [Download a sample document](https://storage.googleapis.com/cloud-samples-data/documentai/Summarizer/Superconductivity.pdf)\n\n It is a PDF file containing the [Wikipedia page for Superconductivity](https://en.wikipedia.org/wiki/Superconductivity).\n3. Select\n **Upload Test Document** and select the document you just downloaded.\n\n4. You are now on the **Summary** page. You can view the OCR detected text and document summarization.\n\n\n5. Adjust the **Length and Format** settings to **Moderate** and **Bulleted** respectively, then select **Rewrite** and observe the results.\n\n6. Go back to the **Customize \\& build** page.\n\nDeploy processor version\n------------------------\n\nIf you want to use specific summarization settings when processing documents with the API, create a processor version for those settings.\n\n1. The **Summarization settings** are set to the last values you used on the previous page.\n\n2. Select on **Create New Version** to create a processor version with the specified **Summarization settings**.\n\n3. Enter a name for the processor version, such as `quickstart-moderate-bulleted`, and select **Create Version**.\n\n4. Go to the **Deploy \\& Use** tab to view the deployment status. Deployment takes a few minutes.\n\n5. When the version is deployed, you can set it as the **Default version**, or you can provide the version ID when processing documents with the API.\n\n6. To use the Document AI API:\n\n - Follow the code samples in [send a processing request](/document-ai/docs/send-request) to use online and batch processing.\n - Refer to [Quotas and limits](/document-ai/quotas#processor_limits) for the number of pages supported for online and batch processing.\n - Follow the code samples in [Handle the processing response](/document-ai/docs/handle-response#summarization) to get the summarization response from the processor.\n\nYou have successfully used Document AI to extract text from a document and summarize it.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\nTo avoid unnecessary Google Cloud charges, use the\n[Google Cloud console](https://console.cloud.google.com/) to delete your processor and [project](https://console.cloud.google.com/cloud-resource-manager) if you do not need\nthem.\n\nWhat's next\n-----------"]]