Spelling Correction Python Program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MegaBK
    New Member
    • May 2010
    • 1

    Spelling Correction Python Program

    Hello. I've only just started out in Python and I'm not very good at it. I have a project in which I have to create a sort of spell checking program. No, I'm not asking for you to do my homework, but to assist me, by pointing me in the right direction.


    We have been supplied a .txt file which is a dictionary of words on single lines. The program is required to ask for user input, for the text file to be checked. It will then output a text file with the words that have been miss spelt, in alphabetical order.


    So far, I have got Python to import the dictionary text file and to split the words into lists, ask the user for the file name to be checked, import the file specified by the user and written the code for the output of the text file with the list of miss spelt words. It is the stuff in between I'm not sure how to tackle.

    Hopefully someone can help me with this problem.

    Thank you.
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    Hi

    It would help if you posted your code and had a more specific problem that we can engage on. A simple way to check whether it's been misspelled is to use the "in" code.

    The below might help.

    Code:
    In [1]: words=["aardvark", "apple", "bear"]
    
    In [2]: "bear" in words
    Out[2]: True
    
    In [3]: "ardvak" in words
    Out[3]: False
    If not, pls come back with more specific questions.

    Comment

    Working...