Getting the Script of Made in Abyss and One Piece Red

Using Sublikescript to get script anime movies such as One Piece Red Movie and Made in Abyss.

Extract Made in Abyss script, check for character,and split into sentece,

Read the Made in Abyss with the html node of the full script. The “.full-script” receive the full text of Made In Abyss script. After the receiving the text, checking the variable if character since the text is string character. Then split the text into sentence to read carefully and the code to read carefully.

Extract One Piece Red script, check for character, and split into sentece

Read the One Piece Red with the html node of the full script. The “.full-script” receive the full text of One Piece Red script. After the receiving the text, checking the variable if character since the text is string character. Then split the text into sentence to read carefully and the code to read carefully.

Cleaning the Made in Abyss with tm Corpus

Using tm is lot easier to clean the text and remove stop words. Replacing the unnecessary words as blanks such as “offthis” or “mitty”

Cleaning the One Piece Red with tm Corpus

Same as Made in Abyss with using the library of tm to clean out junk, stop word, and unnecessary words

#Frequency number of Made in Abyss and One Piece The graph for the frequent words that appear in Made in Abyss and One Piece Red in separate graph.

madein_abyss <- tm_map(AbbysCorpus, stemDocument)
## Warning in tm_map.SimpleCorpus(AbbysCorpus, stemDocument): transformation drops
## documents
term_countabby <- freq_terms(madein_abyss,20)

plot(term_countabby)

one_piece_r <- tm_map(OnePCorpus, stemDocument)
## Warning in tm_map.SimpleCorpus(OnePCorpus, stemDocument): transformation drops
## documents
term_countonep <- freq_terms(one_piece_r,20)

plot(term_countonep)

Creating Document Term Matrix,Sort the Frequency, and plot the most frequent words for Made in Abyss

The Document-Term Matrix that show the relationship which each row as document and the columns as the terms.The top 5 most frequent word is “just” with the count number of 30.

#To Analyze the text data, using the Document-Term Matrix (DTM)
Abby_Made = DocumentTermMatrix(madein_abyss)
inspect(Abby_Made)
## <<DocumentTermMatrix (documents: 852, terms: 842)>>
## Non-/sparse entries: 1647/715737
## Sparsity           : 100%
## Maximal term length: 20
## Weighting          : term frequency (tf)
## Sample             :
##      Terms
## Docs  come even get just like now one pleas take time
##   142    0    0   0    0    0   0   0     0    0    0
##   196    0    0   0    0    0   0   0     0    1    0
##   29     0    0   0    1    1   1   0     0    0    0
##   476    0    0   0    0    1   0   0     0    0    0
##   579    0    0   0    0    0   0   0     0    0    0
##   714    0    0   0    0    0   0   0     0    0    0
##   798    0    0   0    0    1   0   0     0    0    0
##   841    0    0   2    0    0   0   0     0    0    0
##   90     0    0   0    0    0   0   0     0    0    0
##   94     1    0   0    0    0   0   0     0    0    0
miabyss_m <- as.matrix(Abby_Made)

#Sort by decreasing value of frequency
miabyss_v <- sort(colSums(miabyss_m),decreasing = TRUE)
miabyss_d <- data.frame(word = names(miabyss_v), freq=miabyss_v)
head(miabyss_d, 5)
##      word freq
## just just   26
## like like   25
## come come   20
## time time   16
## even even   15
#Plot the most frequent words
barplot(miabyss_d[1:5,]$freq, las = 2, names.arg = miabyss_d[1:5,]$word,
        col = "lightgreen",main = "Top 5 most frequent words",
        ylab = "Word frequencis")

###Creating Document Term Matrix,Sort the Frequency, and plot the most frequent words for One Piece Red The Document-Term Matrix that show the relationship which each row as document and the columns as the terms.The top 5 most frequent word is “let” with the count number of 40.

#Building Document-Term Matrix (DTM)
One_Red = DocumentTermMatrix(one_piece_r)
inspect(One_Red)
## <<DocumentTermMatrix (documents: 328, terms: 1388)>>
## Non-/sparse entries: 2901/452363
## Sparsity           : 99%
## Maximal term length: 21
## Weighting          : term frequency (tf)
## Sample             :
##      Terms
## Docs  can cant get just let like new want will world
##   112   0    1   1    1   0    0   2    0    3     2
##   117   0    1   1    3   0    0   0    0    0     0
##   143   0    0   2    0   0    1   0    0    0     0
##   231   0    0   0    0   0    1   0    0    0     0
##   237   1    3   2    1   0    0   0    0    1     0
##   240   0    2   1    3   0    0   2    2    1     0
##   272   3    4   2    0   1    1   0    0    0     0
##   300   1    3   3    1   2    3   1    0    4     4
##   311   0    2   0    0   1    1   1    1    2     2
##   83    0    1   3    2   2    1   0    1    1     0
onepiecer_m <- as.matrix(One_Red)

