Event Extraction

Introduction

This API is used to extract events of specified types and related entities from natural language text and generate structured data.

Five event types are supported, including conference, appointment, resignation, stock overweight, and stock underweight as well as related elements in financial notices.

This API is free of charge and can be called twice per second.

URI

  • URI format
    POST /v1/{project_id}/nlp-fundamental/event-extraction
  • 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 256 characters.

Response

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

events

Array of events

Event extraction 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 Data structure description of events

Parameter

Type

Description

arguments

Array of arguments

List of elements in an event

role

String

Element role, which refers to the role that an element plays in an event. It is the semantic relationship between an element and an event.

span

List of Integer

Start and end positions of the entity text in the text to be analyzed

word

String

Entity text

event_trigger

String

Word that triggers an event, which best represents the occurrence of an event in the event description and determines key features of an event type

event_type

String

Event type

trigger_span

List of Integer

Start and end positions of the event trigger word in the text to be analyzed

Table 5 Event templates

Event Type

Template Element

Description

Conference

ORG

Company name

Time

Time

Place

Place

Name

Conference name

Appointment

ORG

Company name

Person

Candidate

Job

Post

Time-Period

Term of office

Resignation

ORG

Company name

Person

Person

Job

Post

Time

Time

Stock overweight

Obj

Stock issuer

Sub

Subject (individuals or organizations)

Time-Ending

Date

Increasing-Num

Overweight shares

Increasing-Rate

Overweight ratio

After-Num

Shares after overweight

After-Rate

Shareholding ratio after overweight

Stock underweight

Obj

Stock issuer

Sub

Subject (individuals or organizations)

Time-Ending

Date

Decreasing-Num

Underweight shares

Decreasing-Rate

Underweight ratio

After-Num

Shares after underweight

After-Rate

Shareholding ratio after underweight

Example

  • Example request
    POST https://{endpoint}/v1/{project_id}/nlp-fundamental/event-extraction
    
    Request Header:
        Content-Type: application/json
        X-Auth-Token: MIINRwYJKoZIhvcNAQcCoIINODCCDTQCAQExDTALBglghkgBZQMEAgEwgguVBgkqhkiG...
    
    Request Body:
    {
    "text":"At the first meeting of the fifth Board of Directors of China XXX Co., Ltd. (hereinafter referred to as "the Company"), it was agreed to elect Huang XX as a member of the Audit Committee. The term of office of the Audit Committee shall be consistent with that of the current Board of Directors."
    }
    
  • Example response
    • Successful example response
      {
      "events": [
                {
                   "argument": [
                           {
                            "role": "ORG",
                            "span": [0,11],
                            "word": "China XXX Co., Ltd."
                            },
                           {
                            "role": "Person",
                            "span": [40,43],
                            "word": "Huang XX"
                            },
                           {
                            "role": "Job",
                            "span": [44,51],
                            "word": "member of the Audit Committee"
                            },
                           {
                           "role": "Time-Period",
                           "span": [57,69],
                           "word": "The term of office of the Audit Committee shall be consistent with that of the current Board of Directors."
                            }
                     ],
                    "event_trigger": "elect",
                   "event_type": "Appointment",
                    "trigger_span": [36,38]
              }
          ]
      }
    • Failed example response
      {
         "error_code": "NLP.0301",
         "error_msg": "text should be between 1 to 256."
      }

Status Code

For details about status codes, see Status Code.

Error Code

For details about error codes, see Error Code.