TextSelection.Builder

class TextSelection.Builder


Builder used to build TextSelection objects.

Summary

Public constructors

Builder(startIndex: @IntRange(from = 0) Int, endIndex: @IntRange(from = 0) Int)

Creates a builder used to build TextSelection objects.

Public functions

TextSelection

Builds and returns TextSelection object.

TextSelection.Builder
setEntityType(
    type: String,
    confidenceScore: @FloatRange(from = 0.0, to = 1.0) Float
)

Sets an entity type for the classified text and assigns a confidence score.

TextSelection.Builder
setExtras(extras: Bundle?)

Sets the extended, vendor specific data.

TextSelection.Builder
setId(id: String?)

Sets an id for the TextSelection object.

Public constructors

Builder

Builder(startIndex: @IntRange(from = 0) Int, endIndex: @IntRange(from = 0) Int)

Creates a builder used to build TextSelection objects.

Parameters
startIndex: @IntRange(from = 0) Int

the start index of the text selection.

endIndex: @IntRange(from = 0) Int

the end index of the text selection. Must be greater than startIndex

Public functions

build

fun build(): TextSelection

Builds and returns TextSelection object.

setEntityType

fun setEntityType(
    type: String,
    confidenceScore: @FloatRange(from = 0.0, to = 1.0) Float
): TextSelection.Builder

Sets an entity type for the classified text and assigns a confidence score.

Parameters
confidenceScore: @FloatRange(from = 0.0, to = 1.0) 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.

setExtras

fun setExtras(extras: Bundle?): TextSelection.Builder

Sets the extended, vendor specific data.

setId

fun setId(id: String?): TextSelection.Builder

Sets an id for the TextSelection object.