Inspiration

Curiosity and President Trump

What it does

Analyzes Donald Trump's tweets, and given a key phrase, constructs a language model for donald trump's tweets on that topic, then uses the model to generate a potential tweet, and tweets it to twitter.

How I built it

First, we cleaned the data of Donald's twitter archive, then used Microsoft Azure Text Analysis API to get key phrases of each tweet. After that, we added functionality to subset the tweets based on appearance of a given word in the set of key phrases of a tweet generated by Azure. With this subset, we then generate and run a language model on the smaller set of more relevant data. This gives a tweet more closely related to the keyword we provide to the system.

Challenges I ran into

the largest challenge by far was finding and incorporating a language model that ran well on a small subset of tweets. we overcame this by using NLTK and a trigram language model. The next challenge was using this to generate a custom corpus based on the data, and not with pre-provided corpuses in the libraries. Yet another challenge was using Microsoft Azure Text Analytics API and thinking about usage limits, with our large amount of tweets that were being analyzed. We overcame this by simply processing them in batches of 1000 tweets every minute to comply by the 1k/60s limit.

Accomplishments that I'm proud of

Improving the standard Neural Net model which gave incomprehensible tweets by using Azure to relate it to a certain topic. This, I believe, was a really good idea for using a small set of data.

What I learned

I learned how to use NLTK, Microsoft Azure Text Analytics API, and Tweepy (twitter API) to make a fully functional twitter bot using Natural Language Processing.

What's next for What Would Trump Tweet

To unleash it on the world, and possibly put it on an AWS or Azure cloud instance to run indefinitely.

Share this project:

Updates