Patch_Hawk / patchhawk /data /benign /str_wordcount.py
RAMCr7's picture
Final patch
58f6308
raw
history blame contribute delete
197 Bytes
def word_count(text):
"""Count occurrences of words in text."""
words = text.split()
counts = {}
for word in words:
counts[word] = counts.get(word, 0) + 1
return counts