Interface TextClassifier<L>
- Type Parameters:
L- The type of the label (e.g., String, Enum, etc.)
- All Known Implementing Classes:
EmbeddingModelTextClassifier
public interface TextClassifier<L>
Classifies a given text based on a set of labels.
It can return zero, one, or multiple labels for each classification.
-
Method Summary
Modifier and TypeMethodDescriptionClassifies the givenDocument.classify(TextSegment textSegment) Classifies the givenTextSegment.Classifies the given text.default ClassificationResult<L> classifyWithScores(Document document) Classifies the givenDocumentand returns labels with scores.default ClassificationResult<L> classifyWithScores(TextSegment textSegment) Classifies the givenTextSegmentand returns labels with scores.classifyWithScores(String text) Classifies the given text and returns labels with scores.
-
Method Details
-
classify
-
classify
Classifies the givenTextSegment.- Parameters:
textSegment-TextSegmentto classify.- Returns:
- A list of labels. Can contain zero, one, or multiple labels.
-
classify
-
classifyWithScores
Classifies the given text and returns labels with scores.- Parameters:
text- Text to classify.- Returns:
- a result object containing a list of labels with corresponding scores. Can contain zero, one, or multiple labels.
-
classifyWithScores
Classifies the givenTextSegmentand returns labels with scores.- Parameters:
textSegment-TextSegmentto classify.- Returns:
- a result object containing a list of labels with corresponding scores. Can contain zero, one, or multiple labels.
-
classifyWithScores
-