Einstein Platform Services

Entity Reference

The API supports normalization for some entities. Normalized data is returned in the normalizedData array. The type and format of the data depends on the type of entity.

DATETIME

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • value—Object contains the normalized value for the token.
  • range—Object contains from and to objects that represent the start value and end value for the token.

2.0

unit

string

Unit of measurement for the token value. Valid values:

  • day
  • hour
  • minute
  • month
  • quarter
  • second
  • week
  • year

The unit returned by the API is determined by the unit in the token. For example, if the token is "between today and tomorrow" the unit is day.

2.0

value

string

Value of the normalized data.

2.0

This entity can sometimes overlap with the DURATION and NUMBER entities.

Examples

{
    "token": "...",
    "label": "DATETIME",
    "probability": 0.9787207,
    "normalizedData": [
        {
            "type": "value",
            "unit": "hour",
            "value": "2020-02-03T17:00:00.000-08:00" // 5pm
        },
        ... or ...
        {
            "type": "range", // between 4pm and 5pm
            "from": {
                "type": "value",
                "unit": "hour",
                "value": "2020-02-03T16:00:00.000-08:00"
            },
            "to": {
                "type": "value",
                "unit": "hour",
                "value": "2020-02-03T17:00:00.000-08:00"
            }
        }
    ]
}
{
  "probabilities": [
    {
      "probability": 0.84189475,
      "label": "DATETIME",
      "token": "between today and tomorrow",
      "span": {
        "start": 22,
        "end": 48
      },
      "normalizedData": [
        {
          "from": {
            "value": "2020-08-10T00:00:00.000-07:00", // Today's date
            "unit": "day",
            "type": "value"
          },
          "to": {
            "value": "2020-08-12T00:00:00.000-07:00", // Tomorrow's date
            "unit": "day",
            "type": "value"
          },
          "type": "range"
        }
      ]
    }
  ],
  "object": "predictresponse"
}

DURATION

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • value—Object contains the normalized value for the token.

2.0

unit

string

Unit of measurement for the token value. Valid values:

  • second—Number of seconds in the duration.

2.0

value

string

Value of the normalized data.

2.0

This entity can sometimes overlap with the DATETIME and NUMBER entities.

Example

{
    "token": "3 hours",
    "label": "DURATION",
    "probability": 0.9125207,
    "normalizedData": [
        {
            "type": "value",
            "value": "10800",
            "unit": "second"
        }
    ]
}

EMAIL

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • value—Object contains the normalized value for the token.

2.0

unit

string

Empty for the EMAIL entity type.

2.0

value

string

Value of the normalized data.

2.0

The API recognizes email addresses in these two formats.

Example

{
  "probabilities": [
    {
      "probability": 1,
      "label": "EMAIL",
      "token": "info at salesforce dot com",
      "span": {
        "start": 0,
        "end": 26
      },
      "normalizedData": [
        {
          "value": "[email protected]",
          "unit": "",
          "type": "value"
        }
      ]
    }
  ],
  "object": "predictresponse"
}

LOCATION

Supports normalization: No

Example

{
    "token": "London",
    "label": "LOCATION",
    "probability": 0.9787207,
    "normalizedData": [],
    "span": {
        ...
    }
}

MONEY

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • value—Object contains the normalized value for the token.

2.0

unit

string

Unit of measurement for the token value. Valid values:

  • EUR—Euro
  • GBP—British pound stering
  • RUB—Russian ruble
  • USD—United States dollar

2.0

value

string

Value of the normalized data. For money, it's the numeric value of the specified currency.

2.0

Example

{
  "probabilities": [
    {
      "probability": 0.95074475,
      "label": "MONEY",
      "token": "five dollars",
      "span": {
        "start": 21,
        "end": 33
      },
      "normalizedData": [
        {
          "value": "5",
          "unit": "USD",
          "type": "value"
        }
      ]
    }
  ],
  "object": "predictresponse"
}

