PHP Class SimilarText\Finder

Afficher le fichier Open project: rap2hpoutre/similar-text-finder Class Usage Examples

Protected Properties

Свойство Type Description
$haystack Haystack
$needle Needle
$sorted_haystack Hold the sorted comparison stack.

Méthodes publiques

Méthode Description
__construct ( string $needle, array $haystack ) : void Finder constructor.
all ( ) : array Return all strings in sorted match order.
first ( ) : mixed Return the highest match.
hasExactMatch ( ) : boolean Return whether there is an exact match.

Méthodes protégées

Méthode Description
levenshteinUtf8 ( string $string1, string $string2 ) : integer Calculate the levenshtein distance between two strings.
sortHaystack ( ) : void Sort Haystack.
utf8ToExtendedAscii ( string $str, array &$map ) : string Ensure a string only uses ascii characters.

Method Details

__construct() public méthode

Finder constructor.
public __construct ( string $needle, array $haystack ) : void
$needle string
$haystack array
Résultat void

all() public méthode

Return all strings in sorted match order.
public all ( ) : array
Résultat array

first() public méthode

Return the highest match.
public first ( ) : mixed
Résultat mixed

hasExactMatch() public méthode

Return whether there is an exact match.
public hasExactMatch ( ) : boolean
Résultat boolean

levenshteinUtf8() protected méthode

Calculate the levenshtein distance between two strings.
protected levenshteinUtf8 ( string $string1, string $string2 ) : integer
$string1 string
$string2 string
Résultat integer

sortHaystack() protected méthode

Sort Haystack.
protected sortHaystack ( ) : void
Résultat void

utf8ToExtendedAscii() protected méthode

Ensure a string only uses ascii characters.
protected utf8ToExtendedAscii ( string $str, array &$map ) : string
$str string
$map array
Résultat string

Property Details

$haystack protected_oe property

Haystack
protected $haystack

$needle protected_oe property

Needle
protected $needle

$sorted_haystack protected_oe property

Hold the sorted comparison stack.
protected $sorted_haystack