text mining and text analytics step data retrieval we'll use reddit data for this caseand for those unfamiliar with reddittake the time to familiarize yourself with its concepts at www reddit com reddit calls itself "the front page of the internetbecause users can post things they find interesting and/or found somewhere on the internetand only those things deemed interesting by many people are featured as "popularon its homepage you could say reddit gives an overview of the trending things on the internet any user can post within predefined category called "subreddit when post is madeother users get to comment on it and can up-vote it if they like the content or downvote it if they dislike it because post is always part of subredditwe have this metadata at our disposal when we hook up to the reddit api to get our data we're effectively fetching labeled data because we'll assume that post in the subreddit "gameofthroneshas something to do with "gameofthrones to get to our data we make use of the official reddit python api library called praw once we get the data we needwe'll store it in lightweight database-like file called sqlite sqlite is ideal for storing small amounts of data because it doesn' require any setup to use and will respond to sql queries like any regular relational database does any other data storage medium will doif you prefer oracle or postgres databasespython has an excellent library to interact with these without the need to write sql sqlalchemy will work for sqlite files as well figure shows the data retrieval step within the data science process we have no internal data on this internal data retrieving data reddit is the external data source we use we are using praw to access their data api external data data is stored in sqlite figure the data science process data retrieval step for reddit topic classification case open your favorite python interpreterit' time for actionas shown in listing first we need to collect our data from the reddit website if you haven' alreadyuse pip install praw or conda install praw (anacondabefore running the following script note the code for step can also be found in the ipython file data collection it' available in this book' download section