TextClassificationManager
class TextClassificationManager
kotlin.Any | |
↳ | androidx.textclassifier.TextClassificationManager |
Class to handle the creation of TextClassifier
.
Summary
Public methods | |
---|---|
TextClassifier |
Returns the default text classifier provided by this library. |
TextClassifier |
Returns the text classifier set through |
static TextClassificationManager! |
Returns an instance of |
Unit |
setTextClassifier(@Nullable textClassifier: TextClassifier?) Sets a preferred text classifier. |
Public methods
getDefaultTextClassifier
@NonNull fun getDefaultTextClassifier(): TextClassifier
Returns the default text classifier provided by this library.
This is mainly for text classifier implementation to delegate the request to the default text classifier. Otherwise, in most cases, you shuold consider getTextClassifier()
instead.
Note that the returned text classifier should be only used within the same context that is passed to TextClassificationManager#of(Context)
.
See Also
getTextClassifier
@NonNull fun getTextClassifier(): TextClassifier
Returns the text classifier set through setTextClassifier(TextClassifier)
, a default text classifier is returned if it is not ever set, or a null
is set.
If you are implementing a text classifier, and want to delegate requests to the default text classifier provided by this library, you may want to use getDefaultTextClassifier()
instead.
See Also
of
static fun of(@NonNull context: Context): TextClassificationManager!
Returns an instance of TextClassificationManager
for the specified context. Each context has its own TextClassificationManager
.
setTextClassifier
fun setTextClassifier(@Nullable textClassifier: TextClassifier?): Unit
Sets a preferred text classifier.
To turn off the feature completely, you can set a TextClassifier#NO_OP
. If null
is set, default text classifier is used.
Note that the given text classifier is only set to this instance of the TextClassificationManager
.