ilaydadoganlp/sentiment_analysis

Turkish Sentiment Analysis with Streamlit Dashboard

2

stars

1

commits

Python

primary language

Jul 2, 2025

updated

README

๐ŸŽญ Turkish Sentiment Analysis Dashboard

A Turkish text sentiment analysis tool powered by pre-trained multilingual transformer models, featuring a Streamlit dashboard.

๐Ÿš€ Features

  • Real-time Sentiment Analysis for Turkish texts
  • Pre-trained Transformer Model (XLM-RoBERTa) with 85-90% accuracy
  • Interactive Web Dashboard built with Streamlit
  • Batch Processing capabilities
  • Probability Distributions and confidence scores
  • Rule-based Fallback system for offline usage

๐Ÿ› ๏ธ Technical Stack

  • Backend: Python 3.8+
  • ML Framework: Hugging Face Transformers
  • Frontend: Streamlit
  • Data Visualization: Plotly, Matplotlib
  • Model: cardiffnlp/twitter-xlm-roberta-base-sentiment-multilingual

๐Ÿ“Š Model Performance

  • Architecture: XLM-RoBERTa Base (125M parameters)
  • Training Data: Multilingual social media texts
  • Languages Supported: 100+ including Turkish
  • Estimated Accuracy: 85-90% for Turkish sentiment classification

๐Ÿš€ Quick Start

Installation

git clone https://github.com/YOUR_USERNAME/sentiment_analysis.git
cd sentiment_analysis

Install dependencies

pip install -r requirements.txt

Usage


streamlit run src/dashboard.py
Open your browser and navigate to http://localhost:8501

Python API Usage


from src.model import TurkishSentimentAnalyzer

Initialize analyzer

analyzer = TurkishSentimentAnalyzer()

Analyze single text

result = analyzer.predict_sentiment("Bu film gerรงekten harika!")
print(f"Sentiment: {result['sentiment']}")
print(f"Confidence: {result['confidence']:.3f}")

Batch analysis

texts = ["ร‡ok gรผzel!", "Berbat bir deneyim", "Ortalama bir รผrรผn"]
results = analyzer.batch_predict(texts)

๐Ÿ“ Project Structure

sentiment_analysis/
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ model.py              # Sentiment analysis model
โ”‚   โ”œโ”€โ”€ dashboard.py          # Streamlit web app
โ”‚   โ””โ”€โ”€ preprocessing.py      # Text preprocessing utilities
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ pretrained_model_info.json
โ”œโ”€โ”€ notebooks/                # Jupyter notebooks (optional)
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ”œโ”€โ”€ README.md                # Project documentation
โ””โ”€โ”€ .gitignore               # Git ignore file

๐ŸŽฏ Use Cases

Social Media Monitoring: Analyze Turkish tweets, comments
Product Review Analysis: E-commerce sentiment tracking
News Sentiment: Media sentiment analysis
Customer Feedback: Service quality assessment
Academic Research: Turkish NLP research

๐Ÿ”ง Configuration

The model automatically downloads from Hugging Face Hub on first run. For offline usage, the system falls back to a rule-based classifier.

๐Ÿ“š Academic References

Akฤฑn, A. A., & Akฤฑn, M. D. (2007). "Zemberek, an open source NLP framework for Turkic languages"
Barbieri, F., et al. (2020). "TweetEval: Unified benchmark and comparative evaluation for tweet classification"
Conneau, A., et al. (2020). "Unsupervised cross-lingual representation learning at scale"
EryiฤŸit, G. (2012). "The impact of automatic morphological analysis & disambiguation on dependency parsing of Turkish

๐Ÿค Contributing

Fork the repository
Create your feature branch (git checkout -b feature/AmazingFeature)
Commit your changes (git commit -m 'Add some AmazingFeature')
Push to the branch (git push origin feature/AmazingFeature)
Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Hugging Face for providing pre-trained models
Cardiff NLP team for the multilingual sentiment model
Turkish NLP community for language resources

Built with โค๏ธ for the Turkish NLP community

Contributors

ilaydadoganlp

1 commits

