Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_word(self, word):
- word_list = word.split()
- words = len(word_list)
- correct_words = 0
- for word in word_list:
- stripped_word = ''.join(c for c in word if c.isalpha()).lower()
- if len(word)/2 > len(stripped_word):
- break
- if stripped_word in self.english_words:
- correct_words += 1
- if words > 0:
- this_score = correct_words/words
- else:
- this_score = 0
- return this_score
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement