Detect Entities in Text

The Einstein NER (beta) named-entity recognition (NER) model returns entities for a specified string.

📘

Note

As a beta feature, Einstein NER is a preview and isn’t part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. It’s offered as is and isn’t supported, and Salesforce has no liability for any harm or damage arising out of or in connection with it. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature.

Request Parameters

Name

Type

Description

Available Version

document

string

Text to classify. Maximum length is 3,000 characters.

2.0

language

string

Language of the document parameter. Optional. Valid values:

  • Brazilian Portuguese—pt_BR
  • Chinese (Simplified)—zh_CN
  • Chinese (Traditional)—zh_TW
  • Danish (beta)—da
  • Dutch—nl_NL
  • English UK—en_GB
  • English US—en_US
  • French—fr
  • German—de
  • Italian—it
  • Japanese—ja
  • Korean (beta)—ko
  • Portuguese—pt_PT
  • Russian—ru
  • Spanish—es
  • Swedish (beta)—sv

2.0

modelId

string

ID of the model. Optional. Defaults to ENTITIES.

2.0

timeZone

string

Time zone of the returned DATETIME entity. Optional. Defaults to America/Los_Angeles.

See this list of tz database time zones for valid time zones, and use the TZ database name value from the table. For example, Africa/Abidjan.

For more information, see Get DATETIME Values in the Right Time Zone.

2.0

sampleId

string

String that you can pass in to tag the prediction. Optional. Can be any value, and is returned in the response.

2.0

📘

Note

As a beta feature, Danish, Korean, and Swedish language support is a preview and isn’t part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. It’s offered as is and isn’t supported, and Salesforce has no liability for any harm or damage arising out of or in connection with it. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature.

Keep the following points in mind:

  • Response Sort Order—The entities returned in the response are sorted by the span start value. This is the start position in the document parameter string of the words the the API recognizes as an entity.

Response Body

Name

Type

Description

Available Version

object

string

Object returned; in this case, predictresponse.

2.0

probabilities

array

Array of probabilities for the prediction.

2.0

sampleId

string

Same value as request parameter. Returned only if the sampleId request parameter is provided.

2.0

Probabilities Response Body

Name

Type

Description

Available Version

label

string

Probability label for the input. Each label corresponds to an entity type. Valid values are:

  • DATETIME
  • DURATION
  • EMAIL
  • LOCATION
  • MONEY
  • NUMBER
  • ORGANIZATION
  • PERCENT
  • PERSON
  • PHONE-NUMBER
  • URL

2.0

normalizedData

array

Array of objects that contain the details for each normalized token.

2.0

span

object

Contains the start and end position of the token within the input string.

2.0

token

string

Text from the input string that the model detects as an entity.

2.0

NormalizedData Response Body

The normalizedData array is returned for each detected entity. For some entity types, such as LOCATION, the array is returned but is empty. For other entity types, the array contains an object. The data in that object depends on what type of entity the array is associated with. For example, for the PERSON entity, the normalized data array contains an object with: firstName, lastName, middleName, salutation, suffix, and type.

See the Entity Reference for more information about the normalized data for each entity.

Span Response Body

Name

Type

Description

Available Version

end

string

Ending character position of the token within the document string.

2.0

start

string

Starting character position of the token within the document string. The first character of the document string is 0.

2.0

Pass Request Parameters as JSON

When you call the NER endpoint, you can specify a Content-Type of application/json and pass the request parameters as JSON.

{
  "modelId": "ENTITIES",
  "language": "en_US",
  "document": "Marc Benioff, the CEO of Salesforce, gave the keynote speech at the conference in Paris last week."
}

The cURL call looks like this.

Windows

curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" -d "{\"modelId\":\"ENTITIES\", \"language\": \"en_US\", \"document\":\"Marc Benioff, the CEO of Salesforce, gave the keynote speech at the conference in Paris last week.\"}" https://api.einstein.ai/v2/language/entities

Linux

curl -X POST -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" -d '{"modelId":"ENTITIES", "language": "en_US", "document":"Marc Benioff, the CEO of Salesforce, gave the keynote speech at the conference in Paris last week."}' https://api.einstein.ai/v2/language/entities
Language