# Install
#install.packages("tm")  # for text mining
#install.packages("wordcloud") # word-cloud generator 
#install.packages("RColorBrewer") # color palettes
#install.packages("syuzhet") # for sentiment analysis
#install.packages("ggplot2") # for plotting graphs
# Load
library("tm")
## Loading required package: NLP
library("SnowballC")
library("wordcloud")
## Loading required package: RColorBrewer
library("RColorBrewer")
library("syuzhet")
library("ggplot2")
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'package:NLP':
## 
##     annotate
library(data.table)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
## 
##     between, first, last
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
#coffee_reviews <- readLines(file.choose())
coffee_reviews <- fread("ratings_and_sentiments.csv", showProgress = FALSE,encoding = "UTF-8")
head(coffee_reviews)
#summary(coffee_reviews)

Pre-Processing

reviews <- coffee_reviews[["review_text"]]
head(reviews)
## [1] " 11/25/2016 1 check-in Love love loved the vibe! Every corner of the coffee shop had its own style, and there were swings!!! I ordered the matcha coffee, and it was muy fantastico! Ordering and getting my drink were pretty streamlined. I ordered on an iPad, which included all beverage selections that ranged from coffee to alcohol, desired level of sweetness, and a checkout system. I got my coffee within minutes!  I was hoping for a typical heart or feather on my coffee, but found myself listing out all the possibilities of what the vibe may be. Any ideas? "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
## [2] " 12/2/2016 Listed in Date Night: Austin, vibe in Austin BEAUTIFUL!!!! Love the vibe! Instagram-worthy!!!  Definitely $$$, so be prepared. This is gonna cost you a pretty penny :) food food was just decent...nothing to rave about.  But, will probably be back just to be somewhere unique and nice. "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
## [3] " 11/30/2016 1 check-in Listed in food seating I loved the eclectic and homey plush vibe and who doesn't want to swing and drink their coffee?  I would categorize this as a pricier coffee place but, to me it was worth it.  After Thanksgiving nobody wants to make food so we headed out in search of food and foods.  There is ample parking in the private lot and  ordering is done through I-Pads.  Pick a seating and they will call your name when your items are ready.  Be patient because some of the coffee drinks take longer than others.  I had the cold coffee coffee, food and foods and we shared a pop+art!  The po+art was strawberry; light and fluffy on the outside and gooey sweet filling on the inside.  The food and foods wasn't the standard so expect different, complex and interesting flavors from the accompanying slaw and sauce.  I thoroughly enjoyed it but, the food was a bit bland and maybe could have used a bit of honey to spruce it up.  The coffee here is spot on and I hear that their hot chocolate is the bomb but, I will have to wait for the weather to cool off to try that.  A great place to be vibe and chat with your friends, a date or read a book. food and foods Pop tart Coffee See all photos from parkingmela S. for The Factory - Cafe With a Soul "
## [4] "11/25/2016 Very cool vibe! Good drinks Nice seating  However...  Just about everything is bad price. $1.50 extra for 3 ounces of Almond Milk in a coffee. No WiFi vibe is a bit loud and the mix is odd.  Pleasant French oldies followed by loud techno. Several seatings were dirty when we got there. Service is average.  It feels like a Los Angeles coffee shot that is out of place."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
## [5] " 12/3/2016 1 check-in They are location within the Northcross mall shopping center facing east toward Burnet Rd with plenty of parking. I loved their computerized user friendly ordering system, it made it easy me to pick & choose all the items I wanted to try. I ordered pop tart, food & foods, strawberry foods (photos uploaded). This place is ideal for ordering a few dishes to share with your group. seatinging is limited since this place is fairly new with lots of visitors. Arrive early and be prepared to wait a bit if you with a large grop. Store front facing Burnet Rd See all photos from Michelle A. for The Factory - Cafe With a Soul "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
## [6] " 11/20/2016 1 check-in Very cute cafe! I think from the moment I stepped in, there really wasn't anything I didn't find cute at The Factory. From their vibe to their cups, everything was really cute. It's really the perfect place for a catching up with friends or a coffee date.  When you go order, there's really the least amount of interaction ever with the workers. You just pick your order on an iPad and they'll call your order out after for you to pick up at the counter. The whole thing's pretty novel honestly. I got the Viva Matcha coffee and it was so good! Perfect amount of sweetness and perfect temperature. I went on a cold night and this cafe is just so vibe, it was such a great combination. They have these swings as well which were pretty fun to sit on honestly.  price are what I would expect for a cafe like this, not super good price, but not too bad price. There's no internet here, so if you want to study, maybe this isn't the right place. But overall, very nice vibe! Viva matcha coffee and coffee "

