Natural Language ProcessingNatural Language Processing

Compute
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
Domain Name Service
VPC Endpoint
Cloud Connect
Enterprise Switch
Security & Compliance
Anti-DDoS
Web Application Firewall
Host Security Service
Data Encryption Workshop
Database Security Service
Advanced Anti-DDoS
Data Security Center
Container Guard Service
Situation Awareness
Managed Threat Detection
Compass
Cloud Certificate Manager
Anti-DDoS Service
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GaussDB NoSQL
GaussDB(for MySQL)
Distributed Database Middleware
GaussDB(for openGauss)
Developer Services
ServiceStage
Distributed Cache Service
Simple Message Notification
Application Performance Management
Application Operations Management
Blockchain Service
API Gateway
Cloud Performance Test Service
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
DevCloud
ProjectMan
CodeHub
CloudRelease
CloudPipeline
CloudBuild
CloudDeploy
Cloud Communications
Message & SMS
Cloud Ecosystem
Marketplace
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP License Service
Support Plans
Customer Operation Capabilities
Partner Support Plans
Professional Services
enterprise-collaboration
Meeting
IoT
IoT
Intelligent EdgeFabric
DeveloperTools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Help Center> Natural Language Processing> API Reference> NLP APIs> LG APIs> Text Summarization (Basic Edition)
Updated at: Feb 22, 2022 GMT+08:00

Text Summarization (Basic Edition)

Introduction

This API is used to generate summaries of texts.

Basic text summarization and domain-specific text summarization are implemented based on different algorithms, so the results for processing the same text are different. According to the test data, the effect of the domain-specific edition is better than that of the basic edition.

For details about endpoints, see Endpoints.

URI

  • URI format
    POST /v1/{project_id}/nlg/summarization
  • Parameter description
    Table 1 URI parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

lang

String

No

Supported text language type. English (en) is now supported.

title

String

No

Text title. Currently, the title is encoded using UTF-8. The text length ranges from 0 to 1,000 characters.

content

String

Yes

Text body. Currently, the title is encoded using UTF-8. The text length ranges from 1 to 10,000 characters.

NOTE:

The text language type must be consistent with the value of lang.

length_limit

Float

No

Length limit of the generated summary.

  • If the value of length_limit is greater than 1, the returned result is the summary whose length is the closest to the value.
  • If the value of length_limit ranges from 0 to 1, the returned result is the summary whose length percentage is closest to the value.

The default value is 0.3.

Response

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

summary

String

Summary result returned based on the text request body.

error_code

String

Error code when the API fails to be called. For details, see Error Code.

The parameter is not included when the API call succeeds.

error_msg

String

Error message returned when the API fails to be called.

The parameter is not included when the API call succeeds.

Example

  • Example request
    POST https://nlp-ext.ap-southeast-3.myhuaweicloud.com/v1/{project_id}/nlg/summarization
    
    Request Header:
        Content-Type: application/json
        X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...    // User token obtained during authentication. For details about how to obtain the token, see "Calling APIs" > "Authentication" in this document.
    
    Request Body:
        {
           "length_limit":0.3,
    "title":"Almost 600 plant species have become extinct in the last 250 years",
      "lang": "en",
      "content":" Almost 600 plant species have been wiped from the planet in the past 250 years, more than twice the number of bird, mammal and amphibian species that have met the same fate, according to a new study.The research -- published Monday in Nature, Ecology & Evolution journal -- found that 571 plant species have disappeared from the wild worldwide, and that plant extinction is occurring up to 500 times faster than the rate it would without human intervention.For comparison, the researchers said animal extinction is occurring at least 1,000 times faster than the normal rate of extinction, however the report notes that researchers believe the plant extinction rate has been underestimated. The Royal Botanic Gardens, Kew and Stockholm University researchers say it's the first time scientists have compiled a global overview of which plants have already become extinct. Most people can name a mammal or bird that has become extinct in recent centuries, but few can name an extinct plant, report co-author Aleys Humphreys said. Plants on islands, in the tropics and in Mediterranean climates had the highest rates of plant extinction, as these were areas home to unique species vulnerable to human activities. The study said the increase in the plant extinction rate could be due to the loss of habitat of species located in a small geographic area. Some examples of plants that have gone extinct in the past two centuries are the aromatic Chile sandalwood and the banded trinity, which has no leaves -- only its flowers are visible above the ground."
    }
  • Example response
    • Successful response example
      {
          "summary": "Almost 600 plant species have been wiped from the planet in the past 250 years, more than twice the number of bird, mammal and amphibian species that have met the same fate, according to a new study.The research -- published Monday in Nature, Ecology & Evolution journal -- found that 571 plant species have disappeared from the wild worldwide, and that plant extinction is occurring up to 500 times faster than the rate it would without human intervention.For comparison, the researchers said animal extinction is occurring at least 1,000 times faster than the normal rate of extinction, however the report notes that researchers believe the plant extinction rate has been underestimated."
      }
    • Failed response example
      {
          "error_code": "NLP.3201",
          "error_msg": "parameter error."
      }

Status code

For details about status codes, see Status Code.

Error Code

For details about error codes, see Error Code.

Did you find this page helpful?

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel