https://github.com/crypto-artisan/twitter-sentiment-analysis
Twitter-Sentiment-Analysis
https://github.com/crypto-artisan/twitter-sentiment-analysis
Last synced: 2 months ago
JSON representation
Twitter-Sentiment-Analysis
- Host: GitHub
- URL: https://github.com/crypto-artisan/twitter-sentiment-analysis
- Owner: crypto-artisan
- License: mit
- Created: 2024-02-19T09:57:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-19T09:58:37.000Z (over 1 year ago)
- Last Synced: 2025-01-19T22:22:49.548Z (4 months ago)
- Language: Jupyter Notebook
- Size: 6.96 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sentiment Analysis API for Twitter with a Deep Learnig model and FastAPI
This project implements an API with a deep learning model (Bidirectional LSTM) for sentiment analysis of tweets. The api searches tweets by topic, username and/or date and obtains a prediction of tweets matching the query. The model was trained on a large dataset of tweets (around 1.6 million), and it can classify each tweet as positive or negative.
## Installation
To use this API, you need to have Docker installed on your system. You can then build and run the Docker container by running:
```
docker build -t sentiment-analysis-api .
docker run -p 8000:8000 --name sentiment-api sentiment-analysis-app
```This will build the Docker image and run the container, which listens on http://localhost:8000/. I strongly recommend visiting the following page, which offers an interactive UI of the API: http://localhost:8000/docs
If you don't want to use Docker you can install the requiered packages by running:
```
pip install -r requirements.txt
```And then start the API server running the next command:
```
uvicorn api.main:app --reload
```## Usage
You can then send requests to the API using the following attributes:
- `topic_name`: Returns the sentiment analysis of the latest tweets about a given topic.
- `username`: Returns the sentiment analysis of the latest tweets by a given user.
- `date_init`: Returns the sentiment analysis of the tweets posted since a given date.
- `date_end`: Returns the sentiment analysis of the tweets posted until a given date.
- `limit_number_search`: Limits the number of tweets scraped for the sentiment analysis.The API will return a JSON response with the sentiment analysis results.
## License
This project is licensed under the MIT License. You can use it for any purpose, including commercial projects. However, please credit the original author and provide a link to the original repository.