Downloads · 30 days
10
13% of all-time downloads
OsamaBinLikhon/bengali-sentiment-analysis
bengali-sentiment-analysis is a machine learning model from OsamaBinLikhon. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
A production-ready Bengali sentiment analysis system using XLM-RoBERTa for analyzing Bengali, English, and code-mixed text sentiment.
Downloads · 30 days
10
13% of all-time downloads
All-time downloads
77
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md5.3 KB · 56%
From the Hugging Face model README
A production-ready Bengali sentiment analysis system using XLM-RoBERTa for analyzing Bengali, English, and code-mixed text sentiment.
pip install transformers torch
from transformers import pipeline
# Load the model
analyzer = pipeline(
"sentiment-analysis",
model="OsamaBinLikhon/bengali-sentiment-analysis"
)
# Analyze Bengali text
result = analyzer("আমি ভালো আছি")
print(result)
# [{'label': 'positive', 'score': 0.85}]
# Analyze English text
result = analyzer("This is amazing!")
print(result)
# [{'label': 'positive', 'score': 0.94}]
| Sentiment | Bengali | Description |
|---|---|---|
| Positive | ইতিবাচক | Expresses positive sentiment |
| Neutral | নিরপেক্ষ | Expresses neutral sentiment |
| Negative | নেতিবাচক | Expresses negative sentiment |
OsamaBinLikhon/bengali-sentiment-analysis/
├── README.md # This file
├── model_card.md # Detailed model documentation
├── config.json # Model configuration
├── pytorch_model.bin # Model weights
├── tokenizer.json # Tokenizer files
├── vocab.txt # Vocabulary
└── special_tokens_map.json
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "OsamaBinLikhon/bengali-sentiment-analysis"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Analyze with custom settings
text = "আমি খুব খুশি"
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=128)
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
print(predictions)
| Text | Language | Sentiment | Confidence |
|---|---|---|---|
| আমি ভালো আছি | Bengali | Positive | 85% |
| This is amazing! | English | Positive | 94% |
| কি খবর বস | Bengali | Neutral | 48% |
| The product is terrible | English | Negative | 94% |
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by Bengali AI Team