Property | Type | Description | |
---|---|---|---|
$distance | How far to search for a match (0 = exact location, 1000+ = broad match). A match this many characters away from the expected location will add 1.0 to the score (0.0 is a perfect match). | ||
$maxBits | The number of bits in an int. | ||
$threshold | At what point is no match declared (0.0 = perfection, 1.0 = very loose). |
Method | Description | |
---|---|---|
__construct ( ) | ||
alphabet ( string $pattern ) : array | Initialise the alphabet for the Bitap algorithm. | |
bitap ( string $text, string $pattern, integer $loc ) : integer | Locate the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm. | |
getDistance ( ) : integer | ||
getMaxBits ( ) : integer | ||
getThreshold ( ) : float | ||
main ( string $text, string $pattern, integer $loc ) : integer | Locate the best instance of 'pattern' in 'text' near 'loc'. | |
setDistance ( integer $distance ) | ||
setMaxBits ( integer $maxBits ) | ||
setThreshold ( float $threshold ) |
Method | Description | |
---|---|---|
bitapScore ( integer $errors, integer $matchLoc, integer $patternLen, integer $searchLoc ) : float | Compute and return the score for a match with e errors and x location. |
protected bitapScore ( integer $errors, integer $matchLoc, integer $patternLen, integer $searchLoc ) : float | ||
$errors | integer | Number of errors in match. |
$matchLoc | integer | Location of match. |
$patternLen | integer | Length of pattern to search. |
$searchLoc | integer | The location to search around. TODO refactor param usage. |
return | float | Overall score for match (0.0 = good, 1.0 = bad). |
protected $distance |