Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python: 3. A module speech_parser that contains a set of functions which can process a text file with a speech and write the results

In python:

3. A module speech_parser that contains a set of functions which can process a text file with a speech and write the results to the output file or to stdout. I leave it up to you to decide how to organize your functions inside that module, use your best judgement and the dont repeat yourself principle. However, the start function should have the following signature: parse_text( filename, write_to_file=False, output_filename=out.txt, ignore_file=ignore.txt, top=10)

Make sure you handle exceptions. Heres the example of how I can use the module:

import speech_parser parse_text(Roosevelt.txt) Will give the following output (in terminal, since I didnt set it to be a file): >>> Top-10 words in Roosevelt.txt are: >>> 1. national: 10 >>> 2. people: 9 >>> 3. may: 8 >>> 4. leadership: 7 >>> 5. action: 7 >>> 6. shall: 7 >>> 7. helped: 7 >>> 8. effort: 6 >>> 9. day: 6 >>> 10. from: 6

As you noticed, you need to have a file with words that you ignore (one word per line). My ignore.txt has the following contents: the, and, this, that, there, our, have, has, had, they, with, can, which, their, will, must, are, for, but, not, only, all, these, where, you,your. Requirements: Do not use any libraries other than sys and random (reduce is fine as well). Follow the PEP 8 style guide. (STRONGLY suggest using PyCharm) Variables, functions, files, and folders in your app must use the Snake case notation. All the import statements should be on top of a file. Please, use reasonable amount of comments to make your code clear.

image text in transcribed

Click here to Reply or Forward

Using 0.26 GB

Program PoliciesPowered by

Google

Last account activity: 1 minute ago

Open in 1 other location Details

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_2

Step: 3

blur-text-image_3

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago