ddmp.match

Undocumented in source.

Members

Functions

bitap
int bitap(string text, string pattern, int loc)

Locate the best instance of 'pattern' in 'text' near 'loc' using the Bitap algorithm. Returns -1 if no match found. @param text The text to search. @param pattern The pattern to search for. @param loc The location to search around. @return Best match index or -1.

bitapScore
double bitapScore(int e, int x, int loc, string pattern)

Compute and return the score for a match with e errors and x location. @param e Number of errors in match. @param x Location of match. @param loc Expected location of match. @param pattern Pattern being sought. @return Overall score for match (0.0 = good, 1.0 = bad).

initAlphabet
int[char] initAlphabet(string pattern)

Initialise the alphabet for the Bitap algorithm. @param pattern The text to encode. @return Hash of character locations.

match_main
int match_main(string text, string pattern, int loc)

Locate the best instance of 'pattern' in 'text' near 'loc'. Returns -1 if no match found. @param text The text to search. @param pattern The pattern to search for. @param loc The location to search around. @return Best match index or -1.

Variables

MATCH_DISTANCE
int MATCH_DISTANCE;
Undocumented in source.
MATCH_THRESHOLD
float MATCH_THRESHOLD;
Undocumented in source.

Meta