@willwade/aac-processors 0.0.13 → 0.0.15
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/README.md +45 -7
- package/dist/applePanels.d.ts +6 -0
- package/dist/applePanels.js +13 -0
- package/dist/astericsGrid.d.ts +6 -0
- package/dist/astericsGrid.js +13 -0
- package/dist/core/baseProcessor.d.ts +41 -0
- package/dist/core/baseProcessor.js +41 -0
- package/dist/dot.d.ts +6 -0
- package/dist/dot.js +13 -0
- package/dist/excel.d.ts +6 -0
- package/dist/excel.js +13 -0
- package/dist/gridset.d.ts +17 -0
- package/dist/gridset.js +130 -0
- package/dist/index.d.ts +24 -3
- package/dist/index.js +37 -8
- package/dist/obf.d.ts +7 -0
- package/dist/obf.js +15 -0
- package/dist/obfset.d.ts +6 -0
- package/dist/obfset.js +13 -0
- package/dist/opml.d.ts +6 -0
- package/dist/opml.js +13 -0
- package/dist/processors/gridset/symbolAlignment.d.ts +125 -0
- package/dist/processors/gridset/symbolAlignment.js +283 -0
- package/dist/processors/gridsetProcessor.d.ts +26 -0
- package/dist/processors/gridsetProcessor.js +121 -5
- package/dist/processors/index.d.ts +8 -18
- package/dist/processors/index.js +9 -175
- package/dist/processors/obfProcessor.d.ts +26 -0
- package/dist/processors/obfProcessor.js +82 -1
- package/dist/processors/snapProcessor.js +1 -1
- package/dist/processors/touchchatProcessor.d.ts +26 -0
- package/dist/processors/touchchatProcessor.js +82 -1
- package/dist/snap.d.ts +7 -0
- package/dist/snap.js +24 -0
- package/dist/touchchat.d.ts +7 -0
- package/dist/touchchat.js +16 -0
- package/dist/translation.d.ts +13 -0
- package/dist/translation.js +21 -0
- package/dist/utilities/translation/translationProcessor.d.ts +119 -0
- package/dist/utilities/translation/translationProcessor.js +204 -0
- package/dist/validation.d.ts +13 -0
- package/dist/validation.js +28 -0
- package/package.json +58 -4
- package/dist/utilities/screenshotConverter.d.ts +0 -69
- package/dist/utilities/screenshotConverter.js +0 -453
- /package/dist/{optional → utilities}/analytics/history.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/history.js +0 -0
- /package/dist/{optional → utilities}/analytics/index.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/index.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/comparison.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/comparison.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/core.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/core.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/effort.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/effort.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/index.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/index.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/obl-types.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/obl-types.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/obl.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/obl.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/sentence.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/sentence.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/types.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/types.js +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/vocabulary.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/metrics/vocabulary.js +0 -0
- /package/dist/{optional → utilities}/analytics/reference/index.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/reference/index.js +0 -0
- /package/dist/{optional → utilities}/analytics/utils/idGenerator.d.ts +0 -0
- /package/dist/{optional → utilities}/analytics/utils/idGenerator.js +0 -0
- /package/dist/{optional → utilities}/symbolTools.d.ts +0 -0
- /package/dist/{optional → utilities}/symbolTools.js +0 -0
package/dist/processors/index.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
2
|
+
/**
|
|
3
|
+
* AAC Processor Classes
|
|
4
|
+
*
|
|
5
|
+
* All processor classes for different AAC file formats.
|
|
6
|
+
* For platform-specific utilities (Gridset, Snap, etc.), use the namespace imports:
|
|
7
|
+
* - import { Gridset } from 'aac-processors/gridset';
|
|
8
|
+
* - import { Snap } from 'aac-processors/snap';
|
|
9
|
+
*/
|
|
16
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.symbolReferenceToFilename = exports.getSymbolSearchIndexesDir = exports.getSymbolLibrariesDir = exports.getDefaultGrid3Path = exports.getSymbolLibraryDisplayName = exports.isKnownSymbolLibrary = exports.getSymbolPath = exports.getSymbolLibraryName = exports.createSymbolReference = exports.analyzeSymbolUsage = exports.extractSymbolReferences = exports.getSymbolLibraryInfo = exports.getAvailableSymbolLibraries = exports.resolveSymbolReference = exports.isSymbolReference = exports.parseSymbolReference = exports.Grid3CommandCategory = exports.GRID3_COMMANDS = exports.extractCommandParameters = exports.getAllPluginIds = exports.getAllCommandIds = exports.getCommandsByCategory = exports.getCommandsByPlugin = exports.getCommandDefinition = exports.detectCommand = exports.isRegularCell = exports.isAutoContentCell = exports.isLiveCell = exports.isWorkspaceCell = exports.getCellTypeDisplayName = exports.AUTOCONTENT_TYPES = exports.LIVECELL_TYPES = exports.WORKSPACE_TYPES = exports.Grid3CellType = exports.detectPluginCellType = exports.ensureAlphaChannelFromStyles = exports.SHAPE_NAMES = exports.CellBackgroundShape = exports.createCategoryStyle = exports.createDefaultStylesXml = exports.CATEGORY_STYLES = exports.DEFAULT_GRID3_STYLES = exports.ensureAlphaChannel = exports.normalizeColor = exports.darkenColor = exports.toHexColor = exports.clampAlpha = exports.clampColorChannel = exports.channelToHex = exports.rgbaToHex = void 0;
|
|
19
|
-
exports.openTouchChatImage = exports.getTouchChatAllowedImageEntries = exports.getTouchChatPageTokenImageMap = exports.readSnapUsageForUser = exports.readSnapUsage = exports.isSnapInstalled = exports.findSnapUserHistory = exports.findSnapUserVocabularies = exports.findSnapUsers = exports.findSnapPackagePath = exports.findSnapPackages = exports.openSnapImage = exports.getSnapAllowedImageEntries = exports.getSnapPageTokenImageMap = exports.getSymbolSearchStats = exports.countLibrarySymbols = exports.getSearchSuggestions = exports.getAllSearchTerms = exports.getSymbolDisplayName = exports.getSymbolFilename = exports.searchSymbolsWithReferences = exports.searchSymbols = exports.loadSearchIndexes = exports.parsePixFile = exports.createSymbolManifest = exports.exportSymbolReferencesToCsv = exports.suggestExtractionStrategy = exports.analyzeSymbolExtraction = exports.convertToAstericsImage = exports.extractSymbolLibraryImage = exports.extractButtonImage = exports.getSymbolSearchDir = exports.getSymbolsDir = exports.parseImageSymbolReference = exports.isSymbolLibraryReference = exports.SYMBOL_LIBRARIES = void 0;
|
|
11
|
+
exports.ObfsetProcessor = exports.AstericsGridProcessor = exports.TouchChatProcessor = exports.SnapProcessor = exports.OpmlProcessor = exports.ObfProcessor = exports.GridsetProcessor = exports.ExcelProcessor = exports.DotProcessor = exports.ApplePanelsProcessor = void 0;
|
|
20
12
|
var applePanelsProcessor_1 = require("./applePanelsProcessor");
|
|
21
13
|
Object.defineProperty(exports, "ApplePanelsProcessor", { enumerable: true, get: function () { return applePanelsProcessor_1.ApplePanelsProcessor; } });
|
|
22
14
|
var dotProcessor_1 = require("./dotProcessor");
|
|
@@ -37,161 +29,3 @@ var astericsGridProcessor_1 = require("./astericsGridProcessor");
|
|
|
37
29
|
Object.defineProperty(exports, "AstericsGridProcessor", { enumerable: true, get: function () { return astericsGridProcessor_1.AstericsGridProcessor; } });
|
|
38
30
|
var obfsetProcessor_1 = require("./obfsetProcessor");
|
|
39
31
|
Object.defineProperty(exports, "ObfsetProcessor", { enumerable: true, get: function () { return obfsetProcessor_1.ObfsetProcessor; } });
|
|
40
|
-
// Gridset (Grid 3) helpers
|
|
41
|
-
var helpers_1 = require("./gridset/helpers");
|
|
42
|
-
Object.defineProperty(exports, "getPageTokenImageMap", { enumerable: true, get: function () { return helpers_1.getPageTokenImageMap; } });
|
|
43
|
-
Object.defineProperty(exports, "getAllowedImageEntries", { enumerable: true, get: function () { return helpers_1.getAllowedImageEntries; } });
|
|
44
|
-
Object.defineProperty(exports, "openImage", { enumerable: true, get: function () { return helpers_1.openImage; } });
|
|
45
|
-
Object.defineProperty(exports, "generateGrid3Guid", { enumerable: true, get: function () { return helpers_1.generateGrid3Guid; } });
|
|
46
|
-
Object.defineProperty(exports, "createSettingsXml", { enumerable: true, get: function () { return helpers_1.createSettingsXml; } });
|
|
47
|
-
Object.defineProperty(exports, "createFileMapXml", { enumerable: true, get: function () { return helpers_1.createFileMapXml; } });
|
|
48
|
-
Object.defineProperty(exports, "getCommonDocumentsPath", { enumerable: true, get: function () { return helpers_1.getCommonDocumentsPath; } });
|
|
49
|
-
Object.defineProperty(exports, "findGrid3UserPaths", { enumerable: true, get: function () { return helpers_1.findGrid3UserPaths; } });
|
|
50
|
-
Object.defineProperty(exports, "findGrid3HistoryDatabases", { enumerable: true, get: function () { return helpers_1.findGrid3HistoryDatabases; } });
|
|
51
|
-
Object.defineProperty(exports, "findGrid3Users", { enumerable: true, get: function () { return helpers_1.findGrid3Users; } });
|
|
52
|
-
Object.defineProperty(exports, "findGrid3Vocabularies", { enumerable: true, get: function () { return helpers_1.findGrid3Vocabularies; } });
|
|
53
|
-
Object.defineProperty(exports, "findGrid3UserHistory", { enumerable: true, get: function () { return helpers_1.findGrid3UserHistory; } });
|
|
54
|
-
Object.defineProperty(exports, "isGrid3Installed", { enumerable: true, get: function () { return helpers_1.isGrid3Installed; } });
|
|
55
|
-
Object.defineProperty(exports, "readGrid3History", { enumerable: true, get: function () { return helpers_1.readGrid3History; } });
|
|
56
|
-
Object.defineProperty(exports, "readGrid3HistoryForUser", { enumerable: true, get: function () { return helpers_1.readGrid3HistoryForUser; } });
|
|
57
|
-
Object.defineProperty(exports, "readAllGrid3History", { enumerable: true, get: function () { return helpers_1.readAllGrid3History; } });
|
|
58
|
-
var helpers_2 = require("./gridset/helpers");
|
|
59
|
-
Object.defineProperty(exports, "getGridsetPageTokenImageMap", { enumerable: true, get: function () { return helpers_2.getPageTokenImageMap; } });
|
|
60
|
-
Object.defineProperty(exports, "getGridsetAllowedImageEntries", { enumerable: true, get: function () { return helpers_2.getAllowedImageEntries; } });
|
|
61
|
-
Object.defineProperty(exports, "openGridsetImage", { enumerable: true, get: function () { return helpers_2.openImage; } });
|
|
62
|
-
Object.defineProperty(exports, "generateGridsetGuid", { enumerable: true, get: function () { return helpers_2.generateGrid3Guid; } });
|
|
63
|
-
Object.defineProperty(exports, "createGridsetSettingsXml", { enumerable: true, get: function () { return helpers_2.createSettingsXml; } });
|
|
64
|
-
Object.defineProperty(exports, "createGridsetFileMapXml", { enumerable: true, get: function () { return helpers_2.createFileMapXml; } });
|
|
65
|
-
Object.defineProperty(exports, "getGridsetCommonDocumentsPath", { enumerable: true, get: function () { return helpers_2.getCommonDocumentsPath; } });
|
|
66
|
-
Object.defineProperty(exports, "findGridsetUserPaths", { enumerable: true, get: function () { return helpers_2.findGrid3UserPaths; } });
|
|
67
|
-
Object.defineProperty(exports, "findGridsetHistoryDatabases", { enumerable: true, get: function () { return helpers_2.findGrid3HistoryDatabases; } });
|
|
68
|
-
Object.defineProperty(exports, "findGridsetUsers", { enumerable: true, get: function () { return helpers_2.findGrid3Users; } });
|
|
69
|
-
Object.defineProperty(exports, "findGridsetVocabularies", { enumerable: true, get: function () { return helpers_2.findGrid3Vocabularies; } });
|
|
70
|
-
Object.defineProperty(exports, "findGridsetUserHistory", { enumerable: true, get: function () { return helpers_2.findGrid3UserHistory; } });
|
|
71
|
-
Object.defineProperty(exports, "isGridsetInstalled", { enumerable: true, get: function () { return helpers_2.isGrid3Installed; } });
|
|
72
|
-
Object.defineProperty(exports, "readGridsetHistory", { enumerable: true, get: function () { return helpers_2.readGrid3History; } });
|
|
73
|
-
Object.defineProperty(exports, "readGridsetHistoryForUser", { enumerable: true, get: function () { return helpers_2.readGrid3HistoryForUser; } });
|
|
74
|
-
Object.defineProperty(exports, "readAllGridsetHistory", { enumerable: true, get: function () { return helpers_2.readAllGrid3History; } });
|
|
75
|
-
var resolver_1 = require("./gridset/resolver");
|
|
76
|
-
Object.defineProperty(exports, "resolveGrid3CellImage", { enumerable: true, get: function () { return resolver_1.resolveGrid3CellImage; } });
|
|
77
|
-
// Gridset (Grid 3) wordlist helpers
|
|
78
|
-
var wordlistHelpers_1 = require("./gridset/wordlistHelpers");
|
|
79
|
-
Object.defineProperty(exports, "createWordlist", { enumerable: true, get: function () { return wordlistHelpers_1.createWordlist; } });
|
|
80
|
-
Object.defineProperty(exports, "extractWordlists", { enumerable: true, get: function () { return wordlistHelpers_1.extractWordlists; } });
|
|
81
|
-
Object.defineProperty(exports, "updateWordlist", { enumerable: true, get: function () { return wordlistHelpers_1.updateWordlist; } });
|
|
82
|
-
Object.defineProperty(exports, "wordlistToXml", { enumerable: true, get: function () { return wordlistHelpers_1.wordlistToXml; } });
|
|
83
|
-
var password_1 = require("./gridset/password");
|
|
84
|
-
Object.defineProperty(exports, "resolveGridsetPassword", { enumerable: true, get: function () { return password_1.resolveGridsetPassword; } });
|
|
85
|
-
Object.defineProperty(exports, "resolveGridsetPasswordFromEnv", { enumerable: true, get: function () { return password_1.resolveGridsetPasswordFromEnv; } });
|
|
86
|
-
// Gridset (Grid 3) color utilities
|
|
87
|
-
var colorUtils_1 = require("./gridset/colorUtils");
|
|
88
|
-
Object.defineProperty(exports, "getNamedColor", { enumerable: true, get: function () { return colorUtils_1.getNamedColor; } });
|
|
89
|
-
Object.defineProperty(exports, "rgbaToHex", { enumerable: true, get: function () { return colorUtils_1.rgbaToHex; } });
|
|
90
|
-
Object.defineProperty(exports, "channelToHex", { enumerable: true, get: function () { return colorUtils_1.channelToHex; } });
|
|
91
|
-
Object.defineProperty(exports, "clampColorChannel", { enumerable: true, get: function () { return colorUtils_1.clampColorChannel; } });
|
|
92
|
-
Object.defineProperty(exports, "clampAlpha", { enumerable: true, get: function () { return colorUtils_1.clampAlpha; } });
|
|
93
|
-
Object.defineProperty(exports, "toHexColor", { enumerable: true, get: function () { return colorUtils_1.toHexColor; } });
|
|
94
|
-
Object.defineProperty(exports, "darkenColor", { enumerable: true, get: function () { return colorUtils_1.darkenColor; } });
|
|
95
|
-
Object.defineProperty(exports, "normalizeColor", { enumerable: true, get: function () { return colorUtils_1.normalizeColor; } });
|
|
96
|
-
Object.defineProperty(exports, "ensureAlphaChannel", { enumerable: true, get: function () { return colorUtils_1.ensureAlphaChannel; } });
|
|
97
|
-
// Gridset (Grid 3) style helpers
|
|
98
|
-
var styleHelpers_1 = require("./gridset/styleHelpers");
|
|
99
|
-
Object.defineProperty(exports, "DEFAULT_GRID3_STYLES", { enumerable: true, get: function () { return styleHelpers_1.DEFAULT_GRID3_STYLES; } });
|
|
100
|
-
Object.defineProperty(exports, "CATEGORY_STYLES", { enumerable: true, get: function () { return styleHelpers_1.CATEGORY_STYLES; } });
|
|
101
|
-
Object.defineProperty(exports, "createDefaultStylesXml", { enumerable: true, get: function () { return styleHelpers_1.createDefaultStylesXml; } });
|
|
102
|
-
Object.defineProperty(exports, "createCategoryStyle", { enumerable: true, get: function () { return styleHelpers_1.createCategoryStyle; } });
|
|
103
|
-
Object.defineProperty(exports, "CellBackgroundShape", { enumerable: true, get: function () { return styleHelpers_1.CellBackgroundShape; } });
|
|
104
|
-
Object.defineProperty(exports, "SHAPE_NAMES", { enumerable: true, get: function () { return styleHelpers_1.SHAPE_NAMES; } });
|
|
105
|
-
// Re-export ensureAlphaChannel from styleHelpers for backward compatibility
|
|
106
|
-
var styleHelpers_2 = require("./gridset/styleHelpers");
|
|
107
|
-
Object.defineProperty(exports, "ensureAlphaChannelFromStyles", { enumerable: true, get: function () { return styleHelpers_2.ensureAlphaChannel; } });
|
|
108
|
-
// Gridset (Grid 3) plugin cell type detection
|
|
109
|
-
var pluginTypes_1 = require("./gridset/pluginTypes");
|
|
110
|
-
Object.defineProperty(exports, "detectPluginCellType", { enumerable: true, get: function () { return pluginTypes_1.detectPluginCellType; } });
|
|
111
|
-
Object.defineProperty(exports, "Grid3CellType", { enumerable: true, get: function () { return pluginTypes_1.Grid3CellType; } });
|
|
112
|
-
Object.defineProperty(exports, "WORKSPACE_TYPES", { enumerable: true, get: function () { return pluginTypes_1.WORKSPACE_TYPES; } });
|
|
113
|
-
Object.defineProperty(exports, "LIVECELL_TYPES", { enumerable: true, get: function () { return pluginTypes_1.LIVECELL_TYPES; } });
|
|
114
|
-
Object.defineProperty(exports, "AUTOCONTENT_TYPES", { enumerable: true, get: function () { return pluginTypes_1.AUTOCONTENT_TYPES; } });
|
|
115
|
-
Object.defineProperty(exports, "getCellTypeDisplayName", { enumerable: true, get: function () { return pluginTypes_1.getCellTypeDisplayName; } });
|
|
116
|
-
Object.defineProperty(exports, "isWorkspaceCell", { enumerable: true, get: function () { return pluginTypes_1.isWorkspaceCell; } });
|
|
117
|
-
Object.defineProperty(exports, "isLiveCell", { enumerable: true, get: function () { return pluginTypes_1.isLiveCell; } });
|
|
118
|
-
Object.defineProperty(exports, "isAutoContentCell", { enumerable: true, get: function () { return pluginTypes_1.isAutoContentCell; } });
|
|
119
|
-
Object.defineProperty(exports, "isRegularCell", { enumerable: true, get: function () { return pluginTypes_1.isRegularCell; } });
|
|
120
|
-
// Gridset (Grid 3) command definitions and detection
|
|
121
|
-
var commands_1 = require("./gridset/commands");
|
|
122
|
-
Object.defineProperty(exports, "detectCommand", { enumerable: true, get: function () { return commands_1.detectCommand; } });
|
|
123
|
-
Object.defineProperty(exports, "getCommandDefinition", { enumerable: true, get: function () { return commands_1.getCommandDefinition; } });
|
|
124
|
-
Object.defineProperty(exports, "getCommandsByPlugin", { enumerable: true, get: function () { return commands_1.getCommandsByPlugin; } });
|
|
125
|
-
Object.defineProperty(exports, "getCommandsByCategory", { enumerable: true, get: function () { return commands_1.getCommandsByCategory; } });
|
|
126
|
-
Object.defineProperty(exports, "getAllCommandIds", { enumerable: true, get: function () { return commands_1.getAllCommandIds; } });
|
|
127
|
-
Object.defineProperty(exports, "getAllPluginIds", { enumerable: true, get: function () { return commands_1.getAllPluginIds; } });
|
|
128
|
-
Object.defineProperty(exports, "extractCommandParameters", { enumerable: true, get: function () { return commands_1.extractCommandParameters; } });
|
|
129
|
-
Object.defineProperty(exports, "GRID3_COMMANDS", { enumerable: true, get: function () { return commands_1.GRID3_COMMANDS; } });
|
|
130
|
-
Object.defineProperty(exports, "Grid3CommandCategory", { enumerable: true, get: function () { return commands_1.Grid3CommandCategory; } });
|
|
131
|
-
// Gridset (Grid 3) enhanced index - re-export everything
|
|
132
|
-
__exportStar(require("./gridset/index"), exports);
|
|
133
|
-
// Gridset (Grid 3) symbol library handling
|
|
134
|
-
var symbols_1 = require("./gridset/symbols");
|
|
135
|
-
Object.defineProperty(exports, "parseSymbolReference", { enumerable: true, get: function () { return symbols_1.parseSymbolReference; } });
|
|
136
|
-
Object.defineProperty(exports, "isSymbolReference", { enumerable: true, get: function () { return symbols_1.isSymbolReference; } });
|
|
137
|
-
Object.defineProperty(exports, "resolveSymbolReference", { enumerable: true, get: function () { return symbols_1.resolveSymbolReference; } });
|
|
138
|
-
Object.defineProperty(exports, "getAvailableSymbolLibraries", { enumerable: true, get: function () { return symbols_1.getAvailableSymbolLibraries; } });
|
|
139
|
-
Object.defineProperty(exports, "getSymbolLibraryInfo", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryInfo; } });
|
|
140
|
-
Object.defineProperty(exports, "extractSymbolReferences", { enumerable: true, get: function () { return symbols_1.extractSymbolReferences; } });
|
|
141
|
-
Object.defineProperty(exports, "analyzeSymbolUsage", { enumerable: true, get: function () { return symbols_1.analyzeSymbolUsage; } });
|
|
142
|
-
Object.defineProperty(exports, "createSymbolReference", { enumerable: true, get: function () { return symbols_1.createSymbolReference; } });
|
|
143
|
-
Object.defineProperty(exports, "getSymbolLibraryName", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryName; } });
|
|
144
|
-
Object.defineProperty(exports, "getSymbolPath", { enumerable: true, get: function () { return symbols_1.getSymbolPath; } });
|
|
145
|
-
Object.defineProperty(exports, "isKnownSymbolLibrary", { enumerable: true, get: function () { return symbols_1.isKnownSymbolLibrary; } });
|
|
146
|
-
Object.defineProperty(exports, "getSymbolLibraryDisplayName", { enumerable: true, get: function () { return symbols_1.getSymbolLibraryDisplayName; } });
|
|
147
|
-
Object.defineProperty(exports, "getDefaultGrid3Path", { enumerable: true, get: function () { return symbols_1.getDefaultGrid3Path; } });
|
|
148
|
-
Object.defineProperty(exports, "getSymbolLibrariesDir", { enumerable: true, get: function () { return symbols_1.getSymbolLibrariesDir; } });
|
|
149
|
-
Object.defineProperty(exports, "getSymbolSearchIndexesDir", { enumerable: true, get: function () { return symbols_1.getSymbolSearchIndexesDir; } });
|
|
150
|
-
Object.defineProperty(exports, "symbolReferenceToFilename", { enumerable: true, get: function () { return symbols_1.symbolReferenceToFilename; } });
|
|
151
|
-
Object.defineProperty(exports, "SYMBOL_LIBRARIES", { enumerable: true, get: function () { return symbols_1.SYMBOL_LIBRARIES; } });
|
|
152
|
-
var resolver_2 = require("./gridset/resolver");
|
|
153
|
-
Object.defineProperty(exports, "isSymbolLibraryReference", { enumerable: true, get: function () { return resolver_2.isSymbolLibraryReference; } });
|
|
154
|
-
Object.defineProperty(exports, "parseImageSymbolReference", { enumerable: true, get: function () { return resolver_2.parseImageSymbolReference; } });
|
|
155
|
-
// Backward compatibility
|
|
156
|
-
var symbols_2 = require("./gridset/symbols");
|
|
157
|
-
Object.defineProperty(exports, "getSymbolsDir", { enumerable: true, get: function () { return symbols_2.getSymbolsDir; } });
|
|
158
|
-
Object.defineProperty(exports, "getSymbolSearchDir", { enumerable: true, get: function () { return symbols_2.getSymbolSearchDir; } });
|
|
159
|
-
// Gridset (Grid 3) symbol extraction for conversion
|
|
160
|
-
var symbolExtractor_1 = require("./gridset/symbolExtractor");
|
|
161
|
-
Object.defineProperty(exports, "extractButtonImage", { enumerable: true, get: function () { return symbolExtractor_1.extractButtonImage; } });
|
|
162
|
-
Object.defineProperty(exports, "extractSymbolLibraryImage", { enumerable: true, get: function () { return symbolExtractor_1.extractSymbolLibraryImage; } });
|
|
163
|
-
Object.defineProperty(exports, "convertToAstericsImage", { enumerable: true, get: function () { return symbolExtractor_1.convertToAstericsImage; } });
|
|
164
|
-
Object.defineProperty(exports, "analyzeSymbolExtraction", { enumerable: true, get: function () { return symbolExtractor_1.analyzeSymbolExtraction; } });
|
|
165
|
-
Object.defineProperty(exports, "suggestExtractionStrategy", { enumerable: true, get: function () { return symbolExtractor_1.suggestExtractionStrategy; } });
|
|
166
|
-
Object.defineProperty(exports, "exportSymbolReferencesToCsv", { enumerable: true, get: function () { return symbolExtractor_1.exportSymbolReferencesToCsv; } });
|
|
167
|
-
Object.defineProperty(exports, "createSymbolManifest", { enumerable: true, get: function () { return symbolExtractor_1.createSymbolManifest; } });
|
|
168
|
-
// Gridset (Grid 3) symbol search
|
|
169
|
-
var symbolSearch_1 = require("./gridset/symbolSearch");
|
|
170
|
-
Object.defineProperty(exports, "parsePixFile", { enumerable: true, get: function () { return symbolSearch_1.parsePixFile; } });
|
|
171
|
-
Object.defineProperty(exports, "loadSearchIndexes", { enumerable: true, get: function () { return symbolSearch_1.loadSearchIndexes; } });
|
|
172
|
-
Object.defineProperty(exports, "searchSymbols", { enumerable: true, get: function () { return symbolSearch_1.searchSymbols; } });
|
|
173
|
-
Object.defineProperty(exports, "searchSymbolsWithReferences", { enumerable: true, get: function () { return symbolSearch_1.searchSymbolsWithReferences; } });
|
|
174
|
-
Object.defineProperty(exports, "getSymbolFilename", { enumerable: true, get: function () { return symbolSearch_1.getSymbolFilename; } });
|
|
175
|
-
Object.defineProperty(exports, "getSymbolDisplayName", { enumerable: true, get: function () { return symbolSearch_1.getSymbolDisplayName; } });
|
|
176
|
-
Object.defineProperty(exports, "getAllSearchTerms", { enumerable: true, get: function () { return symbolSearch_1.getAllSearchTerms; } });
|
|
177
|
-
Object.defineProperty(exports, "getSearchSuggestions", { enumerable: true, get: function () { return symbolSearch_1.getSearchSuggestions; } });
|
|
178
|
-
Object.defineProperty(exports, "countLibrarySymbols", { enumerable: true, get: function () { return symbolSearch_1.countLibrarySymbols; } });
|
|
179
|
-
Object.defineProperty(exports, "getSymbolSearchStats", { enumerable: true, get: function () { return symbolSearch_1.getSymbolSearchStats; } });
|
|
180
|
-
// Snap helpers
|
|
181
|
-
var helpers_3 = require("./snap/helpers");
|
|
182
|
-
Object.defineProperty(exports, "getSnapPageTokenImageMap", { enumerable: true, get: function () { return helpers_3.getPageTokenImageMap; } });
|
|
183
|
-
Object.defineProperty(exports, "getSnapAllowedImageEntries", { enumerable: true, get: function () { return helpers_3.getAllowedImageEntries; } });
|
|
184
|
-
Object.defineProperty(exports, "openSnapImage", { enumerable: true, get: function () { return helpers_3.openImage; } });
|
|
185
|
-
Object.defineProperty(exports, "findSnapPackages", { enumerable: true, get: function () { return helpers_3.findSnapPackages; } });
|
|
186
|
-
Object.defineProperty(exports, "findSnapPackagePath", { enumerable: true, get: function () { return helpers_3.findSnapPackagePath; } });
|
|
187
|
-
Object.defineProperty(exports, "findSnapUsers", { enumerable: true, get: function () { return helpers_3.findSnapUsers; } });
|
|
188
|
-
Object.defineProperty(exports, "findSnapUserVocabularies", { enumerable: true, get: function () { return helpers_3.findSnapUserVocabularies; } });
|
|
189
|
-
Object.defineProperty(exports, "findSnapUserHistory", { enumerable: true, get: function () { return helpers_3.findSnapUserHistory; } });
|
|
190
|
-
Object.defineProperty(exports, "isSnapInstalled", { enumerable: true, get: function () { return helpers_3.isSnapInstalled; } });
|
|
191
|
-
Object.defineProperty(exports, "readSnapUsage", { enumerable: true, get: function () { return helpers_3.readSnapUsage; } });
|
|
192
|
-
Object.defineProperty(exports, "readSnapUsageForUser", { enumerable: true, get: function () { return helpers_3.readSnapUsageForUser; } });
|
|
193
|
-
// TouchChat helpers (stubs)
|
|
194
|
-
var helpers_4 = require("./touchchat/helpers");
|
|
195
|
-
Object.defineProperty(exports, "getTouchChatPageTokenImageMap", { enumerable: true, get: function () { return helpers_4.getPageTokenImageMap; } });
|
|
196
|
-
Object.defineProperty(exports, "getTouchChatAllowedImageEntries", { enumerable: true, get: function () { return helpers_4.getAllowedImageEntries; } });
|
|
197
|
-
Object.defineProperty(exports, "openTouchChatImage", { enumerable: true, get: function () { return helpers_4.openImage; } });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseProcessor, ProcessorOptions, ExtractStringsResult, TranslatedString, SourceString } from '../core/baseProcessor';
|
|
2
2
|
import { AACTree } from '../core/treeStructure';
|
|
3
3
|
import { ValidationResult } from '../validation/validationTypes';
|
|
4
|
+
import { type ButtonForTranslation, type LLMLTranslationResult } from '../utilities/translation/translationProcessor';
|
|
4
5
|
declare class ObfProcessor extends BaseProcessor {
|
|
5
6
|
constructor(options?: ProcessorOptions);
|
|
6
7
|
private processBoard;
|
|
@@ -26,5 +27,30 @@ declare class ObfProcessor extends BaseProcessor {
|
|
|
26
27
|
* @returns Promise with validation result
|
|
27
28
|
*/
|
|
28
29
|
validate(filePath: string): Promise<ValidationResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Extract symbol information from an OBF/OBZ file for LLM-based translation.
|
|
32
|
+
* Returns a structured format showing which buttons have symbols and their context.
|
|
33
|
+
*
|
|
34
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
35
|
+
*
|
|
36
|
+
* @param filePathOrBuffer - Path to OBF/OBZ file or buffer
|
|
37
|
+
* @returns Array of symbol information for LLM processing
|
|
38
|
+
*/
|
|
39
|
+
extractSymbolsForLLM(filePathOrBuffer: string | Buffer): ButtonForTranslation[];
|
|
40
|
+
/**
|
|
41
|
+
* Apply LLM translations with symbol information.
|
|
42
|
+
* The LLM should provide translations with symbol attachments in the correct positions.
|
|
43
|
+
*
|
|
44
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
45
|
+
*
|
|
46
|
+
* @param filePathOrBuffer - Path to OBF/OBZ file or buffer
|
|
47
|
+
* @param llmTranslations - Array of LLM translations with symbol info
|
|
48
|
+
* @param outputPath - Where to save the translated OBF/OBZ file
|
|
49
|
+
* @param options - Translation options (e.g., allowPartial for testing)
|
|
50
|
+
* @returns Buffer of the translated OBF/OBZ file
|
|
51
|
+
*/
|
|
52
|
+
processLLMTranslations(filePathOrBuffer: string | Buffer, llmTranslations: LLMLTranslationResult[], outputPath: string, options?: {
|
|
53
|
+
allowPartial?: boolean;
|
|
54
|
+
}): Buffer;
|
|
29
55
|
}
|
|
30
56
|
export { ObfProcessor };
|
|
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ObfProcessor = void 0;
|
|
7
7
|
const baseProcessor_1 = require("../core/baseProcessor");
|
|
8
8
|
const treeStructure_1 = require("../core/treeStructure");
|
|
9
|
-
const idGenerator_1 = require("../
|
|
9
|
+
const idGenerator_1 = require("../utilities/analytics/utils/idGenerator");
|
|
10
10
|
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
11
11
|
const fs_1 = __importDefault(require("fs"));
|
|
12
12
|
const obfValidator_1 = require("../validation/obfValidator");
|
|
13
|
+
const translationProcessor_1 = require("../utilities/translation/translationProcessor");
|
|
13
14
|
const OBF_FORMAT_VERSION = 'open-board-0.1';
|
|
14
15
|
/**
|
|
15
16
|
* Map OBF hidden value to AAC standard visibility
|
|
@@ -403,5 +404,85 @@ class ObfProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
403
404
|
async validate(filePath) {
|
|
404
405
|
return obfValidator_1.ObfValidator.validateFile(filePath);
|
|
405
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* Extract symbol information from an OBF/OBZ file for LLM-based translation.
|
|
409
|
+
* Returns a structured format showing which buttons have symbols and their context.
|
|
410
|
+
*
|
|
411
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
412
|
+
*
|
|
413
|
+
* @param filePathOrBuffer - Path to OBF/OBZ file or buffer
|
|
414
|
+
* @returns Array of symbol information for LLM processing
|
|
415
|
+
*/
|
|
416
|
+
extractSymbolsForLLM(filePathOrBuffer) {
|
|
417
|
+
const tree = this.loadIntoTree(filePathOrBuffer);
|
|
418
|
+
// Collect all buttons from all pages
|
|
419
|
+
const allButtons = [];
|
|
420
|
+
Object.values(tree.pages).forEach((page) => {
|
|
421
|
+
page.buttons.forEach((button) => {
|
|
422
|
+
// Add page context to each button
|
|
423
|
+
button.pageId = page.id;
|
|
424
|
+
button.pageName = page.name || page.id;
|
|
425
|
+
allButtons.push(button);
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
// Use shared utility to extract buttons with translation context
|
|
429
|
+
return (0, translationProcessor_1.extractAllButtonsForTranslation)(allButtons, (button) => ({
|
|
430
|
+
pageId: button.pageId,
|
|
431
|
+
pageName: button.pageName,
|
|
432
|
+
}));
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Apply LLM translations with symbol information.
|
|
436
|
+
* The LLM should provide translations with symbol attachments in the correct positions.
|
|
437
|
+
*
|
|
438
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
439
|
+
*
|
|
440
|
+
* @param filePathOrBuffer - Path to OBF/OBZ file or buffer
|
|
441
|
+
* @param llmTranslations - Array of LLM translations with symbol info
|
|
442
|
+
* @param outputPath - Where to save the translated OBF/OBZ file
|
|
443
|
+
* @param options - Translation options (e.g., allowPartial for testing)
|
|
444
|
+
* @returns Buffer of the translated OBF/OBZ file
|
|
445
|
+
*/
|
|
446
|
+
processLLMTranslations(filePathOrBuffer, llmTranslations, outputPath, options) {
|
|
447
|
+
const tree = this.loadIntoTree(filePathOrBuffer);
|
|
448
|
+
// Validate translations using shared utility
|
|
449
|
+
const buttonIds = Object.values(tree.pages).flatMap((page) => page.buttons.map((b) => b.id));
|
|
450
|
+
(0, translationProcessor_1.validateTranslationResults)(llmTranslations, buttonIds, options);
|
|
451
|
+
// Create a map for quick lookup
|
|
452
|
+
const translationMap = new Map(llmTranslations.map((t) => [t.buttonId, t]));
|
|
453
|
+
// Apply translations
|
|
454
|
+
Object.values(tree.pages).forEach((page) => {
|
|
455
|
+
page.buttons.forEach((button) => {
|
|
456
|
+
const translation = translationMap.get(button.id);
|
|
457
|
+
if (!translation)
|
|
458
|
+
return;
|
|
459
|
+
// Apply label translation
|
|
460
|
+
if (translation.translatedLabel) {
|
|
461
|
+
button.label = translation.translatedLabel;
|
|
462
|
+
}
|
|
463
|
+
// Apply message translation (vocalization in OBF)
|
|
464
|
+
if (translation.translatedMessage) {
|
|
465
|
+
button.message = translation.translatedMessage;
|
|
466
|
+
// Update semantic action if symbols provided
|
|
467
|
+
if (translation.symbols && translation.symbols.length > 0) {
|
|
468
|
+
if (!button.semanticAction) {
|
|
469
|
+
button.semanticAction = {
|
|
470
|
+
category: treeStructure_1.AACSemanticCategory.COMMUNICATION,
|
|
471
|
+
intent: treeStructure_1.AACSemanticIntent.SPEAK_TEXT,
|
|
472
|
+
text: translation.translatedMessage,
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
button.semanticAction.richText = {
|
|
476
|
+
text: translation.translatedMessage,
|
|
477
|
+
symbols: translation.symbols,
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
});
|
|
483
|
+
// Save and return
|
|
484
|
+
this.saveFromTree(tree, outputPath);
|
|
485
|
+
return fs_1.default.readFileSync(outputPath);
|
|
486
|
+
}
|
|
406
487
|
}
|
|
407
488
|
exports.ObfProcessor = ObfProcessor;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.SnapProcessor = void 0;
|
|
7
7
|
const baseProcessor_1 = require("../core/baseProcessor");
|
|
8
8
|
const treeStructure_1 = require("../core/treeStructure");
|
|
9
|
-
const idGenerator_1 = require("../
|
|
9
|
+
const idGenerator_1 = require("../utilities/analytics/utils/idGenerator");
|
|
10
10
|
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
11
11
|
const path_1 = __importDefault(require("path"));
|
|
12
12
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BaseProcessor, ProcessorOptions, ExtractStringsResult, TranslatedString, SourceString } from '../core/baseProcessor';
|
|
2
2
|
import { AACTree } from '../core/treeStructure';
|
|
3
3
|
import { ValidationResult } from '../validation/validationTypes';
|
|
4
|
+
import { type ButtonForTranslation, type LLMLTranslationResult } from '../utilities/translation/translationProcessor';
|
|
4
5
|
declare class TouchChatProcessor extends BaseProcessor {
|
|
5
6
|
private tree;
|
|
6
7
|
private sourceFile;
|
|
@@ -30,5 +31,30 @@ declare class TouchChatProcessor extends BaseProcessor {
|
|
|
30
31
|
* @returns Promise with validation result
|
|
31
32
|
*/
|
|
32
33
|
validate(filePath: string): Promise<ValidationResult>;
|
|
34
|
+
/**
|
|
35
|
+
* Extract symbol information from a TouchChat file for LLM-based translation.
|
|
36
|
+
* Returns a structured format showing which buttons have symbols and their context.
|
|
37
|
+
*
|
|
38
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
39
|
+
*
|
|
40
|
+
* @param filePathOrBuffer - Path to TouchChat .ce file or buffer
|
|
41
|
+
* @returns Array of symbol information for LLM processing
|
|
42
|
+
*/
|
|
43
|
+
extractSymbolsForLLM(filePathOrBuffer: string | Buffer): ButtonForTranslation[];
|
|
44
|
+
/**
|
|
45
|
+
* Apply LLM translations with symbol information.
|
|
46
|
+
* The LLM should provide translations with symbol attachments in the correct positions.
|
|
47
|
+
*
|
|
48
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
49
|
+
*
|
|
50
|
+
* @param filePathOrBuffer - Path to TouchChat .ce file or buffer
|
|
51
|
+
* @param llmTranslations - Array of LLM translations with symbol info
|
|
52
|
+
* @param outputPath - Where to save the translated TouchChat file
|
|
53
|
+
* @param options - Translation options (e.g., allowPartial for testing)
|
|
54
|
+
* @returns Buffer of the translated TouchChat file
|
|
55
|
+
*/
|
|
56
|
+
processLLMTranslations(filePathOrBuffer: string | Buffer, llmTranslations: LLMLTranslationResult[], outputPath: string, options?: {
|
|
57
|
+
allowPartial?: boolean;
|
|
58
|
+
}): Buffer;
|
|
33
59
|
}
|
|
34
60
|
export { TouchChatProcessor };
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.TouchChatProcessor = void 0;
|
|
7
7
|
const baseProcessor_1 = require("../core/baseProcessor");
|
|
8
8
|
const treeStructure_1 = require("../core/treeStructure");
|
|
9
|
-
const idGenerator_1 = require("../
|
|
9
|
+
const idGenerator_1 = require("../utilities/analytics/utils/idGenerator");
|
|
10
10
|
const stringCasing_1 = require("../core/stringCasing");
|
|
11
11
|
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
12
12
|
const better_sqlite3_1 = __importDefault(require("better-sqlite3"));
|
|
@@ -14,6 +14,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
14
14
|
const fs_1 = __importDefault(require("fs"));
|
|
15
15
|
const os_1 = __importDefault(require("os"));
|
|
16
16
|
const touchChatValidator_1 = require("../validation/touchChatValidator");
|
|
17
|
+
const translationProcessor_1 = require("../utilities/translation/translationProcessor");
|
|
17
18
|
const toNumberOrUndefined = (value) => typeof value === 'number' ? value : undefined;
|
|
18
19
|
const toStringOrUndefined = (value) => typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
19
20
|
const toBooleanOrUndefined = (value) => typeof value === 'number' ? value !== 0 : undefined;
|
|
@@ -842,5 +843,85 @@ class TouchChatProcessor extends baseProcessor_1.BaseProcessor {
|
|
|
842
843
|
async validate(filePath) {
|
|
843
844
|
return touchChatValidator_1.TouchChatValidator.validateFile(filePath);
|
|
844
845
|
}
|
|
846
|
+
/**
|
|
847
|
+
* Extract symbol information from a TouchChat file for LLM-based translation.
|
|
848
|
+
* Returns a structured format showing which buttons have symbols and their context.
|
|
849
|
+
*
|
|
850
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
851
|
+
*
|
|
852
|
+
* @param filePathOrBuffer - Path to TouchChat .ce file or buffer
|
|
853
|
+
* @returns Array of symbol information for LLM processing
|
|
854
|
+
*/
|
|
855
|
+
extractSymbolsForLLM(filePathOrBuffer) {
|
|
856
|
+
const tree = this.loadIntoTree(filePathOrBuffer);
|
|
857
|
+
// Collect all buttons from all pages
|
|
858
|
+
const allButtons = [];
|
|
859
|
+
Object.values(tree.pages).forEach((page) => {
|
|
860
|
+
page.buttons.forEach((button) => {
|
|
861
|
+
// Add page context to each button
|
|
862
|
+
button.pageId = page.id;
|
|
863
|
+
button.pageName = page.name || page.id;
|
|
864
|
+
allButtons.push(button);
|
|
865
|
+
});
|
|
866
|
+
});
|
|
867
|
+
// Use shared utility to extract buttons with translation context
|
|
868
|
+
return (0, translationProcessor_1.extractAllButtonsForTranslation)(allButtons, (button) => ({
|
|
869
|
+
pageId: button.pageId,
|
|
870
|
+
pageName: button.pageName,
|
|
871
|
+
}));
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Apply LLM translations with symbol information.
|
|
875
|
+
* The LLM should provide translations with symbol attachments in the correct positions.
|
|
876
|
+
*
|
|
877
|
+
* This method uses shared translation utilities that work across all AAC formats.
|
|
878
|
+
*
|
|
879
|
+
* @param filePathOrBuffer - Path to TouchChat .ce file or buffer
|
|
880
|
+
* @param llmTranslations - Array of LLM translations with symbol info
|
|
881
|
+
* @param outputPath - Where to save the translated TouchChat file
|
|
882
|
+
* @param options - Translation options (e.g., allowPartial for testing)
|
|
883
|
+
* @returns Buffer of the translated TouchChat file
|
|
884
|
+
*/
|
|
885
|
+
processLLMTranslations(filePathOrBuffer, llmTranslations, outputPath, options) {
|
|
886
|
+
const tree = this.loadIntoTree(filePathOrBuffer);
|
|
887
|
+
// Validate translations using shared utility
|
|
888
|
+
const buttonIds = Object.values(tree.pages).flatMap((page) => page.buttons.map((b) => b.id));
|
|
889
|
+
(0, translationProcessor_1.validateTranslationResults)(llmTranslations, buttonIds, options);
|
|
890
|
+
// Create a map for quick lookup
|
|
891
|
+
const translationMap = new Map(llmTranslations.map((t) => [t.buttonId, t]));
|
|
892
|
+
// Apply translations
|
|
893
|
+
Object.values(tree.pages).forEach((page) => {
|
|
894
|
+
page.buttons.forEach((button) => {
|
|
895
|
+
const translation = translationMap.get(button.id);
|
|
896
|
+
if (!translation)
|
|
897
|
+
return;
|
|
898
|
+
// Apply label translation
|
|
899
|
+
if (translation.translatedLabel) {
|
|
900
|
+
button.label = translation.translatedLabel;
|
|
901
|
+
}
|
|
902
|
+
// Apply message translation
|
|
903
|
+
if (translation.translatedMessage) {
|
|
904
|
+
button.message = translation.translatedMessage;
|
|
905
|
+
// Update semantic action if symbols provided
|
|
906
|
+
if (translation.symbols && translation.symbols.length > 0) {
|
|
907
|
+
if (!button.semanticAction) {
|
|
908
|
+
button.semanticAction = {
|
|
909
|
+
category: treeStructure_1.AACSemanticCategory.COMMUNICATION,
|
|
910
|
+
intent: treeStructure_1.AACSemanticIntent.SPEAK_TEXT,
|
|
911
|
+
text: translation.translatedMessage,
|
|
912
|
+
};
|
|
913
|
+
}
|
|
914
|
+
button.semanticAction.richText = {
|
|
915
|
+
text: translation.translatedMessage,
|
|
916
|
+
symbols: translation.symbols,
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
});
|
|
922
|
+
// Save and return
|
|
923
|
+
this.saveFromTree(tree, outputPath);
|
|
924
|
+
return fs_1.default.readFileSync(outputPath);
|
|
925
|
+
}
|
|
845
926
|
}
|
|
846
927
|
exports.TouchChatProcessor = TouchChatProcessor;
|
package/dist/snap.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snap (Tobii Dynavox) Namespace
|
|
3
|
+
*
|
|
4
|
+
* All Snap-specific utilities, helpers, and types.
|
|
5
|
+
*/
|
|
6
|
+
export { SnapProcessor } from './processors/snapProcessor';
|
|
7
|
+
export { getPageTokenImageMap, getAllowedImageEntries, openImage, findSnapPackages, findSnapPackagePath, findSnapUsers, findSnapUserVocabularies, findSnapUserHistory, isSnapInstalled, readSnapUsage, readSnapUsageForUser, type SnapPackagePath, type SnapUserInfo, type SnapUsageEntry, } from './processors/snap/helpers';
|
package/dist/snap.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Snap (Tobii Dynavox) Namespace
|
|
4
|
+
*
|
|
5
|
+
* All Snap-specific utilities, helpers, and types.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.readSnapUsageForUser = exports.readSnapUsage = exports.isSnapInstalled = exports.findSnapUserHistory = exports.findSnapUserVocabularies = exports.findSnapUsers = exports.findSnapPackagePath = exports.findSnapPackages = exports.openImage = exports.getAllowedImageEntries = exports.getPageTokenImageMap = exports.SnapProcessor = void 0;
|
|
9
|
+
// Processor class
|
|
10
|
+
var snapProcessor_1 = require("./processors/snapProcessor");
|
|
11
|
+
Object.defineProperty(exports, "SnapProcessor", { enumerable: true, get: function () { return snapProcessor_1.SnapProcessor; } });
|
|
12
|
+
// === Snap Helpers ===
|
|
13
|
+
var helpers_1 = require("./processors/snap/helpers");
|
|
14
|
+
Object.defineProperty(exports, "getPageTokenImageMap", { enumerable: true, get: function () { return helpers_1.getPageTokenImageMap; } });
|
|
15
|
+
Object.defineProperty(exports, "getAllowedImageEntries", { enumerable: true, get: function () { return helpers_1.getAllowedImageEntries; } });
|
|
16
|
+
Object.defineProperty(exports, "openImage", { enumerable: true, get: function () { return helpers_1.openImage; } });
|
|
17
|
+
Object.defineProperty(exports, "findSnapPackages", { enumerable: true, get: function () { return helpers_1.findSnapPackages; } });
|
|
18
|
+
Object.defineProperty(exports, "findSnapPackagePath", { enumerable: true, get: function () { return helpers_1.findSnapPackagePath; } });
|
|
19
|
+
Object.defineProperty(exports, "findSnapUsers", { enumerable: true, get: function () { return helpers_1.findSnapUsers; } });
|
|
20
|
+
Object.defineProperty(exports, "findSnapUserVocabularies", { enumerable: true, get: function () { return helpers_1.findSnapUserVocabularies; } });
|
|
21
|
+
Object.defineProperty(exports, "findSnapUserHistory", { enumerable: true, get: function () { return helpers_1.findSnapUserHistory; } });
|
|
22
|
+
Object.defineProperty(exports, "isSnapInstalled", { enumerable: true, get: function () { return helpers_1.isSnapInstalled; } });
|
|
23
|
+
Object.defineProperty(exports, "readSnapUsage", { enumerable: true, get: function () { return helpers_1.readSnapUsage; } });
|
|
24
|
+
Object.defineProperty(exports, "readSnapUsageForUser", { enumerable: true, get: function () { return helpers_1.readSnapUsageForUser; } });
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TouchChat (PRC-Saltillo) Namespace
|
|
3
|
+
*
|
|
4
|
+
* All TouchChat-specific utilities, helpers, and types.
|
|
5
|
+
*/
|
|
6
|
+
export { TouchChatProcessor } from './processors/touchchatProcessor';
|
|
7
|
+
export { getPageTokenImageMap, getAllowedImageEntries, openImage, } from './processors/touchchat/helpers';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TouchChat (PRC-Saltillo) Namespace
|
|
4
|
+
*
|
|
5
|
+
* All TouchChat-specific utilities, helpers, and types.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.openImage = exports.getAllowedImageEntries = exports.getPageTokenImageMap = exports.TouchChatProcessor = void 0;
|
|
9
|
+
// Processor class
|
|
10
|
+
var touchchatProcessor_1 = require("./processors/touchchatProcessor");
|
|
11
|
+
Object.defineProperty(exports, "TouchChatProcessor", { enumerable: true, get: function () { return touchchatProcessor_1.TouchChatProcessor; } });
|
|
12
|
+
// === TouchChat Helpers ===
|
|
13
|
+
var helpers_1 = require("./processors/touchchat/helpers");
|
|
14
|
+
Object.defineProperty(exports, "getPageTokenImageMap", { enumerable: true, get: function () { return helpers_1.getPageTokenImageMap; } });
|
|
15
|
+
Object.defineProperty(exports, "getAllowedImageEntries", { enumerable: true, get: function () { return helpers_1.getAllowedImageEntries; } });
|
|
16
|
+
Object.defineProperty(exports, "openImage", { enumerable: true, get: function () { return helpers_1.openImage; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Translation Namespace
|
|
3
|
+
*
|
|
4
|
+
* LLM-based translation utilities for AAC files with symbol preservation.
|
|
5
|
+
*
|
|
6
|
+
* These utilities are used by processor classes. See individual processors for:
|
|
7
|
+
* - extractSymbolsForLLM() - method on GridsetProcessor, ObfProcessor, TouchChatProcessor, SnapProcessor
|
|
8
|
+
* - processLLMTranslations() - method on GridsetProcessor, ObfProcessor, TouchChatProcessor, SnapProcessor
|
|
9
|
+
*
|
|
10
|
+
* Or use the lower-level utilities directly:
|
|
11
|
+
*/
|
|
12
|
+
export { normalizeButtonForTranslation, extractSymbolsFromButton, extractAllButtonsForTranslation, createTranslationPrompt, validateTranslationResults, type SymbolInfo, type ButtonForTranslation, type LLMLTranslationResult, } from './utilities/translation/translationProcessor';
|
|
13
|
+
export { type TranslatedString, type SourceString } from './core/baseProcessor';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Translation Namespace
|
|
4
|
+
*
|
|
5
|
+
* LLM-based translation utilities for AAC files with symbol preservation.
|
|
6
|
+
*
|
|
7
|
+
* These utilities are used by processor classes. See individual processors for:
|
|
8
|
+
* - extractSymbolsForLLM() - method on GridsetProcessor, ObfProcessor, TouchChatProcessor, SnapProcessor
|
|
9
|
+
* - processLLMTranslations() - method on GridsetProcessor, ObfProcessor, TouchChatProcessor, SnapProcessor
|
|
10
|
+
*
|
|
11
|
+
* Or use the lower-level utilities directly:
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.validateTranslationResults = exports.createTranslationPrompt = exports.extractAllButtonsForTranslation = exports.extractSymbolsFromButton = exports.normalizeButtonForTranslation = void 0;
|
|
15
|
+
// LLM translation utilities
|
|
16
|
+
var translationProcessor_1 = require("./utilities/translation/translationProcessor");
|
|
17
|
+
Object.defineProperty(exports, "normalizeButtonForTranslation", { enumerable: true, get: function () { return translationProcessor_1.normalizeButtonForTranslation; } });
|
|
18
|
+
Object.defineProperty(exports, "extractSymbolsFromButton", { enumerable: true, get: function () { return translationProcessor_1.extractSymbolsFromButton; } });
|
|
19
|
+
Object.defineProperty(exports, "extractAllButtonsForTranslation", { enumerable: true, get: function () { return translationProcessor_1.extractAllButtonsForTranslation; } });
|
|
20
|
+
Object.defineProperty(exports, "createTranslationPrompt", { enumerable: true, get: function () { return translationProcessor_1.createTranslationPrompt; } });
|
|
21
|
+
Object.defineProperty(exports, "validateTranslationResults", { enumerable: true, get: function () { return translationProcessor_1.validateTranslationResults; } });
|