Question: Simple Sentiment Analysis ( 4 0 points ) Sentiment Analysis is a Big Data problem used to get the attitude or sentiment of the writer
Simple Sentiment Analysis
points
Sentiment Analysis is a Big Data problem used to get the attitude or sentiment of the writer based
on their written text. For instance, when analyzing movie reviews, "The film was a breath of fresh
air" has a positive statement while It made me want to poke out my eye balls" is negative.
One algorithm that we can use for this is to assign a numeric value to any given word based on
how positive or negative that word is and then score the statement based on the values of the
words. But, how do we come up with our word scores in the first place?
That's the problem that we'll solve in this assignment. In the attachments, you will see a data
file movieReviews.tsv which contains movie reviews from the Rotten Tomatoes website which
have both a numeric score as well as text. The data file has four columns phraselD,
sentencelD the phrase and a sentiment score.
Your goal is to write a JAVA program that reads the given data file and aggregate the review score
per sentence. You will need to create an instance of a class named ReviewEntry for each word in
the file and track the total score assigned to the sentence.
You will need to write a function that computes the average score for each sentence and assigns
the following meaning to a word based on the average score:
: negative
: neutral
: positive
Part Create a class called ReviewEntry which has the following elements: i a variable to track
the sentence IDii a variable to track the total score which is the sum of all scores assigned to
the sentence and iii a variable to track the number of phroses in the sentence. Create an array
of object instances of this class to account for each sentence in the file. You will have a total
elements in the array.
Part Use FilelO operations in JAVA to read each entry in the movieReviews.tsv file and update
the corresponding entry for the sentence. For example, you should update the object for
sentenceID with each corresponding entry in movieReviews.tsv
Part Once you finish loading the entries in the file, ask the user for a sentence ID as input and
print the statistics of the corresponding sentence in the following format:
Sentence ID has phrases with an average rating of The overall sentiment is positive.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
