Entity Linking

Introduction

This API is used to analyze the entity linking in texts of general domains and to identify and return entity information in the text.

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}/nlp-fundamental/entity-linking
  • 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

text

String

Yes

Text to be analyzed. The text is encoded using UTF-8 and contains 1 to 50 characters.

lang

String

No

Supported language type. Currently, only Chinese is supported. The default value is zh.

Response

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

entities

Array of entities

Entity linking result. For details, see Table 4.

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.

Table 4 Entity data structure description

Parameter

Type

Description

mention

String

Entity mention

offset

Integer

Offset value

entity_title

String

Entity name

Example

  • Example request
    POST https://{endpoint}/v1/{project_id}/nlp-fundamental/entity-linking
    
    Request Header:
        Content-Type: application/json
        X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...
    
    Request Body:
        {    
    "text":"Text for analysis,
    	"lang":"zh"
        }
  • Example response
    • Successful example response
      {
          "entities": [
              {
                  "mention": "word-1",
                  "offset": 0,
                  "entity_title": "word-1 (word-2, word-3)"
              },
              {
                  "mention": "word-4",
                  "offset": 4,
                  "entity_title": "word-4 (word-1, word-5)"
              }
          ]
      }
      
    • Failed example response
      {
          "error_code": "NLP.0301",
          "error_msg": "argument valid error:text.text for entity-linking should between 1 and 50;"
      }

Status Code

For details about status codes, see Status Code.

Error Code

For details about error codes, see Error Code.