All Documents
Natural Language ProcessingNatural Language Processing
- what's new
- Service Overview
- Getting Started
- API Reference
-
FAQs
- How Do I Obtain a User Token Using Postman?
- What Should I Do If an NLP API Call Fails?
- Which Methods Can Be Used to Call NLP APIs?
- Must I Subscribe to NLP Before Calling NLP APIs?
- Can NLP Be Deployed on Premises?
- Can I Use NLP Offline?
- What Are Restrictions for Using NLP?
- What Are the Username, Domain Name, and Project Name in the Token Message Body?
- Regions and AZs
- What Permissions Do I Need to Use NLP?
- What Should I Do If I Want to Customize NLP?
- Which Languages Can NLP Process?
- More Documents
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.
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.
The default value is 0.3. |
Response
Table 3 describes the 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." }
- Successful response example
Status code
For details about status codes, see Status Code.
Error Code
For details about error codes, see Error Code.