Update extramath.js

This commit is contained in:
Namhyeon Go 2022-11-06 21:50:22 +09:00 committed by GitHub
parent 750a4f8f94
commit 329f1b1bfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;