Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need this as fast as possible, thank you!! How do I link a .txt file to the question I don't know? can't figure out how
Need this as fast as possible, thank you!!
How do I link a .txt file to the question I don't know? can't figure out how to reply to your comment either so that's why I am replying in the question.
1 ackage a6; 3import java.io.File; 7 public class ReviewAnalysis Goes through the process of -reading the file of movie reviews -etting a "score for each word finding the best scoring word with a count greater than " some threshold scoring a few reviews and comparing the computer-generated 10 score with the actual rating 13 14 15 16 17 18 19 29 public static void main(String] args) 21 You should go through the main nethod to sce what the overall structure is of the project "Then, fill in code for the nethods that get called @param ares Strin] lines - null; need to declare outside the try scope forlater use // Read the file and put cach line in a Strine array try 23 lines -convertFileTostringArray("src/ab/ovieeviews.txt") 26 27 catch (FileNotFoundException e) f / Report and quit if the file wasn't found System.out.println("File was not found") return, 31 32 Create three arrays with our known maximum size of 16444 elenents 1. Words: Al1 the words in the reviews 12. word score: A word at index x has a total point value at word score[x 34 35 3. word count:A word at index x has a total number of appearances at Word count x String[] words -new String[16444]; // Cheat by knowing # of words in advance doublel] wordScore new double[16444]; int] wordCount-naw int[16444]; 39 // We need to track how many words have been added to the arrays // As words gets added, this number should go up to match int number 0fSpacesUsedTnIords -0; / This var 1 able s super important. Tf you don"t krEN the point f it 43 stop- and figure it out Go through each review. For each review 1. Pull off the movic score from the front of the revicw / 2. G0 through the text of the review. Process each word by adding to its /f score and count for (int i- 6; _ 2.0 est inatedScore >_ 2.e) 11 actualscoreStep 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