Sentiment analysis Bot for Taranis AI
Project description
Taranis AI Sentiment Analysis
This project integrates sentiment analysis into Taranis AI, allowing for the classification of news items as positive, negative, or neutral using transformer models. The API intelligently chooses the appropriate model based on the text length, utilizing XLM-RoBERTa for shorter texts and Longformer for longer texts.
Features
- Multi-language Support with XLM-RoBERTa and Longformer.
- Pre-trained Models for high-accuracy sentiment classification.
- Flask API for external calls to the sentiment analysis.
Setup
Prerequisites
- Python 3.8+
Installation
To install dependencies:
pip install -r requirements.txt
Running the API
To start the Flask API:
python -m sentiment_analysis.api.api_multimodel
By default, the API runs at http://127.0.0.1:5003/.
Example API Call
To test the API with a POST request, use curl:
curl -X POST http://127.0.0.1:5003/analyze_sentiment \
-H "Content-Type: application/json" \
-d '{"text": "This is an example sentence to analyze sentiment."}'
Example Response
{
"sentiment": {
"label": "POSITIVE",
"score": 0.94
}
}
License
EUROPEAN UNION PUBLIC LICENCE v. 1.2
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for taranis_sentiment_analysis-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4af99b76baae889d2d160f7781dcf196ca94d83eb747631907d80485da527e6c |
|
MD5 | 8daba7905dfee0d15d368d9e0354f46e |
|
BLAKE2b-256 | 042760e06fe820ea9a7d35f68127f83889867f79e968028ce1004bbdbeb97391 |
Close
Hashes for taranis_sentiment_analysis-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 059c74a3d48bb4e1baf58678655fc1c58d366a386e2697b69e03ce6b3e09ed63 |
|
MD5 | 08f433031042570d012cc354337acb4c |
|
BLAKE2b-256 | e526c866369cf01bcccfd1ab7bd5b152e3d0e168873b6b5fcd0be71d0c3a8d84 |