---
updatedAt: 2025-07-15T22:12:25.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# Appery Entity Extraction

# CordovaMlPlugin

## Entity Extraction

### Extract entities from text

#### EntityExtractor.extractEntities

##### Parameters

* `{string}` `text` - text to extract entities from
* `{string}` `modelIdentifier` - identifier of a model used for entity extraction
* `{function}` `success` - callback function which takes a parameter data which will be invoked on success
* `{function}` `error` - callback function which takes a parameter err which will be invoked on failure
* `{object}` `options` - options for entity extraction

##### Important notice:

Model used for entity extraction should be downloaded before calling `extractEntities`.

Check it with `EntityExtractor.getDownloadedEntityExtractionModels` and then call `EntityExtractor.downloadEntityExtractionModel` if desired model is missing (see below).

Supported model identifiers can be retrieved via `EntityExtractor.getSupportedEntityExtractionModels`.

##### Supported options

| Property                | Description                                                                                                                                                                                                                                                                                                                   | Examples                |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| `referenceTime`         | Reference time based on which relative dates (e.g. “tomorrow”) should be interpreted. Represented as a number of milliseconds from the epoch of 1970-01-01T00:00:00 (UTC timezone) A null value means that the current time (when entity extraction is invoked) should be used.                                               | `1619440306658`         |
| `preferredLocale`       | A preferred locale that can be used to disambiguate potential values for date-time entities. Any of (or a subset of): `en-*` (`en-US`, `en-UK`, `en-CA`, ...), `ar-*`, `de-`, `es-`, `fr-*`, `it-`, `ja-`, `ko-*`, `nl-`, `pl-`, `pt-*`, `ru-`, `th-`, `tr-*`, `zh-*`. If not specified - the device’s system locale is used. | `"en-UK"`               |
| `typesFilter`           | The subset of entity types that will be detected by the entity extractor. Types not present in the set will not be returned even if they are present in the input text. If not specified - all types of entities are detected. Check [the list of supported entity types](#entity-types)                                      | `["address", "flight"]` |
| `referenceTimeZone`     | Timezone string in tzdata compatible format. Reference time zone based on which relative dates (e.g. “tomorrow”) should be interpreted. If this is not set, the current time zone (when entity extraction is invoked) will be used.                                                                                           | `"America/New_York"`    |
| `downloadModelIfNeeded` | Boolean flag, it enables automatic downloading of an extraction model if it isn't yet downloaded                                                                                                                                                                                                                              | true                    |

##### Response format

For each found entity its location is specified with two fields:

* `location` - index of the first character of the entity
* `length` - number of characters in the entity

`entities` field contain a list of entity descriptors. Each descriptor has a `type`field which contains entity type code (look [here](#entity-types) for a list of possible values) and possibly other fields which are specific for an entity type.

##### Entity Types

| Code              | Description                                          | Example                                  | Additional fields in entity descriptor                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------- | ---------------------------------------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `address`         | Address                                              | 350 third street, Cambridge MA           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `flight`          | Flight Number (IATA flight codes only)               | LX37                                     | <ul> <li>`airlineCode` - The IATA airline designator (two or three letters). </li> <li>`flightNumber` - The flight number (1 to 4 digit number).</li>  </ul>                                                                                                                                                                                                                                                                                                    |
| `iban`            | IBAN                                                 | CH52 0483 0000 0000 0000 9               | <ul> <li>`IBAN` - The full IBAN number in canonical form. </li> <li>`countryCode` - The ISO 3166-1 alpha-2 country code (two letters).</li>  </ul>                                                                                                                                                                                                                                                                                                              |
| `datetime`        | Date-Time                                            | 2019/09/29, let's meet tomorrow at 6pm   | <ul> <li>`dateTime` - The parsed date and time. Represented as a number of milliseconds from the epoch of 1970-01-01T00:00:00 (UTC timezone)  </li> <li>`granularity` - The granularity of the date and time (possible values: `year`, `month`, `week`, `day`, `hour`, `minute` or `second`)</li>  </ul>                                                                                                                                                        |
| `isbn`            | ISBN (version 13 only)                               | 978-1101904190                           | <ul> <li>`ISBN` - The full ISBN number in canonical form</li>  </ul>                                                                                                                                                                                                                                                                                                                                                                                            |
| `phone`           | Phone Number                                         | (555) 225-3556                           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `payment_card`    | Payment / Credit Cards                               | 4111 1111 1111 1111                      | <ul> <li>`paymentCardNetwork` - The payment card network. [Possible values](#payment-card-network-codes)</li> <li>`paymentCardNumber` - The payment card number in canonical form</li>  </ul>                                                                                                                                                                                                                                                                   |
| `email`           | Email address                                        | <entity-extraction@google.com>           |                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `tracking_number` | Tracking Number (standardized international formats) | 1Z204E380338943508                       | <ul> <li>`parcelCarrier` - The parcel tracking carrier. [Possible values](#parcel-carrier-codes)</li> <li>`parcelTrackingNumber` - The parcel tracking number in canonical form.</li>  </ul>                                                                                                                                                                                                                                                                    |
| `money`           | Money/Currency (Arabic numerals only)                | $12, 25 USD                              | <ul> <li>`unnormalizedCurrency` - The currency part of the detected annotation. No formatting is applied so this will return a subset of the initial string.</li> <li>`integerPart` - The integer part of the detected annotation. This is the integer written to the left of the decimal separator. </li> <li>`fractionalPart` - The fractional part of the detected annotation. This is the integer written to the right of the decimal separator.</li> </ul> |
| `url`             | URL                                                  | <https://en.wikipedia.org/wiki/Platypus> |                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

##### Parcel carrier codes

| Code         | Value           |
| ------------ | --------------- |
| `fedEx`      | FedEX           |
| `ups`        | UPS             |
| `dhl`        | DHL             |
| `usps`       | USPS            |
| `ontrac`     | Ontrac          |
| `lasership`  | Lasership       |
| `israelPost` | Israel Post     |
| `swissPost`  | Swiss Post      |
| `msc`        | MSC             |
| `amazon`     | Amazon          |
| `iParcel`    | IParcel         |
| `unknown`    | Unknown carrier |

##### Payment card network codes

| Code           | Value           |
| -------------- | --------------- |
| `amex`         | Amex            |
| `dinersClub`   | DinersClub      |
| `discover`     | Discover        |
| `interPayment` | InterPayment    |
| `jcb`          | JCB             |
| `maestro`      | Maestro         |
| `mastercard`   | Mastercard      |
| `mir`          | Mir             |
| `troy`         | Troy            |
| `unionPay`     | Unionpay        |
| `visa`         | Visa            |
| `unknown`      | Unknown network |

##### Example

```
ApperyioMLCordovaPlugin.EntityExtractor.extractEntities(
    "You can contact the test team tomorrow at info@google.com to determine the best timeline. To follow the progress of your delivery please use this tracking number: 9612804152073070474837",
    "english",
    results => console.log(results),
    error => console.log(error),
    {"preferredLocale": "en-UK"});
```

Sample JSON callback: [entity\_extraction.json](json_callback_samples/entity_extraction.json)

### Get supported extraction models

#### EntityExtractor.getSupportedEntityExtractionModels

##### Parameters

* `{function}` `success` - callback function which takes a parameter data which will be invoked on success
* `{function}` `error` - callback function which takes a parameter err which will be invoked on failure

##### Example

```
ApperyioMLCordovaPlugin.EntityExtractor.getSupportedEntityExtractionModels(
    results => console.log(results),
    error => console.log(error));
```

Sample JSON callback: [supported\_entity\_extraction\_models.json](json_callback_samples/supported_entity_extraction_models.json)

### Get downloaded entity extraction models

#### EntityExtractor.getDownloadedEntityExtractionModels

List of language models that have been downloaded to the device.

##### Parameters

* `{function}` `success` - callback function which takes a parameter data which will be invoked on success
* `{function}` `error` - callback function which takes a parameter err which will be invoked on failure

##### Example

```
ApperyioMLCordovaPlugin.EntityExtractor.getSupportedEntityExtractionModels(
    results=>console.log(results),
    error => console.log(error));
```

Sample JSON callback: [downloaded\_entity\_extraction\_models.json](json_callback_samples/downloaded_entity_extraction_models.json)

### Download and delete entity extraction models

#### EntityExtractor.downloadEntityExtractionModel

#### EntityExtractor.deleteEntityExtractionModel

Download or delete an entity extraction model with specified model identifier.

##### Parameters

* `{string}` `modelIdentifier` - model identifier
* `{function}` `success` - callback function which takes a parameter data which will be invoked on success
* `{function}` `error` -  callback function which takes a parameter err which will be invoked on failure

##### Example

```
ApperyioMLCordovaPlugin.EntityExtractor.downloadEntityExtractionModel("russian", successCallback, errorCallback)
```
```
ApperyioMLCordovaPlugin.EntityExtractor.deleteEntityExtractionModel("russian", successCallback, errorCallback)
```

Sample JSON callback: [download\_delete\_entity\_extraction\_model.json](json_callback_samples/download_delete_entity_extraction_model.json)