FAQ
Write a spell checking tool that will identify all misspelled word in a text file using a provided dictionary.


The program will accept either one or two command line parameters.
1. The first command line parameter is the name of the text file that will be checked.
2. The optional second command line parameter is the name of the dictionary file ? a file of words with one word per line. The default dictionary file is ref.txt.
The program will write out the misspelled words, one per line, in alphabetical order.

Extend the spell checking tool so that as well as identifying all misspelled words, the program will list the line numbers in the file where the incorrect spelling occurs.

The program will write out the misspelled words (one per line, in alphabetical order), followed by a tab character, followed by the list of line numbers that word is misspelled in,in ascending order, on the same line, separated by a single space.


Extend the spell-checking tool so that the program will also print out a list of possible correct spellings for the words.

The program will write out the misspelled words (one per line, in alphabetic order), followed (on the same line) by a single space, followed by the list of line numbers in ascending order, each separated by a single space, followed by a single space, then the list of possible correct spellings, each separated by a single space.

Find the alternate spellings by considering:
a. Words in the dictionary that are the same length but:
a. Have a pair of characters interchanged
b. Differ by one character from the misspelled word
b. Words that are one character longer or one character shorter, but otherwise match the misspelled word.

Search Discussions

  • Xavier Ho at May 15, 2010 at 7:27 am
    1) Welcome to Python-List!

    2) Python-list doesn't like to do other people's homework.

    3) What have you tried?

    Cheers,
    Xav
    On Fri, May 14, 2010 at 6:19 PM, harry k wrote:

    Write a spell checking tool that will identify all misspelled word in a
    text file using a provided dictionary.


    The program will accept either one or two command line parameters.
    1. The first command line parameter is the name of the text file that
    will be checked.
    2. The optional second command line parameter is the name of the
    dictionary file ? a file of words with one word per line. The default
    dictionary file is ref.txt.
    The program will write out the misspelled words, one per line, in
    alphabetical order.

    Extend the spell checking tool so that as well as identifying all
    misspelled words, the program will list the line numbers in the file where
    the incorrect spelling occurs.

    The program will write out the misspelled words (one per line, in
    alphabetical order), followed by a tab character, followed by the list of
    line numbers that word is misspelled in,in ascending order, on the same
    line, separated by a single space.


    Extend the spell-checking tool so that the program will also print out a
    list of possible correct spellings for the words.

    The program will write out the misspelled words (one per line, in
    alphabetic order), followed (on the same line) by a single space, followed
    by the list of line numbers in ascending order, each separated by a single
    space, followed by a single space, then the list of possible correct
    spellings, each separated by a single space.

    Find the alternate spellings by considering:
    a. Words in the dictionary that are the same length but:
    a. Have a pair of characters interchanged
    b. Differ by one character from the misspelled word
    b. Words that are one character longer or one character shorter, but
    otherwise match the misspelled word.

    --
    http://mail.python.org/mailman/listinfo/python-list
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/python-list/attachments/20100515/91c596d1/attachment-0001.html>
  • Tim Chase at May 15, 2010 at 11:02 am
    2) Python-list doesn't like to do other people's homework.

    This could be fun... :) For this problem, all you have to do is
    a big "if/elif/else" statement for every possible mis-spelling.
    If you want to get really fancy, you could put all the
    mis-spellings in a set() and then test the incoming word against
    the set for membership...For bonus points, you could use the
    anydbm module as a mapping from known-bad-spellings to the
    correct spelling so it can auto-correct for you...

    Then you know if the word is mis-spelled. The rest is pretty
    easy. ;-)

    -tkc


    (or maybe this only sounds amusing if you're sleep-deprived, up
    with your kid in the wee hours of the morning when you'd prefer
    to be snoozing)
  • James Mills at May 15, 2010 at 7:30 am

    On Fri, May 14, 2010 at 6:19 PM, harry k wrote:
    Write a spell checking tool that will identify all misspelled word in a text file using a provided dictionary.
    Is this an assignment ? Sure looks like it!

    I don't see a question anywhere.

    --james
  • Nigel Rowe at May 19, 2010 at 3:01 am
    On Fri, 14 May 2010 18:19, harry k wrote in comp.lang.python
    <<mailman.205.1273907726.32709.python-list at python.org>>:
    Write a spell checking tool that will identify all misspelled word in
    a text file using a provided dictionary.
    <snip/>

    Extend the spell-checking tool so that the program will also print out
    a list of possible correct spellings for the words.
    >

    I'm happy to do you homework for you, cost is us$1000 per hour. Email
    to your professor automatically on receipt.
  • Steven D'Aprano at May 19, 2010 at 3:37 am

    On Wed, 19 May 2010 13:01:10 +1000, Nigel Rowe wrote:

    I'm happy to do you homework for you, cost is us$1000 per hour. Email
    to your professor automatically on receipt.
    I'll do it for $700 an hour!



    --
    Steven
  • John Machin at May 19, 2010 at 4:23 am

    On May 19, 1:37?pm, Steven D'Aprano <steve-REMOVE- T... at cybersource.com.au> wrote:
    On Wed, 19 May 2010 13:01:10 +1000, Nigel Rowe wrote:
    I'm happy to do you homework for you, cost is us$1000 per hour. ?Email
    to your professor automatically on receipt.
    I'll do it for $700 an hour!
    he could save the money if he oogledgay orvignay ellspay eckerchay
  • Patrick Maupin at May 19, 2010 at 4:18 am

    On May 14, 3:19?am, "harry k" wrote:

    Write a spell checking tool that will identify all misspelled word in a text file using a provided dictionary.
    Well, this has been educational. Both my daughters just finished
    their final exams last week, so I was confused about seeing the
    homework assignment. Then I saw the email address. Although it makes
    perfect sense, I never really thought much about the possibility that
    the school year would be "upside down" "down under"...

    Regards,
    Pat
  • Xavier Ho at May 19, 2010 at 4:45 am
    Yeah, most unis here commence in March, and the first semester usually
    finish in June, when the exams are.

    - Xav on his 'droid

    On 19/05/2010 2:21 PM, "Patrick Maupin" wrote:
    On May 14, 3:19 am, "harry k" wrote:

    Write a spell checking tool that wil...
    Well, this has been educational. Both my daughters just finished
    their final exams last week, so I was confused about seeing the
    homework assignment. Then I saw the email address. Although it makes
    perfect sense, I never really thought much about the possibility that
    the school year would be "upside down" "down under"...

    Regards,
    Pat
  • Alex23 at May 20, 2010 at 4:40 am

    Patrick Maupin wrote:
    Although it makes
    perfect sense, I never really thought much about the possibility that
    the school year would be "upside down" "down under"...
    Yes, having the school year run within the actual year instead of
    across two is such a topsy-turvy concept, it's pretty obvious the
    blood is constantly rushing to our heads ;)
  • CM at May 19, 2010 at 7:17 am
    I love how he just copied and pasted the assignment without any other
    remarks.
  • Terry Reedy at May 19, 2010 at 3:07 pm

    On 5/19/2010 3:17 AM, CM wrote:
    I love how he just copied and pasted the assignment without any other
    remarks.
    Yeah, that way he did not mess it up ;-).
  • Albert van der Horst at May 21, 2010 at 4:43 pm
    In article <mailman.411.1274281806.32709.python-list at python.org>,
    Terry Reedy wrote:
    On 5/19/2010 3:17 AM, CM wrote:
    I love how he just copied and pasted the assignment without any other
    remarks.
    Yeah, that way he did not mess it up ;-).
    OTOH it may be a copyright infringement. Or is posting an assignment to a
    newsgroup "fair use"?

    Groetjes Albert

    --
    --
    Albert van der Horst, UTRECHT,THE NETHERLANDS
    Economic growth -- being exponential -- ultimately falters.
    albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedMay 14, '10 at 8:19a
activeMay 21, '10 at 4:43p
posts13
users12
websitepython.org

People

Translate

site design / logo © 2022 Grokbase