Aktualizovat u4/word_count.py
This commit is contained in:
parent
c57e5420b8
commit
007674c96b
@ -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))
|
||||||
Loading…
Reference in New Issue
Block a user