This project has moved and is read-only. For the latest updates, please go here.

Pure PHP Aho-Corasick algorithm (finite state machine) and pattern match with a wildcard and a ternary trie.

Unittest:
$tree = new Ahocorasick\Ahocorasick();
$tree->add("AC");
$tree->add("GTG");
$tree->add("AACT");
echo $tree->match("ACCGAGTGCGTGGACAAACTACGATTGTGGAATGAACT","AC*GT");
$this->expectOutputString("ACCGAGT,ACCGAGTGCGT,ACCGAGTGCGTGGACAAACTACGATTGT,ACAAACTACGATTGT,ACTACGATTGT,ACGATTGT");

IMPORTANT INFORMATION
It need some bugfixes. The transition table has some problems.



 

This project has moved. For the latest updates, please go here.

Last edited Jun 15 at 1:48 PM by Phpdevpad, version 12