ClassificationRequest
Describes a zero-shot classification request for Classify: the candidate labels the document is scored against. Each label optionally carries a longer description that gives the matcher more context; the description never appears in the result. At least two labels are required — classification is zero-shot, so the labels define the entire output space, and a single label would trivially win with probability 1.
Branch weights, supplied text, and the other classification knobs are controlled separately via DocumentClassificationSettings on the document’s settings.
using Nutrient;Construction
public ClassificationRequest()Methods
AddCandidateLabel
public void AddCandidateLabel(string label)Adds a candidate label with no description. Adding a label that is already present (case-insensitive) replaces the existing entry.
Parameters
| Name | Type | Description |
|---|---|---|
label | string | The short display name of the class (for example, “Invoice”). This is the name reported in the result. |
public void AddCandidateLabel(string label, string description)Adds a candidate label with a description. The label is the short name shown in the result; the description is longer context used only to improve matching and never appears in the output. Labels and descriptions may contain any characters. Adding a label that is already present (case-insensitive) replaces the existing entry.
Parameters
| Name | Type | Description |
|---|---|---|
label | string | The short display name of the class (for example, “Invoice”). This is the name reported in the result. |
description | string | Longer context that helps the matcher (for example, “An itemized bill listing goods or services and the total amount due”). |
Resource management
public void Dispose()ClassificationRequest implements IDisposable. Call Dispose() or use a C# using declaration to release its native handle right away. If you don’t, the handle is released when the object is garbage collected.