Builder
abstract class Builder<T : TextClassifierEvent.Builder<T>!>
kotlin.Any | |
↳ | android.view.textclassifier.TextClassifierEvent.Builder |
Builder to build a text classifier event.
Summary
Public methods | |
---|---|
open T |
setActionIndices(vararg actionIndices: Int) Sets the indices of the actions involved in this event. |
open T |
setEntityTypes(vararg entityTypes: String!) Sets the entity types. |
open T |
setEventContext(eventContext: TextClassificationContext?) Sets the event context. |
open T |
setEventIndex(eventIndex: Int) Sets the index of this event in the series of events it belongs to. |
open T |
Sets a bundle containing non-structured extra information about the event. |
open T |
Sets the detected locale. |
open T |
setModelName(modelVersion: String?) Sets the model name string. |
open T |
setResultId(resultId: String?) Sets the id of the text classifier result related to this event. |
open T |
Sets the scores of the suggestions. |
Public methods
setActionIndices
open fun setActionIndices(vararg actionIndices: Int): T
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. These indices give an indication of the position of the actions that are being reported.
E.g.
// 3 smart actions are shown at index 0, 1, 2 respectively in response to a link click. new TextClassifierEvent.Builder(CATEGORY_LINKIFY, TYPE_ACTIONS_SHOWN) .setEventIndex(0, 1, 2) ... .build(); ... // Smart action at index 1 is activated. new TextClassifierEvent.Builder(CATEGORY_LINKIFY, TYPE_SMART_ACTION) .setEventIndex(1) ... .build();
Parameters | |
---|---|
actionIndices |
Int: This value cannot be null . |
Return | |
---|---|
T |
This value cannot be null . |
setEntityTypes
open fun setEntityTypes(vararg entityTypes: String!): T
Sets the entity types. e.g. TextClassifier.TYPE_ADDRESS
.
Supported types:
See TextClassifier
types
See ConversationAction
types
Parameters | |
---|---|
entityTypes |
String!: This value cannot be null . |
Return | |
---|---|
T |
This value cannot be null . |
setEventContext
open fun setEventContext(eventContext: TextClassificationContext?): T
Sets the event context.
Parameters | |
---|---|
eventContext |
TextClassificationContext?: This value may be null . |
Return | |
---|---|
T |
This value cannot be null . |
setEventIndex
open fun setEventIndex(eventIndex: Int): T
Sets the index of this event in the series of events it belongs to.
Return | |
---|---|
T |
This value cannot be null . |
setExtras
open fun setExtras(extras: Bundle): T
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 cannot be null . |
Return | |
---|---|
T |
This value cannot be null . |
setLocale
open fun setLocale(locale: ULocale?): T
Sets the detected locale.
Parameters | |
---|---|
locale |
ULocale?: This value may be null . |
Return | |
---|---|
T |
This value cannot be null . |
setModelName
open fun setModelName(modelVersion: String?): T
Sets the model name string.
Parameters | |
---|---|
modelVersion |
String?: This value may be null . |
Return | |
---|---|
T |
This value cannot be null . |
setResultId
open fun setResultId(resultId: String?): T
Sets the id of the text classifier result related to this event.
Parameters | |
---|---|
resultId |
String?: This value may be null . |
Return | |
---|---|
T |
This value cannot be null . |
setScores
open fun setScores(vararg scores: Float): T
Sets the scores of the suggestions.
Parameters | |
---|---|
scores |
Float: This value cannot be null . |
Return | |
---|---|
T |
This value cannot be null . |