A Turkish text sentiment analysis tool powered by pre-trained multilingual transformer models, featuring a Streamlit dashboard.
cardiffnlp/twitter-xlm-roberta-base-sentiment-multilingualgit clone https://github.com/YOUR_USERNAME/sentiment_analysis.git
cd sentiment_analysis
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
analyzer = TurkishSentimentAnalyzer()
result = analyzer.predict_sentiment("Bu film gerรงekten harika!")
print(f"Sentiment: {result['sentiment']}")
print(f"Confidence: {result['confidence']:.3f}")
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
1 commits
Python
100.0%
A Turkish text sentiment analysis tool powered by pre-trained multilingual transformer models, featuring a Streamlit dashboard.
cardiffnlp/twitter-xlm-roberta-base-sentiment-multilingualgit clone https://github.com/YOUR_USERNAME/sentiment_analysis.git
cd sentiment_analysis
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
analyzer = TurkishSentimentAnalyzer()
result = analyzer.predict_sentiment("Bu film gerรงekten harika!")
print(f"Sentiment: {result['sentiment']}")
print(f"Confidence: {result['confidence']:.3f}")
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
1 commits
Python
100.0%