public final class

TextLinks.TextLink

extends java.lang.Object

 java.lang.Object

↳androidx.textclassifier.TextLinks.TextLink

Overview

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

Summary

Methods
public static TextLinks.TextLinkcreateFromBundle(Bundle bundle)

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

public floatgetConfidenceScore(java.lang.String entityType)

Returns the confidence score for a particular entity type.

public intgetEnd()

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

public java.lang.StringgetEntityType(int index)

Returns the entity type at a given index.

public intgetEntityTypeCount()

Returns the number of entity types that have confidence scores.

public intgetStart()

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

public BundletoBundle()

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

public java.lang.StringtoString()

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Methods

public int getStart()

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

Returns:

the start index.

public int getEnd()

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

Returns:

the end index.

public int getEntityTypeCount()

Returns the number of entity types that have confidence scores.

Returns:

the entity type count.

public java.lang.String getEntityType(int index)

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

Returns:

the entity type at the provided index.

public float getConfidenceScore(java.lang.String entityType)

Returns the confidence score for a particular entity type.

Parameters:

entityType: the entity type.

public java.lang.String toString()

public Bundle toBundle()

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

public static TextLinks.TextLink createFromBundle(Bundle bundle)

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