def token_freqs(doc):
 freq = defaultdict(int)
 for tok in tokens(doc):
  freq[tok] += 1
 return freq

def token_freqs ( doc ) : freq = defaultdict ( int ) for tok in tokens ( doc ) : freq [ tok ] += 1 return freq
extract a dict mapping tokens from doc to their frequencies .