Skip to content

working model of spell check mechanism (basic)#1

Open
Manas-kashyap wants to merge 3 commits intoBashmug:masterfrom
Manas-kashyap:master
Open

working model of spell check mechanism (basic)#1
Manas-kashyap wants to merge 3 commits intoBashmug:masterfrom
Manas-kashyap:master

Conversation

@Manas-kashyap
Copy link
Copy Markdown

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

Copy link
Copy Markdown

@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.

Comment thread __init__.py
import sys

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

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
Copy Markdown
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
Copy Markdown
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?

Comment thread __init__.py


if __name__ == "__main__":
main() No newline at end of file
Copy link
Copy Markdown

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
Copy Markdown
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

Comment thread misspell.py
import re, random
class Misspell:
#Give list of words to mispell
def __init__(self, wordList):
Copy link
Copy Markdown

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
Copy Markdown
Author

Choose a reason for hiding this comment

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

okay , changes applied .

Comment thread misspell.py
def misspelled(self, word):
if len(word) == 1:
return word
vowels = 'aeiouy'
Copy link
Copy Markdown

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
Copy Markdown
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

Comment thread spellcheck.py
raw_input('<enter>\n')
except KeyboardInterrupt:

'exit'
Copy link
Copy Markdown

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
Copy Markdown
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

Comment thread spellcheck.py
print 'Incorrect -', word
spellchk = self.correct(word, lWords)
if spellchk == word and spellchk not in lWords[word[0]]:
print 'NO SUGGESTION'
Copy link
Copy Markdown

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

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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