Read data, create corpus using a sampling size and save unigrams, bigrams, trigrams and quagrams
For each of the sentence fragments below use your natural language processing algorithm to predict the next word in the sentence.
When you breathe, I want to be the air for you. I’ll be there for you, I’d live and I’d
give
eat
die
sleep
## [1] "When you breathe, I want to be the air for you. I'll be there for you, I'd live and I'd give"
## [1] 70.2
## [1] "When you breathe, I want to be the air for you. I'll be there for you, I'd live and I'd eat"
## [1] 24.2
## [1] "When you breathe, I want to be the air for you. I'll be there for you, I'd live and I'd die"
## [1] 14.5
## [1] "When you breathe, I want to be the air for you. I'll be there for you, I'd live and I'd sleep"
## [1] 21.4
Answer: die
Guy at my table’s wife got up to go to the bathroom and I asked about dessert and he started telling me about his
marital
spiritual
horticultural
financial
## [1] "Guy at my table's wife got up to go to the bathroom and I asked about dessert and he started telling me about his marital"
## [1] 1.1
## [1] "Guy at my table's wife got up to go to the bathroom and I asked about dessert and he started telling me about his spiritual"
## [1] 5.8
## [1] "Guy at my table's wife got up to go to the bathroom and I asked about dessert and he started telling me about his horticultural"
## [1] 0.1
## [1] "Guy at my table's wife got up to go to the bathroom and I asked about dessert and he started telling me about his financial"
## [1] 17.6
Answer marital
I’d give anything to see arctic monkeys this
month
decade
weekend
morning
## [1] "I'd give anything to see arctic monkeys this month"
## [1] 45.8
## [1] "I'd give anything to see arctic monkeys this decade"
## [1] 8
## [1] "I'd give anything to see arctic monkeys this weekend"
## [1] 38.2
## [1] "I'd give anything to see arctic monkeys this morning"
## [1] 50.3
Answer: weekend
Talking to your mom has the same effect as a hug and helps reduce your
stress
sleepiness
hunger
happiness
## [1] "Talking to your mom has the same effect as a hug and helps reduce your stress"
## [1] 7.3
## [1] "Talking to your mom has the same effect as a hug and helps reduce your sleepiness"
## [1] 0
## [1] "Talking to your mom has the same effect as a hug and helps reduce your hunger"
## [1] 4.2
## [1] "Talking to your mom has the same effect as a hug and helps reduce your happiness"
## [1] 4.9
Answer stress
When you were in Holland you were like 1 inch away from me but you hadn’t time to take a
walk
look
minute
picture
## [1] "Talking to your mom has the same effect as a hug and helps reduce your walk"
## [1] 24.1
## [1] "Talking to your mom has the same effect as a hug and helps reduce your look"
## [1] 84.8
## [1] "Talking to your mom has the same effect as a hug and helps reduce your minute"
## [1] 15.2
## [1] "Talking to your mom has the same effect as a hug and helps reduce your picture"
## [1] 22
Answer: picture
I’d just like all of these questions answered, a presentation of evidence, and a jury to settle the
incident
case
matter
account
## [1] "I'd just like all of these questions answered, a presentation of evidence, and a jury to settle the incident "
## [1] 7.8
## [1] "I'd just like all of these questions answered, a presentation of evidence, and a jury to settle the case "
## [1] 45.6
## [1] "I'd just like all of these questions answered, a presentation of evidence, and a jury to settle the matter "
## [1] 32.7
## [1] "I'd just like all of these questions answered, a presentation of evidence, and a jury to settle the account "
## [1] 12.7
Answer: matter
I can’t deal with unsymetrical things. I can’t even hold an uneven number of bags of groceries in each
finger
arm
toe
hand
## [1] "I can't deal with unsymetrical things. I can't even hold an uneven number of bags of groceries in each finger "
## [1] 4.7
## [1] "I can't deal with unsymetrical things. I can't even hold an uneven number of bags of groceries in each arm "
## [1] 6
## [1] "I can't deal with unsymetrical things. I can't even hold an uneven number of bags of groceries in each toe "
## [1] 1.9
## [1] "I can't deal with unsymetrical things. I can't even hold an uneven number of bags of groceries in each hand "
## [1] 37.4
Answer: hand
Every inch of you is perfect from the bottom to the
middle
side
center
top
## [1] "Every inch of you is perfect from the bottom to the middle "
## [1] 21.9
## [1] "Every inch of you is perfect from the bottom to the side "
## [1] 40.2
## [1] "Every inch of you is perfect from the bottom to the center "
## [1] 45.3
## [1] "Every inch of you is perfect from the bottom to the top "
## [1] 53.7
Answer: top
I’m thankful my childhood was filled with imagination and bruises from playing
outside
daily
inside
weekly
## [1] "I’m thankful my childhood was filled with imagination and bruises from playing outside "
## [1] 33.1
## [1] "I’m thankful my childhood was filled with imagination and bruises from playing daily "
## [1] 17.1
## [1] "I’m thankful my childhood was filled with imagination and bruises from playing inside "
## [1] 26.1
## [1] "I’m thankful my childhood was filled with imagination and bruises from playing weekly "
## [1] 6
Answer Outside
I like how the same people are in almost all of Adam Sandler’s
stories
pictures
novels
movies
## [1] "I like how the same people are in almost all of Adam Sandler's stories "
## [1] 18
## [1] "I like how the same people are in almost all of Adam Sandler's pictures "
## [1] 15.2
## [1] "I like how the same people are in almost all of Adam Sandler's novels "
## [1] 3.9
## [1] "I like how the same people are in almost all of Adam Sandler's movies "
## [1] 9.5
Answer: movies