From c12445ecebe621ad2ab01555f9d22a889416707a Mon Sep 17 00:00:00 2001 From: Roman Dmytruk Date: Mon, 26 Oct 2026 23:46:14 +0000 Subject: [PATCH] Update u4/word_count.py --- u4/word_count.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))