NUMBER

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • value—Object contains the normalized value for the token.

2.0

unit

string

Empty for the NUMBER entity type.

2.0

value

string

Value of the normalized data.

2.0

Example

{
  "probabilities": [
    {
      "probability": 1,
      "label": "NUMBER",
      "token": "Three thousand",
      "span": {
        "start": 0,
        "end": 14
      },
      "normalizedData": [
        {
          "value": "3000",
          "unit": "",
          "type": "value"
        }
      ]
    }
  ],
  "object": "predictresponse"
}

ORGANIZATION

Supports normalization: No

Example

{
  "probability": 0.9469566,
  "label": "ORGANIZATION",
  "token": "Salesforce",
  "span": {
    "start": 25,
    "end": 35
  },
  "normalizedData": []
}

PERCENT

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • value—Object contains the normalized value for the token.
  • range—Object contains from and to objects that represent the start value and end value for the token.

2.0

unit

string

Empty for the PERCENT entity type.

2.0

value

string

Value of the normalized data.

2.0

The normalized value is the percent divided by 100. For example, 50 percent is 0.5. Recognizes percentages in these formats:

  • 50%
  • 50 percent

Example

// Single value example
{
  "token": "150%",
  "label": "PERCENT",
  "probability": 0.9787207,
  "normalizedData": [
    {
      "type": "value",
      "unit": "",
      "value": "1.5"
    }
  ]
}

// Range value example
{
  "probability": 0.99382097,
  "label": "PERCENT",
  "token": "40-50%",
  "span": {
    "start": 26,
    "end": 32
  },
  "normalizedData": [
    {
      "from": {
        "value": "0.4",
        "unit": "",
        "type": "value"
      },
      "to": {
        "value": "0.5",
        "unit": "",
        "type": "value"
      },
      "type": "range"
    }
  ]
}

PERSON

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

firstName

string

Text identified as the person's first name.

2.0

lastName

string

Text identified as the person's last name.

2.0

middleName

string

Text identified as the person's middle name.

2.0

salutation

string

Empty for the PERSON entity type.

2.0

suffix

string

Text identified as the person's suffix such as Jr., Sr., and so on.

2.0

type

string

Normalization type. Valid values:

  • person

2.0

Example

  "probability": 0.99966216,
  "label": "PERSON",
  "token": "Marc Benioff",
  "span": {
    "start": 0,
    "end": 12
  },
  "normalizedData": [
    {
      "firstName": "Marc",
      "lastName": "Benioff",
      "middleName": "",
      "suffix": "",
      "salutation": "",
      "type": "person"
    }
  ]

PHONE-NUMBER

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • phone

2.0

unit

string

Empty for the PHONE-NUMBER entity type.

2.0

value

string

Value of the normalized data.

2.0

Example

{
  "probability": 1,
  "label": "PHONE-NUMBER",
  "token": "408-123-4455",
  "span": {
    "start": 37,
    "end": 49
  },
  "normalizedData": [
    {
      "value": "4081234455",
      "unit": "",
      "type": "value"
    }
  ]
}

URL

Supports normalization: Yes
Normalization fields

Name
Type
Description
Available version

type

string

Normalization type. Valid values:

  • value

2.0

unit

string

Empty for the URL entity type.

2.0

value

string

Value of the normalized data.

2.0

{
  "probabilities": [
    {
      "probability": 1,
      "label": "URL",
      "token": "https://developer.salesforce.com/signup.",
      "span": {
        "start": 58,
        "end": 98
      },
      "normalizedData": [
        {
          "value": "https://developer.salesforce.com/signup.",
          "unit": "",
          "type": "value"
        }
      ]
    }
  ],
  "object": "predictresponse"
}

Updated 5 months ago

Entity Reference


The API supports normalization for some entities. Normalized data is returned in the normalizedData array. The type and format of the data depends on the type of entity.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.