strings.detecting_english_programmatically

Attributes

ENGLISH_WORDS

LETTERS_AND_SPACE

Functions

get_english_count(→ float)

is_english(→ bool)

load_dictionary(→ dict[str, None])

remove_non_letters(→ str)

Module Contents

strings.detecting_english_programmatically.get_english_count(message: str) float
strings.detecting_english_programmatically.is_english(message: str, word_percentage: int = 20, letter_percentage: int = 85) bool
>>> is_english('Hello World')
True
>>> is_english('llold HorWd')
False
strings.detecting_english_programmatically.load_dictionary() dict[str, None]
strings.detecting_english_programmatically.remove_non_letters(message: str) str
>>> remove_non_letters("Hi! how are you?")
'Hi how are you'
>>> remove_non_letters("P^y%t)h@o*n")
'Python'
>>> remove_non_letters("1+1=2")
''
>>> remove_non_letters("www.google.com/")
'wwwgooglecom'
>>> remove_non_letters("")
''
strings.detecting_english_programmatically.ENGLISH_WORDS
strings.detecting_english_programmatically.LETTERS_AND_SPACE