Stay organized with collections
Save and categorize content based on your preferences.
Builder
class Builder : TextClassifierEvent.Builder<TextClassifierEvent.LanguageDetectionEvent.Builder!>
Builder class for LanguageDetectionEvent
.
Summary
Inherited functions |
From class Builder
T |
setActionIndices(vararg actionIndices: Int)
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();
|
T |
setEntityTypes(vararg entityTypes: String!)
Sets the entity types. e.g. TextClassifier.TYPE_ADDRESS .
Supported types:
See TextClassifier types
See ConversationAction types
See ULocale.toLanguageTag()
|
T |
setEventContext(eventContext: TextClassificationContext?)
Sets the event context.
|
T |
setEventIndex(eventIndex: Int)
Sets the index of this event in the series of events it belongs to.
|
T |
setExtras(extras: Bundle)
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.
|
T |
setLocale(locale: ULocale?)
Sets the detected locale.
|
T |
setModelName(modelVersion: String?)
Sets the model name string.
|
T |
setResultId(resultId: String?)
Sets the id of the text classifier result related to this event.
|
T |
setScores(vararg scores: Float)
Sets the scores of the suggestions.
|
|
Public constructors
Builder
Builder(eventType: Int)
Creates a builder for building TextSelectionEvent
s.
Parameters |
eventType |
Int: The event type. e.g. TYPE_SMART_ACTION Value is android.view.textclassifier.TextClassifierEvent#TYPE_SELECTION_STARTED , android.view.textclassifier.TextClassifierEvent#TYPE_SELECTION_MODIFIED , android.view.textclassifier.TextClassifierEvent#TYPE_SMART_SELECTION_SINGLE , android.view.textclassifier.TextClassifierEvent#TYPE_SMART_SELECTION_MULTI , android.view.textclassifier.TextClassifierEvent#TYPE_AUTO_SELECTION , android.view.textclassifier.TextClassifierEvent#TYPE_ACTIONS_SHOWN , android.view.textclassifier.TextClassifierEvent#TYPE_LINK_CLICKED , android.view.textclassifier.TextClassifierEvent#TYPE_OVERTYPE , android.view.textclassifier.TextClassifierEvent#TYPE_COPY_ACTION , android.view.textclassifier.TextClassifierEvent#TYPE_PASTE_ACTION , android.view.textclassifier.TextClassifierEvent#TYPE_CUT_ACTION , android.view.textclassifier.TextClassifierEvent#TYPE_SHARE_ACTION , android.view.textclassifier.TextClassifierEvent#TYPE_SMART_ACTION , android.view.textclassifier.TextClassifierEvent#TYPE_SELECTION_DRAG , android.view.textclassifier.TextClassifierEvent#TYPE_SELECTION_DESTROYED , android.view.textclassifier.TextClassifierEvent#TYPE_OTHER_ACTION , android.view.textclassifier.TextClassifierEvent#TYPE_SELECT_ALL , android.view.textclassifier.TextClassifierEvent#TYPE_SELECTION_RESET , android.view.textclassifier.TextClassifierEvent#TYPE_MANUAL_REPLY , android.view.textclassifier.TextClassifierEvent#TYPE_ACTIONS_GENERATED , android.view.textclassifier.TextClassifierEvent#TYPE_LINKS_GENERATED , or android.view.textclassifier.TextClassifierEvent.TYPE_READ_CLIPBOARD |
Public methods
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-12-18 UTC.