Datasets:

Modalities:
Text
Formats:
text
Size:
< 1K
Libraries:
Datasets
License:
PyRs2 / python /word_frequency.py
khulnasoft's picture
Upload folder using huggingface_hub
998b6cc verified
raw
history blame contribute delete
195 Bytes
from collections import Counter
def word_frequency(file_path):
with open(file_path, 'r') as f:
words = f.read().split()
return Counter(words)
print(word_frequency('sample.txt'))