ilaydadoganlp/sentiment_analysis

Turkish Sentiment Analysis with Streamlit Dashboard

2

stars

1

commits

Python

primary language

Jul 2, 2025

updated

README

๐ŸŽญ Turkish Sentiment Analysis Dashboard

A Turkish text sentiment analysis tool powered by pre-trained multilingual transformer models, featuring a Streamlit dashboard.

๐Ÿš€ Features

  • Real-time Sentiment Analysis for Turkish texts
  • Pre-trained Transformer Model (XLM-RoBERTa) with 85-90% accuracy
  • Interactive Web Dashboard built with Streamlit
  • Batch Processing capabilities
  • Probability Distributions and confidence scores
  • Rule-based Fallback system for offline usage

๐Ÿ› ๏ธ Technical Stack

  • Backend: Python 3.8+
  • ML Framework: Hugging Face Transformers
  • Frontend: Streamlit
  • Data Visualization: Plotly, Matplotlib
  • Model: cardiffnlp/twitter-xlm-roberta-base-sentiment-multilingual

๐Ÿ“Š Model Performance

  • Architecture: XLM-RoBERTa Base (125M parameters)
  • Training Data: Multilingual social media texts
  • Languages Supported: 100+ including Turkish
  • Estimated Accuracy: 85-90% for Turkish sentiment classification

๐Ÿš€ Quick Start

Installation

git clone https://github.com/YOUR_USERNAME/sentiment_analysis.git
cd sentiment_analysis

Install dependencies

pip install -r requirements.txt

Usage


streamlit run src/dashboard.py
Open your browser and navigate to http://localhost:8501

Python API Usage


from src.model import TurkishSentimentAnalyzer

Initialize analyzer

analyzer = TurkishSentimentAnalyzer()

Analyze single text

result = analyzer.predict_sentiment("Bu film gerรงekten harika!")
print(f"Sentiment: {result['sentiment']}")
print(f"Confidence: {result['confidence']:.3f}")

Batch analysis

texts = ["ร‡ok gรผzel!", "Berbat bir deneyim", "Ortalama bir รผrรผn"]
results = analyzer.batch_predict(texts)

๐Ÿ“ Project Structure

sentiment_analysis/
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ model.py              # Sentiment analysis model
โ”‚   โ”œโ”€โ”€ dashboard.py          # Streamlit web app
โ”‚   โ””โ”€โ”€ preprocessing.py      # Text preprocessing utilities
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ pretrained_model_info.json
โ”œโ”€โ”€ notebooks/                # Jupyter notebooks (optional)
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ”œโ”€โ”€ README.md                # Project documentation
โ””โ”€โ”€ .gitignore               # Git ignore file

๐ŸŽฏ Use Cases

Social Media Monitoring: Analyze Turkish tweets, comments
Product Review Analysis: E-commerce sentiment tracking
News Sentiment: Media sentiment analysis
Customer Feedback: Service quality assessment
Academic Research: Turkish NLP research

๐Ÿ”ง Configuration

The model automatically downloads from Hugging Face Hub on first run. For offline usage, the system falls back to a rule-based classifier.

๐Ÿ“š Academic References

Akฤฑn, A. A., & Akฤฑn, M. D. (2007). "Zemberek, an open source NLP framework for Turkic languages"
Barbieri, F., et al. (2020). "TweetEval: Unified benchmark and comparative evaluation for tweet classification"
Conneau, A., et al. (2020). "Unsupervised cross-lingual representation learning at scale"
EryiฤŸit, G. (2012). "The impact of automatic morphological analysis & disambiguation on dependency parsing of Turkish

๐Ÿค Contributing

Fork the repository
Create your feature branch (git checkout -b feature/AmazingFeature)
Commit your changes (git commit -m 'Add some AmazingFeature')
Push to the branch (git push origin feature/AmazingFeature)
Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Hugging Face for providing pre-trained models
Cardiff NLP team for the multilingual sentiment model
Turkish NLP community for language resources

Built with โค๏ธ for the Turkish NLP community

Contributors

ilaydadoganlp

1 commits

Languages

Python

100.0%