Twitter analysis using sql
Last updated
Was this helpful?
Last updated
Was this helpful?
En example of a program using sql is the twitter analysis program to fetch twitter messages, analyse the word counts and visualize them with a word cloud
The program is written in Python3 with the following (externeral) packages:
twitter-api
tweepy
yaml
stop_words
langid
sqlite3
collections
The application uses several settings such as database name, search key words etc which can be easily changed in the settings file present in the project.
Open config.yaml and change the setting.
The following steps need to be done to run the program
Check the config.yaml and change the following:
twitter keys with your own keys
required filter key words
required names for the raw database and the clean database
after the configuration the program needs to download some tweets. This might take some time and you might need to restart the program several times. run the progam that downloads the tweets into a database with
(NB this program uses modules tstore.py, tconfig.py)
Once the database is filled with some tweets some cleaning steps need to be performed. This can be done by
The program generates some cleaned tweets and a more normalized database
Lastly we need to count the words in the tweets. We use a program that generates a js file (tword.js) with word counts
by the command line command open tword.htm a word cloud is depicted
Fenna Feenstra
In order to access Twitter Streaming API, we need to get 4 pieces of information from Twitter: API key, API secret, Access token and Access token secret. If you to and log in with your twitter credentials you can create a New App and get the API key credentials for yourself.
For the twitter API we need the tweepy library see .
This project is derived from concepts published by dr Chuck