Re: Counting occurences of words in a list of strings

2005-05-24 Thread John Machin
Travers Naran wrote: > John Machin wrote: > >> 3. If you want to roll your own, start with Gonzalo Navarro's >> publications: http://www.dcc.uchile.cl/~gnavarro/subj-multiple.html > > > I don't suffer from NMH syndrome. If ahocorasick does the job, or even > count, I'm OK with that. Do you m

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

Re: Counting occurences of words in a list of strings

2005-05-24 Thread John Machin
Travers Naran wrote: > 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 string

Re: Counting occurences of words in a list of strings

2005-05-24 Thread Robert Kern
Travers Naran wrote: > 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 string

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