Prev: Alternate string object type for PyStringObject(available Python 2.x) in python 3.x?
Next: yappi 0.51 released
From: harry k on 14 May 2010 04:19 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.
From: James Mills on 15 May 2010 03:30 On Fri, May 14, 2010 at 6:19 PM, harry k <hkiridis(a)yahoo.com.au> 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
From: Tim Chase on 15 May 2010 07:02 > 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)
From: Nigel Rowe on 18 May 2010 23:01 On Fri, 14 May 2010 18:19, harry k wrote in comp.lang.python <<mailman.205.1273907726.32709.python-list(a)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.
From: Steven D'Aprano on 18 May 2010 23:37 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
|
Next
|
Last
Pages: 1 2 3 Prev: Alternate string object type for PyStringObject(available Python 2.x) in python 3.x? Next: yappi 0.51 released |