lightbulb_outline Please take our October 2018 developer survey. Start survey

TextLinks.Builder

public static final class TextLinks.Builder
extends Object

java.lang.Object
   ↳ android.view.textclassifier.TextLinks.Builder


A builder to construct a TextLinks instance.

Summary

Public constructors

TextLinks.Builder(String fullText)

Create a new TextLinks.Builder.

Public methods

TextLinks.Builder addLink(int start, int end, Map<StringFloat> entityScores)

Adds a TextLink.

TextLinks build()

Constructs a TextLinks instance.

TextLinks.Builder clearTextLinks()

Removes all TextLinks.TextLinks.

Inherited methods

Public constructors

TextLinks.Builder

added in API level 28
public TextLinks.Builder (String fullText)

Create a new TextLinks.Builder.

Parameters
fullText String: The full text to annotate with links

This value must never be null.

Public methods

addLink

added in API level 28
public TextLinks.Builder addLink (int start, 
                int end, 
                Map<StringFloat> entityScores)

Adds a TextLink.

Parameters
start int: The start index of the identified subsequence

end int: The end index of the identified subsequence

entityScores Map: A mapping of entity type to confidence score

Returns
TextLinks.Builder

This value will never be null.

Throws
IllegalArgumentException if entityScores is null or empty.

build

added in API level 28
public TextLinks build ()

Constructs a TextLinks instance.

Returns
TextLinks the constructed TextLinks

This value will never be null.

clearTextLinks

added in API level 28
public TextLinks.Builder clearTextLinks ()

Removes all TextLinks.TextLinks.

Returns
TextLinks.Builder

This value will never be null.