Giter Site home page Giter Site logo

node-sift-distance's Introduction

SIFT 4

npm npm downloads build status

Install via npm

$ 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.

About

This implements the SIFT4 extended version.

API

SIFT( a, b, [options] )

  • String|Buffer|Array a
  • String|Buffer|Array b
  • Object options
    • Number maxOffset
    • Number maxDistance
    • Function tokenizer
    • Function tokenMatcher
    • Function matchEvaluator
    • Function lengthEvaluator
    • Function transpositionEvaluator

Options

Number maxOffset

The maximum largest common substring offset to be matched against one another. Defaults to 5.

Number maxDistance

Distance at which the algorithm should stop computing the value and just exit (the values are too different anyway).

Function tokenizer( value ) -> String|Array|Buffer

  • Mixed value

Function to transform strings into vectors of tokens.

Function tokenMatcher( token1, token2 ) -> Boolean

  • Mixed token1
  • Mixed token2

Function to determine if two tokens match each other (equal).

Function matchEvaluator( token1, token2 ) -> Number

  • Mixed token1
  • Mixed 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.

Function lengthEvaluator( lcs ) -> Number

  • Number lcs: largest common substring length

Function to determine the way the lcs value is added to the lcss. For example, longer continuous substrings could be awarded.

Function transpositionEvaluator( transpositions, lcss ) -> Number

  • Number transpositions: number of transpositions
  • Number lcss: largest common subsequence length

Function to determine the way the number of transpositions affects the final result.

node-sift-distance's People

Contributors

jhermsmeier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

trash-mad

node-sift-distance's Issues

Add tests

Find some test vectors for all versions and implement tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.