Extract entities from a text. An entity is a word or a group of words that represent a concept. For example, the word "Canada" represents the concept of a country. The word "Jim Carrey" represents the concept of a person. The word "Tesla" represents the concept of a company. The API will return a list of entities found in the text. The entities are classified into different types such as person, location, organization, etc.
Supported entity types: PER, LOC, ORG. The API works on English text.
| Type | Code | Example |
|---|---|---|
| Location | LOC | Ireland |
| Person | PER | Michael Jordan |
| Organization | ORG | Tesla |
| Name | Example | Description |
|---|---|---|
text | Jim Carrey is an actor from Canada | The English text from which entities should be extracted. Max 2,000 characters for Latin-script text. Because the text travels in the URL, texts in other scripts are limited to about 800 characters. |
api-key | abcd1234 | Your API key. |
{
"entities": [
{
"type": "PER",
"value": "Jim Carrey",
"start_position": 0,
"end_position": 10,
"image": "https://upload.wikimedia.org/wikipedia/commons/8/8b/Jim_Carrey_2008.jpg"
},
{
"type": "LOC",
"value": "Canada",
"start_position": 28,
"end_position": 34,
"image": null
}
]
} Copy Code
curl -X GET 'https://api.apileague.com/extract-entities?text=Jim+Carrey+is+an+actor+from+Canada' \ -H 'x-api-key: myapikey'
Response Headers:
Content-Type: application/jsonX-API-Quota-Request: The number of tokens used by the requestX-API-Quota-Used: The number of tokens used in total todayX-API-Quota-Left: The number of tokens left today (depends on your plan)The API currently supports the extraction of Persons (PER), Locations (LOC), and Organizations (ORG).
Yes, if available, the API attempts to provide a relevant image URL for the extracted entities, particularly for famous people.
The API is primarily optimized for English text but may work with other languages depending on the context and entity names.
The Extract Entities API identifies specific people, places, and organizations in the text, while the Detect Sentiment API analyzes the overall emotional tone of the text.