Aktualizovat u4/word_count.py

This commit is contained in:
Oleksandr Mateshchuk 2026-10-06 12:31:41 +00:00
parent c57e5420b8
commit 007674c96b

View File

@ -2,7 +2,7 @@ import re
from collections import Counter from collections import Counter
def word_count(text): def count_words(text):
pattern = r"\w+(?:'\w+)?" pattern = r"\w+(?:'\w+)?"
words = re.findall(pattern, text.lower()) words = re.findall(pattern, text.lower())
return dict(Counter(words)) return dict(Counter(words))