auraclassify
v1.0.0
Published
AuraClassify is a powerful content moderation and classification system built on TensorFlow.js, utilizing the Universal Sentence Encoder for text analysis.
Downloads
70
Maintainers
Keywords
Readme
AuraClassify
AuraClassify is a powerful content moderation and classification system built on TensorFlow.js, utilizing the Universal Sentence Encoder for text analysis.
Features
- 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
Installation
npm install auraclassify
Quick Start
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 Format
Training data should be an array of objects with input
and output
properties:
const trainingData = [
{
input: "Example text content",
output: "category" // or "category/subcategory"
}
];
Supported Categories
safe
: Safe contentsexual
: Adult contentharassment
: Harassment contenthate
: Hate speechillicit
: Illegal contentself-harm
: Self-harm contentviolence
: Violent content
Each category can have subcategories (e.g., "violence/threatening", "self-harm/instructions")
API Reference
Constructor
const classifier = new AuraClassify({ backend = "tfjs" });
Methods
train(options)
await classifier.train({
dataset: trainingData,
log: true,
batchSize: 4
});
classify(text)
const result = await classifier.classify("Text to analyze");
save(path)
await classifier.save("path/to/model.json");
load(path)
await classifier.load("path/to/model.json");
How It Works
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
Example Output
{
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"
}
}
License
Apache License 2.0
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and feature requests, please use the GitHub issues page.