hybridtm 0.3.0 → 0.5.0
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/dist/{ts/tmxHandler.d.ts → tmxHandler.d.ts} +1 -0
- package/dist/{ts/tmxHandler.js → tmxHandler.js} +10 -0
- package/dist/{tmxhandler.js.map → tmxHandler.js.map} +1 -1
- package/dist/{ts/xliffHandler.d.ts → xliffHandler.d.ts} +1 -0
- package/dist/{ts/xliffHandler.js → xliffHandler.js} +10 -0
- package/dist/{xliffhandler.js.map → xliffHandler.js.map} +1 -1
- package/package.json +14 -9
- package/dist/batchimporter.d.ts +0 -22
- package/dist/batchimporter.js +0 -203
- package/dist/constants.d.ts +0 -15
- package/dist/constants.js +0 -16
- package/dist/constants.js.map +0 -1
- package/dist/debug-progress.d.ts +0 -12
- package/dist/debug-progress.js +0 -49
- package/dist/debug-progress.js.map +0 -1
- package/dist/ngramIndex.d.ts +0 -31
- package/dist/ngramIndex.js +0 -132
- package/dist/ngramIndex.js.map +0 -1
- package/dist/ngrams.d.ts +0 -21
- package/dist/ngrams.js +0 -73
- package/dist/ngrams.js.map +0 -1
- package/dist/package.json +0 -35
- package/dist/progressProvider.d.ts +0 -17
- package/dist/progressProvider.js +0 -14
- package/dist/progressProvider.js.map +0 -1
- package/dist/simplexlifftest.d.ts +0 -1
- package/dist/simplexlifftest.js +0 -23
- package/dist/simplexlifftest.js.map +0 -1
- package/dist/test-import.d.ts +0 -12
- package/dist/test-import.js +0 -101
- package/dist/test-import.js.map +0 -1
- package/dist/test-progress-fix.d.ts +0 -1
- package/dist/test-progress-fix.js +0 -32
- package/dist/test-progress-fix.js.map +0 -1
- package/dist/test-progress.d.ts +0 -12
- package/dist/test-progress.js +0 -32
- package/dist/test-progress.js.map +0 -1
- package/dist/tests/vectorSimilarityComparison.d.ts +0 -12
- package/dist/tests/vectorSimilarityComparison.js +0 -153
- package/dist/tests/vectorSimilarityComparison.js.map +0 -1
- package/dist/tmxhandler.d.ts +0 -61
- package/dist/tmxhandler.js +0 -347
- package/dist/tmxreader.d.ts +0 -25
- package/dist/tmxreader.js +0 -51
- package/dist/tmxtest.d.ts +0 -16
- package/dist/tmxtest.js +0 -316
- package/dist/tmxtest.js.map +0 -1
- package/dist/ts/batchImporter.js.map +0 -1
- package/dist/ts/hybridtm.d.ts +0 -67
- package/dist/ts/hybridtm.js +0 -932
- package/dist/ts/hybridtm.js.map +0 -1
- package/dist/ts/hybridtmFactory.d.ts +0 -43
- package/dist/ts/hybridtmFactory.js +0 -165
- package/dist/ts/hybridtmFactory.js.map +0 -1
- package/dist/ts/importOptions.d.ts +0 -21
- package/dist/ts/importOptions.js +0 -24
- package/dist/ts/importOptions.js.map +0 -1
- package/dist/ts/index.d.ts +0 -25
- package/dist/ts/index.js +0 -22
- package/dist/ts/index.js.map +0 -1
- package/dist/ts/langEntry.d.ts +0 -64
- package/dist/ts/langEntry.js +0 -13
- package/dist/ts/langEntry.js.map +0 -1
- package/dist/ts/match.d.ts +0 -22
- package/dist/ts/match.js +0 -38
- package/dist/ts/match.js.map +0 -1
- package/dist/ts/matchQuality.d.ts +0 -16
- package/dist/ts/matchQuality.js +0 -83
- package/dist/ts/matchQuality.js.map +0 -1
- package/dist/ts/pendingEntry.d.ts +0 -24
- package/dist/ts/pendingEntry.js +0 -13
- package/dist/ts/pendingEntry.js.map +0 -1
- package/dist/ts/searchFilters.d.ts +0 -24
- package/dist/ts/searchFilters.js +0 -13
- package/dist/ts/searchFilters.js.map +0 -1
- package/dist/ts/tmxHandler.js.map +0 -1
- package/dist/ts/tmxReader.js.map +0 -1
- package/dist/ts/tmxtest.d.ts +0 -16
- package/dist/ts/tmxtest.js +0 -316
- package/dist/ts/tmxtest.js.map +0 -1
- package/dist/ts/utils.d.ts +0 -17
- package/dist/ts/utils.js +0 -49
- package/dist/ts/utils.js.map +0 -1
- package/dist/ts/xliffHandler.js.map +0 -1
- package/dist/ts/xliffReader.js.map +0 -1
- package/dist/ts/xlifftest.d.ts +0 -54
- package/dist/ts/xlifftest.js +0 -245
- package/dist/ts/xlifftest.js.map +0 -1
- package/dist/vectorSimilarityTester.d.ts +0 -56
- package/dist/vectorSimilarityTester.js +0 -164
- package/dist/vectorSimilarityTester.js.map +0 -1
- package/dist/xliffhandler.d.ts +0 -67
- package/dist/xliffhandler.js +0 -522
- package/dist/xliffreader.d.ts +0 -25
- package/dist/xliffreader.js +0 -50
- package/dist/xlifftest.d.ts +0 -54
- package/dist/xlifftest.js +0 -245
- package/dist/xlifftest.js.map +0 -1
- /package/dist/{ts/batchImporter.d.ts → batchImporter.d.ts} +0 -0
- /package/dist/{ts/batchImporter.js → batchImporter.js} +0 -0
- /package/dist/{batchimporter.js.map → batchImporter.js.map} +0 -0
- /package/dist/{ts/tmxReader.d.ts → tmxReader.d.ts} +0 -0
- /package/dist/{ts/tmxReader.js → tmxReader.js} +0 -0
- /package/dist/{tmxreader.js.map → tmxReader.js.map} +0 -0
- /package/dist/{ts/xliffReader.d.ts → xliffReader.d.ts} +0 -0
- /package/dist/{ts/xliffReader.js → xliffReader.js} +0 -0
- /package/dist/{xliffreader.js.map → xliffReader.js.map} +0 -0
package/dist/ngramIndex.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*******************************************************************************
|
|
3
|
-
* Copyright (c) 2025 Maxprograms.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials
|
|
6
|
-
* are made available under the terms of the Eclipse License 1.0
|
|
7
|
-
* which accompanies this distribution, and is available at
|
|
8
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
9
|
-
*
|
|
10
|
-
* Contributors:
|
|
11
|
-
* Maxprograms - initial API and implementation
|
|
12
|
-
*******************************************************************************/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.NGramIndex = void 0;
|
|
15
|
-
const apache_arrow_1 = require("apache-arrow");
|
|
16
|
-
const utils_1 = require("./utils");
|
|
17
|
-
class NGramIndex {
|
|
18
|
-
db;
|
|
19
|
-
static TABLE_NAME = "ngramIndex";
|
|
20
|
-
table = null;
|
|
21
|
-
initializing = null;
|
|
22
|
-
constructor(db) {
|
|
23
|
-
this.db = db;
|
|
24
|
-
// Expect external initialization
|
|
25
|
-
}
|
|
26
|
-
async initialize() {
|
|
27
|
-
if (this.initializing) {
|
|
28
|
-
await this.initializing;
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
this.initializing = this.ensureTable();
|
|
32
|
-
try {
|
|
33
|
-
await this.initializing;
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
this.initializing = null;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async upsert(entries) {
|
|
40
|
-
if (!entries || entries.length === 0) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
const table = await this.ensureTable();
|
|
44
|
-
const uniqueIds = new Set();
|
|
45
|
-
const rows = [];
|
|
46
|
-
for (const entry of entries) {
|
|
47
|
-
uniqueIds.add(entry.entryId);
|
|
48
|
-
const uniqueNgrams = Array.from(new Set(entry.ngrams));
|
|
49
|
-
for (const ngram of uniqueNgrams) {
|
|
50
|
-
rows.push({
|
|
51
|
-
ngram: ngram,
|
|
52
|
-
language: entry.language,
|
|
53
|
-
entryid: entry.entryId
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
await this.deleteByEntryIds(Array.from(uniqueIds), table);
|
|
58
|
-
if (rows.length > 0) {
|
|
59
|
-
await table.add(rows);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async remove(entryId) {
|
|
63
|
-
if (!entryId) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const table = await this.ensureTable();
|
|
67
|
-
await table.delete("entryid = '" + utils_1.Utils.escapeSqlLiteral(entryId) + "'");
|
|
68
|
-
}
|
|
69
|
-
async collect(language, ngrams) {
|
|
70
|
-
const result = new Map();
|
|
71
|
-
if (!language || !ngrams || ngrams.length === 0) {
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
const table = await this.ensureTable();
|
|
75
|
-
const unique = Array.from(new Set(ngrams));
|
|
76
|
-
const chunkSize = 512;
|
|
77
|
-
for (let i = 0; i < unique.length; i += chunkSize) {
|
|
78
|
-
const chunk = unique.slice(i, i + chunkSize);
|
|
79
|
-
if (chunk.length === 0) {
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
const ngramList = chunk.join(",");
|
|
83
|
-
const filter = "language = '" + language + "' AND ngram IN (" + ngramList + ")";
|
|
84
|
-
const rows = await table.query().where(filter).toArray();
|
|
85
|
-
for (const row of rows) {
|
|
86
|
-
const existing = result.get(row.entryid);
|
|
87
|
-
if (typeof existing === "number") {
|
|
88
|
-
result.set(row.entryid, existing + 1);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
result.set(row.entryid, 1);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
}
|
|
97
|
-
async ensureTable() {
|
|
98
|
-
if (this.table) {
|
|
99
|
-
return this.table;
|
|
100
|
-
}
|
|
101
|
-
const names = await this.db.tableNames();
|
|
102
|
-
if (!names.includes(NGramIndex.TABLE_NAME)) {
|
|
103
|
-
const schema = new apache_arrow_1.Schema([
|
|
104
|
-
apache_arrow_1.Field.new("ngram", new apache_arrow_1.Int32(), false),
|
|
105
|
-
apache_arrow_1.Field.new("language", new apache_arrow_1.Utf8(), false),
|
|
106
|
-
apache_arrow_1.Field.new("entryid", new apache_arrow_1.Utf8(), false)
|
|
107
|
-
]);
|
|
108
|
-
this.table = await this.db.createEmptyTable(NGramIndex.TABLE_NAME, schema);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
this.table = await this.db.openTable(NGramIndex.TABLE_NAME);
|
|
112
|
-
}
|
|
113
|
-
return this.table;
|
|
114
|
-
}
|
|
115
|
-
async deleteByEntryIds(entryIds, table) {
|
|
116
|
-
if (!entryIds || entryIds.length === 0) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
const target = table ? table : await this.ensureTable();
|
|
120
|
-
const uniqueIds = Array.from(new Set(entryIds));
|
|
121
|
-
const chunkSize = 256;
|
|
122
|
-
for (let i = 0; i < uniqueIds.length; i += chunkSize) {
|
|
123
|
-
const chunk = uniqueIds.slice(i, i + chunkSize).map(function (id) {
|
|
124
|
-
return "'" + utils_1.Utils.escapeSqlLiteral(id) + "'";
|
|
125
|
-
});
|
|
126
|
-
const filter = "entryid IN (" + chunk.join(",") + ")";
|
|
127
|
-
await target.delete(filter);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.NGramIndex = NGramIndex;
|
|
132
|
-
//# sourceMappingURL=ngramIndex.js.map
|
package/dist/ngramIndex.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngramIndex.js","sourceRoot":"","sources":["../ts/ngramIndex.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;iFAUiF;;;AAGjF,+CAA0D;AAC1D,mCAAgC;AAehC,MAAa,UAAU;IAOU;IALrB,MAAM,CAAU,UAAU,GAAW,YAAY,CAAC;IAElD,KAAK,GAAiB,IAAI,CAAC;IAC3B,YAAY,GAA0B,IAAI,CAAC;IAEnD,YAA6B,EAAc;QAAd,OAAE,GAAF,EAAE,CAAY;QACvC,iCAAiC;IACrC,CAAC;IAED,KAAK,CAAC,UAAU;QACZ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,MAAM,IAAI,CAAC,YAAY,CAAC;YACxB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC;YACD,MAAM,IAAI,CAAC,YAAY,CAAC;QAC5B,CAAC;gBAAS,CAAC;YACP,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QAC7B,CAAC;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C,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/D,MAAM,SAAS,GAAa,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1D,MAAM,SAAS,GAAW,GAAG,CAAC;QAE9B,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;YAC3D,MAAM,KAAK,GAAa,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,GAAG,CAAC,UAAS,EAAU;gBAC7E,OAAO,GAAG,GAAG,aAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;YAClD,CAAC,CAAC,CAAC;YACH,MAAM,MAAM,GAAW,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;YAC9D,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;IACL,CAAC;;AA3HL,gCA4HC"}
|
package/dist/ngrams.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (c) 2025 Maxprograms.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials
|
|
5
|
-
* are made available under the terms of the Eclipse License 1.0
|
|
6
|
-
* which accompanies this distribution, and is available at
|
|
7
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
8
|
-
*
|
|
9
|
-
* Contributors:
|
|
10
|
-
* Maxprograms - initial API and implementation
|
|
11
|
-
*******************************************************************************/
|
|
12
|
-
export declare class NGrams {
|
|
13
|
-
private static readonly NGRAM_SIZE;
|
|
14
|
-
static readonly SEPARATORS: string;
|
|
15
|
-
static readonly TERM_SEPARATORS: string;
|
|
16
|
-
private constructor();
|
|
17
|
-
static getNGrams(source: string): number[];
|
|
18
|
-
static buildWordList(source: string, separators: string): string[];
|
|
19
|
-
private static escapeForRegex;
|
|
20
|
-
private static javaHashCode;
|
|
21
|
-
}
|
package/dist/ngrams.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*******************************************************************************
|
|
3
|
-
* Copyright (c) 2025 Maxprograms.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials
|
|
6
|
-
* are made available under the terms of the Eclipse License 1.0
|
|
7
|
-
* which accompanies this distribution, and is available at
|
|
8
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
9
|
-
*
|
|
10
|
-
* Contributors:
|
|
11
|
-
* Maxprograms - initial API and implementation
|
|
12
|
-
*******************************************************************************/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.NGrams = void 0;
|
|
15
|
-
class NGrams {
|
|
16
|
-
static NGRAM_SIZE = 3;
|
|
17
|
-
static SEPARATORS = " \r\n\f\t\u2028\u2029,.;\":<>¿?¡!()[]{}=+-/*\u00AB\u00BB\u201C\u201D\u201E\uFF00";
|
|
18
|
-
static TERM_SEPARATORS = " \u00A0\r\n\f\t\u2028\u2029,.;\":<>¿?¡!()[]{}=+/*\u00AB\u00BB\u201C\u201D\u201E\uFF00";
|
|
19
|
-
constructor() {
|
|
20
|
-
// Utility class
|
|
21
|
-
}
|
|
22
|
-
static getNGrams(source) {
|
|
23
|
-
if (!source) {
|
|
24
|
-
return [];
|
|
25
|
-
}
|
|
26
|
-
const src = source.toLowerCase();
|
|
27
|
-
const words = NGrams.buildWordList(src, NGrams.SEPARATORS);
|
|
28
|
-
const unique = new Set();
|
|
29
|
-
for (const word of words) {
|
|
30
|
-
if (!word) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const length = word.length;
|
|
34
|
-
const chars = Array.from(word);
|
|
35
|
-
const segments = Math.ceil(length / NGrams.NGRAM_SIZE);
|
|
36
|
-
for (let i = 0; i < segments; i++) {
|
|
37
|
-
let gram = "";
|
|
38
|
-
for (let j = 0; j < NGrams.NGRAM_SIZE; j++) {
|
|
39
|
-
const idx = i * NGrams.NGRAM_SIZE + j;
|
|
40
|
-
if (idx < length) {
|
|
41
|
-
gram += chars[idx];
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
if (gram.length > 0) {
|
|
45
|
-
unique.add(NGrams.javaHashCode(gram));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return Array.from(unique);
|
|
50
|
-
}
|
|
51
|
-
static buildWordList(source, separators) {
|
|
52
|
-
if (!source) {
|
|
53
|
-
return [];
|
|
54
|
-
}
|
|
55
|
-
const escaped = NGrams.escapeForRegex(separators);
|
|
56
|
-
const regex = new RegExp("[" + escaped + "]+", "g");
|
|
57
|
-
return source.split(regex).filter((token) => token.length > 0);
|
|
58
|
-
}
|
|
59
|
-
static escapeForRegex(value) {
|
|
60
|
-
return value.replace(/[\\\-\[\]{}()*+?.,^$|#\s]/g, function (match) {
|
|
61
|
-
return "\\" + match;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
static javaHashCode(value) {
|
|
65
|
-
let hash = 0;
|
|
66
|
-
for (let i = 0; i < value.length; i++) {
|
|
67
|
-
hash = ((hash << 5) - hash + value.charCodeAt(i)) | 0;
|
|
68
|
-
}
|
|
69
|
-
return hash;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.NGrams = NGrams;
|
|
73
|
-
//# sourceMappingURL=ngrams.js.map
|
package/dist/ngrams.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ngrams.js","sourceRoot":"","sources":["../ts/ngrams.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;iFAUiF;;;AAEjF,MAAa,MAAM;IAEP,MAAM,CAAU,UAAU,GAAW,CAAC,CAAC;IACxC,MAAM,CAAU,UAAU,GAAW,kFAAkF,CAAC;IAC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|
5
|
-
"description": "HybridTM is a Translation Memory (TM) engine that combines semantic embeddings with fuzzy string matching.",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"/dist"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "tsc"
|
|
14
|
-
},
|
|
15
|
-
"author": {
|
|
16
|
-
"name": "Rodolfo M. Raya",
|
|
17
|
-
"url": "https://maxprograms.com",
|
|
18
|
-
"email": "rmraya@maxprograms.com"
|
|
19
|
-
},
|
|
20
|
-
"keywords": [],
|
|
21
|
-
"license": "EPL-1.0",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@lancedb/lancedb": "^0.23.0",
|
|
24
|
-
"@xenova/transformers": "^2.17.2",
|
|
25
|
-
"apache-arrow": "^18.1.0",
|
|
26
|
-
"sdltm": "^2.0.0",
|
|
27
|
-
"typesbcp47": "^1.17.0",
|
|
28
|
-
"typesxml": "^1.17.0"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^24.10.4",
|
|
32
|
-
"ts-node": "^10.9.2",
|
|
33
|
-
"typescript": "^5.9.3"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (c) 2025 Maxprograms.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials
|
|
5
|
-
* are made available under the terms of the Eclipse License 1.0
|
|
6
|
-
* which accompanies this distribution, and is available at
|
|
7
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
8
|
-
*
|
|
9
|
-
* Contributors:
|
|
10
|
-
* Maxprograms - initial API and implementation
|
|
11
|
-
*******************************************************************************/
|
|
12
|
-
export interface ProgressProvider {
|
|
13
|
-
getProgress(): {
|
|
14
|
-
processed: number;
|
|
15
|
-
pending: number;
|
|
16
|
-
};
|
|
17
|
-
}
|
package/dist/progressProvider.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*******************************************************************************
|
|
3
|
-
* Copyright (c) 2025 Maxprograms.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials
|
|
6
|
-
* are made available under the terms of the Eclipse License 1.0
|
|
7
|
-
* which accompanies this distribution, and is available at
|
|
8
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
9
|
-
*
|
|
10
|
-
* Contributors:
|
|
11
|
-
* Maxprograms - initial API and implementation
|
|
12
|
-
*******************************************************************************/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
//# sourceMappingURL=progressProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"progressProvider.js","sourceRoot":"","sources":["../ts/progressProvider.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;iFAUiF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/simplexlifftest.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const xliffreader_1 = require("./xliffreader");
|
|
4
|
-
async function test() {
|
|
5
|
-
const reader = new xliffreader_1.XLIFFReader('/tmp/test.xlf');
|
|
6
|
-
try {
|
|
7
|
-
console.log('Starting parse...');
|
|
8
|
-
await reader.parse();
|
|
9
|
-
console.log('Parse completed!');
|
|
10
|
-
console.log('Entry count:', reader.getEntryCount());
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
console.error('Error:', error);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
test().then(() => {
|
|
17
|
-
console.log('Test finished');
|
|
18
|
-
process.exit(0);
|
|
19
|
-
}).catch((error) => {
|
|
20
|
-
console.error('Test failed:', error);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
});
|
|
23
|
-
//# sourceMappingURL=simplexlifftest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simplexlifftest.js","sourceRoot":"","sources":["../ts/simplexlifftest.ts"],"names":[],"mappings":";;AAAA,+CAA4C;AAE5C,KAAK,UAAU,IAAI;IACf,MAAM,MAAM,GAAG,IAAI,yBAAW,CAAC,eAAe,CAAC,CAAC;IAChD,IAAI,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACnC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IACb,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACf,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
package/dist/test-import.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (c) 2025 Maxprograms.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials
|
|
5
|
-
* are made available under the terms of the Eclipse Public License 1.0
|
|
6
|
-
* which accompanies this distribution, and is available at
|
|
7
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
8
|
-
*
|
|
9
|
-
* Contributors:
|
|
10
|
-
* Maxprograms - initial API and implementation
|
|
11
|
-
*******************************************************************************/
|
|
12
|
-
export {};
|
package/dist/test-import.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*******************************************************************************
|
|
3
|
-
* Copyright (c) 2025 Maxprograms.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials
|
|
6
|
-
* are made available under the terms of the Eclipse Public License 1.0
|
|
7
|
-
* which accompanies this distribution, and is available at
|
|
8
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
9
|
-
*
|
|
10
|
-
* Contributors:
|
|
11
|
-
* Maxprograms - initial API and implementation
|
|
12
|
-
*******************************************************************************/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const hybridtm_1 = require("./hybridtm");
|
|
15
|
-
async function testImportValidation() {
|
|
16
|
-
console.log('Testing import validation...\n');
|
|
17
|
-
const tm = new hybridtm_1.HybridTM('/tmp/test-validation.db', hybridtm_1.HybridTM.SPEED_MODEL);
|
|
18
|
-
// Test 1: Valid file path
|
|
19
|
-
console.log('Test 1: Valid file path');
|
|
20
|
-
try {
|
|
21
|
-
const validPath = '/Users/rmraya/Documents/GitHub/HybridTM/samples/sample.tmx';
|
|
22
|
-
console.log(`Testing with valid path: ${validPath}`);
|
|
23
|
-
// This should work (even if file doesn't exist, the filename extraction should succeed)
|
|
24
|
-
const fileName = require('path').basename(validPath);
|
|
25
|
-
console.log(`✓ Filename extracted successfully: '${fileName}'`);
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.log(`✗ Unexpected error: ${error}`);
|
|
29
|
-
}
|
|
30
|
-
console.log();
|
|
31
|
-
// Test 2: Empty string path
|
|
32
|
-
console.log('Test 2: Empty string path');
|
|
33
|
-
try {
|
|
34
|
-
await tm.importTMX('');
|
|
35
|
-
console.log('✗ Should have thrown an error for empty path');
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.log(`✓ Correctly threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
39
|
-
}
|
|
40
|
-
console.log();
|
|
41
|
-
// Test 3: Root path only
|
|
42
|
-
console.log('Test 3: Root path only');
|
|
43
|
-
try {
|
|
44
|
-
await tm.importTMX('/');
|
|
45
|
-
console.log('✗ Should have thrown an error for root path');
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
console.log(`✓ Correctly threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
49
|
-
}
|
|
50
|
-
console.log();
|
|
51
|
-
// Test 4: Path with only separators
|
|
52
|
-
console.log('Test 4: Path with only separators');
|
|
53
|
-
try {
|
|
54
|
-
await tm.importXLIFF('///');
|
|
55
|
-
console.log('✗ Should have thrown an error for separator-only path');
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
console.log(`✓ Correctly threw error: ${error instanceof Error ? error.message : String(error)}`);
|
|
59
|
-
}
|
|
60
|
-
console.log();
|
|
61
|
-
// Test 5: Valid filename (this should work even if file doesn't exist)
|
|
62
|
-
console.log('Test 5: Valid filename extraction');
|
|
63
|
-
try {
|
|
64
|
-
const testPath = '/some/valid/path/test.xliff';
|
|
65
|
-
const fileName = require('path').basename(testPath);
|
|
66
|
-
if (fileName) {
|
|
67
|
-
console.log(`✓ Valid filename extraction works: '${fileName}'`);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
console.log('✗ Filename extraction failed unexpectedly');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
console.log(`✗ Unexpected error: ${error}`);
|
|
75
|
-
}
|
|
76
|
-
console.log();
|
|
77
|
-
// Test 6: Test path.basename() edge cases directly
|
|
78
|
-
console.log('Test 6: Direct path.basename() edge cases');
|
|
79
|
-
const path = require('path');
|
|
80
|
-
const testCases = [
|
|
81
|
-
{ input: '', expected: '' },
|
|
82
|
-
{ input: '/', expected: '' },
|
|
83
|
-
{ input: '//', expected: '' },
|
|
84
|
-
{ input: '///', expected: '' },
|
|
85
|
-
{ input: '/file.tmx', expected: 'file.tmx' },
|
|
86
|
-
{ input: '/path/to/file.tmx', expected: 'file.tmx' },
|
|
87
|
-
{ input: 'file.tmx', expected: 'file.tmx' },
|
|
88
|
-
];
|
|
89
|
-
testCases.forEach(({ input, expected }) => {
|
|
90
|
-
const result = path.basename(input);
|
|
91
|
-
const matches = result === expected;
|
|
92
|
-
console.log(` '${input}' -> '${result}' ${matches ? '✓' : '✗ (expected: \'' + expected + '\')'}`);
|
|
93
|
-
});
|
|
94
|
-
await tm.close();
|
|
95
|
-
console.log('\nValidation tests completed!');
|
|
96
|
-
}
|
|
97
|
-
testImportValidation().catch(error => {
|
|
98
|
-
console.error('Test failed:', error);
|
|
99
|
-
process.exit(1);
|
|
100
|
-
});
|
|
101
|
-
//# sourceMappingURL=test-import.js.map
|
package/dist/test-import.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-import.js","sourceRoot":"","sources":["../ts/test-import.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;iFAUiF;;AAEjF,yCAAsC;AAEtC,KAAK,UAAU,oBAAoB;IAC/B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAE9C,MAAM,EAAE,GAAG,IAAI,mBAAQ,CAAC,yBAAyB,EAAE,mBAAQ,CAAC,WAAW,CAAC,CAAC;IAEzE,0BAA0B;IAC1B,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;IACvC,IAAI,CAAC;QACD,MAAM,SAAS,GAAG,4DAA4D,CAAC;QAC/E,OAAO,CAAC,GAAG,CAAC,4BAA4B,SAAS,EAAE,CAAC,CAAC;QAErD,wFAAwF;QACxF,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACrD,OAAO,CAAC,GAAG,CAAC,uCAAuC,QAAQ,GAAG,CA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E,mBAAmB,EAAE,QAAQ,EAAE,UAAU,EAAE;QACpD,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE;KAC9C,CAAC;IAEF,SAAS,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,MAAM,KAAK,QAAQ,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,iBAAiB,GAAG,QAAQ,GAAG,KAAK,EAAE,CAAC,CAAC;IACvG,CAAC,CAAC,CAAC;IAEH,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IAEjB,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AACjD,CAAC;AAED,oBAAoB,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const hybridtm_1 = require("./hybridtm");
|
|
4
|
-
async function testProgressTracking() {
|
|
5
|
-
console.log('Testing updated progress tracking...\n');
|
|
6
|
-
const tm = new hybridtm_1.HybridTM('/tmp/test-progress.lancedb', hybridtm_1.HybridTM.SPEED_MODEL);
|
|
7
|
-
let pollCount = 0;
|
|
8
|
-
const progressInterval = setInterval(() => {
|
|
9
|
-
const progress = tm.getImportProgress();
|
|
10
|
-
pollCount++;
|
|
11
|
-
console.log(`Poll ${pollCount}: processed=${progress.entriesProcessed} TUs, pending=${progress.entriesPending} TUs, importing=${progress.isImporting}`);
|
|
12
|
-
if (!progress.isImporting && pollCount > 3) {
|
|
13
|
-
clearInterval(progressInterval);
|
|
14
|
-
}
|
|
15
|
-
}, 2000);
|
|
16
|
-
try {
|
|
17
|
-
await tm.importTMX('/Users/rmraya/Desktop/Norden/NordenTM_2023_rev2.tmx');
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
console.error('Import failed:', error);
|
|
21
|
-
}
|
|
22
|
-
finally {
|
|
23
|
-
clearInterval(progressInterval);
|
|
24
|
-
}
|
|
25
|
-
await tm.close();
|
|
26
|
-
console.log('Test completed');
|
|
27
|
-
}
|
|
28
|
-
testProgressTracking().catch(error => {
|
|
29
|
-
console.error('Test failed:', error);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=test-progress-fix.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-progress-fix.js","sourceRoot":"","sources":["../ts/test-progress-fix.ts"],"names":[],"mappings":";;AAAA,yCAAsC;AAEtC,KAAK,UAAU,oBAAoB;IAC/B,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;IAEtD,MAAM,EAAE,GAAG,IAAI,mBAAQ,CAAC,4BAA4B,EAAE,mBAAQ,CAAC,WAAW,CAAC,CAAC;IAE5E,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,MAAM,gBAAgB,GAAG,WAAW,CAAC,GAAG,EAAE;QACtC,MAAM,QAAQ,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC;QACxC,SAAS,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,QAAQ,SAAS,eAAe,QAAQ,CAAC,gBAAgB,iBAAiB,QAAQ,CAAC,cAAc,mBAAmB,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;QAExJ,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YACzC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACpC,CAAC;IACL,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,IAAI,CAAC;QACD,MAAM,EAAE,CAAC,SAAS,CAAC,qDAAqD,CAAC,CAAC;IAC9E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;YAAS,CAAC;QACP,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAClC,CAAC;AAED,oBAAoB,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
package/dist/test-progress.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (c) 2025 Maxprograms.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials
|
|
5
|
-
* are made available under the terms of the Eclipse Public License 1.0
|
|
6
|
-
* which accompanies this distribution, and is available at
|
|
7
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
8
|
-
*
|
|
9
|
-
* Contributors:
|
|
10
|
-
* Maxprograms - initial API and implementation
|
|
11
|
-
*******************************************************************************/
|
|
12
|
-
export {};
|
package/dist/test-progress.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*******************************************************************************
|
|
3
|
-
* Copyright (c) 2025 Maxprograms.
|
|
4
|
-
*
|
|
5
|
-
* This program and the accompanying materials
|
|
6
|
-
* are made available under the terms of the Eclipse Public License 1.0
|
|
7
|
-
* which accompanies this distribution, and is available at
|
|
8
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
9
|
-
*
|
|
10
|
-
* Contributors:
|
|
11
|
-
* Maxprograms - initial API and implementation
|
|
12
|
-
*******************************************************************************/
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const hybridtm_1 = require("./hybridtm");
|
|
15
|
-
async function testProgressTracking() {
|
|
16
|
-
console.log('Testing progress tracking...\n');
|
|
17
|
-
const tm = new hybridtm_1.HybridTM('/tmp/test-progress.lancedb', hybridtm_1.HybridTM.SPEED_MODEL);
|
|
18
|
-
// Start import (this would start parsing)
|
|
19
|
-
console.log('Starting simulated import...');
|
|
20
|
-
// In a real scenario, the progress would be polled during actual import
|
|
21
|
-
// Here we'll just verify that the progress method structure is correct
|
|
22
|
-
console.log('✓ Progress tracking structure verified');
|
|
23
|
-
console.log('✓ Expected: processed should be multiples of 1000, pending should be 0-999');
|
|
24
|
-
await tm.close();
|
|
25
|
-
console.log('\nProgress tracking test completed!');
|
|
26
|
-
console.log('\nNow run the actual TMX import to see the fixed progress tracking.');
|
|
27
|
-
}
|
|
28
|
-
testProgressTracking().catch(error => {
|
|
29
|
-
console.error('Test failed:', error);
|
|
30
|
-
process.exit(1);
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=test-progress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-progress.js","sourceRoot":"","sources":["../ts/test-progress.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;iFAUiF;;AAEjF,yCAAsC;AAEtC,KAAK,UAAU,oBAAoB;IAC/B,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAE9C,MAAM,EAAE,GAAG,IAAI,mBAAQ,CAAC,4BAA4B,EAAE,mBAAQ,CAAC,WAAW,CAAC,CAAC;IAE5E,0CAA0C;IAC1C,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAE5C,wEAAwE;IACxE,uEAAuE;IAEvE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,4EAA4E,CAAC,CAAC;IAE1F,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IAEjB,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;AACvF,CAAC;AAED,oBAAoB,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACjC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (c) 2025 Maxprograms.
|
|
3
|
-
*
|
|
4
|
-
* This program and the accompanying materials
|
|
5
|
-
* are made available under the terms of the Eclipse Public License 1.0
|
|
6
|
-
* which accompanies this distribution, and is available at
|
|
7
|
-
* https://www.eclipse.org/org/documents/epl-v10.html
|
|
8
|
-
*
|
|
9
|
-
* Contributors:
|
|
10
|
-
* Maxprograms - initial API and implementation
|
|
11
|
-
*******************************************************************************/
|
|
12
|
-
export {};
|