Commit 6480e277 authored by Hetvi Ariwala's avatar Hetvi Ariwala
Browse files

Further analysis on conistancy of sentiment has been done.

parent 95dd33a7
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ load("D:/Hohenheim/SEM 3/ADS/introads_ass2_team18/01_data/reviews.clean.RData")
load("D:/Hohenheim/SEM 3/ADS/introads_ass2_team18/01_data/raw/gamereviews.RData")

# Only keeping necessary columns for analysis
rev.sentiment <- data.frame(reviews = reviews.clean$reviews)
rev.sentiment <- data.frame(id= reviews.clean$recommendationid,  reviews = reviews.clean$reviews)

# Manual sentiment analysis-----------------------------------------------------

@@ -161,3 +161,27 @@ cat("An emotion with highest weightage is positive with", round(nrc.scores$weigh
cat("An emotion with highest weightage is disgust with", round(nrc.scores$weightage[10],2),"%\n")

# Checking the consistency of sentiment with positive and negative voted_up

merged <- merge(sent.label= rev.sentiment$sent.label, voted_up= gamereviews$voted_up, by.x = "id", 
                by.y = "recommendationid", all.x = TRUE)
comparison <- data.frame(id = merged$id, reviews = merged$reviews, sent.label=merged$sent.label, voted_up=merged$voted_up)

comparison <- comparison %>%
  mutate(voted_up_mapped = case_when(
    voted_up==TRUE ~ "Positive",
    voted_up==FALSE ~ "Negative"))

comparison$compare <- ifelse(comparison$sent.label == "Positive" & comparison$voted_up_mapped == "Positive", "positive",
                             ifelse(comparison$sent.label == "Negative" & comparison$voted_up_mapped == "Negative", "positive",
                                    "Neutral"))

# Counting the number of match 
match.count <- sum(comparison$compare=="Match")
mismatch.count <- sum(comparison$compare=="Mismatch")

total.count <- length(comparison$compare)

# Calculating ration of match and mismatch
match.ratio <- match.count / total.count
# Display the result
print(comparison_result)