EntityExtractor
Stay organized with collections
Save and categorize content based on your preferences.
Annotates a text with information about entities referenced in the text.
Inherited Method Summary
From interface java.io.Closeable
From interface java.lang.AutoCloseable
Public Methods
Creates annotations for the given params
, identifying entities
referenced in it. Returns empty list if there is no identified entity.
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
>
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
Task
that will
be completed when the required files have been downloaded
public abstract Task< Void
>
downloadModelIfNeeded
(DownloadConditions downloadConditions)
Downloads the appropriate model for the Entity Extractor depending on the DownloadConditions
that were passed.
Parameters
downloadConditions
the download conditions for remote model.
Returns
- a
Task
that will
be completed when the required files have been downloaded
public abstract Task< Boolean
>
isModelDownloaded
()
Returns true
if model for the Entity Extractor is downloaded.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eEntityExtractor\u003c/code\u003e annotates text, identifying entities like people, locations, and organizations.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to annotate text, download necessary models, and manage resources.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eannotate()\u003c/code\u003e returns a list of \u003ccode\u003eEntityAnnotation\u003c/code\u003e objects representing identified entities.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003edownloadModelIfNeeded()\u003c/code\u003e ensures the required model is downloaded for entity extraction.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eclose()\u003c/code\u003e should be called to release resources when the extractor is no longer needed.\u003c/p\u003e\n"]]],[],null,["# EntityExtractor\n\npublic interface **EntityExtractor** extends [Closeable](//developer.android.com/reference/java/io/Closeable.html), [LifecycleObserver](//developer.android.com/reference/androidx/lifecycle/LifecycleObserver.html) \nAnnotates a text with information about entities referenced in the text. \n\n### Public Method Summary\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract Task\\\u003c[List](//developer.android.com/reference/java/util/List.html)\\\u003c[EntityAnnotation](/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\\\u003e\\\u003e | [annotate](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#annotate(com.google.mlkit.nl.entityextraction.EntityExtractionParams))([EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams) params) Creates annotations for the given `params`, identifying entities referenced in it. |\n| abstract Task\\\u003c[List](//developer.android.com/reference/java/util/List.html)\\\u003c[EntityAnnotation](/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\\\u003e\\\u003e | [annotate](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#annotate(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) text) Creates annotations for the given `text`, identifying entities referenced in it. |\n| abstract void | [close](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#close())() Closes the extractor and releases its resources. |\n| abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e | [downloadModelIfNeeded](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#downloadModelIfNeeded())() Downloads the appropriate model for the Entity Extractor. |\n| abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e | [downloadModelIfNeeded](/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 [DownloadConditions](/android/reference/com/google/mlkit/common/model/DownloadConditions) that were passed. |\n| abstract Task\\\u003c[Boolean](//developer.android.com/reference/java/lang/Boolean.html)\\\u003e | [isModelDownloaded](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractor#isModelDownloaded())() Returns `true` if model for the Entity Extractor is downloaded. |\n\n### Inherited Method Summary\n\nFrom interface java.io.Closeable \n\n|---------------|---------|\n| abstract void | close() |\n\nFrom interface java.lang.AutoCloseable \n\n|---------------|---------|\n| abstract void | close() |\n\nPublic Methods\n--------------\n\n#### public abstract Task\\\u003c[List](//developer.android.com/reference/java/util/List.html)\\\u003c[EntityAnnotation](/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\\\u003e\\\u003e\n**annotate** ([EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams) params)\n\nCreates annotations for the given `params`, identifying entities\nreferenced in it. Returns empty list if there is no identified entity. \n\n#### public abstract Task\\\u003c[List](//developer.android.com/reference/java/util/List.html)\\\u003c[EntityAnnotation](/android/reference/com/google/mlkit/nl/entityextraction/EntityAnnotation)\\\u003e\\\u003e\n**annotate** ([String](//developer.android.com/reference/java/lang/String.html) text)\n\nCreates annotations for the given `text`, identifying entities referenced\nin it. Returns empty list if there is no identified entity. \n\n#### public abstract void **close** ()\n\nCloses the extractor and releases its resources. \n\n#### public abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e **downloadModelIfNeeded** ()\n\nDownloads the appropriate model for the Entity Extractor. The download will be\ntriggered as soon as there is a network connection, with no other conditions. \n\n##### Returns\n\n- a [Task](/android/reference/com/google/android/gms/tasks/Task) that will be completed when the required files have been downloaded \n\n#### public abstract Task\\\u003c[Void](//developer.android.com/reference/java/lang/Void.html)\\\u003e **downloadModelIfNeeded** (DownloadConditions downloadConditions)\n\nDownloads the appropriate model for the Entity Extractor depending on the\n[DownloadConditions](/android/reference/com/google/mlkit/common/model/DownloadConditions)\nthat were passed. \n\n##### Parameters\n\n| downloadConditions | the download conditions for remote model. |\n|--------------------|-------------------------------------------|\n\n##### Returns\n\n- a [Task](/android/reference/com/google/android/gms/tasks/Task) that will be completed when the required files have been downloaded \n\n#### public abstract Task\\\u003c[Boolean](//developer.android.com/reference/java/lang/Boolean.html)\\\u003e\n**isModelDownloaded** ()\n\nReturns `true` if model for the Entity Extractor is downloaded."]]