The Android Developer Challenge is back! Submit your idea before December 2.

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 getEntityType(int index)

Returns the entity type at a given index.

int getEntityTypeCount()

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.

getEntityType

public String getEntityType (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.

getEntityTypeCount

public int getEntityTypeCount ()

Returns the number of entity types that have confidence scores.

Returns
int the entity type 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