MCPcopy
hub / github.com/TheAlgorithms/Python / get_english_count

Function get_english_count

strings/detecting_english_programmatically.py:19–24  ·  view source on GitHub ↗
(message: str)

Source from the content-addressed store, hash-verified

17
18
19def get_english_count(message: str) -> float:
20 message = message.upper()
21 message = remove_non_letters(message)
22 possible_words = message.split()
23 matches = len([word for word in possible_words if word in ENGLISH_WORDS])
24 return float(matches) / len(possible_words)
25
26
27def remove_non_letters(message: str) -> str:

Callers 1

is_englishFunction · 0.85

Calls 2

remove_non_lettersFunction · 0.85
splitMethod · 0.80

Tested by

no test coverage detected