Question: (without using the collections library please) Lab Exercises 1. In this exercise you will create a Python program to compute document statistics. Follow the steps
(without using the collections library please)


Lab Exercises 1. In this exercise you will create a Python program to compute document statistics. Follow the steps below: Create a text file with some random text. Create a Python program with functions for reading the file, computing word count and top 10 words. Use the template below: def readFile(filename): #Implement this def wordCount(contents): #Implement this def top Ten Words(wordCountDict): #Implement this def main(): filename = - sys.argv[1] contents = readFile(filename) wordCountDict=wordCount(contents) top Ten Words(wordCountDict) main__': if _name main() Run the Python program as follows: python documentstats.py filename.txt Extend Exercise-1 to compute top 10 keywords in a file. To ignore stop-words (commonly occurring words such as 'an', 'the', 'how', etc) create a list of stop-words. Ignore stop-words when computing top 10 keywords
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
