Algorithm-AhoCorasick
view release on metacpan or search on metacpan
lib/Algorithm/AhoCorasick.pm view on Meta::CPAN
}
}
=head1 DESCRIPTION
Aho-Corasick is a classic (1975) algorithm for locating elements of a
finite set of strings within an input text. It constructs a finite
state machine from a list of keywords, then uses the machine to locate
all occurrences of the keywords. Construction of the machine takes
time proportional to the sum of the lengths of the keywords and the
machine processes the input string in a single pass - that is, the
algorithm may be considerably more efficient than searching for each
keyword separately.
=head1 PROCEDURAL INTERFACE
The module exports 2 functions for the common use cases: C<find_all>
for finding all matches, and C<find_first> for finding whether a match
exists at all. Note that both functions must be explicitly imported
(i.e. with C<use Algorithm::AhoCorasick qw(find_all find_first);>)
before they can be called. Both functions take the same arguments: the
( run in 0.315 second using v1.01-cache-2.11-cpan-8d75d55dd25 )