PHP 클래스 DiffMatchPatch\Match

저자: Neil Fraser ([email protected])
저자: Daniil Skrobov ([email protected])
파일 보기 프로젝트 열기: yetanotherape/diff-match-patch

보호된 프로퍼티들

프로퍼티 타입 설명
$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).

공개 메소드들

메소드 설명
__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 )

보호된 메소드들

메소드 설명
bitapScore ( integer $errors, integer $matchLoc, integer $patternLen, integer $searchLoc ) : float Compute and return the score for a match with e errors and x location.

메소드 상세

__construct() 공개 메소드

public __construct ( )

alphabet() 공개 메소드

Initialise the alphabet for the Bitap algorithm.
public alphabet ( string $pattern ) : array
$pattern string The text to encode.
리턴 array Hash of character locations.

bitap() 공개 메소드

Locate the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm.
public bitap ( string $text, string $pattern, integer $loc ) : integer
$text string The text to search.
$pattern string The pattern to search for.
$loc integer The location to search around.
리턴 integer Best match index or -1.

bitapScore() 보호된 메소드

Accesses loc and pattern through being a closure.
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.
리턴 float Overall score for match (0.0 = good, 1.0 = bad).

getDistance() 공개 메소드

public getDistance ( ) : integer
리턴 integer

getMaxBits() 공개 메소드

public getMaxBits ( ) : integer
리턴 integer

getThreshold() 공개 메소드

public getThreshold ( ) : float
리턴 float

main() 공개 메소드

Locate the best instance of 'pattern' in 'text' near 'loc'.
public main ( string $text, string $pattern, integer $loc ) : integer
$text string The text to search.
$pattern string The pattern to search for.
$loc integer The location to search around.
리턴 integer Best match index or -1.

setDistance() 공개 메소드

public setDistance ( integer $distance )
$distance integer

setMaxBits() 공개 메소드

public setMaxBits ( integer $maxBits )
$maxBits integer

setThreshold() 공개 메소드

public setThreshold ( float $threshold )
$threshold float

프로퍼티 상세

$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).
protected $distance

$maxBits 보호되어 있는 프로퍼티

The number of bits in an int.
protected $maxBits

$threshold 보호되어 있는 프로퍼티

At what point is no match declared (0.0 = perfection, 1.0 = very loose).
protected $threshold