API reference · Kjarni 0.2.7

Class Classifier

Namespace: Kjarni
Assembly: Kjarni.dll

Text classification model.

public class Classifier : IDisposable

Inheritance

object ← Classifier

Implements

IDisposable

Constructors

Classifier(string, string, string?, string[]?, bool, bool)

Create a new Classifier.

public Classifier(string model = "sentiment", string device = "cpu", string? cacheDir = null, string[]? labels = null, bool multiLabel = false, bool quiet = false)

Parameters

model string

device string

cacheDir string?

labels string[]?

multiLabel bool

quiet bool

Properties

NumLabels

Get number of classification labels.

public int NumLabels { get; }

Property Value

int

Methods

Classify(string)

Classifies one text.

public ClassificationResult Classify(string text)

Parameters

text string

Returns

ClassificationResult

The top label and score, with every label's score in .

ClassifyBatch(string[])

Classify a single text.

public ClassificationResult[] ClassifyBatch(string[] texts)

Parameters

texts string[]

Returns

ClassificationResult[]

Dispose()

Releases the native model. The object cannot be used afterwards.

public void Dispose()

~Classifier()

Releases the native model if was not called.

protected ~Classifier()

Kjarni runs the same engine on every platform: