:| :0 POSITIVE "Great service for an affordable price. We will definitely be booking again." Part 3: Sentiment Analysis Requirements NEUTRAL "Just booked two nights at this hotel." NEGATIVE "Horrible services. The room was dirty and unpleasant. Not worth the money." A common approach to text analysis is called "sentiment analysis". Broadly, sentiment analysis is intended to determine the writer's overall sentiment in a piece of writing. Are they happy? Sad? Angry? Enthusiastic? Rumor has it that Amazon uses sentiment analysis in selecting reviews to prioritize and for other things, too. The most straightforward form of sentiment analysis involves looking at word frequencies. A document with more positive than negative words is likely to be interpreted as positive. A document with more negative than positive words is likely to be interpreted as negative. The two files positive.txt and negative.txt contain lists of English words. The words listed in positive.txt correspond to positive sentiment. The words in negative.txt correspond to a negative sentiment. You should ignore all comment lines that start with a semicolon (;). Write a program that will use these word lists to create a sentiment analysis of a txt file provided by the user of your program. To test this part of the project, you'll need to create your own .txt files for testing purposes. First, read all of the positive words and negative words into separate HashSet objects. Then, ask the user to enter the name of a text file that contains written English. The user's input file should be analyzed, and a report should be displayed showing: number of positive words number of negative words number of words in the entire file and the overall "sentiment", positive, negative or neutral when: • "positive" if the percent of positive words (on a 0 to 1 scale) is at least 0.05 higher than the percent of negative words; 。 "negative" if the percent of negative words is at least 5% higher than the percent of positive words; and "neutral" in all other cases. Not all words are represented in these two lists. If a word in the file is not in the list, it should be counted as a total word, but not positive or negative. Sample Output 1. Select the Suitor. 2. Escape the Haunted House. 3. Sentiment Analysis. Q. Quit. Your option ==>3 Sentiment Analysis. 2006 Positive Words Successfully Loaded. 4783 Negative Words Successfully Loaded. Enter the name of the text file to perform sentiment analysis: report.txt Sentiment Report for report.txt: There were 51 positive words, 23 negative words and 100 total words. That's 51% positive and 23% negative. Overall the file's sentiment was positive. Would you like to analyze another file Y/N? Y Enter the name of the text file to perform sentiment analysis: portfolio.txt Sentiment Report for portfolio.txt: There were 38 positive words, 111 negative words and 200 total words. That's 19% positive and 56% negative. Overall the file's sentiment was negative. Would you like to analyze another file Y/N? N

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter8: Working With Advanced Functions
Section: Chapter Questions
Problem 2.11CP
icon
Related questions
Question

Write the full Java code

