Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

working model of spell check mechanism (basic) #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Manas-kashyap
Copy link

Basic model of spell check that currently working on command line .

Copy link

@bhanuvrat bhanuvrat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some pep8 changes required.

also, do not push .pyc files to version control.

import sys

def main():
spellchk = SpellCheck('/usr/share/dict/words')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use 4 spaces instead of tabs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure , will keep that in mind.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bhanuvrat why ?use tabs instead of spaces?



if __name__ == "__main__":
main()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file should end with a blank line

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay , i will remeber it

import re, random
class Misspell:
#Give list of words to mispell
def __init__(self, wordList):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pep8: use lowercase words separated by underscore for variable names.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay , changes applied .

def misspelled(self, word):
if len(word) == 1:
return word
vowels = 'aeiouy'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

y is a vowel?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops sorry , my bad

raw_input('<enter>\n')
except KeyboardInterrupt:

'exit'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you intend to do with the string exit?

it is not going to have any effect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay , removing the unnecessary things

print 'Incorrect -', word
spellchk = self.correct(word, lWords)
if spellchk == word and spellchk not in lWords[word[0]]:
print 'NO SUGGESTION'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use python logging module instead of print statements

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when does this loop terminate? I do not see a break.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay , i am reading about python logging module , and maybe i forgot to give break .

@xeon-zolt
Copy link
Member

@bhanuvrat thankyou for such a awesome review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants