$ npm install sift-distance
NOTE: The major version of this module tracks the algorithm's version.
So, if you want to use SIFT 3, for example, you'd install [email protected]
, for version 3B of the SIFT algorithm [email protected]
, for version 4 [email protected]
and so on.
This implements the SIFT4 extended version.
a
b
options
maxOffset
maxDistance
tokenizer
tokenMatcher
matchEvaluator
lengthEvaluator
transpositionEvaluator
maxOffset
The maximum largest common substring offset to be matched against one another. Defaults to 5
.
maxDistance
Distance at which the algorithm should stop computing the value and just exit (the values are too different anyway).
tokenizer( value ) -> String|Array|Buffer
value
Function to transform strings into vectors of tokens.
tokenMatcher( token1, token2 ) -> Boolean
token1
token2
Function to determine if two tokens match each other (equal).
matchEvaluator( token1, token2 ) -> Number
token1
token2
Function to determine the way a token match should be added to the lcs
(largest common substring). For example, a fuzzy match could be implemented.
lengthEvaluator( lcs ) -> Number
lcs
: largest common substring lengthFunction to determine the way the lcs
value is added to the lcss
. For example, longer continuous substrings could be awarded.
transpositionEvaluator( transpositions, lcss ) -> Number
transpositions
: number of transpositionslcss
: largest common subsequence lengthFunction to determine the way the number of transpositions affects the final result.