Skip to content

Commit

Permalink
Fixup docstring rendering for utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
bravegnu committed Jul 6, 2015
1 parent e397b2a commit 3bc6f84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions doc/utils.rst
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Utils
=====

.. automodule:: libcipher.utils
:members:
14 changes: 8 additions & 6 deletions libcipher/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
class EnglishChecker():
"""This class serves the purpose of checking if a statement is
English or not. Two filter methods accomplish this by ensuring:
1. At least 85% of the message comprises of english alphabets
2. At least 25% of the words in the sentence are contained in
the dictionary file that the user provides
1. At least 85% of the message comprises of english alphabets
2. At least 25% of the words in the sentence are contained in
the dictionary file that the user provides
"""

def __init__(self, dict_file):
Expand Down Expand Up @@ -37,8 +38,8 @@ def remove_non_letters(self, message):
return ''.join(letters_only)

def is_english(self, message, word_percentage=25, letter_percentage=85):
"""Checks to see if given text is in English and
returns the result.
"""Returns true if given text is in English, false otherwise.
Args:
message (string): The text input
word_percentage (int): Indicates the minium
Expand All @@ -47,10 +48,11 @@ def is_english(self, message, word_percentage=25, letter_percentage=85):
letter_percentage (int): Indicates the minium
percentage of English alphabets in a word. The
default value is 85
Returns:
bool: True if message is in English, False otherwise.
"""

if len(message) == 0:
return False
words_match = self.get_english_count(message) * 100 >= word_percentage
Expand Down

0 comments on commit 3bc6f84

Please sign in to comment.