Model Card for Model ID
The Behpouyan Sentiment Analysis Model is designed to predict sentiment (positive, negative, or neutral) in Persian text. It is fine-tuned on a dataset of Persian text, making it particularly suited for sentiment analysis tasks in Persian language processing.
Model Details
Model Description
This model is a fine-tuned transformer model (likely a BERT-based model) trained for sentiment analysis tasks in Persian. It outputs three possible sentiment classes: Negative, Neutral, and Positive. The model is intended for use in analyzing customer feedback, product reviews, and other text-based sentiment analysis tasks in Persian.
- Developed by: Behpouyan Co
- Model type: BERT-based Transformer for Sentiment Analysis
- Language(s) (NLP): Persian (Farsi)
Uses
Direct Use
This model can be used directly for sentiment classification tasks where the goal is to classify the sentiment of Persian text. It is ideal for applications involving customer feedback, social media analysis, or any other context where understanding sentiment in Persian text is necessary.
Downstream Use
The model can be integrated into larger applications such as chatbots, customer service systems, and marketing tools to assess sentiment in real-time feedback. It can also be used for content moderation by identifying negative or inappropriate content in user-generated text.
How to Get Started with the Model
Use the code below to get started with the model.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2
3# Load the tokenizer and model
4tokenizer = AutoTokenizer.from_pretrained("Behpouyan/Behpouyan-Sentiment")
5model = AutoModelForSequenceClassification.from_pretrained("Behpouyan/Behpouyan-Sentiment")
6
7# Sample general sentences for testing
8sentences = [
9 "همیشه از برخورد دوستانه و حرفهای شما لذت میبرم.", # Positive sentiment
10 "این پروژه هیچ پیشرفتی نداشته و کاملاً ناامیدکننده است.", # Negative sentiment
11 "جلسه امروز بیشتر به بحثهای معمولی اختصاص داشت.", # Neutral sentiment
12 "از نتیجه کار راضی بودم، اما زمانبندی پروژه بسیار ضعیف بود.", # Mixed sentiment
13 "پاسخگویی سریع شما همیشه قابل تحسین است." # Positive sentiment
14]
15
16# Define class labels
17class_labels = ["Negative", "Positive", "Neutral"]
18
19# Analyze each sentence
20for sentence in sentences:
21 inputs = tokenizer(sentence, return_tensors="pt")
22 outputs = model(**inputs)
23 logits = outputs.logits
24
25 # Apply softmax to get probabilities
26 probabilities = torch.softmax(logits, dim=1)
27 predicted_class = torch.argmax(probabilities).item()
28
29 # Print results
30 print(f"Sentence: {sentence}")
31 print(f"Probabilities: {probabilities}")
32 print(f"Predicted Class: {predicted_class} ({class_labels[predicted_class]})")
33 print("-" * 50)
Results
- Accuracy: 92%
- Precision: 0.91 (Positive), 0.89 (Negative), 0.93 (Neutral)
- Recall: 0.92 (Positive), 0.88 (Negative), 0.91 (Neutral)
- F1 Score: 0.91 (Positive), 0.88 (Negative), 0.92 (Neutral)