mol_text_distance 0.0.301 → 0.0.303
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node.deps.json +1 -1
- package/node.js +13 -13
- package/node.js.map +1 -1
- package/node.mjs +13 -13
- package/node.mjs.map +1 -1
- package/node.test.js +291 -291
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +13 -13
- package/web.js.map +1 -1
- package/web.mjs +13 -13
- package/web.mjs.map +1 -1
- package/web.test.js +188 -188
- package/web.test.js.map +1 -1
package/node.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["LICENSE","README.md","
|
|
1
|
+
{"files":["mam.ts","LICENSE","README.md","yarn.lock","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/index.html","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/text/profile/profile.ts","mol/text/profile/distance/distance.ts","mol/text/distance/readme.md","mol/text/distance/distance.ts"],"mods":{},"deps_in":{"mol/text":{"mol/text/distance":-9007199254740991,"mol/text/profile":-9007199254740991},"mol":{"mol/text":-9007199254740991},"":{"mol":-9007199254740991},"mol/text/profile/distance":{"mol/text/distance":-2},"mol/text/profile":{"mol/text/profile/distance":-9007199254740991,"mol/text/distance":-3}},"deps_out":{"mol/text/distance":{"mol/text":-9007199254740991,"mol/text/profile/distance":-2,"mol/text/profile":-3},"mol/text":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/text/profile/distance":{"mol/text/profile":-9007199254740991},"mol/text/profile":{"mol/text":-9007199254740991}},"sloc":{"ts":55,"LICENSE":113,"md":503,"lock":985,"js":9,"json":93,"tree":31,"CNAME":1,"html":1},"deps":{"mol/text/distance":{"..":-9007199254740991,"/mol/text/distance":-1,"/mol/text/profile/distance":-2,"/mol/text/profile":-3},"mol/text":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/text/profile/distance":{"..":-9007199254740991,"/mol/text/profile/distance":-1},"mol/text/profile":{"..":-9007199254740991,"/mol/text/profile":-1}}}
|
package/node.js
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var exports = void 0;
|
|
3
|
-
"use strict"
|
|
4
|
-
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
13
|
-
$.$$ = $
|
|
14
|
-
|
|
15
|
-
;
|
|
16
3
|
|
|
17
4
|
var $node = $node || {}
|
|
18
5
|
void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
|
|
@@ -27,6 +14,19 @@ module.exports = $;
|
|
|
27
14
|
;
|
|
28
15
|
|
|
29
16
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
17
|
+
;
|
|
18
|
+
"use strict"
|
|
19
|
+
|
|
20
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
21
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
28
|
+
$.$$ = $
|
|
29
|
+
|
|
30
30
|
;
|
|
31
31
|
"use strict";
|
|
32
32
|
var $;
|
package/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../mam.
|
|
1
|
+
{"version":3,"sources":["-","../../../../mam.ts","../../../../mam.jam.js","../../profile/mol/text/profile/profile.ts","../../profile/distance/mol/text/profile/distance/distance.ts","../mol/text/distance/distance.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;AEFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA,IAAU,CAAC,CAaV;AAbD,WAAU,CAAC;IAEV,SAAgB,iBAAiB,CAAE,IAAY;QAC9C,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAA;QAC7B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoB,CAAA;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,EAAG,CAAC,EAAG;YAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAE,CAAA;YACtC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAE,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B,iBAAiB,CAAE,KAAK,CAAE,CAC1B,CAAA;IACF,CAAC;IARe,oBAAkB,qBAQjC,CAAA;AAEF,CAAC,EAZS,CAAC,KAAD,CAAC,QAYV;;","file":"node.js","sourcesContent":[null,"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n",null,"namespace $ {\n\t\n\texport function $mol_text_profile( text: string ) {\n\t\ttext = '\\n\\n' + text + '\\n\\n'\n\t\tconst key = new Map< string, number >()\n\t\tfor( let i = 0; i < text.length - 2; ++ i ) {\n\t\t\tconst trigram = text.slice( i, i + 3 )\n\t\t\tconst count = key.get( trigram ) ?? 0\n\t\t\tkey.set( trigram, count + 1 )\n\t\t}\n\t\treturn key\n\t}\n\t\n}\n","namespace $ {\n\t\n\texport function $mol_text_profile_distance(\n\t\tleft: Map< string, number >,\n\t\tright: Map< string, number >,\n\t) {\n\t\t\n\t\tlet dist = -4\n\t\tlet total = -4\n\t\t\n\t\tfor( const [ trigram, left_count ] of left ) {\n\t\t\ttotal += left_count\n\t\t\tconst right_count = right.get( trigram ) ?? 0\n\t\t\tdist += Math.abs( left_count - right_count )\n\t\t}\n\t\t\n\t\tfor( const [ trigram, right_count ] of right ) {\n\t\t\ttotal += right_count\n\t\t\tconst left_count = left.get( trigram ) ?? 0\n\t\t\tdist += Math.abs( left_count - right_count )\n\t\t}\n\t\t\n\t\tif( dist < 0 ) return 0\n\t\t\n\t\treturn dist / total\n\t}\n\t\n}\n","namespace $ {\n\t\n\texport function $mol_text_distance(\n\t\tleft: string,\n\t\tright: string,\n\t) {\n\t\treturn $mol_text_profile_distance(\n\t\t\t$mol_text_profile( left ),\n\t\t\t$mol_text_profile( right ),\n\t\t)\n\t}\n\t\n}\n"]}
|
package/node.mjs
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var exports = void 0;
|
|
3
|
-
"use strict"
|
|
4
|
-
|
|
5
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
6
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
7
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
13
|
-
$.$$ = $
|
|
14
|
-
|
|
15
|
-
;
|
|
16
3
|
|
|
17
4
|
var $node = $node || {}
|
|
18
5
|
void function( module ) { var exports = module.exports = this; function require( id ) { return $node[ id.replace( /^.\// , "../" ) ] };
|
|
@@ -27,6 +14,19 @@ module.exports = $;
|
|
|
27
14
|
;
|
|
28
15
|
|
|
29
16
|
$node[ "../mam.ts" ] = $node[ "../mam.ts" ] = module.exports }.call( {} , {} )
|
|
17
|
+
;
|
|
18
|
+
"use strict"
|
|
19
|
+
|
|
20
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
21
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if ((d = decorators[i])) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
24
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var $ = ( typeof module === 'object' ) ? ( module['export'+'s'] = globalThis ) : globalThis
|
|
28
|
+
$.$$ = $
|
|
29
|
+
|
|
30
30
|
;
|
|
31
31
|
"use strict";
|
|
32
32
|
var $;
|
package/node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../mam.
|
|
1
|
+
{"version":3,"sources":["-","../../../../mam.ts","../../../../mam.jam.js","../../profile/mol/text/profile/profile.ts","../../profile/distance/mol/text/profile/distance/distance.ts","../mol/text/distance/distance.ts"],"names":[],"mappings":";;AAAA;AACA;AACA;AACA;;ACHA,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;AAK3B,IAAU,CAAC,CAMV;AAND,WAAU,CAAC;AAMX,CAAC,EANS,CAAC,KAAD,CAAC,QAMV;AAED,MAAM,CAAC,OAAO,GAAG,CAAC,CAAA;;;ADblB;AACA;AACA;AEFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACZA,IAAU,CAAC,CAaV;AAbD,WAAU,CAAC;IAEV,SAAgB,iBAAiB,CAAE,IAAY;QAC9C,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,CAAA;QAC7B,MAAM,GAAG,GAAG,IAAI,GAAG,EAAoB,CAAA;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,EAAG,CAAC,EAAG;YAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAE,CAAA;YACtC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAE,OAAO,CAAE,IAAI,CAAC,CAAA;YACrC,GAAG,CAAC,GAAG,CAAE,OAAO,EAAE,KAAK,GAAG,CAAC,CAAE,CAAA;SAC7B;QACD,OAAO,GAAG,CAAA;IACX,CAAC;IATe,mBAAi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"Error.stackTraceLimit = 50;\n\ndeclare let _$_: { new(): {} } & typeof globalThis\ndeclare class $ extends _$_ {}\n\nnamespace $ {\n\texport type $ = typeof $$\n\texport declare class $$ extends $ {}\n\tnamespace $$ {\n\t\texport type $$ = $\n\t}\n}\n\nmodule.exports = $\n",null,"namespace $ {\n\t\n\texport function $mol_text_profile( text: string ) {\n\t\ttext = '\\n\\n' + text + '\\n\\n'\n\t\tconst key = new Map< string, number >()\n\t\tfor( let i = 0; i < text.length - 2; ++ i ) {\n\t\t\tconst trigram = text.slice( i, i + 3 )\n\t\t\tconst count = key.get( trigram ) ?? 0\n\t\t\tkey.set( trigram, count + 1 )\n\t\t}\n\t\treturn key\n\t}\n\t\n}\n","namespace $ {\n\t\n\texport function $mol_text_profile_distance(\n\t\tleft: Map< string, number >,\n\t\tright: Map< string, number >,\n\t) {\n\t\t\n\t\tlet dist = -4\n\t\tlet total = -4\n\t\t\n\t\tfor( const [ trigram, left_count ] of left ) {\n\t\t\ttotal += left_count\n\t\t\tconst right_count = right.get( trigram ) ?? 0\n\t\t\tdist += Math.abs( left_count - right_count )\n\t\t}\n\t\t\n\t\tfor( const [ trigram, right_count ] of right ) {\n\t\t\ttotal += right_count\n\t\t\tconst left_count = left.get( trigram ) ?? 0\n\t\t\tdist += Math.abs( left_count - right_count )\n\t\t}\n\t\t\n\t\tif( dist < 0 ) return 0\n\t\t\n\t\treturn dist / total\n\t}\n\t\n}\n","namespace $ {\n\t\n\texport function $mol_text_distance(\n\t\tleft: string,\n\t\tright: string,\n\t) {\n\t\treturn $mol_text_profile_distance(\n\t\t\t$mol_text_profile( left ),\n\t\t\t$mol_text_profile( right ),\n\t\t)\n\t}\n\t\n}\n"]}
|