Update u4/word_count.py
This commit is contained in:
parent
a9053e5f7d
commit
c12445eceb
@ -4,6 +4,6 @@ from collections import Counter
|
|||||||
def count_words(text: str) -> dict[str, int]:
|
def count_words(text: str) -> dict[str, int]:
|
||||||
text = text.lower()
|
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))
|
return dict(Counter(words))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user