Updated on 2023-09-27 GMT+08:00

Entity Recognition Interface

Description

This interface is invoked by third-party access systems to implement the entity recognition capability, which can be used in intelligent ticket filling scenarios.

To use the LODAS-based entity recognition model, commission the entity recognition function before invoking the entity recognition interface. For details, see "Commissioning the Entity Extraction Model Function" in OIAP Product Documentation.

Interface Method

POST

URL

https://IP:PORT/oifde/rest/api/entityDetection

Request

Table 1 Parameters in the request body

Parameter

Type

Position

Mandatory

Description

tenantId

String

Body

Yes

Tenant ID.

language

String

Body

Yes

Language. The options are as follows:

  • zh_CN: Chinese
  • en_US: English
  • es_ES: Spanish
  • ar: Arabic
  • th_TH: Thai
  • pt_BR: Portuguese

    Note:

    1. The preceding languages are supported for TUC-based entity recognition.
    2. For LODAS-based entity recognition, the languages supported by the LODAS entity recognition model are used.

sentence

String

Body

Yes

Statement.

Entity recognition basis. The value can contain a maximum of 4096 characters.

authToken

String

Body

Yes

Authentication token.

For details, see C3 OIAP Interface Authentication.

Response

Parameter

Type

Position

Mandatory

Description

count

Integer

Body

Yes

Number of identified entities.

entityMsgV2List

EntityMsgV2[]

Body

Yes

Entity object list.

Table 2 EntityMsgV2

Name

Mandatory

Type

Description

citation

Yes

String

Reference name of an entity,

for example, reference name of an address in a system entity.

@system.address

type

Yes

Integer

Entity type.

  • –1: system or environment entity, not a user entity
  • 0: common entity
  • 1: composite entity
  • 2: rule entity
  • 3: entity identified by the LODAS

userEntity

Yes

Boolean

Whether the entity is a user entity.

envEntity

Yes

Boolean

Whether the entity is an environment entity.

beginIndex

Yes

Integer

Start sequence number in the input statement when the entity value is identified.

endIndex

Yes

Integer

End sequence number in the input statement when the entity value is identified.

values

Yes

Map <String, String>

Identified entity value pair.

The value is in Entity type:Entity value format.

Example: "@system.address": "Yuelu District, Changsha City, Hunan Province"

For details, see Adding an Entity.

formats

Yes

List<String>

List of reference formats that identify the entity.

In the example ["raw","province"],

"raw" indicates the original value, and "province" indicates the province.

Example

  • Request
    { 
        "tenantId":"202104237142",
        "language":"en_US",
        "sentence":"On Wanglong Road, Yuelu Avenue, Yuelu District, Changsha, travel is affected due to serious water accumulation after the heavy rain.",
        "authToken":"E2mjXcv*******************XX1av"
    }
  • Response
    {
        "count": 4,
        "entityMsgV2List": [
            {
                "citation": "@system.any",  // Match any user input.
                "type": -1,
                "userEntity": false,
                "envEntity": false,
                "beginIndex": 0,
                "endIndex": 25,
                "values": {
                    "@system.any": "On Wanglong Road, Yuelu Avenue, Yuelu District, Changsha, travel is affected due to serious water accumulation after the heavy rain.",
                    "@system.any.raw": "On Wanglong Road, Yuelu Avenue, Yuelu District, Changsha, travel is affected due to serious water accumulation after the heavy rain."
                },
                "formats": [
                    "raw"
                ]
            },
            {
                "citation": "@system.env.time", // Current time.
                "type": -1,
                "userEntity": false,
                "envEntity": true,
                "beginIndex": -1,
                "endIndex": -1,
                "values": {
                    "@system.env.time.hour": "11",
                    "@system.env.time.minute": "09",
                    "@system.env.time": "11:09"
                },
                "formats": [
                    "hour",
                    "minute"
                ]
            },
            {
                "citation": "@system.env.date", // Current date.
                "type": -1,
                "userEntity": false,
                "envEntity": true,
                "beginIndex": -1,
                "endIndex": -1,
                "values": {
                    "@system.env.date.yyyyMM": "202110",
                    "@system.env.date": "2021-10-19",
                    "@system.env.date.year": "2021",
                    "@system.env.date.month": "10",
                    "@system.env.date.day": "19"
                },
                "formats": [
                    "yyyyMM",
                    "year",
                    "month",
                    "day"
                ]
            },
            {
                "citation": "@system.address", // Address detection.
                "type": -1,
                "userEntity": false,
                "envEntity": false,
                "beginIndex": 0,
                "endIndex": 5,
                "values": {
                    "@system.address.raw": "Yuelu District",
                    "@system.address": "Yuelu District, Changsha City, Hunan Province",
                    "@system.address.province": "Hunan Province"
                },
                "formats": [
                    "raw",
                    "province"
                ]
            }
        ]
    }