Python Implementation of Aho-Corasick Algorithm

Reference: https://cr.yp.to/bib/1975/aho.pdf

Demo

the result of executing the sample in main.py is as follows:

input:

text = 'ahishers'
words = {'he', 'she', 'his', 'hers'}

output:

his from position 1 to 3
he from position 4 to 5
she from position 3 to 5
hers from position 4 to 7

GitHub

View Github