Global Analytics is a system which crawls tweets from Twitter API, resolving location of tweets which are not geo-tagged using different Geocoding Map API, translate into english, correctify improper words of tweets and then analyzes the sentiment around a targeted topic (here i.e Governance, Economics, Religion, Tourism) using NLTK techniques with the help of TextBlob and generates the Visual Statistics on different Visualization techniques eg: Map, Histogram etc.
Steps involved here for creating analytics:
- Crawling Twitter Data (Twitter API)
- Storing Twitter Data (MongoDB)
- Filter Data (location, text, geo-spatial details)
- Resolving Location (Geocoding Map API)
- Preparing Data (Cleaning tweets ie, urls, @user, unicode, Spell correction)
- Scoring Country (Sentimentally)
- Visualization on OpenStreet Map
- Tweepy
- Pymongo
- Textblob
- MongoDB
- Python 2.7+
- RStudio
Use git clone
to your local machine:
git clone https://github.com/sunnykrGupta/Glob_Analytics.git
Install all dependencies defined in
requirements.txt
:
$ pip install -r requirements.txt
Follow this link to set MongoDB for the first time : Detailed Installation Instruction MongoDB
Install the r programming language by following instructions:
# Install R
$ sudo add-apt-repository "deb http://cran.rstudio.com/bin/linux/ubuntu $(lsb_release -cs)/"
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
$ sudo apt-get update
$ sudo apt-get install r-base r-base-dev
Next, Download the required package according to your Operating System. Download RStudio
Once you have Rstudio up and running, Follow packages or libraries below that are needed for the visualization before running the R-script in your machine:
> install.packages('rgdal')
> install.packages('RColorBrewer')
> install.packages('reshape2')
> install.packages('maps')
This command will install Leaflet in R that is ultimate boss of Map-VIZ. For the installation of the package “leaflet” one should have “devtools” package in your R-studio, following command will take care of that :
> if (!require('devtools')) install.packages('devtools')
> devtools::install_github('rstudio/leaflet')
After the installation of these packages you are ready to visualize yourself the plotting of the tweets, choropleth and graphical experience of the tweets.
Density of Tweets across world wide
Choropleth