Named Entity Recognition API

Named Entity Recognition API extracts the important keywords from natural language texts in your domain.

API Server

nlu-api.allganize.ai is Allganize's NLU API endpoint. If you are using on-prem, please use your API endpoint.

Getting API KEY

The NLU API uses API keys to authenticate requests that you can find in the Allganize NLU API dashboard. Go to Settings > General to find your API key. If you don't have an account yet, you can create one here.

Provide your API KEY in the request header API-KEY.

Named Entity Recognition API

POST https://nlu-api.allganize.ai/api/inference

Headers

Request Body

{
  "inputText": STRING,
  "entities": [
    { 
      "startIndex": NUMBER, 
      "endIndex": NUMBER, 
      "tag": STRING,
      "token": STRING
    }, ...
  ]
}

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.

curl https://nlu-api.allganize.ai/api/inference \
-d '{"text": "I am traveling from Munich to Paris by Air France business class"}' \
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"

Response Example

{
  "inputText": "I am traveling from Munich to Paris by Air France business class",
  "entities": [
    {"startIndex": 20, "endIndex": 26, "tag": "DEPARTURE", "token": "Munich"},
    {"startIndex": 30, "endIndex": 35, "tag": "ARRIVAL", "token": "Paris"},
    {"startIndex": 39, "endIndex": 49, "tag": "AIRLINE", "token": "Air France"},
    {"startIndex": 50, "endIndex": 64, "tag": "SEAT_CLASS", "token": "business class"}
  ]
}

Upload Training and Testing Data

POST https://nlu-api.allganize.ai/api/add_phrase/<data_type>

This API lets you upload training data in json format

Path Parameters

Headers

Request Body

{"success": true}

Request Example

Please replace YOUR_API_KEY with your one in the example below. Please see getting-api-key section.

curl https://nlu-api.allganize.ai/api/add_phrase/train \ 
-d '[{
  "text": "I am traveling from Munich to Paris by Air France business class",
  "entities": [
    {"start": 20, "end": 26, "tag": {"name": "DEPARTURE"}, "token": "Munich"},
    {"start": 30, "end": 35, "tag": {"name": "ARRIVAL"}, "token": "Paris"},
    {"start": 39, "end": 49, "tag": {"name": "AIRLINE"}, "token": "Air France"},
    {"start": 50, "end": 64, "tag": {"name": "SEAT_CLASS"}, "token": "business class"}
  ]
}' \ 
-H "Content-Type: application/json" \
-H "API-KEY: YOUR_API_KEY"

Response Example

{"success": true}

Error Messages

Please read the error message you get if you don't get the response that you expected.

Error Response example

{
    "type": "APIError",
    "code": 7000,
    "message": "Something went wrong."
}

Last updated