Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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)

image text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions

Question

Compare the different types of employee separation actions.

Answered: 1 week ago

Question

Assess alternative dispute resolution methods.

Answered: 1 week ago

Question

Distinguish between intrinsic and extrinsic rewards.

Answered: 1 week ago