public final class TextLinks.TextLink


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

Summary

Public methods

static @NonNull TextLinks.TextLink

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

@FloatRange(from = 0.0, to = 1.0) float

Returns the confidence score for a particular entity type.

int

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

@NonNull String
getEntityType(int index)

Returns the entity type at a given index.

int

Returns the number of entity types that have confidence scores.

int

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

@NonNull Bundle

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

@NonNull String

Public methods

createFromBundle

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

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

getConfidenceScore

public @FloatRange(from = 0.0, to = 1.0) float getConfidenceScore(String entityType)

Returns the confidence score for a particular entity type.

Parameters
String entityType

the entity type.

getEnd

public int getEnd()

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

Returns
int

the end index.

getEntityType

public @NonNull String getEntityType(int index)

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

Returns
@NonNull 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 @NonNull Bundle toBundle()

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

toString

public @NonNull String toString()