Skip to content

zine-robotics/Sentiment-Analysis-Twitter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentiment-Analysis

Use main.py to run your query.

Setup

You can create Virtual Environment using:
python3 -m venv my_env
source my_env/bin/activate

Install requirements by running
pip3 install -r requirements.txt
python3 -m spacy download en_core_web_sm

Running main.py

For checking sentiments pertaining to a given topic or a hashtag or even a user on Twitter,
you can use any query. eg- #Avengers, @twitter or even 'Europe elections'

To run <your-query> :
python3 main.py -q "<your-query>" or python3 main.py -query "<your-query>"

Further Description

Following models, currently, are used and their votes are averaged to produce final sentiment score with confidence(out of 1) in the form of [Negative, Postive] :

  • LSTM (RNN architecture)
  • Naive Bayes classifier for Multinomial model
  • Naive Bayes classifier for multivariate Bernoulli model
  • Gaussian Naive Bayes
  • Logistic Regression
  • C-Support Vector Classification
  • Linear Support Vector Classification
  • Nu-Support Vector Classification.

After finding some free corpuses(corpi?) online, the models are trained. If you want to train yourself, there are some corpi in training-data, you can add your files in that folder and/or change train.py according to your data and train for weights which are stored in weights.

Note: After some testing I found LSTM, SVC and NuSVC to perform much better than others as is also visible by the size of their weights, and therefore if no flag to include all models is passed, by default those are used for predictions. If you want to include all, run with --all flag, as in `python3 main.py --all` . I have still included them, if you find more data, training with it will improve the model, also if you fine tune hyperparameters that will help too, kindly let me know also.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages