MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / remove_non_letters

Function remove_non_letters

strings/detecting_english_programmatically.py:27–40  ·  view source on GitHub ↗

>>> 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("") ''

(message: str)

Source from the content-addressed store, hash-verified

25
26
27def remove_non_letters(message: str) -> str:
28 """
29 >>> remove_non_letters("Hi! how are you?")
30 'Hi how are you'
31 >>> remove_non_letters("P^y%t)h@o*n")
32 'Python'
33 >>> remove_non_letters("1+1=2")
34 ''
35 >>> remove_non_letters("www.google.com/")
36 'wwwgooglecom'
37 >>> remove_non_letters("")
38 ''
39 """
40 return "".join(symbol for symbol in message if symbol in LETTERS_AND_SPACE)
41
42
43def is_english(

Callers 2

get_english_countFunction · 0.85
is_englishFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected