Entity data types
Speechly can post-process some entity values so that they are returned in a more structured format. This is done by assigning the entity to have an appropriate data type.
Below are the supported entity data types, a brief description of what they do, and what standard variable they are designed to work with.
string
The default data type, returns the value verbatim.
date_future
- Standard variable:
$SPEECHLY.DATE
Expressions that define a date are returned as ISO-8601 formatted string. Relative expressions like tomorrow or next Friday are parsed relative to the current date.
january fifth twenty twenty four → 2024-01-05
date_past
- Standard variable:
$SPEECHLY.DATE
Expressions that define a date are returned as ISO-8601 formatted string. Relative expressions like yesterday or last Monday are parsed relative to the current date.
april ninth twenty twenty → 2020-04-09
The two date types only differ in their behavior with relative date expressions in which it is unknown whether the user speaks about the future or the past.
For example, the phrase “on Monday” can either refer to the previous Monday (in the past), or the following Monday (in the future). Likewise, “January fifth” can either refer to the previous or next January.
By choosing the variant that prefers future dates, such phrases are mapped to a date in the future, while the one that prefers the past will return a date in the past, respectively.
Which variant you should use depends on the application in question, and whether your users are more likely to talk about the future or the past.
time
- Standard variable:
$SPEECHLY.TIME
Expressions that define a time of day are returned as a hh:mm formatted string using a 24-hour clock.
three thirty pm → 15:30
quarter past two in the morning → 02:15
twenty past nine pm → 21:20
number
- Standard variable:
$SPEECHLY.*_NUMBER
Normalizes all numeric utterances into digits.
five six four nine → 5649
seventeen point five → 17.5
three hundred thousand → 300000
three quarters → 0.75
identifier
- Standard variable:
$SPEECHLY.IDENTIFIER*
Should be used together with alphanumeric identifiers (sequences) that are spelled out one character at a time. Entities of this type are normalized into character sequences representing the identifier.
zero zero seven x → 007x
one two seven dot zero dot zero dot one slash x y → 127.0.0.1/xy
phone_number
- Standard variable:
$SPEECHLY.PHONE_NUMBER
- Recommended for expressions that are phone numbers. Entities with this type are formatted according to common conventions for writing telephone numbers.
plus four four two oh seven seven three oh one two three four → +44 207 730 1234
proper_noun
- Standard variable:
$SPEECHLY.PERSON_NAME
Should be used with entities that are person names. The returned entity value should in most cases have appropriate capitalization, and parts of the name that were spelled letter by letter should be combined to a single word.
c o n a n o’brien → Conan O’Brien
email_address
- Standard variable:
$SPEECHLY.EMAIL_ADDRESS
Formats the returned entity value as an email address.
john dot smith at company dot com → john.smith@company.com
a n t t i at speechly dot com → antti@speechly.com
url
- Standard variable:
$SPEECHLY.WEB_ADDRESS
Formats the returned entity value as a website URL.
h t t p s colon slash slash docs dot speechly dot com → https://docs.speechly.com
address
- Standard variable:
$SPEECHLY.STREET_ADDRESS
Formats the returned entity value as a US style street address.
one twenty three michigan avenue → 123 Michigan Av.
forty seven east one hundred and tenth street → 47 E 100th St.
lookup
The returned values of entities having lookup
type are normalized according to a simple lookup mechanism. This is useful for mapping synonyms to a normalized value.
t v → tv
tv set → tv
telly → tv
television → tv
See Imports and lookups to learn more.