
| Current Path : /proc/thread-self/root/usr/local/lib/python3.8/dist-packages/txt/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : //proc/thread-self/root/usr/local/lib/python3.8/dist-packages/txt/is_word.py |
def is_word(s):
if not isinstance(s, str):
raise TypeError(f'{s} if of type {type(s)}')
return any([character.isalpha() for character in s])
def count_words(text):
if not isinstance(text, str):
raise TypeError(f'{text} if of type {type(text)}')
return len([s for s in text.split() if is_word(s)])