Re: help on dictionary

2007-11-01 Thread Paul Hankin
On Nov 1, 11:21 pm, cesco <[EMAIL PROTECTED]> wrote: > Hi, > > I have a defaultdict which I have initialized as follows: > > def train(features): > model = collections.defaultdict(lambda: 1) > for f in features: > model[f] += 1 > return model > > def_dict = train(large_set_of_wo

help on dictionary

2007-11-01 Thread cesco
Hi, I have a defaultdict which I have initialized as follows: def train(features): model = collections.defaultdict(lambda: 1) for f in features: model[f] += 1 return model def_dict = train(large_set_of_words) where large_set_of_words is the list of possible strings. I'd lik