0

Hey ,
Have a task i want to do I have a .txt file with mispelt words and a .txt file which is a dictionary and has correct spelling of words now i know that i need to split both of the .txt files into words , i need to convert the mispelt.txt to lower case (but alway get object has no attribute) and then subtract them form each other and whats left will be the mispelt words
mispel.txt is text with mispelt words
corspel.txt is dictionary
here is what i have so far that split the mispelt.txt into lines

import sys
import string
infile = open('mispel.txt', 'r') 
infile2 = open('corspel.txt', 'r').read()
words = set(open('mispel.txt').read().split())
2
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by swerty4
0

sorry what i have their splits the mispelt.txt into words so need to conevrt them to lowercase get error all the time using lower() and then somehow subtract the two to see the mispelt words

0

put lower() after read().: words = set(open('mispel.txt').read().lower().split()) Do you need to suggest correct spelling for the incorrect words?

Edited by pyTony: Question added

0

yes i do but im struggling so much that i havent thought that far ahead and have no idea how to do that

0

ok so not sure of exact syntax to replace punctuation with " "
i think it would be something like

def pun(s):
    for ch in 'mispel.txt'.punctuation:
        s = s.replace(ch, ' ')
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.