AhoCorasick
PHP implementation of the Aho-Corasick string search algorithm
|
Search and replace functionality. More...
Public Member Functions | |
__construct (array $replacePairs) | |
Constructor. | |
searchAndReplace ( $text) | |
Search and replace a set of keywords in some text. | |
Public Member Functions inherited from AhoCorasick\MultiStringMatcher | |
getKeywords () | |
Accessor for the search keywords. | |
nextState ( $currentState, $inputChar) | |
Map the current state and input character to the next state. | |
searchIn ( $text) | |
Locate the search keywords in some text. | |
Protected Attributes | |
$replacePairs = [] | |
Protected Attributes inherited from AhoCorasick\MultiStringMatcher | |
$searchKeywords = [] | |
$numStates = 1 | |
$outputs = [] | |
$noTransitions = [] | |
$yesTransitions = [] | |
Additional Inherited Members | |
Protected Member Functions inherited from AhoCorasick\MultiStringMatcher | |
computeYesTransitions () | |
Get the state transitions which the string-matching automaton shall make as it advances through input text. | |
computeNoTransitions () | |
Get the state transitions which the string-matching automaton shall make when a partial match proves false. | |
Search and replace functionality.
AhoCorasick\MultiStringReplacer::__construct | ( | array | $replacePairs | ) |
Constructor.
array | $replacePairs | array of ( 'from' => 'to' ) replacement pairs. |
Reimplemented from AhoCorasick\MultiStringMatcher.
AhoCorasick\MultiStringReplacer::searchAndReplace | ( | $text | ) |
Search and replace a set of keywords in some text.
string | $text | The string to search in. |