Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help and I am only limited to using material covered in chapters 1 - 16 CSC143-Computer Programming II Programming Assignment #3 For 25
I need help and I am only limited to using material covered in chapters 1 - 16
CSC143-Computer Programming II Programming Assignment #3 For 25 points Due: see our Canvas class site This assignment will give you practice using sets. You will read in the text of various books and use the provided lists of "positive" and "negative" words to classify each book as a "comedy" or a "tragedy." The practice of attempting to determine the overall tone of a block of text is known as "sentiment analysis." In practice, algorithms for sentiment analysis can be quite sophisticated. Ours is clearly quite simple. We'll see how accurate it is at classifying some books. Part A: Create a BookAnalyzer Class This class will have the following fields (posWords and negwords should both be SETS, bookwords should be an ARRAYLIST) posWords negWords bookWords Your class should have a CONSTRUCTOR that takes 3 INPUT PARAMETERS: the "positive" and "negative" text files, which are used to construct the posWords and negWords sets, and a book text file, which is used to construct the bookWords ArrayList object. Your class should handle bad input gracefully. One option might be to have "default" lists for positive and negative words, such as the lists shown below (which you would need to convert to sets): "great", String [ ] posList = {"good", "nice", "love", "excellent", "awesome", "wonderful", "fantastic", "fabulous", "like" "miserable", String [] negList {"bad", "awful", "hate", "terrible", "sad", "dislike", "atrocious", "depressed, "cry" Another option (and the one you should probably use for the book file name is to keep querying the user until a valid file name is entered Your class should contain methods to analyze the book. You get to determine what methods you will need. Hint: You may want to have methods that create positive and negative sets of words for a given book. Your BookAnalyzer class should determine whether the book being analyzed is a comedy (positive word count > negative word count), a tragedy (positive word count
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started