TextLinks.TextLink

public static final class TextLinks.TextLink
extends Object

java.lang.Object
   ↳ androidx.textclassifier.TextLinks.TextLink


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

Summary

Public methods

static TextLinks.TextLink createFromBundle(Bundle bundle)

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

float getConfidenceScore(String entityType)

Returns the confidence score for a particular entity type.

int getEnd()

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

String getEntity(int index)

Returns the entity type at a given index.

int getEntityCount()

Returns the number of entity types that have confidence scores.

int getStart()

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

Bundle toBundle()

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

String toString()

Inherited methods

Public methods

createFromBundle

public static TextLinks.TextLink createFromBundle (Bundle bundle)

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

Parameters
bundle Bundle

Returns
TextLinks.TextLink

getConfidenceScore

public float getConfidenceScore (String entityType)

Returns the confidence score for a particular entity type.

Parameters
entityType String: the entity type.

Returns
float

Value is between 0.0 and 1.0 inclusive.

getEnd

public int getEnd ()

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

Returns
int the end index.

getEntity

public String getEntity (int index)

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

Parameters
index int

Returns
String the entity type at the provided index.

getEntityCount

public int getEntityCount ()

Returns the number of entity types that have confidence scores.

Returns
int the entity count.

getStart

public int getStart ()

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

Returns
int the start index.

toBundle

public Bundle toBundle ()

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

Returns
Bundle

toString

public String toString ()

Returns
String