Re: Counting occurences of words in a list of strings

2005-05-24 Thread Travers Naran
John Machin wrote: > Are you comparing BMH implemented in Python with str.count() implemented > in C? Tee-hee. Yes. I figured out that was the problem pretty quickly and just went back to count(). > 1. A pure Python suggestion: > > Presuming there is a character SEP that cannot appear in the

Counting occurences of words in a list of strings

2005-05-24 Thread Travers Naran
Here's the basic idea. I have a dictionary of substrings (the substrings stored as keys). I have a list of strings. I want to find out, for each word in the dictionary, how many times the substring occurs non-overlapping occurrences there are in the list of strings. This is the best I could