#Sort by decreasing value of frequency
onepiecer_v <- sort(colSums(onepiecer_m),decreasing = TRUE)
onepiecer_d <- data.frame(word = names(onepiecer_v), freq=onepiecer_v)
head(onepiecer_d, 5)
##      word freq
## let   let   41
## can   can   38
## want want   36
## cant cant   34
## like like   32
#Plot the most frequent words
barplot(onepiecer_d[1:5,]$freq, las = 2, names.arg = onepiecer_d[1:5,]$word,
        col = "red",main = "Top 5 most frequent words",
        ylab = "Word frequencis")

World Cloud for Made in Abyss and word assocation

#Generate Word Cloud
set.seed(1234)
wordcloud(words = miabyss_d$word, freq = miabyss_d$freq, min.freq = 1,
          max.words=200, random.order=FALSE, rot.per=0.35, 
          colors=brewer.pal(8, "Dark2"))

#Word Association 
findAssocs(Abby_Made, terms = c("just","like","pleas"), corlimit = 0.25)
## $just
## allow   are thing  mind  reli  help 
##  0.38  0.38  0.31  0.26  0.26  0.26 
## 
## $like
## much 
## 0.29 
## 
## $pleas
##      okayif     partway throughyour 
##        0.28        0.28        0.28

World Cloud for One Piece Redand word assocation

#Generate Word Cloud
set.seed(1234)
wordcloud(words = onepiecer_d$word, freq = onepiecer_d$freq, min.freq = 1,
          max.words=200, random.order=FALSE, rot.per=0.35, 
          colors=brewer.pal(8, "Dark2"))

#Word Association 
findAssocs(One_Red, terms = c("want","sea","new"), corlimit = 0.25)
## $want
##     forgetlet          piec         dream           cri       happili 
##          0.40          0.40          0.32          0.31          0.29 
##     courseguy          danc        okayit        thisof        whenev 
##          0.28          0.28          0.28          0.28          0.28 
##        fansit   muchinstead         nowdo      pirateto    pirateyeah 
##          0.28          0.28          0.28          0.28          0.28 
##     pirateyou    singerlook    togetheral  togetherwait     yearswhat 
##          0.28          0.28          0.28          0.28          0.28 
##         about      bearutta         choth         gorgi     planluffi 
##          0.28          0.28          0.28          0.28          0.28 
##    shanksshut         shipi sorrypaypalah        wellif      adviceso 
##          0.28          0.28          0.28          0.28          0.28 
##    controlled          drop       happyit         innoc          itin 
##          0.28          0.28          0.28          0.28          0.28 
##        itstop      latewhat          plan          solv       violenc 
##          0.28          0.28          0.28          0.28          0.28 
##     worldwhat      worryyou        diseas     freedomto      homewhat 
##          0.28          0.28          0.28          0.28          0.28 
##      liedidnt      persecut          play          live         anyth 
##          0.28          0.28          0.27          0.26          0.26 
##          said 
##          0.26 
## 
## $sea
##        pirat       fansit  muchinstead        nowdo     pirateto   pirateyeah 
##         0.61         0.56         0.56         0.56         0.56         0.56 
##    pirateyou   singerlook   togetheral togetherwait    yearswhat        decid 
##         0.56         0.56         0.56         0.56         0.56         0.52 
##     luffylet       friend         care          one        luffi         shes 
##         0.52         0.50         0.42         0.41         0.40         0.39 
##          use       defeat          two      happili         piec    boxingsor 
##         0.39         0.39         0.39         0.39         0.39         0.37 
##  freedomwhat         gave      goodlet     pirateif   piratewhat        sakei 
##         0.37         0.37         0.37         0.37         0.37         0.37 
##     shouldnt     themtang   thingsther      redhead          ask        great 
##         0.37         0.37         0.37         0.34         0.32         0.31 
##          ive        minut        thing        world          fun          fan 
##         0.31         0.31         0.30         0.29         0.29         0.28 
##          got         weak        least        today         also       cipher 
##         0.26         0.25         0.25         0.25         0.25         0.25 
##        white       abouti 
##         0.25         0.25 
## 
## $new
##            era            age          peopl           will           long 
##           0.70           0.52           0.41           0.41           0.40 
##          everi          white           youd        problem           kill 
##           0.38           0.37           0.37           0.37           0.36 
##         actual          agoso        airflow         arrest        assembl 
##           0.35           0.35           0.35           0.35           0.35 
##         author          breez         cannon      cannonmak          check 
##           0.35           0.35           0.35           0.35           0.35 
##           code        command        compani        complic concerteveryon 
##           0.35           0.35           0.35           0.35           0.35 
##         condit           cook          crack    dangerousit     daughterth 
##           0.35           0.35           0.35           0.35           0.35 
##         detect   eligiathirti          emerg          entir           flag 
##           0.35           0.35           0.35           0.35           0.35 
##       flagship         follow        girlhey         gunner          hersh 
##           0.35           0.35           0.35           0.35           0.35 
##           herw           hole      hungrylet          ignit       interfer 
##           0.35           0.35           0.35           0.35           0.35 
##         ityeah    knowcaptain          latei           lazi          level 
##           0.35           0.35           0.35           0.35           0.35 
##         measur          meter         musica      musicthat        obstacl 
##           0.35           0.35           0.35           0.35           0.35 
##     overboardi        perfect       pirateit      portantth         prepar 
##           0.35           0.35           0.35           0.35           0.35 
##        presenc      quicklyth          readi       reportsa        revolut 
##           0.35           0.35           0.35           0.35           0.35 
##           rush         sailar           seal        sendhow        shipsif 
##           0.35           0.35           0.35           0.35           0.35 
##       shipstak          sight         signal    songredhead        songsal 
##           0.35           0.35           0.35           0.35           0.35 
##      stuffthat        support           thin            tot   vicinityther 
##           0.35           0.35           0.35           0.35           0.35 
##          water           wave    wavesattent          weird       wheelsno 
##           0.35           0.35           0.35           0.35           0.35 
##     worryingif       adviceso     controlled           drop        happyit 
##           0.35           0.35           0.35           0.35           0.35 
##          innoc           itin         itstop       latewhat           plan 
##           0.35           0.35           0.35           0.35           0.35 
##           solv        violenc      worldwhat       worryyou          creat 
##           0.35           0.35           0.35           0.35           0.34 
##           seem          phone          whole          anyth            lot 
##           0.34           0.34           0.34           0.34           0.31 
##            ate            use           boat           send           ship 
##           0.31           0.31           0.31           0.31           0.31 
##           sure          right           hurt            bug           path 
##           0.31           0.30           0.30           0.30           0.29 
##           food           mani          sound        without        youwhat 
##           0.29           0.29           0.29           0.29           0.28 
##            fun           make         around 
##           0.27           0.26           0.26

