# EntityExtractor

public interface **EntityExtractor** extends [Closeable](https://developer.android.com/reference/java/io/Closeable.html), [LifecycleObserver](https://developer.android.com/reference/androidx/lifecycle/LifecycleObserver.html) Annotates a text with information about entities referenced in the text.

### Public Method Summary

|---|---|
| abstract Task\<[List](https://developer.android.com/reference/java/util/List.html)\<[EntityAnnotation](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\>\> | [annotate](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#annotate(com.google.mlkit.nl.entityextraction.EntityExtractionParams))([EntityExtractionParams](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams) params) Creates annotations for the given `params`, identifying entities referenced in it. |
| abstract Task\<[List](https://developer.android.com/reference/java/util/List.html)\<[EntityAnnotation](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\>\> | [annotate](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#annotate(java.lang.String))([String](https://developer.android.com/reference/java/lang/String.html) text) Creates annotations for the given `text`, identifying entities referenced in it. |
| abstract void | [close](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#close())() Closes the extractor and releases its resources. |
| abstract Task\<[Void](https://developer.android.com/reference/java/lang/Void.html)\> | [downloadModelIfNeeded](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#downloadModelIfNeeded())() Downloads the appropriate model for the Entity Extractor. |
| abstract Task\<[Void](https://developer.android.com/reference/java/lang/Void.html)\> | [downloadModelIfNeeded](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#downloadModelIfNeeded(com.google.mlkit.common.model.DownloadConditions))(DownloadConditions downloadConditions) Downloads the appropriate model for the Entity Extractor depending on the `https://developers.google.com/android/reference/com/google/mlkit/common/model/DownloadConditions` that were passed. |
| abstract Task\<[Boolean](https://developer.android.com/reference/java/lang/Boolean.html)\> | [isModelDownloaded](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#isModelDownloaded())() Returns `true` if model for the Entity Extractor is downloaded. |

### Inherited Method Summary

From interface java.io.Closeable

|---|---|
| abstract void | close() |

From interface java.lang.AutoCloseable

|---|---|
| abstract void | close() |

## Public Methods

#### public abstract Task\<[List](https://developer.android.com/reference/java/util/List.html)\<[EntityAnnotation](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\>\>
**annotate** ([EntityExtractionParams](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams) params)

Creates annotations for the given `params`, identifying entities
referenced in it. Returns empty list if there is no identified entity.

#### public abstract Task\<[List](https://developer.android.com/reference/java/util/List.html)\<[EntityAnnotation](https://developers.google.com/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\>\>
**annotate** ([String](https://developer.android.com/reference/java/lang/String.html) text)

Creates annotations for the given `text`, identifying entities referenced
in it. Returns empty list if there is no identified entity.

#### public abstract void **close** ()

Closes the extractor and releases its resources.

#### public abstract Task\<[Void](https://developer.android.com/reference/java/lang/Void.html)\> **downloadModelIfNeeded** ()

Downloads the appropriate model for the Entity Extractor. The download will be
triggered as soon as there is a network connection, with no other conditions.

##### Returns

- a `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task` that will be completed when the required files have been downloaded

#### public abstract Task\<[Void](https://developer.android.com/reference/java/lang/Void.html)\> **downloadModelIfNeeded** (DownloadConditions downloadConditions)

Downloads the appropriate model for the Entity Extractor depending on the
`https://developers.google.com/android/reference/com/google/mlkit/common/model/DownloadConditions`
that were passed.

##### Parameters

| downloadConditions | the download conditions for remote model. |
|---|---|

##### Returns

- a `https://developers.google.com/android/reference/com/google/android/gms/tasks/Task` that will be completed when the required files have been downloaded

#### public abstract Task\<[Boolean](https://developer.android.com/reference/java/lang/Boolean.html)\>
**isModelDownloaded** ()

Returns `true` if model for the Entity Extractor is downloaded.