The purpose of this report is to summarize my current progress on the Data Science Capstone project. Specifically, I will attempt to do the following:
We begin by reading in the data (I used the “read_lines” function from the “readr” package) and viewing some summary statistics of the data, specifically word counts and line counts.
## [1] 37579923 899384
## [1] 34821445 1010371
## [1] 30194381 2360392
I then combined the files into a single corpus and subsetted the data into a random sample to make the data more manageable. My data set for analysis has about 43,000 elements, or roughly 1% of the original data.
summary(all_subset)
## V1
## Length:42990
## Class :character
## Mode :character
For my exploratory analysis, I used the “Quanteda” package. I examined 1-grams, 2-grams, and 3-grams to get a better sense of the data. The results of the exploratory analysis (tables of counts, word clouds) are shown below.
## the to and a of i in for is that
## 47863 27763 24286 23780 20396 16943 16686 10991 10899 10567
## just said will one like can get time new now
## 3160 3129 3125 2889 2669 2555 2285 2183 2005 1875
## of_the in_the to_the for_the on_the to_be at_the and_the in_a
## 4484 4088 2051 2039 1930 1653 1412 1293 1184
## is_a
## 992
## one_of_the a_lot_of thanks_for_the out_of_the to_be_a
## 370 268 243 175 171
## it_was_a going_to_be some_of_the i_want_to the_end_of
## 169 165 145 145 141
My next step will be to build a predictive model using the training data and the n-grams above. I then plan to deploy the model into a Shiny app where a user can enter a phrase, and the model will predict the following words.