
March 3, 2010
8:37 a.m.
M.-A. Lemburg, 02.03.2010 23:09:
If you only need to search for a finite set of words, there are few good algorithms for this:
http://en.wikipedia.org/wiki/Aho-Corasick_algorithm * used in Unix fgrep * Python implementation: http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/
http://en.wikipedia.org/wiki/Rabin-Karp_string_search_algorithm#Rabin.E2.80.... * uses hashing
... and acora: http://pypi.python.org/pypi/acora Stefan