Skip to content

This Good Boy sniffs out the sentiment from Twitter profile and presents it in an elegant way. Or you could also say it as Applying Sentiment Analysis on Twitter Profile and using ChartJs to visualize the result.

License

Notifications You must be signed in to change notification settings

utsavk28/DetectiveDog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Detective Dog

Twitter Profile Sentiment Analyzer
View Demo · Report Bug · Request Feature

📖 Table of Contents

Table of Contents

-----------------------------------------------------

About the Project

This Good Boy sniffs out the sentiment from Twitter profile and presents it in an elegant way.
Or you could also say it as Applying Sentiment Analysis on Twitter Profile and using ChartJs to visualize the result.

-----------------------------------------------------

Screenshots

Desktop Screenshot Desktop Screenshot Info Page Screenshot Mobile Screenshot Mobile Screenshot

-----------------------------------------------------

Tech Stack

Client:

Server:

-----------------------------------------------------

Models

DataSet Used for Training : Sentiment140

Model Training Testing API
Name Settings Accuracy F1 Score Accuracy F1 Score Version
Textblob Default - - 62.24% 0.5994 v1
VaderSentiment Default - - 65.19% 0.6453 v2
Logistic Regression Count Vect. & Lemmatization Used 79.58% 0.8008 77.92% 0.7859 v3-1
TF-IDF & Lemmatization Used 79.80% 0.8015 78.11% 0.7856 v3-2
Bernoulli Naive Bayes Count Vect. & Lemmatization Used 80.36% 0.8051 76.98% 0.7733 v4-1
TF-IDF & Lemmatization Used 80.36% 0.8052 76.98% 0.7733 v4-2
Multinomial Naive Bayes Count Vect. & Lemmatization Used 80.37% 0.8020 76.91% 0.7680 v4-3
TF-IDF & Lemmatization Used 80.36% 0.8051 76.98% 0.7733 v4-4
Gradient Boosting Classifier TF-IDF { min_df=5 } & Lemmatization Used . Gradient Boosting Parameters : {lr=1.5, n=150, depth=10} 80.03% 0.8065 77.00% 0.7780 v5-1
TF-IDF { min_df=5 } & Lemmatization Used . Gradient Boosting Parameters : {lr=1.25, n=300, depth=15} 83.72% 0.8410 76.89% 0.7747

Model Results

Following are the score for the username "elonmusk"

Model API Score
Name Version Positive Score Negative Score
Textblob v1 61.69% 38.31%
VaderSentiment v2 69.71% 32.09%
Logistic Regression v3-1 72.06% 27.94%
v3-2 74.07% 25.93%
Bernoulli Naive Bayes v4-1 68.40% 31.60%
v4-2 72.21% 27.79%
Multinomial Naive Bayes v4-3 67.44% 32.56%
v4-4 62.47% 37.43%
Gradient Boosting Classifier v5-1 64.86% 35.14%

-----------------------------------------------------

API Reference

Get Sentiment using Username

  GET /sentiment-v{x}/<string:username>

{x} is the version number which hosts different ML models. Check Models section for more details

Parameter Type Description
username string Required. Twitter Profile Username

-----------------------------------------------------

Roadmap

  • Frontend using React
  • Backend Model hosting on heroku using Flask Restful API
  • Creating Sentiment model using TextBlob & Vader
  • Custom ML Models :
    • Logistic Regression
    • Naive Bayes
      • Multinomial
      • Bernoulli
    • Gradient Boosting Classifier
  • Custom DL Models :
    • CNN
    • RNN, LSTM
    • BERT
  • Refactoring the WebApp Code
  • Update Notebooks
  • Improve Existing Models

-----------------------------------------------------

Run Locally

Clone the project

  git clone https://github.com/utsavk28/DetectiveDog

Install dependencies in server folder.

  cd server
  python -m venv my-project-env
  source my-project-env/bin/activate
  pip install -r requirements.txt

Generate environment variables and fill in the values.

  cp .env.example .env

Your .env is ignored by git, which you can see in .gitignore, and so, it's safe!

Starting Development Server

  python main.py

Install dependencies in client folder.

  cd ../client # If you are in ./server
  npm i
  change API url in ./client/src/utils/api.js to your need

Starting Client

  npm start

At the end of this, you should have

  • server running at http://127.0.0.1:5000/
  • new_client running at http://localhost:3000/

-----------------------------------------------------

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

API_KEY : Twitter API/Consumer Key

API_KEY_SECRET : Twitter API/Consumer Secret

BEARER_TOKEN : Twitter Bearer Token

ACCESS_TOKEN : Twitter Access Token

ACCESS_TOKEN_SECRET : Twitter Access Secret

-----------------------------------------------------

Authors

-----------------------------------------------------

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

-----------------------------------------------------

License

Distributed under the MIT License. See LICENSE.txt for more information.

-----------------------------------------------------

Acknowledgements

-----------------------------------------------------

Further Reading

-----------------------------------------------------

Related

Here are some related projects

About

This Good Boy sniffs out the sentiment from Twitter profile and presents it in an elegant way. Or you could also say it as Applying Sentiment Analysis on Twitter Profile and using ChartJs to visualize the result.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published