AuraClassify is a powerful content moderation and classification system built on TensorFlow.js, utilizing the Universal Sentence Encoder for text analysis.
- Content moderation and classification
- Multi-category support with subcategories
- Confidence scoring and sentiment analysis
- Detailed analysis reports
- Easy to train and use
- Supports both browser and Node.js environments
npm install auraclassify
const AuraClassify = require('auraclassify');
// Initialize classifier
const classifier = new AuraClassify({
backend: "tfjs" // or "tfjs-node" for Node.js backend
});
// Train the model
await classifier.train({
dataset: trainingData,
log: true,
batchSize: 4
});
// Classify text
const result = await classifier.classify("Text to analyze");
Training data should be an array of objects with input
and output
properties:
const trainingData = [
{
input: "Example text content",
output: "category" // or "category/subcategory"
}
];
-
safe
: Safe content -
sexual
: Adult content -
harassment
: Harassment content -
hate
: Hate speech -
illicit
: Illegal content -
self-harm
: Self-harm content -
violence
: Violent content
Each category can have subcategories (e.g., "violence/threatening", "self-harm/instructions")
const classifier = new AuraClassify({ backend = "tfjs" });
await classifier.train({
dataset: trainingData,
log: true,
batchSize: 4
});
const result = await classifier.classify("Text to analyze");
await classifier.save("path/to/model.json");
await classifier.load("path/to/model.json");
AuraClassify uses the Universal Sentence Encoder to convert text into high-dimensional vectors (embeddings). These embeddings capture semantic meaning, allowing the system to understand context and nuance in text.
The classification process involves:
- Text embedding generation
- Similarity comparison with trained examples
- Category and subcategory detection
- Confidence scoring
- Detailed analysis generation
{
analysis: {
input: {
text: "Original text",
length: 12,
wordCount: 2
},
result: {
label: "category/subcategory",
confidence: 0.85,
confidenceLevel: "HIGH"
},
// ... additional analysis data
},
summary: {
decision: "CATEGORY (HIGH confidence level)",
confidence: 0.85,
status: "RELIABLE"
}
}
Apache License 2.0
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and feature requests, please use the GitHub issues page.