dictionary idiom needed

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Dec 11 19:34:45 CET 2008

> I need an dictionary idiom whereby I can find all instances of
> a given 'word' with any 'tagB', and then subdivide into all instances
> of a given 'tagB'.  In both cases I would want the value as a count of
> all instances found.

If I have understood you well enough, I think you can do with a dict
that has the tuple ('word', 'tagB') as key, and as value has a
collections.defaultdict(int) that maps 'tagB' to its count.


More information about the Python-list mailing list