TextClassificationManager


class TextClassificationManager


Class to handle the creation of TextClassifier.

Summary

Public functions

TextClassifier

Returns the default text classifier provided by this library.

TextClassifier

Returns the text classifier set through setTextClassifier, a default text classifier is returned if it is not ever set, or a null is set.

java-static TextClassificationManager!
of(context: Context)

Returns an instance of TextClassificationManager for the specified context.

Unit

Sets a preferred text classifier.

Public functions

getDefaultTextClassifier

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 of.

getTextClassifier

fun getTextClassifier(): TextClassifier

Returns the text classifier set through setTextClassifier, 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.

of

java-static fun of(context: Context): TextClassificationManager!

Returns an instance of TextClassificationManager for the specified context. Each context has its own TextClassificationManager.

setTextClassifier

fun setTextClassifier(textClassifier: TextClassifier?): Unit

Sets a preferred text classifier.

To turn off the feature completely, you can set a 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.