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.
Calling NLP APIs will incur fees. NLP packages are classified into the basic and domain-specific editions. When purchasing a package, view the APIs supported by the basic package and domain-specific packages in the Natural Language Processing Price Calculator.
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. Currently, Chinese (zh) and English (en) are supported. The default value is zh. |
| 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://{endpoint}/v1/{project_id}/nlg/summarization Request Header: Content-Type: application/json X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG... 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.
Last Article: LG APIs
Next Article: Text Summarization (Domain-specific Edition)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.