2 ms·
Pure PHP Aho-Corasick algorithm finite state machine) and pattern match with a wildcard and a ternary trie. Unittest: $tree = new Ahocorasick\Ahocorasick(); $t
by Gigamegs 1y ago
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");
web+git: https://tetramatrix.github.io/phpahocorasick/ https://tetramatrix.github.io/phpahocorasick/