def np_counts ( self ) : counts = defaultdict ( int ) for phrase in self . noun_phrases : counts [ phrase ] += 1 return counts
word counts to dictionary in python
Dictionary of noun phrase frequencies in this text .
def np_counts(self):
    """Dictionary of noun phrase frequencies in this text.
    """
    counts = defaultdict(int)
    for phrase in self.noun_phrases:
        counts[phrase] += 1
    return counts