TextSelection.Builder
public
static
final
class
TextSelection.Builder
extends Object
Builder used to build TextSelection
objects.
Summary
Public constructors |
Builder(int startIndex, int endIndex)
Creates a builder used to build TextSelection objects.
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
Public constructors
Builder
public Builder (int startIndex,
int endIndex)
Creates a builder used to build TextSelection
objects.
Parameters |
startIndex |
int : the start index of the text selection.
Value is 0 or greater |
endIndex |
int : the end index of the text selection. Must be greater than startIndex
Value is 0 or greater |
Public methods
setEntityType
public TextSelection.Builder setEntityType (String type,
float confidenceScore)
Sets an entity type for the classified text and assigns a confidence score.
Parameters |
type |
String : This value cannot be null .
Value is TextClassifier.TYPE_UNKNOWN , TextClassifier.TYPE_OTHER , TextClassifier.TYPE_EMAIL , TextClassifier.TYPE_PHONE , TextClassifier.TYPE_ADDRESS , TextClassifier.TYPE_URL , TextClassifier.TYPE_DATE , TextClassifier.TYPE_DATE_TIME , TextClassifier.TYPE_FLIGHT_NUMBER , android.view.textclassifier.TextClassifier.TYPE_DICTIONARY, or TextClassifier.TYPE_OTP |
confidenceScore |
float : a value from 0 (low confidence) to 1 (high confidence).
0 implies the entity does not exist for the classified text.
Values greater than 1 are clamped to 1.
Value is between 0.0 and 1.0 inclusive |
setExtras
public TextSelection.Builder setExtras (Bundle extras)
Sets the extended data.
Parameters |
extras |
Bundle : This value may be null . |
setId
public TextSelection.Builder setId (String id)
Sets an id for the TextSelection object.
Parameters |
id |
String : This value may be null . |
setTextClassification
public TextSelection.Builder setTextClassification (TextClassification textClassification)
Sets the text classification result of the suggested selection. If
Request.shouldIncludeTextClassification()
is true
, set this value.
Otherwise this value may be set to null. The intention of this method is to avoid
doing expensive work if the client is not interested in such result.
Parameters |
textClassification |
TextClassification : This value may be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-13 UTC.
[null,null,["Last updated 2025-02-13 UTC."],[],[]]