Part Two



TitleMajor Project MP 7.1-7.2DueOct 13, 2019 11:55 PMNumber of resubmissions allowed0StatusNot StartedGrade ScalePoints (max 9.00)For this projects, we continue with the same TripAdvisor context as in the past couple of weeks. You may therefore want to use your submissions for Week 5 as foundations upon which to build your work here.Using dictionaries, and add-on Python modules such as re, pandas, and csv,?augment the functionality of EXAMPLE SCRIPT 2 provided towards the end of the Dictionaries cheat sheet to create the .csv file shown below. Note that --The data file for this project (attached) contains thousands of reviews rather than 20 reviews.Your dictionary as well as your subsequent data frame and .csv file need to incorporate all the fields shown below, in the sequence shown below.The first column titled 'Negative-Keywords' needs to display the total number of negative keywords for each reviewer, per your Week 5 computations.negative_keyword= ['awful','bad','beware','careless','decline','depressing','deteriorated','difficult','dirty','disappointing','disinterested','frightening','horrible','hostile','incompetent','inconsistent','indifferent','inferior','infuriating','lesson','mediocre','miscommunication','poor','rough','scary','suck','sullen','terrible','unclean','uncomfortable','uneven','unfriendly','unhygienic','unimpressive','uninterested','worst']Part OneREMINDER:? YOU WILL NEED ADD-ON PYTHON MODULES SUCH AS pandas, numpy, re, and csv, among others.NOTE:?BEFORE ATTEMPTING WEEK 7 WORK, REVIEW THE?'DEFINED FUNCTIONS' CHEAT SHEET. IF NECESSARY, ALSO REVISIT ALL PRIOR CHEAT SHEETS.Split your script for MP 6-1 into two scripts -- a calling script and a second script containing a user-defined function.?These two scripts need to be stored in separate Python files.?The job of the user-defined function will be to read a TripAdvisor reviews file containing raw data, convert it to a list of lists (review Minor Assignment 4.1 for this if necessary), and return this generated list to the calling script. The job of the calling script is to conduct all other processing, including calling the user-defined function and generating the final output.Your user-defined function should accept two parameters -- the name of the raw data file and the number of lines per review. The values of these two parameters you will need to enter to make all this work are? 'hotel_218524.txt' and 13. The data file is attached here.Submit this part separately as MP7-1Part TwoREMINDER:? YOU WILL NEED ADD-ON PYTHON MODULES SUCH AS pandas, numpy, re, and csv, among others.NOTE:?BEFORE ATTEMPTING WEEK 7 WORK, REVIEW THE?'DEFINED FUNCTIONS' CHEAT SHEET. IF NECESSARY, ALSO REVISIT ALL PRIOR CHEAT SHEETS.Further split up your two files for Major Project MP 7-1, into three files. Let us say these files are called MP_7_2_a.py, MP_7_2_b.py, and MP_7_2_c.py.MP_7_2_c.py needs to call a function in MP_7_2_b.py.The function in MP_7_2_b.py needs to include a statement that in turn calls a function in MP_7_2_a.py.The functionalities for the three files are as follows.MP_7_2_a.py needs to be identical to your called script in the project MP 7-1.MP_7_2_c.py needs to only contain the last few lines of code that consolidate various lists into a dictionary, convert the dictionary to a pandas data frame, and print out this frame as a .csv file.MP_7_2_b.py needs to contain everything else. The function in this file needs to accept the same two parameters as MP_7_2_a.py. That is, the name of the raw data file and the number of lines per review. As before, the values of these two parameters you will need to enter to make all this work are? 'hotel_218524.txt' and 13. The function in MP_7_2_b.py needs to return a list of lists to MP_7_2_c.py. This list of lists will be utilized by the receiving script to generate the dictionary, convert it to a pandas data frame, and print out this frame as a .csv file.Your output in this project needs to be identical to the output of Major Project MP 7-1.Submit your three Python scripts as?separate?Word/Notepad files, your .csv file (i.e., the output), and the screenshot of MP_7_2_c.py working correctly as a jpeg image. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download