fastest way for humongous regexp search?

Richie Hindle richie at entrian.com
Tue Nov 2 11:56:06 EST 2004


[me, with brain switched off]
> Make the misspelling set lower case, and convert the list of words from
> the text file into lower case before comparing them:

Gah!  That code should read:

>>> from sets import Set
>>> misspellings = Set(['speling', 'misteak'])
>>> text = "Does this text contain any common Speling Mistakes?"
>>> print [word for word in text.lower().split() if word in misspellings]
['speling']

-- 
Richie Hindle
richie at entrian.com




More information about the Python-list mailing list