mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 06:54:58 +00:00
Update extramath.js
This commit is contained in:
parent
750a4f8f94
commit
329f1b1bfe
|
@ -13,7 +13,7 @@ function DTM() {
|
|||
this.data.push(w);
|
||||
};
|
||||
|
||||
this.toDTM = function() {
|
||||
this.toArray = function() {
|
||||
var dtm = [];
|
||||
for (var i = 0; i < this.data.length; i++) {
|
||||
var dt = [];
|
||||
|
@ -43,8 +43,15 @@ function cos(A, B) {
|
|||
|
||||
exports.DTM = DTM;
|
||||
exports.cos = cos;
|
||||
exports.measureSimilarity = function(s1, s2) {
|
||||
var dtm = new DTM();
|
||||
dtm.add(s1);
|
||||
dtm.add(s2);
|
||||
var mat = dtm.toArray();
|
||||
return cos(mat[0], mat[1]);
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "ExtraMath module (extramath.js) version 0.0.2";
|
||||
exports.VERSIONINFO = "ExtraMath module (extramath.js) version 0.0.3";
|
||||
exports.AUTHOR = "catswords@protonmail.com";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
Loading…
Reference in New Issue
Block a user