Builder
class Builder
kotlin.Any | |
↳ | android.view.textclassifier.TextSelection.Builder |
Builder used to build TextSelection
objects.
Summary
Public constructors | |
---|---|
Creates a builder used to build |
Public methods | |
---|---|
TextSelection |
build() Builds and returns |
TextSelection.Builder |
setEntityType(type: String, confidenceScore: Float) Sets an entity type for the classified text and assigns a confidence score. |
TextSelection.Builder |
Sets the extended data. |
TextSelection.Builder |
Sets an id for the TextSelection object. |
TextSelection.Builder |
setTextClassification(textClassification: TextClassification?) Sets the text classification result of the suggested selection. |
Public constructors
Builder
Builder(
startIndex: Int,
endIndex: Int)
Creates a builder used to build TextSelection
objects.
Parameters | |
---|---|
startIndex |
Int: the start index of the text selection. Value is 0 or greater |
endIndex |
Int: the end index of the text selection. Must be greater than startIndex Value is 0 or greater |
Public methods
build
fun build(): TextSelection
Builds and returns TextSelection
object.
Return | |
---|---|
TextSelection |
This value cannot be null . |
setEntityType
fun setEntityType(
type: String,
confidenceScore: Float
): TextSelection.Builder
Sets an entity type for the classified text and assigns a confidence score.
Parameters | |
---|---|
confidenceScore |
Float: a value from 0 (low confidence) to 1 (high confidence). 0 implies the entity does not exist for the classified text. Values greater than 1 are clamped to 1. Value is between 0.0 and 1.0 inclusive |
type |
String: This value cannot be null . Value is android.view.textclassifier.TextClassifier#TYPE_UNKNOWN , android.view.textclassifier.TextClassifier#TYPE_OTHER , android.view.textclassifier.TextClassifier#TYPE_EMAIL , android.view.textclassifier.TextClassifier#TYPE_PHONE , android.view.textclassifier.TextClassifier#TYPE_ADDRESS , android.view.textclassifier.TextClassifier#TYPE_URL , android.view.textclassifier.TextClassifier#TYPE_DATE , android.view.textclassifier.TextClassifier#TYPE_DATE_TIME , android.view.textclassifier.TextClassifier#TYPE_FLIGHT_NUMBER , or android.view.textclassifier.TextClassifier.TYPE_DICTIONARY |
Return | |
---|---|
TextSelection.Builder |
This value cannot be null . |
setExtras
fun setExtras(extras: Bundle?): TextSelection.Builder
Sets the extended data.
Parameters | |
---|---|
extras |
Bundle?: This value may be null . |
Return | |
---|---|
TextSelection.Builder |
this builder This value cannot be null . |
setId
fun setId(id: String?): TextSelection.Builder
Sets an id for the TextSelection object.
Parameters | |
---|---|
id |
String?: This value may be null . |
Return | |
---|---|
TextSelection.Builder |
This value cannot be null . |
setTextClassification
fun setTextClassification(textClassification: TextClassification?): TextSelection.Builder
Sets the text classification result of the suggested selection. If Request.shouldIncludeTextClassification()
is true
, set this value. Otherwise this value may be set to null. The intention of this method is to avoid doing expensive work if the client is not interested in such result.
Parameters | |
---|---|
textClassification |
TextClassification?: This value may be null . |
Return | |
---|---|
TextSelection.Builder |
this builder |