library(rvest)
## Warning: package 'rvest' was built under R version 3.5.1
## Loading required package: xml2
## Warning: package 'xml2' was built under R version 3.5.1
library(XML)
## Warning: package 'XML' was built under R version 3.5.1
##
## Attaching package: 'XML'
## The following object is masked from 'package:rvest':
##
## xml
library(magrittr)
## Warning: package 'magrittr' was built under R version 3.5.1
library(tm)
## Warning: package 'tm' was built under R version 3.5.1
## Loading required package: NLP
## Warning: package 'NLP' was built under R version 3.5.1
library(wordcloud)
## Warning: package 'wordcloud' was built under R version 3.5.1
## Loading required package: RColorBrewer
library(wordcloud2)
library(syuzhet)
## Warning: package 'syuzhet' was built under R version 3.5.1
library(lubridate)
## Warning: package 'lubridate' was built under R version 3.5.1
##
## Attaching package: 'lubridate'
## The following object is masked from 'package:base':
##
## date
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.5.1
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:NLP':
##
## annotate
library(scales)
## Warning: package 'scales' was built under R version 3.5.1
##
## Attaching package: 'scales'
## The following object is masked from 'package:syuzhet':
##
## rescale
library(reshape2)
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.5.1
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:lubridate':
##
## intersect, setdiff, union
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
# install.packages('devtools')
# devtools::install_github("lchiffon/wordcloud2")
# IMDBReviews #############################
aurl <- "https://www.imdb.com/title/tt1477834/reviews?ref_=tt_ov_rt"
IMDB_reviews <- NULL
for (i in 1:10){
murl <- read_html(as.character(paste(aurl,i,sep="=")))
rev <- murl %>%
html_nodes(".show-more__control") %>%
html_text()
IMDB_reviews <- c(IMDB_reviews,rev)
}
length(IMDB_reviews)
## [1] 750
setwd("C:/Users/Thiru/Desktop/Assignments In Progress/Text Mining/IMDB Analysis")
write.table(IMDB_reviews,"Aquaman.txt",row.names = F)
Aquaman <- read.delim('Aquaman.txt')
str(Aquaman)
## 'data.frame': 500 obs. of 1 variable:
## $ x: Factor w/ 26 levels "\n ",..: 9 1 6 1 24 1 14 1 11 1 ...
View(Aquaman)
# Build Corpus and DTM/TDM
library(tm)
corpus <- Aquaman[-1,]
head(corpus)
## [1] \n
## [2] CinematographyVisualsStoryPlotWritingDirectingAction scenesVilliansDevelepmentsAtmosphereI didn't even think another human being could top Snyder's visuals in DCEU. Well, I wasn't wrong about that one. I still think his visuals are the best in DCEU but this movie had lots of moments too, those wide angle and tracking shots were a treat. The cinematography was really satisfying, so thank you to Don Burgess and James Wan for that. Underwater CGI scenes were breathtakingly beautiful to look at. Set-pieces makes you forget about the world you live in. They're not on the same level as LOTR or Indiana Jones or Star Wars but It's close, and I think that's a pretty tough thing to accomplish. Dialogues were cringy now and then but, unfortunately, that's what makes a super-hero movie ''good'' nowadays, and this probably will continue for the next 10 years. Too bad the days where Nolan's TDK Trilogy gave you goosebumps with just words are gone. Now it's just you have to act weird and say something out of place to create a chemistry between the characters. I can't even believe how people buy these kinds of contrived relationships anymore. Anyways, let me say this, the movie isn't something like Thor (2011) It doesn't make you feel like you're on a movie set. It actually has high-quality different places that set the movie's atmosphere perfectly. If you guys worried about if the movie is just a copycat of MCU film, you can relax. The only similarity between this movie and MCU movies is 9 unfunny jokes. The movie actually harbors multiple layers. Antagonists are actually valued, they're not just background actors or extra performers, they actually have moments to shine. This isn't something like Ant-Man. It doesn't have a stereotype, cliché, and generic film elements that created for the lowest common denominator. It actually has innovations for its genre. This isn't something like Black Panther, It doesn't have 2D PS4 battle scenes. The CGI is actually well-crafted. This isn't something like Captain America: Civil War or most of the MCU films out there, it doesn't have a dim or bland color grading. The movie actually looks lively and vibrant. This isn't something like Guardians of the Galaxy, the characters don't act irrational or illogical, they actually have good reasons because they have developments. This isn't something like Ant-Man and The Wasp, It's not just a filler movie. It actually has a worth-seeing climax. This isn't something like Wonder Woman, It doesn't fail or fall flat in the third act. It actually fulfills its mission at every level. This isn't something like Avengers: Age of Ultron or any other MCU movie. The tone isn't out of place. The movie doesn't have a recurring and predictable theme. The camera isn't too shaky or it doesn't change in every second when an action scene comes up. The villains don't act out of character when they're in a situation. This isn't another Justice League, it isn't trying to be something else. It actually knows its place. But still, nothing can save this universe, not even something as good as The Dark Knight. But as a standalone, this is something worth seeing in the theaters.
## [3] \n
## [4] Watched it!!! And have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented this..This is the true jewel so far in DC universe<U+0001F44D><U+0001F3FB>\nWon't Add any Spoilers<U+0001F60B>..as this is something you should witness
## [5] \n
## [6] I want to cry now ......last year after watching Justice League, I was depressed. My friend didn't say anything but I know she think DC films sucks.\nSo I went to see Aquaman alone yesterday, for the first time in my life,everyone was applauding after the movie (Maybe because everyone who go to watch Aquaman premiere is a DC fan but when I was waiting for a taxi I heard a boy talking to his girlfriend that \\This Marvel movie is wonderful!!!\\ lol)\nJames Wan is AMAZING,Aquaman is very imaginative and it's nothing like any other superhero movie I've seen before, he knows what we want, BEST DCEU FILM (Yes I think it's much better than SS/JL/BVS/MOS/WW)\nI can't believe that Aquaman's net production cost is160m, much lower than JL(300m) BVS(250m\n)MOS(225m) even SS costs175m!!! WB should give James Wan more budget to direct Aquaman 2!!!!\nP.S. James says he may direct a horror-style Batman movie,pls WB let him do it!!!!
## 26 Levels: \n ...
class(corpus)
## [1] "factor"
corpus <- Corpus(VectorSource(corpus))
inspect(corpus[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] CinematographyVisualsStoryPlotWritingDirectingAction scenesVilliansDevelepmentsAtmosphereI didn't even think another human being could top Snyder's visuals in DCEU. Well, I wasn't wrong about that one. I still think his visuals are the best in DCEU but this movie had lots of moments too, those wide angle and tracking shots were a treat. The cinematography was really satisfying, so thank you to Don Burgess and James Wan for that. Underwater CGI scenes were breathtakingly beautiful to look at. Set-pieces makes you forget about the world you live in. They're not on the same level as LOTR or Indiana Jones or Star Wars but It's close, and I think that's a pretty tough thing to accomplish. Dialogues were cringy now and then but, unfortunately, that's what makes a super-hero movie ''good'' nowadays, and this probably will continue for the next 10 years. Too bad the days where Nolan's TDK Trilogy gave you goosebumps with just words are gone. Now it's just you have to act weird and say something out of place to create a chemistry between the characters. I can't even believe how people buy these kinds of contrived relationships anymore. Anyways, let me say this, the movie isn't something like Thor (2011) It doesn't make you feel like you're on a movie set. It actually has high-quality different places that set the movie's atmosphere perfectly. If you guys worried about if the movie is just a copycat of MCU film, you can relax. The only similarity between this movie and MCU movies is 9 unfunny jokes. The movie actually harbors multiple layers. Antagonists are actually valued, they're not just background actors or extra performers, they actually have moments to shine. This isn't something like Ant-Man. It doesn't have a stereotype, cliché, and generic film elements that created for the lowest common denominator. It actually has innovations for its genre. This isn't something like Black Panther, It doesn't have 2D PS4 battle scenes. The CGI is actually well-crafted. This isn't something like Captain America: Civil War or most of the MCU films out there, it doesn't have a dim or bland color grading. The movie actually looks lively and vibrant. This isn't something like Guardians of the Galaxy, the characters don't act irrational or illogical, they actually have good reasons because they have developments. This isn't something like Ant-Man and The Wasp, It's not just a filler movie. It actually has a worth-seeing climax. This isn't something like Wonder Woman, It doesn't fail or fall flat in the third act. It actually fulfills its mission at every level. This isn't something like Avengers: Age of Ultron or any other MCU movie. The tone isn't out of place. The movie doesn't have a recurring and predictable theme. The camera isn't too shaky or it doesn't change in every second when an action scene comes up. The villains don't act out of character when they're in a situation. This isn't another Justice League, it isn't trying to be something else. It actually knows its place. But still, nothing can save this universe, not even something as good as The Dark Knight. But as a standalone, this is something worth seeing in the theaters.
## [3] \n
## [4] Watched it!!! And have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented this..This is the true jewel so far in DC universe<U+0001F44D><U+0001F3FB>\nWon't Add any Spoilers<U+0001F60B>..as this is something you should witness
## [5] \n
# Clean the text
corpus <- tm_map(corpus,tolower)
## Warning in tm_map.SimpleCorpus(corpus, tolower): transformation drops
## documents
inspect(corpus[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didn't even think another human being could top snyder's visuals in dceu. well, i wasn't wrong about that one. i still think his visuals are the best in dceu but this movie had lots of moments too, those wide angle and tracking shots were a treat. the cinematography was really satisfying, so thank you to don burgess and james wan for that. underwater cgi scenes were breathtakingly beautiful to look at. set-pieces makes you forget about the world you live in. they're not on the same level as lotr or indiana jones or star wars but it's close, and i think that's a pretty tough thing to accomplish. dialogues were cringy now and then but, unfortunately, that's what makes a super-hero movie ''good'' nowadays, and this probably will continue for the next 10 years. too bad the days where nolan's tdk trilogy gave you goosebumps with just words are gone. now it's just you have to act weird and say something out of place to create a chemistry between the characters. i can't even believe how people buy these kinds of contrived relationships anymore. anyways, let me say this, the movie isn't something like thor (2011) it doesn't make you feel like you're on a movie set. it actually has high-quality different places that set the movie's atmosphere perfectly. if you guys worried about if the movie is just a copycat of mcu film, you can relax. the only similarity between this movie and mcu movies is 9 unfunny jokes. the movie actually harbors multiple layers. antagonists are actually valued, they're not just background actors or extra performers, they actually have moments to shine. this isn't something like ant-man. it doesn't have a stereotype, cliché, and generic film elements that created for the lowest common denominator. it actually has innovations for its genre. this isn't something like black panther, it doesn't have 2d ps4 battle scenes. the cgi is actually well-crafted. this isn't something like captain america: civil war or most of the mcu films out there, it doesn't have a dim or bland color grading. the movie actually looks lively and vibrant. this isn't something like guardians of the galaxy, the characters don't act irrational or illogical, they actually have good reasons because they have developments. this isn't something like ant-man and the wasp, it's not just a filler movie. it actually has a worth-seeing climax. this isn't something like wonder woman, it doesn't fail or fall flat in the third act. it actually fulfills its mission at every level. this isn't something like avengers: age of ultron or any other mcu movie. the tone isn't out of place. the movie doesn't have a recurring and predictable theme. the camera isn't too shaky or it doesn't change in every second when an action scene comes up. the villains don't act out of character when they're in a situation. this isn't another justice league, it isn't trying to be something else. it actually knows its place. but still, nothing can save this universe, not even something as good as the dark knight. but as a standalone, this is something worth seeing in the theaters.
## [3] \n
## [4] watched it!!! and have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented this..this is the true jewel so far in dc universe<u+0001f44d><u+0001f3fb>\nwon't add any spoilers<u+0001f60b>..as this is something you should witness
## [5] \n
corpus <- tm_map(corpus,removePunctuation)
## Warning in tm_map.SimpleCorpus(corpus, removePunctuation): transformation
## drops documents
inspect(corpus[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didnt even think another human being could top snyders visuals in dceu well i wasnt wrong about that one i still think his visuals are the best in dceu but this movie had lots of moments too those wide angle and tracking shots were a treat the cinematography was really satisfying so thank you to don burgess and james wan for that underwater cgi scenes were breathtakingly beautiful to look at setpieces makes you forget about the world you live in theyre not on the same level as lotr or indiana jones or star wars but its close and i think thats a pretty tough thing to accomplish dialogues were cringy now and then but unfortunately thats what makes a superhero movie good nowadays and this probably will continue for the next 10 years too bad the days where nolans tdk trilogy gave you goosebumps with just words are gone now its just you have to act weird and say something out of place to create a chemistry between the characters i cant even believe how people buy these kinds of contrived relationships anymore anyways let me say this the movie isnt something like thor 2011 it doesnt make you feel like youre on a movie set it actually has highquality different places that set the movies atmosphere perfectly if you guys worried about if the movie is just a copycat of mcu film you can relax the only similarity between this movie and mcu movies is 9 unfunny jokes the movie actually harbors multiple layers antagonists are actually valued theyre not just background actors or extra performers they actually have moments to shine this isnt something like antman it doesnt have a stereotype cliché and generic film elements that created for the lowest common denominator it actually has innovations for its genre this isnt something like black panther it doesnt have 2d ps4 battle scenes the cgi is actually wellcrafted this isnt something like captain america civil war or most of the mcu films out there it doesnt have a dim or bland color grading the movie actually looks lively and vibrant this isnt something like guardians of the galaxy the characters dont act irrational or illogical they actually have good reasons because they have developments this isnt something like antman and the wasp its not just a filler movie it actually has a worthseeing climax this isnt something like wonder woman it doesnt fail or fall flat in the third act it actually fulfills its mission at every level this isnt something like avengers age of ultron or any other mcu movie the tone isnt out of place the movie doesnt have a recurring and predictable theme the camera isnt too shaky or it doesnt change in every second when an action scene comes up the villains dont act out of character when theyre in a situation this isnt another justice league it isnt trying to be something else it actually knows its place but still nothing can save this universe not even something as good as the dark knight but as a standalone this is something worth seeing in the theaters
## [3] \n
## [4] watched it and have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented thisthis is the true jewel so far in dc universeu0001f44du0001f3fb\nwont add any spoilersu0001f60bas this is something you should witness
## [5] \n
corpus <- tm_map(corpus,removeNumbers)
## Warning in tm_map.SimpleCorpus(corpus, removeNumbers): transformation drops
## documents
inspect(corpus[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didnt even think another human being could top snyders visuals in dceu well i wasnt wrong about that one i still think his visuals are the best in dceu but this movie had lots of moments too those wide angle and tracking shots were a treat the cinematography was really satisfying so thank you to don burgess and james wan for that underwater cgi scenes were breathtakingly beautiful to look at setpieces makes you forget about the world you live in theyre not on the same level as lotr or indiana jones or star wars but its close and i think thats a pretty tough thing to accomplish dialogues were cringy now and then but unfortunately thats what makes a superhero movie good nowadays and this probably will continue for the next years too bad the days where nolans tdk trilogy gave you goosebumps with just words are gone now its just you have to act weird and say something out of place to create a chemistry between the characters i cant even believe how people buy these kinds of contrived relationships anymore anyways let me say this the movie isnt something like thor it doesnt make you feel like youre on a movie set it actually has highquality different places that set the movies atmosphere perfectly if you guys worried about if the movie is just a copycat of mcu film you can relax the only similarity between this movie and mcu movies is unfunny jokes the movie actually harbors multiple layers antagonists are actually valued theyre not just background actors or extra performers they actually have moments to shine this isnt something like antman it doesnt have a stereotype cliché and generic film elements that created for the lowest common denominator it actually has innovations for its genre this isnt something like black panther it doesnt have d ps battle scenes the cgi is actually wellcrafted this isnt something like captain america civil war or most of the mcu films out there it doesnt have a dim or bland color grading the movie actually looks lively and vibrant this isnt something like guardians of the galaxy the characters dont act irrational or illogical they actually have good reasons because they have developments this isnt something like antman and the wasp its not just a filler movie it actually has a worthseeing climax this isnt something like wonder woman it doesnt fail or fall flat in the third act it actually fulfills its mission at every level this isnt something like avengers age of ultron or any other mcu movie the tone isnt out of place the movie doesnt have a recurring and predictable theme the camera isnt too shaky or it doesnt change in every second when an action scene comes up the villains dont act out of character when theyre in a situation this isnt another justice league it isnt trying to be something else it actually knows its place but still nothing can save this universe not even something as good as the dark knight but as a standalone this is something worth seeing in the theaters
## [3] \n
## [4] watched it and have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented thisthis is the true jewel so far in dc universeufduffb\nwont add any spoilersufbas this is something you should witness
## [5] \n
corpus_clean<-tm_map(corpus,stripWhitespace)
## Warning in tm_map.SimpleCorpus(corpus, stripWhitespace): transformation
## drops documents
inspect(corpus[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didnt even think another human being could top snyders visuals in dceu well i wasnt wrong about that one i still think his visuals are the best in dceu but this movie had lots of moments too those wide angle and tracking shots were a treat the cinematography was really satisfying so thank you to don burgess and james wan for that underwater cgi scenes were breathtakingly beautiful to look at setpieces makes you forget about the world you live in theyre not on the same level as lotr or indiana jones or star wars but its close and i think thats a pretty tough thing to accomplish dialogues were cringy now and then but unfortunately thats what makes a superhero movie good nowadays and this probably will continue for the next years too bad the days where nolans tdk trilogy gave you goosebumps with just words are gone now its just you have to act weird and say something out of place to create a chemistry between the characters i cant even believe how people buy these kinds of contrived relationships anymore anyways let me say this the movie isnt something like thor it doesnt make you feel like youre on a movie set it actually has highquality different places that set the movies atmosphere perfectly if you guys worried about if the movie is just a copycat of mcu film you can relax the only similarity between this movie and mcu movies is unfunny jokes the movie actually harbors multiple layers antagonists are actually valued theyre not just background actors or extra performers they actually have moments to shine this isnt something like antman it doesnt have a stereotype cliché and generic film elements that created for the lowest common denominator it actually has innovations for its genre this isnt something like black panther it doesnt have d ps battle scenes the cgi is actually wellcrafted this isnt something like captain america civil war or most of the mcu films out there it doesnt have a dim or bland color grading the movie actually looks lively and vibrant this isnt something like guardians of the galaxy the characters dont act irrational or illogical they actually have good reasons because they have developments this isnt something like antman and the wasp its not just a filler movie it actually has a worthseeing climax this isnt something like wonder woman it doesnt fail or fall flat in the third act it actually fulfills its mission at every level this isnt something like avengers age of ultron or any other mcu movie the tone isnt out of place the movie doesnt have a recurring and predictable theme the camera isnt too shaky or it doesnt change in every second when an action scene comes up the villains dont act out of character when theyre in a situation this isnt another justice league it isnt trying to be something else it actually knows its place but still nothing can save this universe not even something as good as the dark knight but as a standalone this is something worth seeing in the theaters
## [3] \n
## [4] watched it and have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented thisthis is the true jewel so far in dc universeufduffb\nwont add any spoilersufbas this is something you should witness
## [5] \n
cleanset<-tm_map(corpus,removeWords, stopwords('english'))
## Warning in tm_map.SimpleCorpus(corpus, removeWords, stopwords("english")):
## transformation drops documents
inspect(cleanset[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didnt even think another human top snyders visuals dceu well wasnt wrong one still think visuals best dceu movie lots moments wide angle tracking shots treat cinematography really satisfying thank don burgess james wan underwater cgi scenes breathtakingly beautiful look setpieces makes forget world live theyre level lotr indiana jones star wars close think thats pretty tough thing accomplish dialogues cringy now unfortunately thats makes superhero movie good nowadays probably will continue next years bad days nolans tdk trilogy gave goosebumps just words gone now just act weird say something place create chemistry characters cant even believe people buy kinds contrived relationships anymore anyways let say movie isnt something like thor doesnt make feel like youre movie set actually highquality different places set movies atmosphere perfectly guys worried movie just copycat mcu film can relax similarity movie mcu movies unfunny jokes movie actually harbors multiple layers antagonists actually valued theyre just background actors extra performers actually moments shine isnt something like antman doesnt stereotype cliché generic film elements created lowest common denominator actually innovations genre isnt something like black panther doesnt d ps battle scenes cgi actually wellcrafted isnt something like captain america civil war mcu films doesnt dim bland color grading movie actually looks lively vibrant isnt something like guardians galaxy characters dont act irrational illogical actually good reasons developments isnt something like antman wasp just filler movie actually worthseeing climax isnt something like wonder woman doesnt fail fall flat third act actually fulfills mission every level isnt something like avengers age ultron mcu movie tone isnt place movie doesnt recurring predictable theme camera isnt shaky doesnt change every second action scene comes villains dont act character theyre situation isnt another justice league isnt trying something else actually knows place still nothing can save universe even something good dark knight standalone something worth seeing theaters
## [3] \n
## [4] watched words describe splendid performance cast beautifully wan visualised presented thisthis true jewel far dc universeufduffb\nwont add spoilersufbas something witness
## [5] \n
removeURL <- function(x) gsub('http[[:alnum:]]*','',x)
cleanset <- tm_map(cleanset, content_transformer(removeURL))
## Warning in tm_map.SimpleCorpus(cleanset, content_transformer(removeURL)):
## transformation drops documents
inspect(cleanset[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didnt even think another human top snyders visuals dceu well wasnt wrong one still think visuals best dceu movie lots moments wide angle tracking shots treat cinematography really satisfying thank don burgess james wan underwater cgi scenes breathtakingly beautiful look setpieces makes forget world live theyre level lotr indiana jones star wars close think thats pretty tough thing accomplish dialogues cringy now unfortunately thats makes superhero movie good nowadays probably will continue next years bad days nolans tdk trilogy gave goosebumps just words gone now just act weird say something place create chemistry characters cant even believe people buy kinds contrived relationships anymore anyways let say movie isnt something like thor doesnt make feel like youre movie set actually highquality different places set movies atmosphere perfectly guys worried movie just copycat mcu film can relax similarity movie mcu movies unfunny jokes movie actually harbors multiple layers antagonists actually valued theyre just background actors extra performers actually moments shine isnt something like antman doesnt stereotype cliché generic film elements created lowest common denominator actually innovations genre isnt something like black panther doesnt d ps battle scenes cgi actually wellcrafted isnt something like captain america civil war mcu films doesnt dim bland color grading movie actually looks lively vibrant isnt something like guardians galaxy characters dont act irrational illogical actually good reasons developments isnt something like antman wasp just filler movie actually worthseeing climax isnt something like wonder woman doesnt fail fall flat third act actually fulfills mission every level isnt something like avengers age ultron mcu movie tone isnt place movie doesnt recurring predictable theme camera isnt shaky doesnt change every second action scene comes villains dont act character theyre situation isnt another justice league isnt trying something else actually knows place still nothing can save universe even something good dark knight standalone something worth seeing theaters
## [3] \n
## [4] watched words describe splendid performance cast beautifully wan visualised presented thisthis true jewel far dc universeufduffb\nwont add spoilersufbas something witness
## [5] \n
cleanset<-tm_map(cleanset,removeWords, c('can','film'))
## Warning in tm_map.SimpleCorpus(cleanset, removeWords, c("can", "film")):
## transformation drops documents
# Since the word laptop and can were used, this can be removed as we are
# mining the tweets for this film.Also the word "Can" is common english word.
# we can pull back the word "can" if needed.
cleanset<-tm_map(cleanset,removeWords, c('movie','movies'))
## Warning in tm_map.SimpleCorpus(cleanset, removeWords, c("movie",
## "movies")): transformation drops documents
# Removing the word movie and movies on similar grounds - as unnecessary.
cleanset <- tm_map(cleanset, gsub,pattern = 'character', replacement = 'characters')
## Warning in tm_map.SimpleCorpus(cleanset, gsub, pattern = "character",
## replacement = "characters"): transformation drops documents
# the barplot pulls both character and characters as separate words. this should be
# counted as one as both holds the same synonym.
inspect(cleanset[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1] \n
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didnt even think another human top snyders visuals dceu well wasnt wrong one still think visuals best dceu lots moments wide angle tracking shots treat cinematography really satisfying thank don burgess james wan underwater cgi scenes breathtakingly beautiful look setpieces makes forget world live theyre level lotr indiana jones star wars close think thats pretty tough thing accomplish dialogues cringy now unfortunately thats makes superhero good nowadays probably will continue next years bad days nolans tdk trilogy gave goosebumps just words gone now just act weird say something place create chemistry characterss cant even believe people buy kinds contrived relationships anymore anyways let say isnt something like thor doesnt make feel like youre set actually highquality different places set atmosphere perfectly guys worried just copycat mcu relax similarity mcu unfunny jokes actually harbors multiple layers antagonists actually valued theyre just background actors extra performers actually moments shine isnt something like antman doesnt stereotype cliché generic elements created lowest common denominator actually innovations genre isnt something like black panther doesnt d ps battle scenes cgi actually wellcrafted isnt something like captain america civil war mcu films doesnt dim bland color grading actually looks lively vibrant isnt something like guardians galaxy characterss dont act irrational illogical actually good reasons developments isnt something like antman wasp just filler actually worthseeing climax isnt something like wonder woman doesnt fail fall flat third act actually fulfills mission every level isnt something like avengers age ultron mcu tone isnt place doesnt recurring predictable theme camera isnt shaky doesnt change every second action scene comes villains dont act characters theyre situation isnt another justice league isnt trying something else actually knows place still nothing save universe even something good dark knight standalone something worth seeing theaters
## [3] \n
## [4] watched words describe splendid performance cast beautifully wan visualised presented thisthis true jewel far dc universeufduffb\nwont add spoilersufbas something witness
## [5] \n
cleanset <- tm_map(cleanset,stripWhitespace)
## Warning in tm_map.SimpleCorpus(cleanset, stripWhitespace): transformation
## drops documents
inspect(cleanset[1:5])
## <<SimpleCorpus>>
## Metadata: corpus specific: 1, document level (indexed): 0
## Content: documents: 5
##
## [1]
## [2] cinematographyvisualsstoryplotwritingdirectingaction scenesvilliansdevelepmentsatmospherei didnt even think another human top snyders visuals dceu well wasnt wrong one still think visuals best dceu lots moments wide angle tracking shots treat cinematography really satisfying thank don burgess james wan underwater cgi scenes breathtakingly beautiful look setpieces makes forget world live theyre level lotr indiana jones star wars close think thats pretty tough thing accomplish dialogues cringy now unfortunately thats makes superhero good nowadays probably will continue next years bad days nolans tdk trilogy gave goosebumps just words gone now just act weird say something place create chemistry characterss cant even believe people buy kinds contrived relationships anymore anyways let say isnt something like thor doesnt make feel like youre set actually highquality different places set atmosphere perfectly guys worried just copycat mcu relax similarity mcu unfunny jokes actually harbors multiple layers antagonists actually valued theyre just background actors extra performers actually moments shine isnt something like antman doesnt stereotype cliché generic elements created lowest common denominator actually innovations genre isnt something like black panther doesnt d ps battle scenes cgi actually wellcrafted isnt something like captain america civil war mcu films doesnt dim bland color grading actually looks lively vibrant isnt something like guardians galaxy characterss dont act irrational illogical actually good reasons developments isnt something like antman wasp just filler actually worthseeing climax isnt something like wonder woman doesnt fail fall flat third act actually fulfills mission every level isnt something like avengers age ultron mcu tone isnt place doesnt recurring predictable theme camera isnt shaky doesnt change every second action scene comes villains dont act characters theyre situation isnt another justice league isnt trying something else actually knows place still nothing save universe even something good dark knight standalone something worth seeing theaters
## [3]
## [4] watched words describe splendid performance cast beautifully wan visualised presented thisthis true jewel far dc universeufduffb wont add spoilersufbas something witness
## [5]
#Term Document Matrix :
# Convert the unstructured data to structured data :
tdm <- TermDocumentMatrix(cleanset)
tdm
## <<TermDocumentMatrix (terms: 813, documents: 499)>>
## Non-/sparse entries: 13529/392158
## Sparsity : 97%
## Maximal term length: 52
## Weighting : term frequency (tf)
# the terms indicate that there are 13649 words and 393036 documents(# of tweets) in this TDM
# Sparsity is 97% which indicates that there are lots of zero values.
tdm <- as.matrix(tdm)
tdm[1:10,1:20]
## Docs
## Terms 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
## accomplish 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## act 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## action 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
## actors 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## actually 0 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## age 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## america 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
## angle 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## another 0 2 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
## antagonists 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
# Bar Plot
w <- rowSums(tdm) # provides the no of times a particular word has been used.
w <- subset(w, w>= 50) # Pull words that were used more than 25 times.
barplot(w, las = 2, col = rainbow(50))
# the word Aquaman,Like and James as the highest frequency. This implies
# that Movie Aquaman has got more reviews about the James and
# most of them liked the movie.
# Word Cloud :
library(wordcloud)
w <- sort(rowSums(tdm), decreasing = TRUE) # Sort words in decreasing order.
set.seed(123)
wordcloud(words = names(w), freq = w,
max.words = 250,random.order = F,
min.freq = 3,
colors = brewer.pal(8, 'Dark2'),
scale = c(5,0.3),
rot.per = 0.6)
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : superhero could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : amazing could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : characterss could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : characters could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : justice could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : villains could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : moments could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : nothing could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : watched could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : special could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : classic could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : performances could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : league could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : looks could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : pretty could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : universe could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : wonder could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : direct could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : heard could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : seen could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : want could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : ever could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : momoa could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : must could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : never could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : effects could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : enough could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : fight could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : love could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : saw could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : role could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : screen could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : next could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : worth could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : watching could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : come could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : done could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : actors could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : atmosphere could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : bad could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : cgi could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : cinematography could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : didnt could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : every could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : makes could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : people could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : place could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : second could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : set could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : theme could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : theyre could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : wars could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : worried could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : everyone could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : definitely could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : expected could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : visually could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : heroes could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : many could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : plot could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : retro could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : style could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : acting could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : fantastic could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : badass could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : need could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : clear could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : simply could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : stunning could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : take could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : way could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : quite could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : trailer could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : overall could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : book could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : comic could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : score could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : underwater could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : right could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : please could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : battle could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : antman could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : breathtakingly could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : days could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : dialogues could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : forget could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : gave could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : highquality could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : satisfying could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : scene could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : seeing could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : thats could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : vibrant could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : woman could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : words could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : youre could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : performance could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : batman could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : friend could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : imaginative could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : may could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : maybe could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : amber could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : away could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : blown could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : kidman could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : wilson could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : armor could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : arthur could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : atlantis could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : avatar could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : dazzling could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : fantasy could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : funny could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : gives could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : growth could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : however could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : obviously could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : review could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : said could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : soldiers could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : talk could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : understand could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : wanted could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : emotion could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : bored could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : day could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : message could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : opinion could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : orm could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : polluting could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : times could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : youll could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : ambitious could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : cheesy could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : family could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : fans could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : highly could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : imax could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : issues could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : marvelous could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : motivations could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : outstanding could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : perfect could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : comics could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : music could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : since could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : wait could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : unique could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : long could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : adapt could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : helmet could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : oceanmaster could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : solid could not be fit on page. It will not be plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : momoah could not be fit on page. It will not be
## plotted.
## Warning in wordcloud(words = names(w), freq = w, max.words = 250,
## random.order = F, : witnessed could not be fit on page. It will not be
## plotted.
library(wordcloud2)
w <- data.frame(names(w),w)
colnames(w) <- c('word','freq')
wordcloud2(w,size = 0.5, shape = 'triangle', rotateRatio = 0.5,
minSize = 1)
# lettercloud
letterCloud(w,word = 'A',frequency(5), size=1)
# Sentiment Analysis for tweets:
library(syuzhet)
library(lubridate)
library(ggplot2)
library(scales)
library(reshape2)
library(dplyr)
# install.packages("syuzhet")
# Read File
IMDB_reviews <- read.delim('Aquaman.TXT')
reviews <- as.character(IMDB_reviews[-1,])
class(reviews)
## [1] "character"
# Obtain Sentiment scores
s <- get_nrc_sentiment(reviews)
## Warning: package 'bindrcpp' was built under R version 3.5.1
head(s)
## anger anticipation disgust fear joy sadness surprise trust negative
## 1 0 0 0 0 0 0 0 0 0
## 2 6 9 5 7 10 9 4 12 20
## 3 0 0 0 0 0 0 0 0 0
## 4 1 0 0 1 1 1 1 1 2
## 5 0 0 0 0 0 0 0 0 0
## 6 2 3 2 4 2 5 3 4 6
## positive
## 1 0
## 2 23
## 3 0
## 4 1
## 5 0
## 6 7
reviews[4]
## [1] "Watched it!!! And have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented this..This is the true jewel so far in DC universe<U+0001F44D><U+0001F3FB>\nWon't Add any Spoilers<U+0001F60B>..as this is something you should witness"
# Watched it!!! And have no words to describe the splendid performance of the cast and how beautifully wan visualised and presented this..This is the true jewel so far in DC universe<U+0001F44D><U+0001F3FB>\nWon't Add any Spoilers<U+0001F60B>..as this is something you should witness"
# on tweet 4, you have 4 for anger, each one work for disgust, fear
# and sadness, 3 for trust , 4 words for negative and 2 positive.
get_nrc_sentiment('splendid')
## anger anticipation disgust fear joy sadness surprise trust negative
## 1 0 0 0 0 1 0 1 0 0
## positive
## 1 1
# Splendid has one Joy and one positive
get_nrc_sentiment('no words') #1 Anger and 1 Negative
## anger anticipation disgust fear joy sadness surprise trust negative
## 1 1 0 0 0 0 0 0 0 1
## positive
## 1 0
# barplot
barplot(colSums(s), las = 2.5, col = rainbow(10),
ylab = 'Count',main= 'Sentiment scores for IMDB Reviews
for Aquaman')