diff --git a/u4/word_count.py b/u4/word_count.py index fdcda35..bfbd034 100644 --- a/u4/word_count.py +++ b/u4/word_count.py @@ -4,6 +4,6 @@ from collections import Counter def count_words(text: str) -> dict[str, int]: text = text.lower() - words = re.findall(r"[a-z0-9áäčďéíľňóôŕšťúýž]+(?:'[a-z0-9áäčďéíľňóôŕšťúýž]+)?", text) + words = re.findall(r"\b[a-z0-9áäčďéíľňóôŕšťúýž]+(?:'[a-z0-9áäčďéíľňóôŕšťúýž]+)?\b", text) return dict(Counter(words))