files for the work: https://mega.nz/file/AEJQFZIT#IKKIb5DD9h-5fHiWzEAIg8Lm60syggKnAwL1fqQQ168 Therefore, you should have print statements only where it is explicitly mentioned in the assignment. If...


files for the work: https://mega.nz/file/AEJQFZIT#IKKIb5DD9h-5fHiWzEAIg8Lm60syggKnAwL1fqQQ168


Therefore, you should have print statements only where it is explicitly mentioned in the assignment. If you have additional print statements, make sure they are all converted to comments before you submit the assignment. Page 4 of 12 Assignment # 4 Due: Nov. 27th 11:00 PM 1. Text File Format Download the zipped file Files_for_A4 from Brightspace. When you will extract this zipped file you should find the following text files in the folder. The sample text files (datafile) are aTaleOfTwoCities.txt, harry.txt, harryPotter.txt, and invisibleMan.txt. You may assume that the words of the text files are separated by spaces (* ') and newline characters ( *\n'). You will be using these text files to do the analysis. There are two additional files (wordfile) named positivewords.txt and negativewords.txt; each of these files contains a sequence of words (one word per line) and these words will be considered 'positive' and 'negative' words, respectively. These words will be used in Section 3 to analyze the sentiment of a piece of unstructured text data. There are six more text files (outfile) in this folder and I will refer to these files in Section 3. You are expected to create a python file called a4.py. You will add several functions to a4.py that must follow the instructions described in Section 2 and Section 3 of this specification.




1. Text File Format<br>Download the zipped file Files_for_A4 from Brightspace. When you will extract this zipped file<br>you should find the following text files in the folder.<br>The sample text files (datafile) are aTaleOfTwoCities.txt, harry.txt, harryPotter.txt, and<br>invisibleMan.txt. You may assume that the words of the text files are separated by spaces (* ')<br>and newline characters ( *\n*). You will be using these text files to do the analysis.<br>There are two additional files (wordfile) named positivewords.txt and negativewords.txt; each<br>of these files contains a sequence of words (one word per line) and these words will be considered<br>

Extracted text: 1. Text File Format Download the zipped file Files_for_A4 from Brightspace. When you will extract this zipped file you should find the following text files in the folder. The sample text files (datafile) are aTaleOfTwoCities.txt, harry.txt, harryPotter.txt, and invisibleMan.txt. You may assume that the words of the text files are separated by spaces (* ') and newline characters ( *\n*). You will be using these text files to do the analysis. There are two additional files (wordfile) named positivewords.txt and negativewords.txt; each of these files contains a sequence of words (one word per line) and these words will be considered "positive' and 'negative' words, respectively. These words will be used in Section 3 to analyze the sentiment of a piece of unstructured text data. There are six more text files (oufile) in this folder and I will refer to these files in Section 3. You are expected to create a python file called a4.py. You will add several functions to a4.py that must follow the instructions described in Section 2 and Section 3 of this specification.
In the first part of this assignment, you will add the following functions to your a4.py. These<br>functions will be used to perform the text analysis on the sample text files.<br>1) load_datafile() takes a single string parameter representing the filename of a datafile.<br>This function must read the content of the file, convert all letters to their lowercase, and store<br>the result in a string, and finally retum that string. I will refer to this string as data throughout<br>this specification, you may rename it. You must also handle all exceptions in case the datafile<br>is not available.<br>Sample output:<br>» data - load_datafile(> print(data) the hottest day of the summer so far was drawing to a close and a drowsy silence lay over the large, square houses of privet drive. 2) load_wordfile() takes a single string argument representing the filename of a wordfile. This function must read the content of the wordfile and store all words in a one-dimensional list and return the list. Make sure that the words do not have any additional whitespace or "/>
Extracted text: In the first part of this assignment, you will add the following functions to your a4.py. These functions will be used to perform the text analysis on the sample text files. 1) load_datafile() takes a single string parameter representing the filename of a datafile. This function must read the content of the file, convert all letters to their lowercase, and store the result in a string, and finally retum that string. I will refer to this string as data throughout this specification, you may rename it. You must also handle all exceptions in case the datafile is not available. Sample output: » data - load_datafile("harry.txt') >> print(data) the hottest day of the summer so far was drawing to a close and a drowsy silence lay over the large, square houses of privet drive. 2) load_wordfile() takes a single string argument representing the filename of a wordfile. This function must read the content of the wordfile and store all words in a one-dimensional list and return the list. Make sure that the words do not have any additional whitespace or

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here