Interface IContentClassifier<T>
- Namespace
- AiDotNet.AdversarialRobustness.Safety
- Assembly
- AiDotNet.dll
Defines the interface for ML-based content classification.
public interface IContentClassifier<T>
Type Parameters
TThe numeric data type used for calculations.
Remarks
Content classifiers provide machine learning-based analysis of content to detect harmful, toxic, or inappropriate material. Unlike regex-based pattern matching, ML classifiers can understand semantic meaning and context.
For Beginners: Think of this as an AI-powered content moderator that can understand the meaning of text, not just look for specific keywords. It can detect subtle forms of harmful content that simple pattern matching would miss.
Methods
Classify(Vector<T>)
Classifies content and returns the classification result.
ContentClassificationResult<T> Classify(Vector<T> content)
Parameters
contentVector<T>The content to classify as a vector representation.
Returns
- ContentClassificationResult<T>
The classification result with category predictions and confidence scores.
ClassifyBatch(Matrix<T>)
Classifies a batch of content items.
ContentClassificationResult<T>[] ClassifyBatch(Matrix<T> contents)
Parameters
contentsMatrix<T>Matrix where each row is a content item to classify.
Returns
- ContentClassificationResult<T>[]
Array of classification results, one per input row.
ClassifyText(string)
Classifies content provided as text.
ContentClassificationResult<T> ClassifyText(string text)
Parameters
textstringThe text content to classify.
Returns
- ContentClassificationResult<T>
The classification result with category predictions and confidence scores.
GetSupportedCategories()
Gets the list of content categories this classifier can detect.
string[] GetSupportedCategories()
Returns
- string[]
Array of category names supported by this classifier.
IsReady()
Checks if the classifier is ready to make predictions.
bool IsReady()
Returns
- bool
True if the model is loaded and ready, false otherwise.