sequencematcher
v1.0.11
Published
calculate two array's similarity, like difflib.SequenceMatcher() in python.
Downloads
57
Maintainers
Readme
calculate two array's similarity, like difflib.SequenceMatcher().ratio() in python.
usage:
var sm = require('sequencematcher');
var array1 = [1, 2, 3];
var array2 = [1, 2];
var similarity = sm.sequenceMatcher(array1, array2);
console.log(similarity);
//0.8
params:
Type must be array and length must equal 1 at least. otherwise it return -1;
It keeps same result no matter how sorted of params;
result:
similarity between 0 and 1 in normal.