Added doctest to detecting_english_programmatically.py (#11135)

This commit is contained in:
Suyash Dongre 2023-11-06 17:44:39 +05:30 committed by GitHub
parent eb989c08cd
commit fa508d7b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,18 @@ def get_english_count(message: str) -> float:
def 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("")
''
"""
return "".join(symbol for symbol in message if symbol in LETTERS_AND_SPACE)