Positive/Negative and Emotion of Made in Abyss

Made in Abyss has lot of negative words and lot of fear since the movie has its scary moments and show words that relates the character’s fear.

# Calculate sentiment scores of Made in Abyss
result <- get_nrc_sentiment(as.character(madein_abyss))
result1<-data.frame(t(result))
Made_in_Abyss <- data.frame(rowSums(result1))

#name rows and columns of the data frame
names(Made_in_Abyss)[1] <- "count"
Made_in_Abyss <- cbind("sentiment" = rownames(Made_in_Abyss), Made_in_Abyss)
rownames(Made_in_Abyss) <- NULL

#plot the first 8 rows,the distinct emotions
qplot(sentiment, data=Made_in_Abyss[1:8,], weight=count, geom="bar",fill=sentiment)+ggtitle("Made in Abyss Sentiments")
## Warning: `qplot()` was deprecated in ggplot2 3.4.0.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

#plot the last 2 rows ,positive and negative
qplot(sentiment, data=Made_in_Abyss[9:10,], weight=count, geom="bar",fill=sentiment)+ggtitle("Made in Abyss Sentiments")

Positive/Negative and Emotion of One Piece Red

This is similar to Made in Abyss of fear and negative. This may result of characters being scare or showing fear through other characters.

# Calculate sentiment scores of Made in Abyss
result2 <- get_nrc_sentiment(as.character(one_piece_r))
result21<-data.frame(t(result2))
One_Piece_Red <- data.frame(rowSums(result21))

#name rows and columns of the data frame
names(One_Piece_Red)[1] <- "count"
One_Piece_Red <- cbind("sentiment" = rownames(One_Piece_Red), One_Piece_Red)
rownames(One_Piece_Red) <- NULL

#plot the first 8 rows,the distinct emotions
qplot(sentiment, data=One_Piece_Red[1:8,], weight=count, geom="bar",fill=sentiment)+ggtitle("One Piece Red Sentiments")

#plot the last 2 rows ,positive and negative
qplot(sentiment, data=One_Piece_Red[9:10,], weight=count, geom="bar",fill=sentiment)+ggtitle("One Piece Red Sentiments")

In conclusion, both anime movies show words that is more negative but still have words that is positive that the character made state in the script. The emotion in characters in Made in Abyss and One Piece Red show a lot fear which indicate the negative words and character said something scary to scare the character.