If you are getting Multi Byte Errors due to encoding issues run below

reviews <- iconv(reviews,"WINDOWS-1252","UTF-8")
class(reviews)
## [1] "character"

a) Extract the text data from the given dataset and convert it into a VectorSource.

library(tm)
library(NLP)
library(dplyr)

reviews_vs <- VectorSource(reviews)
head(reviews_vs,2)
## [1] " 11/25/2016 1 check-in Love love loved the vibe! Every corner of the coffee shop had its own style, and there were swings!!! I ordered the matcha coffee, and it was muy fantastico! Ordering and getting my drink were pretty streamlined. I ordered on an iPad, which included all beverage selections that ranged from coffee to alcohol, desired level of sweetness, and a checkout system. I got my coffee within minutes!  I was hoping for a typical heart or feather on my coffee, but found myself listing out all the possibilities of what the vibe may be. Any ideas? "
## [2] " 12/2/2016 Listed in Date Night: Austin, vibe in Austin BEAUTIFUL!!!! Love the vibe! Instagram-worthy!!!  Definitely $$$, so be prepared. This is gonna cost you a pretty penny :) food food was just decent...nothing to rave about.  But, will probably be back just to be somewhere unique and nice. "

b) Create a Volatile corpus from the vector source created.

coffee_corpus <- VCorpus(reviews_vs)
class(coffee_corpus)
## [1] "VCorpus" "Corpus"
head(coffee_corpus,2)
## <<VCorpus>>
## Metadata:  corpus specific: 0, document level (indexed): 0
## Content:  documents: 2
coffee_corpus[[15]]
## <<PlainTextDocument>>
## Metadata:  7
## Content:  chars: 397
cat("\n sample below\n")
## 
##  sample below
sample<-coffee_corpus[[15]][1] 
sample
## $content
## [1] " 11/13/2016 Beautiful eccentric coffee shop with a library of peculiar books.  Swings, couches, and pillow corners for cuddle puddles.  Coffee with mint and ways you've never imagined coffee could be made. Try the matcha green tea with soy, creamiest matcha I've ever had.  First time here and already my favorite coffee bar so far. See all photos from Vicki Y. for The Factory - Cafe With a Soul "

Get the frequency of the words in the review text

library(qdap)
## Loading required package: qdapDictionaries
## Loading required package: qdapRegex
## 
## Attaching package: 'qdapRegex'
## The following object is masked from 'package:dplyr':
## 
##     explain
## The following object is masked from 'package:ggplot2':
## 
##     %+%
## Loading required package: qdapTools
## 
## Attaching package: 'qdapTools'
## The following object is masked from 'package:dplyr':
## 
##     id
## The following object is masked from 'package:data.table':
## 
##     shift
## 
## Attaching package: 'qdap'
## The following objects are masked from 'package:tm':
## 
##     as.DocumentTermMatrix, as.TermDocumentMatrix
## The following object is masked from 'package:NLP':
## 
##     ngrams
## The following objects are masked from 'package:base':
## 
##     Filter, proportions
term_count <- freq_terms(coffee_reviews, 10)
term_count

Plot the word count for top 10 frequency

plot(term_count)

#### Convert text to lower case

sample_content
## [1] "11/10/2016 3 check-ins This place has been shown on my social media for days so i finally visited! One of THE cutest and vibeistic looking coffeehops I have ever visited. You can self order which is nice because you can take your time and look at the pictures to help you decide! I especially liked how pictures were shown so I knew which coffee/tea came out aesthetically  I ordered the famous matcha green coffee and i dont usually drink coffee but it went beyond my expectations. They give you a good amount and its creamy and sweet. Only downside is no internet.. So hard to study here. Matcha green tea and living la vida coffee Matcha green tea coffee Interior design See all photos from Sarah L. for The Factory - Cafe With a Soul"
cat("\n Converted Text \n")
## 
##  Converted Text
sample_lower <- tolower(sample_content)
sample_lower
## [1] "11/10/2016 3 check-ins this place has been shown on my social media for days so i finally visited! one of the cutest and vibeistic looking coffeehops i have ever visited. you can self order which is nice because you can take your time and look at the pictures to help you decide! i especially liked how pictures were shown so i knew which coffee/tea came out aesthetically  i ordered the famous matcha green coffee and i dont usually drink coffee but it went beyond my expectations. they give you a good amount and its creamy and sweet. only downside is no internet.. so hard to study here. matcha green tea and living la vida coffee matcha green tea coffee interior design see all photos from sarah l. for the factory - cafe with a soul"

