hybridtm 0.4.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/package.json +9 -8
- 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/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.d.ts +0 -61
- package/dist/ts/tmxHandler.js +0 -347
- 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.d.ts +0 -67
- package/dist/ts/xliffHandler.js +0 -522
- 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/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/{tmxhandler.d.ts → tmxHandler.d.ts} +0 -0
- /package/dist/{tmxhandler.js → tmxHandler.js} +0 -0
- /package/dist/{tmxhandler.js.map → tmxHandler.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/{xliffhandler.d.ts → xliffHandler.d.ts} +0 -0
- /package/dist/{xliffhandler.js → xliffHandler.js} +0 -0
- /package/dist/{xliffhandler.js.map → xliffHandler.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/package.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "hybridtm",
|
|
3
|
-
"productName": "HybridTM",
|
|
4
|
-
"version": "0.2.0",
|
|
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,CAAC,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,4BAA4B;IAC5B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IACzC,IAAI,CAAC;QACD,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;IAChE,CAAC;IAAC,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,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 {};
|
|
@@ -1,153 +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 lancedb_1 = require("@lancedb/lancedb");
|
|
15
|
-
const node_path_1 = require("node:path");
|
|
16
|
-
const hybridtm_1 = require("../hybridtm");
|
|
17
|
-
const hybridtmFactory_1 = require("../hybridtmFactory");
|
|
18
|
-
const FRIENDLY_NAME = 'XLIFF Test TM';
|
|
19
|
-
const DB_PATH = 'my-tm.lancedb';
|
|
20
|
-
const DEFAULT_LIMIT = 5;
|
|
21
|
-
const EVALUATION_QUERIES = [
|
|
22
|
-
{ query: 'Generate XLIFF files and optional word counts', src: 'en', tgt: 'es', similarity: 70 },
|
|
23
|
-
{ query: 'Use the following parameters to import a translated XLIFF file', src: 'en', tgt: 'es', similarity: 65 },
|
|
24
|
-
{ query: 'Select the Ignore Inline Tag Errors check box', src: 'en', tgt: 'es', similarity: 60 },
|
|
25
|
-
{ query: 'Select inline tag errors ignore', src: 'en', tgt: 'es', similarity: 55 },
|
|
26
|
-
{ query: 'Reuse ICE matches to translate reused content', src: 'en', tgt: 'es', similarity: 55 },
|
|
27
|
-
{ query: 'Type the folder for XLIFF output', src: 'en', tgt: 'es', similarity: 50 }
|
|
28
|
-
];
|
|
29
|
-
function cosineSimilarity(vecA, vecB) {
|
|
30
|
-
if (vecA.length !== vecB.length) {
|
|
31
|
-
throw new Error('Vectors must have the same length');
|
|
32
|
-
}
|
|
33
|
-
let dotProduct = 0;
|
|
34
|
-
let normA = 0;
|
|
35
|
-
let normB = 0;
|
|
36
|
-
for (let i = 0; i < vecA.length; i++) {
|
|
37
|
-
const a = vecA[i];
|
|
38
|
-
const b = vecB[i];
|
|
39
|
-
dotProduct += a * b;
|
|
40
|
-
normA += a * a;
|
|
41
|
-
normB += b * b;
|
|
42
|
-
}
|
|
43
|
-
if (normA === 0 || normB === 0) {
|
|
44
|
-
return 0;
|
|
45
|
-
}
|
|
46
|
-
return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));
|
|
47
|
-
}
|
|
48
|
-
async function acquireInstance(factory) {
|
|
49
|
-
const instances = await factory.listInstances();
|
|
50
|
-
const existing = instances.find(function (metadata) {
|
|
51
|
-
return metadata.name === FRIENDLY_NAME;
|
|
52
|
-
});
|
|
53
|
-
if (!existing) {
|
|
54
|
-
console.log('Creating translation memory for analysis: ' + FRIENDLY_NAME);
|
|
55
|
-
const tm = await factory.createInstance(FRIENDLY_NAME, DB_PATH, hybridtm_1.HybridTM.SPEED_MODEL);
|
|
56
|
-
return { tm, isNew: true };
|
|
57
|
-
}
|
|
58
|
-
const tm = await factory.openInstance(existing.name);
|
|
59
|
-
return { tm, isNew: false };
|
|
60
|
-
}
|
|
61
|
-
function asNumberArray(vector) {
|
|
62
|
-
if (Array.isArray(vector)) {
|
|
63
|
-
return vector.map((value) => Number(value));
|
|
64
|
-
}
|
|
65
|
-
if (vector instanceof Float32Array || vector instanceof Float64Array) {
|
|
66
|
-
return Array.from(vector);
|
|
67
|
-
}
|
|
68
|
-
if (vector && typeof vector === 'object' && 'toArray' in vector && typeof vector.toArray === 'function') {
|
|
69
|
-
return vector.toArray();
|
|
70
|
-
}
|
|
71
|
-
throw new Error('Unsupported vector format: ' + String(vector));
|
|
72
|
-
}
|
|
73
|
-
async function getTargetText(table, sourceEntry, targetLang) {
|
|
74
|
-
const targetId = sourceEntry.fileId + ':' + sourceEntry.unitId + ':' + targetLang;
|
|
75
|
-
const candidates = (await table
|
|
76
|
-
.query()
|
|
77
|
-
.where('id = ' + '\'' + targetId.replace(/'/g, "''") + '\'')
|
|
78
|
-
.toArray());
|
|
79
|
-
if (candidates.length === 0) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
return candidates[0].pureText ?? null;
|
|
83
|
-
}
|
|
84
|
-
async function ensureData(factory, tm, isNew) {
|
|
85
|
-
if (!isNew) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
console.log('Importing sample XLIFF data into analysis TM...');
|
|
89
|
-
await tm.importXLIFF('/Users/rmraya/Documents/GitHub/FluentaPRO/Localization/fluenta_es.ditamap.xlf');
|
|
90
|
-
}
|
|
91
|
-
async function analyzeQueries() {
|
|
92
|
-
const factory = new hybridtmFactory_1.HybridTMFactory();
|
|
93
|
-
const { tm, isNew } = await acquireInstance(factory);
|
|
94
|
-
await ensureData(factory, tm, isNew);
|
|
95
|
-
const dbTable = await (await (0, lancedb_1.connect)(DB_PATH)).openTable('langEntry');
|
|
96
|
-
const embed = async function (text) {
|
|
97
|
-
const generator = tm;
|
|
98
|
-
return generator.generateEmbedding(text);
|
|
99
|
-
};
|
|
100
|
-
console.log('============================================================');
|
|
101
|
-
console.log('Vector similarity analysis (Cosine only)');
|
|
102
|
-
console.log('Database path: ' + (0, node_path_1.resolve)(DB_PATH));
|
|
103
|
-
console.log('============================================================');
|
|
104
|
-
for (const spec of EVALUATION_QUERIES) {
|
|
105
|
-
console.log('');
|
|
106
|
-
console.log('Query: "' + spec.query + '" [' + spec.src + ' -> ' + spec.tgt + ']');
|
|
107
|
-
const queryEmbedding = await embed(spec.query);
|
|
108
|
-
const candidates = (await dbTable
|
|
109
|
-
.vectorSearch(queryEmbedding)
|
|
110
|
-
.limit(DEFAULT_LIMIT)
|
|
111
|
-
.toArray());
|
|
112
|
-
const sourceCandidates = candidates.filter(function (candidate) {
|
|
113
|
-
return candidate.language === spec.src;
|
|
114
|
-
});
|
|
115
|
-
if (sourceCandidates.length === 0) {
|
|
116
|
-
console.log(' (no vector candidates for source language)');
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
for (let index = 0; index < sourceCandidates.length; index++) {
|
|
120
|
-
const candidate = sourceCandidates[index];
|
|
121
|
-
if (!candidate.vector) {
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
const candidateVector = asNumberArray(candidate.vector);
|
|
125
|
-
const cosine = cosineSimilarity(queryEmbedding, candidateVector);
|
|
126
|
-
const cosinePercent = Math.round(cosine * 100);
|
|
127
|
-
const distance = typeof candidate._distance === 'number' ? ' distance=' + candidate._distance.toFixed(6) : '';
|
|
128
|
-
const targetText = await getTargetText(dbTable, candidate, spec.tgt);
|
|
129
|
-
console.log(' #' + (index + 1) +
|
|
130
|
-
' cosine=' + cosinePercent.toString().padStart(3, ' ') + '%'
|
|
131
|
-
+ distance);
|
|
132
|
-
console.log(' source: ' + candidate.pureText);
|
|
133
|
-
if (targetText) {
|
|
134
|
-
console.log(' target: ' + targetText);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
await tm.close();
|
|
139
|
-
}
|
|
140
|
-
async function main() {
|
|
141
|
-
try {
|
|
142
|
-
await analyzeQueries();
|
|
143
|
-
console.log('\nAnalysis complete.');
|
|
144
|
-
}
|
|
145
|
-
catch (err) {
|
|
146
|
-
console.error('Vector similarity analysis failed:', err);
|
|
147
|
-
process.exitCode = 1;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
if (require.main === module) {
|
|
151
|
-
void main();
|
|
152
|
-
}
|
|
153
|
-
//# sourceMappingURL=vectorSimilarityComparison.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vectorSimilarityComparison.js","sourceRoot":"","sources":["../../ts/tests/vectorSimilarityComparison.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;iFAUiF;;AAEjF,8CAAkD;AAClD,yCAAoC;AACpC,0CAAuC;AACvC,wDAA+E;AAc/E,MAAM,aAAa,GAAW,eAAe,CAAC;AAC9C,MAAM,OAAO,GAAW,eAAe,CAAC;AACxC,MAAM,aAAa,GAAW,CAAC,CAAC;AAEhC,MAAM,kBAAkB,GAAgB;IACpC,EAAE,KAAK,EAAE,+CAA+C,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;IAChG,EAAE,KAAK,EAAE,gEAAgE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;IACjH,EAAE,KAAK,EAAE,+CAA+C,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;IAChG,EAAE,KAAK,EAAE,iCAAiC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;IAClF,EAAE,KAAK,EAAE,+CAA+C,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;IAChG,EAAE,KAAK,EAAE,kCAAkC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,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AAQ,GAAW,OAAO,SAAS,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,GAAG,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACtH,MAAM,UAAU,GAAkB,MAAM,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;YAEpF,OAAO,CAAC,GAAG,CACP,KAAK,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;gBACnB,UAAU,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG;kBAC1D,QAAQ,CACb,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;YAClD,IAAI,UAAU,EAAE,CAAC;gBACb,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,UAAU,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC;IACL,CAAC;IAED,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC;AAED,KAAK,UAAU,IAAI;IACf,IAAI,CAAC;QACD,MAAM,cAAc,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,GAAG,CAAC,CAAC;QACzD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACzB,CAAC;AACL,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC1B,KAAK,IAAI,EAAE,CAAC;AAChB,CAAC"}
|
package/dist/tmxreader.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (c) 2025-2026 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
|
-
import { SAXParser } from "typesxml";
|
|
13
|
-
import { ImportOptions } from './importOptions.js';
|
|
14
|
-
import { TMXHandler } from './tmxHandler.js';
|
|
15
|
-
export declare class TMXReader {
|
|
16
|
-
parser: SAXParser;
|
|
17
|
-
filePath: string;
|
|
18
|
-
handler: TMXHandler;
|
|
19
|
-
jsonlTempPath: string;
|
|
20
|
-
private readonly options;
|
|
21
|
-
constructor(filePath: string, options?: ImportOptions);
|
|
22
|
-
parse(): Promise<void>;
|
|
23
|
-
getTempFilePath(): string;
|
|
24
|
-
getEntryCount(): number;
|
|
25
|
-
}
|
package/dist/tmxreader.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/*******************************************************************************
|
|
2
|
-
* Copyright (c) 2025-2026 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
|
-
import { tmpdir } from "node:os";
|
|
13
|
-
import { basename, join } from 'node:path';
|
|
14
|
-
import { SAXParser } from "typesxml";
|
|
15
|
-
import { DEFAULT_IMPORT_OPTIONS, resolveImportOptions } from './importOptions.js';
|
|
16
|
-
import { TMXHandler } from './tmxHandler.js';
|
|
17
|
-
export class TMXReader {
|
|
18
|
-
parser;
|
|
19
|
-
filePath;
|
|
20
|
-
handler;
|
|
21
|
-
jsonlTempPath;
|
|
22
|
-
options;
|
|
23
|
-
constructor(filePath, options = DEFAULT_IMPORT_OPTIONS) {
|
|
24
|
-
this.filePath = filePath;
|
|
25
|
-
this.options = resolveImportOptions(options);
|
|
26
|
-
const filename = basename(filePath);
|
|
27
|
-
// Generate temp file path for the JSONL output
|
|
28
|
-
const tempDir = tmpdir();
|
|
29
|
-
const tempFileName = 'tmx_' + Date.now() + '_' + Math.random().toString(36).substring(7) + '.jsonl';
|
|
30
|
-
this.jsonlTempPath = join(tempDir, tempFileName);
|
|
31
|
-
this.parser = new SAXParser();
|
|
32
|
-
this.handler = new TMXHandler(this.jsonlTempPath, filename, this.options);
|
|
33
|
-
this.parser.setContentHandler(this.handler);
|
|
34
|
-
}
|
|
35
|
-
async parse() {
|
|
36
|
-
try {
|
|
37
|
-
this.parser.parseFile(this.filePath);
|
|
38
|
-
await this.handler.waitForCompletion();
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
throw error instanceof Error ? error : new Error(String(error));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
getTempFilePath() {
|
|
45
|
-
return this.jsonlTempPath;
|
|
46
|
-
}
|
|
47
|
-
getEntryCount() {
|
|
48
|
-
return this.handler.getEntryCount();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=tmxReader.js.map
|
package/dist/tmxtest.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare class TMXTest {
|
|
2
|
-
private static readonly NAME;
|
|
3
|
-
private static readonly DB_PATH;
|
|
4
|
-
private static readonly SAMPLE_TMX;
|
|
5
|
-
private static readonly SWORD_FISH_TMX;
|
|
6
|
-
runTest(): Promise<void>;
|
|
7
|
-
private resetEnvironment;
|
|
8
|
-
private verifyEntry;
|
|
9
|
-
private verifySegmentMetadata;
|
|
10
|
-
private expectTranslationMatch;
|
|
11
|
-
private expectConcordanceMatch;
|
|
12
|
-
private logConcordanceExample;
|
|
13
|
-
private verifyMetadataRoundtrip;
|
|
14
|
-
private verifyBatchImporterRoundtrip;
|
|
15
|
-
private assertMetadataEquals;
|
|
16
|
-
}
|