mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-19 08:01:04 +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.data.push(w);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.toDTM = function() {
|
this.toArray = function() {
|
||||||
var dtm = [];
|
var dtm = [];
|
||||||
for (var i = 0; i < this.data.length; i++) {
|
for (var i = 0; i < this.data.length; i++) {
|
||||||
var dt = [];
|
var dt = [];
|
||||||
|
@ -43,8 +43,15 @@ function cos(A, B) {
|
||||||
|
|
||||||
exports.DTM = DTM;
|
exports.DTM = DTM;
|
||||||
exports.cos = cos;
|
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.AUTHOR = "catswords@protonmail.com";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user