https://github.com/shahules786/twitter-sentiment
Sentiment analyzer for your tweets.
https://github.com/shahules786/twitter-sentiment
embedding-vectors natural-language-processing pytorch sentiment-analyzer twitter-domain
Last synced: 12 days ago
JSON representation
Sentiment analyzer for your tweets.
- Host: GitHub
- URL: https://github.com/shahules786/twitter-sentiment
- Owner: shahules786
- License: mit
- Created: 2020-09-24T05:34:39.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-29T15:24:18.000Z (over 4 years ago)
- Last Synced: 2025-03-25T16:54:17.624Z (29 days ago)
- Topics: embedding-vectors, natural-language-processing, pytorch, sentiment-analyzer, twitter-domain
- Language: Python
- Homepage:
- Size: 3.41 MB
- Stars: 63
- Watchers: 2
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[]()
[]()
[]()# Twitter Sentiment analyzer
![]()
Sentiment analysis is the task of determining the sentiment of a given expression in natural language, It is essentially a multiclass text classification text where the given input text is classified into positive, neutral, or negative sentiment. But the number of classes can vary according to the nature of the training dataset. This project aims to build a sentiment analyzer specifically for twitter domain.
![]()
## Why a Custom model for twitter domain?
Simply put, a Tweet is a message sent on Twitter. Most of the tweets do not follow normal English grammar and vocabulary mainly due to the limitation of the number of characters allowed in a tweet. This requires special care to yield better performance, hence this project.
**Want to build a similar project? Read my [article](https://shahules786.medium.com/sentiment-analysis-build-your-nlp-project-d41257d06c8c) to find out how I build twittersentimt.**
## Install
`!pip install twittersentiment`## Examples
- **Using pretrained model**
```python
from twittersentiment import TwitterSentiment
sent = TwitterSentiment.Sentiment()
sent.load_pretrained()
sent.predict("hey how are you?")
```
- **You can train your own model with custom dataset and your choice of word embedding**
```python
from twittersentiment import TwitterSentiment
import pandas as pd
df = pd.read_csv("your_dataset.csv")
sent = TwitterSentiment.Sentiment()
sent.train(df["text"],df["target"],path="/your_model_save_path",name="6B",dim=100)
sent.train("hey you just trained a custom model")```
see [examples](https://github.com/shahules786/Twitter-Sentiment/blob/master/examples/basic.ipynb) for more.