BertNLClassifier class

Classifier API for NLClassification tasks with Bert models, categorizes string into different classes. The API expects a Bert based TFLite model with metadata populated.

The metadata should contain the following information:

  • 1 input_process_unit for Wordpiece/Sentencepiece Tokenizer.
  • 3 input tensors with names "ids", "mask" and "segment_ids".
  • 1 output tensor of type float32[1, 2], with a optionally attached label file. If a label file is attached, the file should be a plain text file with one label per line, the number of labels should match the number of categories the model outputs.

Properties

base Pointer<TfLiteBertNLClassifier>
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

classify(String text) List<Category>
Perform classification on a string input text,
delete() → void
Deletes BertNLClassifier Instance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create(String modelPath, {BertNLClassifierOptions? options}) BertNLClassifier
Create BertNLClassifier from modelPath and optional options.
createFromAsset(String assetPath, {BertNLClassifierOptions? options}) Future<BertNLClassifier>
Create BertNLClassifier directly from assetPath and optional options.
createFromFile(File modelFile) BertNLClassifier
Create BertNLClassifier from modelFile.
createFromFileAndOptions(File modelFile, BertNLClassifierOptions options) BertNLClassifier
Create BertNLClassifier from modelFile and options.