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)

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!