import collections
freq = collections.Counter()
line = (
    'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod')
freq.update(line.split())
Word Frequency calculation for 1Gb text file in Python