:|
:0
POSITIVE
"Great service for an affordable
price.
We will definitely be booking again."
Part 3: Sentiment Analysis Requirements
NEUTRAL
"Just booked two nights
at this hotel."
NEGATIVE
"Horrible services. The room
was dirty and unpleasant.
Not worth the money."
A common approach to text analysis is called "sentiment analysis". Broadly, sentiment analysis is intended to determine the writer's overall sentiment in a piece of writing. Are they happy? Sad? Angry? Enthusiastic? Rumor has it that Amazon
uses sentiment analysis in selecting reviews to prioritize and for other things, too.
The most straightforward form of sentiment analysis involves looking at word frequencies. A document with more positive than negative words is likely to be interpreted as positive. A document with more negative than positive words is likely
to be interpreted as negative.
The two files positive.txt and negative.txt contain lists of English words. The words listed in positive.txt correspond to positive sentiment. The words in negative.txt correspond to a negative sentiment. You should ignore all comment lines that
start with a semicolon (;).
Write a program that will use these word lists to create a sentiment analysis of a txt file provided by the user of your program. To test this part of the project, you'll need to create your own .txt files for testing purposes.
First, read all of the positive words and negative words into separate HashSet<String> objects. Then, ask the user to enter the name of a text file that contains written English. The user's input file should be analyzed, and a report should be
displayed showing:
number of positive words
number of negative words
number of words in the entire file
and the overall "sentiment", positive, negative or neutral when:
• "positive" if the percent of positive words (on a 0 to 1 scale) is at least 0.05 higher than the percent of negative words;
。 "negative" if the percent of negative words is at least 5% higher than the percent of positive words; and
"neutral" in all other cases.
Not all words are represented in these two lists. If a word in the file is not in the list, it should be counted as a total word, but not positive or negative.
Sample Output
1. Select the Suitor.
2. Escape the Haunted House.
3. Sentiment Analysis.
Q. Quit.
Your option ==>3
Sentiment Analysis.
2006 Positive Words Successfully Loaded.
4783 Negative Words Successfully Loaded.
Enter the name of the text file to perform sentiment analysis: report.txt
Sentiment Report for report.txt:
There were 51 positive words, 23 negative words and 100 total words.
That's 51% positive and 23% negative. Overall the file's sentiment was positive.
Would you like to analyze another file Y/N? Y
Enter the name of the text file to perform sentiment analysis: portfolio.txt
Sentiment Report for portfolio.txt:
There were 38 positive words, 111 negative words and 200 total words.
That's 19% positive and 56% negative. Overall the file's sentiment was negative.
Would you like to analyze another file Y/N? N
Transcribed Image Text::| :0 POSITIVE "Great service for an affordable price. We will definitely be booking again." Part 3: Sentiment Analysis Requirements NEUTRAL "Just booked two nights at this hotel." NEGATIVE "Horrible services. The room was dirty and unpleasant. Not worth the money." A common approach to text analysis is called "sentiment analysis". Broadly, sentiment analysis is intended to determine the writer's overall sentiment in a piece of writing. Are they happy? Sad? Angry? Enthusiastic? Rumor has it that Amazon uses sentiment analysis in selecting reviews to prioritize and for other things, too. The most straightforward form of sentiment analysis involves looking at word frequencies. A document with more positive than negative words is likely to be interpreted as positive. A document with more negative than positive words is likely to be interpreted as negative. The two files positive.txt and negative.txt contain lists of English words. The words listed in positive.txt correspond to positive sentiment. The words in negative.txt correspond to a negative sentiment. You should ignore all comment lines that start with a semicolon (;). Write a program that will use these word lists to create a sentiment analysis of a txt file provided by the user of your program. To test this part of the project, you'll need to create your own .txt files for testing purposes. First, read all of the positive words and negative words into separate HashSet<String> objects. Then, ask the user to enter the name of a text file that contains written English. The user's input file should be analyzed, and a report should be displayed showing: number of positive words number of negative words number of words in the entire file and the overall "sentiment", positive, negative or neutral when: • "positive" if the percent of positive words (on a 0 to 1 scale) is at least 0.05 higher than the percent of negative words; 。 "negative" if the percent of negative words is at least 5% higher than the percent of positive words; and "neutral" in all other cases. Not all words are represented in these two lists. If a word in the file is not in the list, it should be counted as a total word, but not positive or negative. Sample Output 1. Select the Suitor. 2. Escape the Haunted House. 3. Sentiment Analysis. Q. Quit. Your option ==>3 Sentiment Analysis. 2006 Positive Words Successfully Loaded. 4783 Negative Words Successfully Loaded. Enter the name of the text file to perform sentiment analysis: report.txt Sentiment Report for report.txt: There were 51 positive words, 23 negative words and 100 total words. That's 51% positive and 23% negative. Overall the file's sentiment was positive. Would you like to analyze another file Y/N? Y Enter the name of the text file to perform sentiment analysis: portfolio.txt Sentiment Report for portfolio.txt: There were 38 positive words, 111 negative words and 200 total words. That's 19% positive and 56% negative. Overall the file's sentiment was negative. Would you like to analyze another file Y/N? N
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage