Summary: Ctors | Methods | Inherited Methods
public
static
final
class
TextLinks.Builder
extends Object
A builder to construct a TextLinks instance.
Summary
Public constructors | |
|---|---|
Builder(String fullText)
Create a new TextLinks.Builder. |
|
Public methods | |
|---|---|
TextLinks.Builder
|
addLink(int start, int end, Map<String, Float> entityScores, Bundle extras)
Adds a TextLink. |
TextLinks.Builder
|
addLink(int start, int end, Map<String, Float> entityScores)
Adds a TextLink. |
TextLinks
|
build()
Constructs a TextLinks instance. |
TextLinks.Builder
|
clearTextLinks()
Removes all |
TextLinks.Builder
|
setExtras(Bundle extras)
Sets the extended data. |
Inherited methods | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
From class
| |||||||||||||||||||||||
Public constructors
Builder
public Builder (String fullText)
Create a new TextLinks.Builder.
| Parameters | |
|---|---|
fullText |
String: The full text to annotate with links.
This value cannot be null. |
Public methods
addLink
public TextLinks.Builder addLink (int start, int end, Map<String, Float> entityScores, Bundle extras)
Adds a TextLink.
| Parameters | |
|---|---|
start |
int |
end |
int |
entityScores |
Map: This value cannot be null. |
extras |
Bundle: An optional bundle containing custom data related to this TextLink.
This value cannot be null. |
| Returns | |
|---|---|
TextLinks.Builder |
This value cannot be null. |
addLink
public TextLinks.Builder addLink (int start, int end, Map<String, Float> 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.
This value cannot be null. |
| Returns | |
|---|---|
TextLinks.Builder |
This value cannot be null. |
| Throws | |
|---|---|
IllegalArgumentException |
if entityScores is null or empty. |
build
public TextLinks build ()
Constructs a TextLinks instance.
| Returns | |
|---|---|
TextLinks |
the constructed TextLinks.
This value cannot be null. |
setExtras
public TextLinks.Builder setExtras (Bundle extras)
Sets the extended data.
| Parameters | |
|---|---|
extras |
Bundle: This value may be null. |
| Returns | |
|---|---|
TextLinks.Builder |
this builder.
This value cannot be null. |