****************** Sentiment Analysis ****************** * **Worth**: 5% * **DUE**: March 19th, 2024 at 11:55pm; submitted on MOODLE. .. warning:: For this assignment, you may **not** work with anyone else. You need to work independently. How to submit your work ======================= You need to submit your Java files directly on moodle. The first two lines of the Java files should be as follows: .. code-block:: java // Student name: // Student number: Instructions ============ * In this assignment you will calculate the overall sentiment of a text. * There are multiple techniques, but we will focus on a very simple one. * The analysis will be done by words. * The scale is going from -5 (very negative) to 5 (very positive). * You will create a first hash table based on the file :download:`sentiments.txt <../asn/sentiment/sentiments.txt>` * This file is adapted from `AFINN `_. * This hash table will map each word the corresponding value. * After that you need to take the input from a user. * Concretly a text. * I am giving you a csv file containing book reviews from Amazon that you can you use. :download:`Reviews.csv <../asn/sentiment/Reviews.csv>` * You need to calculate the total sentiment of the text and the average. * Then you print the total sentiment of the text and the average. * The average sentiment gives us an idea if the text is positive, negative or neutral. Structure of your program ------------------------- The program should contain the following files: * main * Analysis : It's the main class of the program. * Sentiment : The sentiment database that will contain only the words and their sentiment value. main **** * This file should take two arguments from the console: .. code-block:: SentimentAnalysis :code:`SentimentAnalysis` is the name of the executable. * Then it should create the class :code:`Analsyis`. * Then it asks the user to enter a text. * The program ends when the user type "quit". Analysis ******** * The principal class of your program. * The constructor should take the sentiment file as an argument of the constructor. * With the file it should create the class :code:`Sentiment`. * It should have a method taking the text entered by the user and sent by :code:`main`. * It will calculate the total sentiment of the text. To do that it sum the sentiment of each word in the text. * It will also calculate the average sentiment (total sentiment / number of words). * Finally, it will print these values. Sentiment ********* * This class must be a Hash Table. * The hash must be done on the word. * It must contain a find methods that will return the value of the word. And 0 if the word doesn't exist. * You can use the hash function that you want. * The way you handle collision also is up to you, but it needs to be explained in the comments. Some marking details ==================== .. warning:: Having the correct outputs doesn't mean that you will obtain a perfect mark. The marking will depend on: * Correctness. * Comments * Variable names * Style * etc.