EntityExtractionParams.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Constructors
public Builder (String text)
Parameters
text |
used for entity extraction. |
Public Methods
Defines the subset of type (e.g. Entity.TYPE_URL
)
that are relevant to the use case (can be a single element if only one entity type is
relevant). If this is not set, all possible entity types will be returned.
Sets the preferred locale that can be used to disambiguate potential values for
identified entities. For example, "01/02/2000" is ambiguous and could refer to either
January 2nd or February 1st, but a locale preference could help pick the right one
(en-US would pick the first, en-UK would pick the second).
The supported locales match the list of supported models. So 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 this is not set, the device's locale will be used instead.
Sets the reference time based on which relative dates (e.g. "tomorrow") should be
interpreted, in milliseconds from the epoch of 1970-01-01T00:00:00Z (UTC timezone). If
this is not set, the current time (when entity extraction is invoked) will be used.
Sets the 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.
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.
[null,null,["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eEntityExtractionParams.Builder\u003c/code\u003e is used to create \u003ccode\u003eEntityExtractionParams\u003c/code\u003e objects for entity extraction in text.\u003c/p\u003e\n"],["\u003cp\u003eIt allows filtering by entity types, specifying preferred locale for disambiguation, and setting reference time and timezone for relative dates.\u003c/p\u003e\n"],["\u003cp\u003eThe builder provides methods like \u003ccode\u003esetEntityTypesFilter\u003c/code\u003e, \u003ccode\u003esetPreferredLocale\u003c/code\u003e, \u003ccode\u003esetReferenceTime\u003c/code\u003e, \u003ccode\u003esetReferenceTimeZone\u003c/code\u003e, and \u003ccode\u003ebuild\u003c/code\u003e to customize and create the \u003ccode\u003eEntityExtractionParams\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003eIf locale, reference time, or timezone are not set, the system defaults will be used.\u003c/p\u003e\n"]]],[],null,["# EntityExtractionParams.Builder\n\npublic static class **EntityExtractionParams.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder class for [EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams). \n\n### Public Constructor Summary\n\n|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder#Builder(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) text) Creates a new builder to build [EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams). |\n\n### Public Method Summary\n\n|--------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams) | [build](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder#build())() Builds a [EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams) instance. |\n| [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) | [setEntityTypesFilter](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder#setEntityTypesFilter(java.util.Set\u003cjava.lang.Integer\u003e))([Set](//developer.android.com/reference/java/util/Set.html)\\\u003c[Integer](//developer.android.com/reference/java/lang/Integer.html)\\\u003e typesFilter) Defines the subset of type (e.g. |\n| [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) | [setPreferredLocale](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder#setPreferredLocale(java.util.Locale))([Locale](//developer.android.com/reference/java/util/Locale.html) preferredLocale) Sets the preferred locale that can be used to disambiguate potential values for identified entities. |\n| [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) | [setReferenceTime](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder#setReferenceTime(java.lang.Long))([Long](//developer.android.com/reference/java/lang/Long.html) referenceTime) Sets the reference time based on which relative dates (e.g. |\n| [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) | [setReferenceTimeZone](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder#setReferenceTimeZone(java.util.TimeZone))([TimeZone](//developer.android.com/reference/java/util/TimeZone.html) referenceTimeZone) Sets the reference time zone based on which relative dates (e.g. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** ([String](//developer.android.com/reference/java/lang/String.html) text)\n\nCreates a new builder to build [EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams). \n\n##### Parameters\n\n| text | used for entity extraction. |\n|------|-----------------------------|\n\nPublic Methods\n--------------\n\n#### public [EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams)\n**build** ()\n\nBuilds a [EntityExtractionParams](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams)\ninstance. \n\n#### public [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) **setEntityTypesFilter** ([Set](//developer.android.com/reference/java/util/Set.html)\\\u003c[Integer](//developer.android.com/reference/java/lang/Integer.html)\\\u003e typesFilter)\n\nDefines the subset of type (e.g. [Entity.TYPE_URL](/android/reference/com/google/mlkit/nl/entityextraction/Entity#TYPE_URL))\nthat are relevant to the use case (can be a single element if only one entity type is\nrelevant). If this is not set, all possible entity types will be returned. \n\n#### public [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) **setPreferredLocale** ([Locale](//developer.android.com/reference/java/util/Locale.html) preferredLocale)\n\nSets the preferred locale that can be used to disambiguate potential values for\nidentified entities. For example, \"01/02/2000\" is ambiguous and could refer to either\nJanuary 2nd or February 1st, but a locale preference could help pick the right one\n(en-US would pick the first, en-UK would pick the second).\n\nThe supported locales match the list of supported models. So any of (or a subset\nof): `'en-*'` (`'en-US'`, `'en-UK'`,\n`'en-CA'`, ...), `'ar-*'`, `'de-*'`,\n`'es-*'`, `'fr-*'`, `'it-*'`, `'ja-*'`,\n`'ko-*'`, `'nl-*'`, `'pl-*'`, `'pt-*'`,\n`'ru-*'`, `'th-*'`, `'tr-*'`, `'zh-*'`\n\nIf this is not set, the device's locale will be used instead. \n\n#### public [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) **setReferenceTime** ([Long](//developer.android.com/reference/java/lang/Long.html) referenceTime)\n\nSets the reference time based on which relative dates (e.g. \"tomorrow\") should be\ninterpreted, in milliseconds from the epoch of 1970-01-01T00:00:00Z (UTC timezone). If\nthis is not set, the current time (when entity extraction is invoked) will be used. \n\n#### public [EntityExtractionParams.Builder](/android/reference/com/google/mlkit/nl/entityextraction/EntityExtractionParams.Builder) **setReferenceTimeZone** ([TimeZone](//developer.android.com/reference/java/util/TimeZone.html) referenceTimeZone)\n\nSets the reference time zone based on which relative dates (e.g. \"tomorrow\") should\nbe interpreted. If this is not set, the current time zone (when entity extraction is\ninvoked) will be used."]]