import sets
KEYWORDS = sets.Set(['and', 'or', 'not'])
query = "test and testing and not perl or testit or example"
def decorate(w):
if w in KEYWORDS:
return w
return "*%s*" % w
query = " ".join([decorate(w.strip()) for w in query.split()])
--
Regards,
Diez B. Roggisch