Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function constructMatrix(sentences, threshold) {
var matrix = [];
for (var i = 0; i < sentences.length; i++) {
matrix[i] = [];
var sentenceA = sentences[i];
for (var j = 0; j < sentences.length; j++) {
var sentenceB = sentences[j];
var value = wuzzy.tanimoto(sentenceB, sentenceA);
if(!!threshold && value < threshold) {
value = 0;
}
matrix[i][j] = value;
}
matrix[i] = normalize(matrix[i]);
}
return matrix;
}