A = ahocorasick.Automaton()
for i, w in enumerate(search_words):
    A.add_word(w, (i, w))
A.make_automaton()
start = time.time()
print(('ah matches', sum(1 for i in A.iter(text))))
print(('aho done in ', time.time() - start))
exp = re.compile('|'.join(search_words))
start = time.time()
m = exp.findall(text)
print(('re matches', sum(1 for _ in m)))
print(('re done in ', time.time() - start))
Извлечь смайлики из текста