build/modelscript.umd.js
function (str1, str2) {
              var sanitized_str1 = sanitize(str1);
              var sanitized_str2 = sanitize(str2);
              var pairs1 = wordLetterPairs(sanitized_str1);
              var pairs2 = wordLetterPairs(sanitized_str2);
              var intersection = 0, union = pairs1.length + pairs2.length;
              if (union === 0) {
                  if (sanitized_str1 === sanitized_str2) {
                      return 1;
                  } else {
                      return 0;
                  }
              } else {
                var i, j, pair1, pair2;
                for (i = 0; i < pairs1.length; i++) {
                  pair1 = pairs1[i];
                  for (j = 0; j < pairs2.length; j++) {
                    pair2 = pairs2[j];
                    if (pair1 == pair2) {
                      intersection ++;
                      delete pairs2[j];
                      break;
                    }
                  }
                }
                return 2 * intersection / union;
              }
            }
function (str1, str2) {
              var sanitized_str1 = sanitize(str1);
              var sanitized_str2 = sanitize(str2);
              var pairs1 = wordLetterPairs(sanitized_str1);
              var pairs2 = wordLetterPairs(sanitized_str2);
              var intersection = 0, union = pairs1.length + pairs2.length;
              if (union === 0) {
                  if (sanitized_str1 === sanitized_str2) {
                      return 1;
                  } else {
                      return 0;
                  }
              } else {
                var i, j, pair1, pair2;
                for (i = 0; i < pairs1.length; i++) {
                  pair1 = pairs1[i];
                  for (j = 0; j < pairs2.length; j++) {
                    pair2 = pairs2[j];
                    if (pair1 == pair2) {
                      intersection ++;
                      delete pairs2[j];
                      break;
                    }
                  }
                }
                return 2 * intersection / union;
              }
            }
function ( str1 , str2 ) { var sanitized_str1 = sanitize ( str1 ) ; var sanitized_str2 = sanitize ( str2 ) ; var pairs1 = wordLetterPairs ( sanitized_str1 ) ; var pairs2 = wordLetterPairs ( sanitized_str2 ) ; var intersection = 0 , union = pairs1 . length + pairs2 . length ; if ( union === 0 ) { if ( sanitized_str1 === sanitized_str2 ) { return 1 ; } else { return 0 ; } } else { var i , j , pair1 , pair2 ; for ( i = 0 ; i < pairs1 . length ; i ++ ) { pair1 = pairs1 [ i ] ; for ( j = 0 ; j < pairs2 . length ; j ++ ) { pair2 = pairs2 [ j ] ; if ( pair1 == pair2 ) { intersection ++ ; delete pairs2 [ j ] ; break ; } } } return 2 * intersection / union ; } }
Compare two strings, and spit out a number from 0-1
Compare two strings and spit out a number from 0 - 1