Sentiment Analysis is a problem within the field of Artificial Intelligence which seeks to determine the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Sentiment Analysis is a problem within the field of Artificial Intelligence which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like the program to recognize that the text "My favourite film all year" is a positive statement while "A giant waste of time" is negative. One algorithm that we can use for this is to assign a number to each 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 what we will do in this assignment. You are going to search through a file containing movie reviews from the Rotten Tomatoes website which have both a numeric score as well as text. Your program will use this to learn which words are positive and which are negative. The file is called movieReviews.txt and is available on UM Learn. Notice that each review starts with a number 0 through 4 with the following meaning: 0: negative 1: somewhat negative 2: neutral • 4: positive You are going to write a program that determines the score for each word in this file, and then uses those word scores to decide if an unlabelled movie review is positive, negative, or neutral. Part A: Learning from Labelled Movie Reviews To begin, your program must compute the average sentiment score for each of the words in the movieReviews.txt file. Download the text file and save it in the same folder where your program will be. Then write a program to do the following: . Set up a new, empty dictionary. Iterate over every review in the text file (there is one review per line). Examine every word in every review within the file. If the word is not yet in your dictionary: Add a new entry into your dictionary for that word. The word itself is the key, and the value to store at this key is a list that contains two items: the sentiment score and the number 1 (meaning that you've seen this word 1 time). Otherwise (if the word is already in your dictionary): Add the new sentiment score to the score that is already stored in the list, and • Increase the number of times that you have seen this word. . 3: somewhat positive . . Sentiment Analysis is a problem within the field of Artificial Intelligence which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like the program to recognize that the text "My favourite film all year" is a positive statement while "A giant waste of time" is negative. One algorithm that we can use for this is to assign a number to each 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 what we will do in this assignment. You are going to search through a file containing movie reviews from the Rotten Tomatoes website which have both a numeric score as well as text. Your program will use this to learn which words are positive and which are negative. The file is called movieReviews.txt and is available on UM Learn. Notice that each review starts with a number 0 through 4 with the following meaning: 0: negative 1: somewhat negative 2: neutral • 4: positive You are going to write a program that determines the score for each word in this file, and then uses those word scores to decide if an unlabelled movie review is positive, negative, or neutral. Part A: Learning from Labelled Movie Reviews To begin, your program must compute the average sentiment score for each of the words in the movieReviews.txt file. Download the text file and save it in the same folder where your program will be. Then write a program to do the following: . Set up a new, empty dictionary. Iterate over every review in the text file (there is one review per line). Examine every word in every review within the file. If the word is not yet in your dictionary: Add a new entry into your dictionary for that word. The word itself is the key, and the value to store at this key is a list that contains two items: the sentiment score and the number 1 (meaning that you've seen this word 1 time). Otherwise (if the word is already in your dictionary): Add the new sentiment score to the score that is already stored in the list, and • Increase the number of times that you have seen this word. . 3: somewhat positive . .
Expert Answer:
Answer rating: 100% (QA)
Part A Learning from Labelled Movie Reviews In this part of the assignment you will read movie reviews from the movieReviewstxt file calculate the sen... View the full answer
Related Book For
Analytics Data Science And Artificial Intelligence Systems For Decision Support
ISBN: 9781292341552
11th Global Edition
Authors: Ramesh Sharda, Dursun Delen, Efraim Turban
Posted Date:
Students also viewed these organizational behavior questions
-
What precautions do you take to guarantee that machines perform properly?
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Read the case study "Southwest Airlines," found in Part 2 of your textbook. Review the "Guide to Case Analysis" found on pp. CA1 - CA11 of your textbook. (This guide follows the last case in the...
-
A survey of recent masters of business administration (MBAs) reveals that their starting salaries follow a normal distribution with mean $48,000 and standard deviation $9,000. Find the probability...
-
The position of member ABC is controlled by the hydraulic cylinder CD. For the loading shown, determine the force exerted by the hydraulic cylinder on pin C when θ = 60°.
-
The following data relate to the Plant Assets account of Eshkol, Ltd. at December 31, 2022. The following transactions occurred during 2023. a. On May 5, Asset A was sold for 13,000 cash. The...
-
What is the relationship of technology to the information system architecture?
-
Refer to P22-26A and P22-27A. Requirements 1. Prepare a budgeted balance sheet as of May 31, 2012. 2. Prepare the budgeted statement of cash flows for the two months ended May 31, 2012. (Note: You...
-
The financial statements for Castile Products, Incorporated are given below: Castile Products, Incorporated Balance Sheet December 3 1 Assets Current assets: Cash $ 2 0 , 0 0 0 Accounts receivable,...
-
A department store maintains data on customers, products, and purchase records in three tables: CUSTOMER, PRODUCT, and PURCHASE. The store manager wants to find the average price of all distinct...
-
KYY Group had started construction of a US$200 million logistics hub in Singapore. The facility also houses KYY Group's headquarter. Please discuss the advantages and challenges of choosing Singapore...
-
Feet for Athletes, Incorporated sells athletic shoes and socks. Shoes sell for $135 per unit and have a variable cost of $60 per unit. Socks sell for $25 a bag with a variable cost of $10 per bag....
-
Memo to the Manager: Summarize your findings in a clear, concise manner. Explain how each scenario impacts the income statement and what that could mean for the company's financial health.
-
What are Contingent Liabilities?Give an example. What are the factors that determine the reason for Contingent Liabilities?
-
Posey's Pet Emporium Sales Forecast July August September Quarter Budgeted sales volume $32,000.00 $35,200.00 $35,000.00 $102,200.00 Budgeted selling price $4.99 $4.99 $4.99 $4.99 Budgeted sales...
-
Company A's balance sheet shows $400 million in debt, $75 million in preferred stock, and $325 million in total common equity. Company A's tax rate is 30%,rd = 7%,rps = 6.2%, andrs = 15%. If A has a...
-
Consider an economy with one good r and two agents i {1,2} with utility functions u(x) = ln(x). There are two equally prob- able states, 8 {L, H}. There are also two firms: firm 1 produces 1 unit...
-
Determine the annual percentage yield for a loan that charges a monthly interest rate of 1.5% and compounds the interest monthly.
-
How may intelligent systems change jobs?
-
What is the Turing Test and what are its limitations?
-
What is time series? What are the main forecasting techniques for time-series data?
-
The following are summaries of the cash book and bank accounts of J. Duncan who does not keep his books using the double entry system. You are required to: (a) Calculate the value of J. Duncan's...
-
Read the following and answer the questions below. On 31 December 2015 the bank column of C. Tench's cash book showed a debit balance of 1,500. The monthly bank statement written up to 31 December...
-
The bank columns in the cash book for June 2016 and the bank statement for that month for D. Hogan are as follows: You are required to: () Write the cash book up to date to take the above into...
Study smarter with the SolutionInn App