TextClassifierEvent.Builder
public
static
final
class
TextClassifierEvent.Builder
extends Object
| java.lang.Object | |
| ↳ | android.view.textclassifier.TextClassifierEvent.Builder |
Builder to build a text classifier event.
Summary
Public constructors | |
|---|---|
TextClassifierEvent.Builder(int eventCategory, int eventType)
Creates a builder for building |
|
Public methods | |
|---|---|
TextClassifierEvent
|
build()
Builds and returns a text classifier event. |
TextClassifierEvent.Builder
|
setActionIndices(int... actionIndices)
Sets the indices of the actions involved in this event. |
TextClassifierEvent.Builder
|
setEntityTypes(String... entityTypes)
Sets the entity types. |
TextClassifierEvent.Builder
|
setEventContext(TextClassificationContext eventContext)
Sets the event context. |
TextClassifierEvent.Builder
|
setEventIndex(int eventIndex)
Sets the index of this events in the series of events it belongs to. |
TextClassifierEvent.Builder
|
setEventTime(long eventTime)
Sets the time this event occurred. |
TextClassifierEvent.Builder
|
setExtras(Bundle extras)
Sets a bundle containing non-structured extra information about the event. |
TextClassifierEvent.Builder
|
setLanguage(String language)
For language detection. |
TextClassifierEvent.Builder
|
setRelativeSuggestedWordEndIndex(int relativeSuggestedWordEndIndex)
For smart selection. |
TextClassifierEvent.Builder
|
setRelativeSuggestedWordStartIndex(int relativeSuggestedWordStartIndex)
For smart selection. |
TextClassifierEvent.Builder
|
setRelativeWordEndIndex(int relativeWordEndIndex)
For smart selection. |
TextClassifierEvent.Builder
|
setRelativeWordStartIndex(int relativeWordStartIndex)
For smart selection. |
TextClassifierEvent.Builder
|
setResultId(String resultId)
Sets the id of the text classifier result related to this event. |
TextClassifierEvent.Builder
|
setScore(float score)
Sets the score of the suggestion. |
Inherited methods | |
|---|---|
Public constructors
TextClassifierEvent.Builder
public TextClassifierEvent.Builder (int eventCategory,
int eventType)
Creates a builder for building TextClassifierEvents.
Public methods
build
public TextClassifierEvent build ()
Builds and returns a text classifier event.
| Returns | |
|---|---|
TextClassifierEvent |
This value will never be null. |
setActionIndices
public TextClassifierEvent.Builder setActionIndices (int... actionIndices)
Sets the indices of the actions involved in this event. Actions are usually returned by the text classifier in priority order with the most preferred action at index 0. This index gives an indication of the position of the action that is being reported.
| Parameters | |
|---|---|
actionIndices |
int: This value must never be null. |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setEntityTypes
public TextClassifierEvent.Builder setEntityTypes (String... entityTypes)
Sets the entity types. e.g. TextClassifier#TYPE_ADDRESS.
| Parameters | |
|---|---|
entityTypes |
String: This value must never be null. |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setEventContext
public TextClassifierEvent.Builder setEventContext (TextClassificationContext eventContext)
Sets the event context.
| Parameters | |
|---|---|
eventContext |
TextClassificationContext: This value may be null. |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setEventIndex
public TextClassifierEvent.Builder setEventIndex (int eventIndex)
Sets the index of this events in the series of events it belongs to.
| Parameters | |
|---|---|
eventIndex |
int |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setEventTime
public TextClassifierEvent.Builder setEventTime (long eventTime)
Sets the time this event occurred. This is the number of milliseconds since January 1, 1970, 00:00:00 GMT. 0 indicates not set.
| Parameters | |
|---|---|
eventTime |
long |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setExtras
public TextClassifierEvent.Builder setExtras (Bundle extras)
Sets a bundle containing non-structured extra information about the event.
NOTE: Prefer to set only immutable values on the bundle otherwise, avoid updating the internals of this bundle as it may have unexpected consequences on the clients of the built event object. For similar reasons, avoid depending on mutable objects in this bundle.
| Parameters | |
|---|---|
extras |
Bundle: This value must never be null. |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setLanguage
public TextClassifierEvent.Builder setLanguage (String language)
For language detection. Sets the language tag for the detected locale.
| Parameters | |
|---|---|
language |
String: This value may be null. |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
See also:
setRelativeSuggestedWordEndIndex
public TextClassifierEvent.Builder setRelativeSuggestedWordEndIndex (int relativeSuggestedWordEndIndex)
For smart selection. Sets the relative word (exclusive) index of the end of the smart selection.
| Parameters | |
|---|---|
relativeSuggestedWordEndIndex |
int |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setRelativeSuggestedWordStartIndex
public TextClassifierEvent.Builder setRelativeSuggestedWordStartIndex (int relativeSuggestedWordStartIndex)
For smart selection. Sets the relative word index of the start of the smart selection.
| Parameters | |
|---|---|
relativeSuggestedWordStartIndex |
int |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setRelativeWordEndIndex
public TextClassifierEvent.Builder setRelativeWordEndIndex (int relativeWordEndIndex)
For smart selection. Sets the relative word (exclusive) index of the end of the selection.
| Parameters | |
|---|---|
relativeWordEndIndex |
int |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setRelativeWordStartIndex
public TextClassifierEvent.Builder setRelativeWordStartIndex (int relativeWordStartIndex)
For smart selection. Sets the relative word index of the start of the selection.
| Parameters | |
|---|---|
relativeWordStartIndex |
int |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setResultId
public TextClassifierEvent.Builder setResultId (String resultId)
Sets the id of the text classifier result related to this event.
| Parameters | |
|---|---|
resultId |
String: This value may be null. |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |
setScore
public TextClassifierEvent.Builder setScore (float score)
Sets the score of the suggestion.
| Parameters | |
|---|---|
score |
float |
| Returns | |
|---|---|
TextClassifierEvent.Builder |
This value will never be null. |