This script will call the Twitter API for keyword related Tweets, clean the data using regex, and then run it through named entity recognition.
With the output we get from the algorithm the data will then be grouped by the category each named entity is assigned to, and then extract the categories we are interested in.
For the full blog post related to this recipe, see How to Retrieve Tweets By Keyword and Identify Named Entities.
Install the Algorithmia client from PyPi:
You’ll also need a free Algorithmia account, which includes 5,000 free credits a month – more than enough to get started with crawling, extracting, and analyzing web data.
Find this line in the script:
and add in your API key.
How to Extract Keyword Tweets and Find Noun Phrases
After putting in your own API key to the line above run it in your console environment: