Spell Check program.

Writing a Spell Check program in Python.

Page 1 of 1

0 Replies - 1661 Views - Last Post: 12 April 2009 - 11:31 AM Rate Topic: -----

#1 amarmasic21  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-April 09

Spell Check program.

Post icon  Posted 12 April 2009 - 11:31 AM

I'm trying to code a spell-checker in Python, but I'm having trouble defining my own classes. So for this is what I have:

class LanguageHelper:			   #define languagehelper class
	def __init__(self,languagefile):
		self._languagefile = open(raw_input('Enter the name of the language file: '))

print 'Please enter the filename for the language: '		#get the dictionary file
file_path = raw_input()			 
file_open = open(file_path, 'r')		#open the user file
language = list()					   #create an internal list
for line in open(file_path):
	language.append(line)			   #add words to internal list
	userfile = file(raw_input('Enter the filename you wish to correct: '))	  #ask the user for his file to fix
tofix = list()						  #create an internal list
for line in userfile:
	tofix.append(line)				  #add userfile words to list

getSuggestions(self, word):

I'm trying to get it to run like this:
Open up the program and have it ask where the language file is(English.txt) and store it internally in a list.
Ask to open up a file the user wants spell checked, and then what they want to name the final fixed version.
Then the program would ideally iterate through the users file and put suggestions for spelling mistakes such as this:
1. Replace
2. Ignore
3. 1st suggestion
4. 2nd suggestion

I'm not sure how I would go about this by defining a class around it, but I would appreciate any help.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1