1) load_datafile() takes a single string parameter representing the filename of a datafile. This funetion 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

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 1DE: Each of the following files in the Chapter.05 folder of your downloadable student files has syntax...
icon
Related questions
Question
100%

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
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.
Transcribed Image 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
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
Transcribed Image 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
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr