Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Problem: Spell Checker (20 points) The problem reviews material we covered on strings, files, anddictionaries. You will write a simple spell checker that uses

Python

Problem: Spell Checker (20 points)

The problem reviews material we covered on strings, files, anddictionaries.

You will write a simple spell checker that uses the officialScrabble players list of words to check all the words in asentence.

Part 1: (8 points)

The first thing your program should do is read a the list ofcorrectly spelled words into a datastructure that you can use tofind them. For this problem the datastructure only needs to supportthe in Boolean operator to determine ifa word is present. A list will work fine for this, more advanceddatastructures like the dictionary or set (not covered) would alsowork and provide more speed.

The main function will test if you have build the datastructureby printing its length. Running the updated program should producethe following one line result:

267751 words read into spelling dictionary

Part 2: (8 points)

Next you will implement thefunction check_sentence. The function takesone argument which is the list of words created in Part 1. The completed function will prompt the user for asentence to check. It will look at each word in the sentence andprint out those words it did not find in the list of correctlyspelled words.

For example entering "The quick brown foxx played in the rain inSpain on the plain." should identify the words "The", "foxx","Spain", and "plain." as misspelled because these words do notexactly appear in the word list.

Enter a sentence to check:The quick brown foxx played in the rain in Spain on the plain.ThefoxxSpainplain.

Part 3: (4 points)

To improve your spell checker, your program will convert wordsto lower case before looking them up in the dictionary. It willalso clean the words by removing any punctuation on the ends. Thiscleaning process is described in lecture 23. When the example above is re-run, only the word "foxx" is identified asmisspelled. The words The and Spain are found in the word list inlower case, and plain is found after the period is removed.

Enter a sentence to check:The quick brown foxx played in the rain in Spain on the plain.foxx

Step by Step Solution

3.39 Rating (158 Votes )

There are 3 Steps involved in it

Step: 1

Answer for Part 1 The first part of this problem requires the creation of a data structure that can store a list of correctly spelled words and then use the in Boolean operator to determine if a word ... 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

Fundamentals of Cost Accounting

Authors: William Lanen, Shannon Anderson, Michael Maher

3rd Edition

9780078025525, 9780077517359, 77517350, 978-0077398194

More Books

Students also viewed these Electrical Engineering questions