Remove Punctuation marks

library(tm)
sample_content
## [1] "11/10/2016 3 check-ins This place has been shown on my social media for days so i finally visited! One of THE cutest and vibeistic looking coffeehops I have ever visited. You can self order which is nice because you can take your time and look at the pictures to help you decide! I especially liked how pictures were shown so I knew which coffee/tea came out aesthetically  I ordered the famous matcha green coffee and i dont usually drink coffee but it went beyond my expectations. They give you a good amount and its creamy and sweet. Only downside is no internet.. So hard to study here. Matcha green tea and living la vida coffee Matcha green tea coffee Interior design See all photos from Sarah L. for The Factory - Cafe With a Soul"
cat("\n Converted Text \n")
## 
##  Converted Text
sample_punc <- removePunctuation(sample_content)
sample_punc
## [1] "11102016 3 checkins This place has been shown on my social media for days so i finally visited One of THE cutest and vibeistic looking coffeehops I have ever visited You can self order which is nice because you can take your time and look at the pictures to help you decide I especially liked how pictures were shown so I knew which coffeetea came out aesthetically  I ordered the famous matcha green coffee and i dont usually drink coffee but it went beyond my expectations They give you a good amount and its creamy and sweet Only downside is no internet So hard to study here Matcha green tea and living la vida coffee Matcha green tea coffee Interior design See all photos from Sarah L for The Factory  Cafe With a Soul"

Get a list of files available in the current working directory.

path <- getwd()
path
## [1] "/Users/faiz/Downloads/_POP/KLU/bigdataanalytics/Session8/coffee"
list.files(path)
##  [1] "arabica_data_cleaned.csv"   "coffee_analysis.csv"       
##  [3] "coffee.csv"                 "ratings_and_sentiments.csv"
##  [5] "robusta_data_cleaned.csv"   "rsconnect"                 
##  [7] "TextProcessing_files"       "TextProcessing.nb.html"    
##  [9] "TextProcessing.pdf"         "TextProcessing.Rmd"
class(coffee_reviews)
## [1] "data.table" "data.frame"
class(coffee_corpus)
## [1] "VCorpus" "Corpus"
coffee_corpus
## <<VCorpus>>
## Metadata:  corpus specific: 0, document level (indexed): 0
## Content:  documents: 7621

Remove Numbers

sample_content
## [1] "11/10/2016 3 check-ins This place has been shown on my social media for days so i finally visited! One of THE cutest and vibeistic looking coffeehops I have ever visited. You can self order which is nice because you can take your time and look at the pictures to help you decide! I especially liked how pictures were shown so I knew which coffee/tea came out aesthetically  I ordered the famous matcha green coffee and i dont usually drink coffee but it went beyond my expectations. They give you a good amount and its creamy and sweet. Only downside is no internet.. So hard to study here. Matcha green tea and living la vida coffee Matcha green tea coffee Interior design See all photos from Sarah L. for The Factory - Cafe With a Soul"
cat("\n Removed Numbers Text\n")
## 
##  Removed Numbers Text
numberRemoved <-removeNumbers(reviews)
head(numberRemoved)
## [1] " //  check-in Love love loved the vibe! Every corner of the coffee shop had its own style, and there were swings!!! I ordered the matcha coffee, and it was muy fantastico! Ordering and getting my drink were pretty streamlined. I ordered on an iPad, which included all beverage selections that ranged from coffee to alcohol, desired level of sweetness, and a checkout system. I got my coffee within minutes!  I was hoping for a typical heart or feather on my coffee, but found myself listing out all the possibilities of what the vibe may be. Any ideas? "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
## [2] " // Listed in Date Night: Austin, vibe in Austin BEAUTIFUL!!!! Love the vibe! Instagram-worthy!!!  Definitely $$$, so be prepared. This is gonna cost you a pretty penny :) food food was just decent...nothing to rave about.  But, will probably be back just to be somewhere unique and nice. "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
## [3] " //  check-in Listed in food seating I loved the eclectic and homey plush vibe and who doesn't want to swing and drink their coffee?  I would categorize this as a pricier coffee place but, to me it was worth it.  After Thanksgiving nobody wants to make food so we headed out in search of food and foods.  There is ample parking in the private lot and  ordering is done through I-Pads.  Pick a seating and they will call your name when your items are ready.  Be patient because some of the coffee drinks take longer than others.  I had the cold coffee coffee, food and foods and we shared a pop+art!  The po+art was strawberry; light and fluffy on the outside and gooey sweet filling on the inside.  The food and foods wasn't the standard so expect different, complex and interesting flavors from the accompanying slaw and sauce.  I thoroughly enjoyed it but, the food was a bit bland and maybe could have used a bit of honey to spruce it up.  The coffee here is spot on and I hear that their hot chocolate is the bomb but, I will have to wait for the weather to cool off to try that.  A great place to be vibe and chat with your friends, a date or read a book. food and foods Pop tart Coffee See all photos from parkingmela S. for The Factory - Cafe With a Soul "
## [4] "// Very cool vibe! Good drinks Nice seating  However...  Just about everything is bad price. $. extra for  ounces of Almond Milk in a coffee. No WiFi vibe is a bit loud and the mix is odd.  Pleasant French oldies followed by loud techno. Several seatings were dirty when we got there. Service is average.  It feels like a Los Angeles coffee shot that is out of place."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
## [5] " //  check-in They are location within the Northcross mall shopping center facing east toward Burnet Rd with plenty of parking. I loved their computerized user friendly ordering system, it made it easy me to pick & choose all the items I wanted to try. I ordered pop tart, food & foods, strawberry foods (photos uploaded). This place is ideal for ordering a few dishes to share with your group. seatinging is limited since this place is fairly new with lots of visitors. Arrive early and be prepared to wait a bit if you with a large grop. Store front facing Burnet Rd See all photos from Michelle A. for The Factory - Cafe With a Soul "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
## [6] " //  check-in Very cute cafe! I think from the moment I stepped in, there really wasn't anything I didn't find cute at The Factory. From their vibe to their cups, everything was really cute. It's really the perfect place for a catching up with friends or a coffee date.  When you go order, there's really the least amount of interaction ever with the workers. You just pick your order on an iPad and they'll call your order out after for you to pick up at the counter. The whole thing's pretty novel honestly. I got the Viva Matcha coffee and it was so good! Perfect amount of sweetness and perfect temperature. I went on a cold night and this cafe is just so vibe, it was such a great combination. They have these swings as well which were pretty fun to sit on honestly.  price are what I would expect for a cafe like this, not super good price, but not too bad price. There's no internet here, so if you want to study, maybe this isn't the right place. But overall, very nice vibe! Viva matcha coffee and coffee "

Add the words Coffee and Mug to the stop words

library(qdap)
library(tm)

sample_content
## [1] "11/10/2016 3 check-ins This place has been shown on my social media for days so i finally visited! One of THE cutest and vibeistic looking coffeehops I have ever visited. You can self order which is nice because you can take your time and look at the pictures to help you decide! I especially liked how pictures were shown so I knew which coffee/tea came out aesthetically  I ordered the famous matcha green coffee and i dont usually drink coffee but it went beyond my expectations. They give you a good amount and its creamy and sweet. Only downside is no internet.. So hard to study here. Matcha green tea and living la vida coffee Matcha green tea coffee Interior design See all photos from Sarah L. for The Factory - Cafe With a Soul"
cat("\n new stop words after Including 'Coffee' and 'Mug'\n")
## 
##  new stop words after Including 'Coffee' and 'Mug'
new_stops <- c("coffee", "mug", stopwords("en"))
new_stops
##   [1] "coffee"     "mug"        "i"          "me"         "my"        
##   [6] "myself"     "we"         "our"        "ours"       "ourselves" 
##  [11] "you"        "your"       "yours"      "yourself"   "yourselves"
##  [16] "he"         "him"        "his"        "himself"    "she"       
##  [21] "her"        "hers"       "herself"    "it"         "its"       
##  [26] "itself"     "they"       "them"       "their"      "theirs"    
##  [31] "themselves" "what"       "which"      "who"        "whom"      
##  [36] "this"       "that"       "these"      "those"      "am"        
##  [41] "is"         "are"        "was"        "were"       "be"        
##  [46] "been"       "being"      "have"       "has"        "had"       
##  [51] "having"     "do"         "does"       "did"        "doing"     
##  [56] "would"      "should"     "could"      "ought"      "i'm"       
##  [61] "you're"     "he's"       "she's"      "it's"       "we're"     
##  [66] "they're"    "i've"       "you've"     "we've"      "they've"   
##  [71] "i'd"        "you'd"      "he'd"       "she'd"      "we'd"      
##  [76] "they'd"     "i'll"       "you'll"     "he'll"      "she'll"    
##  [81] "we'll"      "they'll"    "isn't"      "aren't"     "wasn't"    
##  [86] "weren't"    "hasn't"     "haven't"    "hadn't"     "doesn't"   
##  [91] "don't"      "didn't"     "won't"      "wouldn't"   "shan't"    
##  [96] "shouldn't"  "can't"      "cannot"     "couldn't"   "mustn't"   
## [101] "let's"      "that's"     "who's"      "what's"     "here's"    
## [106] "there's"    "when's"     "where's"    "why's"      "how's"     
## [111] "a"          "an"         "the"        "and"        "but"       
## [116] "if"         "or"         "because"    "as"         "until"     
## [121] "while"      "of"         "at"         "by"         "for"       
## [126] "with"       "about"      "against"    "between"    "into"      
## [131] "through"    "during"     "before"     "after"      "above"     
## [136] "below"      "to"         "from"       "up"         "down"      
## [141] "in"         "out"        "on"         "off"        "over"      
## [146] "under"      "again"      "further"    "then"       "once"      
## [151] "here"       "there"      "when"       "where"      "why"       
## [156] "how"        "all"        "any"        "both"       "each"      
## [161] "few"        "more"       "most"       "other"      "some"      
## [166] "such"       "no"         "nor"        "not"        "only"      
## [171] "own"        "same"       "so"         "than"       "too"       
## [176] "very"
cat("\nCoffee and Mug words are removed \n\n")
## 
## Coffee and Mug words are removed
review_minus_coffee <- removeWords(reviews, new_stops)

Replace ‘The’ with null and ‘I’ with null for all review text

review_minus_coffee <- gsub("The ",'',review_minus_coffee)
review_minus_coffee <- gsub("I ",'',review_minus_coffee)
head(review_minus_coffee)
## [1] " 11/25/2016 1 check- Love love loved  vibe! Every corner    shop    style,    swings!!! ordered  matcha ,    muy fantastico! Ordering  getting  drink  pretty streamlined. ordered   iPad,  included  beverage selections  ranged    alcohol, desired level  sweetness,   checkout system. got   within minutes!   hoping   typical heart  feather   ,  found  listing    possibilities    vibe may . Any ideas? "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
## [2] " 12/2/2016 Listed  Date Night: Austin, vibe  Austin BEAUTIFUL!!!! Love  vibe! Instagram-worthy!!!  Definitely $$$,   prepared. This  gonna cost   pretty penny :) food food  just decent...nothing  rave .  But, will probably  back just   somewhere unique  nice. "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
## [3] " 11/30/2016 1 check- Listed  food seating loved  eclectic  homey plush vibe    want  swing  drink  ?   categorize    pricier  place ,     worth .  After Thanksgiving nobody wants  make food   headed   search  food  foods.  There  ample parking   private lot   ordering  done  I-Pads.  Pick  seating   will call  name   items  ready.  Be patient      drinks take longer  others.    cold  , food  foods   shared  pop+art!  po+art  strawberry; light  fluffy   outside  gooey sweet filling   inside.  food  foods   standard  expect different, complex  interesting flavors   accompanying slaw  sauce.  thoroughly enjoyed  ,  food   bit bland  maybe   used  bit  honey  spruce  .     spot   hear   hot chocolate   bomb , will   wait   weather  cool   try .  A great place   vibe  chat   friends,  date  read  book. food  foods Pop tart Coffee See  photos  parkingmela S.  Factory - Cafe With  Soul "
## [4] "11/25/2016 Very cool vibe! Good drinks Nice seating  However...  Just  everything  bad price. $1.50 extra  3 ounces  Almond Milk   . No WiFi vibe   bit loud   mix  odd.  Pleasant French oldies followed  loud techno. Several seatings  dirty   got . Service  average.  It feels like  Los Angeles  shot     place."                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
## [5] " 12/3/2016 1 check- They  location within  Northcross mall shopping center facing east toward Burnet Rd  plenty  parking. loved  computerized user friendly ordering system,  made  easy   pick & choose   items wanted  try. ordered pop tart, food & foods, strawberry foods (photos uploaded). This place  ideal  ordering   dishes  share   group. seatinging  limited since  place  fairly new  lots  visitors. Arrive early   prepared  wait  bit     large grop. Store front facing Burnet Rd See  photos  Michelle A.  Factory - Cafe With  Soul "                                                                                                                                                                                                                                                                                                                                                                   
## [6] " 11/20/2016 1 check- Very cute cafe! think   moment stepped ,  really  anything  find cute  Factory. From  vibe   cups, everything  really cute. It's really  perfect place   catching   friends    date.  When  go order,  really  least amount  interaction ever   workers. You just pick  order   iPad   call  order      pick    counter. whole thing's pretty novel honestly. got  Viva Matcha      good! Perfect amount  sweetness  perfect temperature. went   cold night   cafe  just  vibe,     great combination. They   swings  well   pretty fun  sit  honestly.  price    expect   cafe like ,  super good price,    bad price. There's  internet ,    want  study, maybe    right place. But overall,  nice vibe! Viva matcha    "

Replace Mentions with space like “:)”.

sample_content3 <- coffee_corpus[[3333]]$content
sample_content3
## [1] " 10/16/2015 1 check-in Yummy yum yum! :)  I had the widowmaker, it was delicious :) a little sugary, but good :)  I appreciate the service and would go back for sure :)  Note: it's a busy area, may or may not be places to sit, so use the oppurnuoty to drink coffee and take a nice parking :) "
cat("\n After Replacing ':)' with blank \n")
## 
##  After Replacing ':)' with blank
sample_content3 <- gsub(":) ",'',sample_content3)
sample_content3
## [1] " 10/16/2015 1 check-in Yummy yum yum!  I had the widowmaker, it was delicious a little sugary, but good  I appreciate the service and would go back for sure  Note: it's a busy area, may or may not be places to sit, so use the oppurnuoty to drink coffee and take a nice parking "
coffee_corpus_fixed <- Corpus(VectorSource(review_minus_coffee))
coffee_corpus_fixed[[15]]$content
## [1] " 11/13/2016 Beautiful eccentric  shop   library  peculiar books.  Swings, couches,  pillow corners  cuddle puddles.  Coffee  mint  ways  never imagined    made. Try  matcha green tea  soy, creamiest matcha I've ever .  First time   already  favorite  bar  far. See  photos  Vicki Y.  Factory - Cafe With  Soul "
library(qdap)
word_count_without_stop_words <- freq_terms(review_minus_coffee, 20)

plot(word_count_without_stop_words)

clean_coffee_corpus <- function(coffee_corpus){
  coffee_corpus <- tm_map(coffee_corpus, removePunctuation)
  coffee_corpus <- tm_map(coffee_corpus, content_transformer(tolower))
  coffee_corpus <- tm_map(coffee_corpus, removeWords, words = new_stops)
  coffee_corpus <- tm_map(coffee_corpus, stripWhitespace)
  return(coffee_corpus)
}

# Apply your customized function to the tweet_corp: clean_corp
cleaned_corp <- clean_coffee_corpus(coffee_corpus)

# Print out a cleaned up tweet
content(cleaned_corp[[227]])
## [1] " 4232016 friendly nook morning staple locals way busy day enthusiasts looking something new interior minimally furnished fine outdoor space great stop peacefully energized start day menu funky intended play traditional flavors note tried food menu review looks smells delicious "

Word Cloud before Clean Up/pre-processing

library(wordcloud)
library(qdap)
set.seed(1234)
word_count_before_cleanup <- freq_terms(coffee_reviews, 100)

wordcloud(words = word_count_before_cleanup$WORD, freq = word_count_before_cleanup$FREQ, min.freq = 1,           max.words=200, random.order=FALSE, rot.per=0.35,colors=brewer.pal(8, "Dark2"))

Word Cloud After Clean Up/pre-processing

library(wordcloud)
library(qdap)
set.seed(1234)
word_count_without_stop_words <- freq_terms(review_minus_coffee, 80)

wordcloud(words = word_count_without_stop_words$WORD, freq = word_count_without_stop_words$FREQ, min.freq = 1,           max.words=200, random.order=FALSE, rot.per=0.35,colors=brewer.pal(8, "Dark2"))