TextLink

class TextLink
kotlin.Any
   ↳ androidx.textclassifier.TextLinks.TextLink

A link, identifying a substring of text and possible entity types for it.

Summary

Public methods
Int

Returns the start index of this link in the original text.

Float
getConfidenceScore(entityType: String!)

Returns the confidence score for a particular entity type.

Int

Returns the end index of this link in the original text.

String

Int

Returns the number of entity types that have confidence scores.

Bundle

Adds this TextLink to a Bundle that can be read back with the same parameters to createFromBundle(Bundle).

String

Returns the entity type at a given index.

static TextLinks.TextLink
createFromBundle(@NonNull bundle: Bundle)

Extracts a TextLink from a bundle that was added using toBundle().

Public methods

getStart

fun getStart(): Int

Returns the start index of this link in the original text.

Return
Int: the start index.

getConfidenceScore

fun getConfidenceScore(entityType: String!): Float

Returns the confidence score for a particular entity type.

Parameters
entityType String!: the entity type.

getEnd

fun getEnd(): Int

Returns the end index of this link in the original text.

Return
Int: the end index.

toString

@NonNull fun toString(): String

getEntityTypeCount

fun getEntityTypeCount(): Int

Returns the number of entity types that have confidence scores.

Return
Int: the entity type count.

toBundle

@NonNull fun toBundle(): Bundle

Adds this TextLink to a Bundle that can be read back with the same parameters to createFromBundle(Bundle).

getEntityType

@NonNull fun getEntityType(index: Int): String

Returns the entity type at a given index. Entity types are sorted by confidence.

Return
String: the entity type at the provided index.

createFromBundle

@NonNull static fun createFromBundle(@NonNull bundle: Bundle): TextLinks.TextLink

Extracts a TextLink from a bundle that was added using toBundle().