@willwade/aac-processors 0.0.14 → 0.0.16
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 +58 -10
- 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/treeStructure.d.ts +1 -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 +23 -2
- package/dist/index.js +36 -7
- 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/commands.js +15 -0
- package/dist/processors/gridset/pluginTypes.js +4 -4
- package/dist/processors/gridsetProcessor.d.ts +4 -0
- package/dist/processors/gridsetProcessor.js +315 -47
- package/dist/processors/index.d.ts +8 -18
- package/dist/processors/index.js +9 -175
- package/dist/processors/snapProcessor.js +105 -9
- package/dist/processors/touchchatProcessor.js +33 -13
- 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/types/aac.d.ts +13 -3
- package/dist/types/aac.js +6 -2
- package/dist/utilities/analytics/metrics/comparison.d.ts +1 -0
- package/dist/utilities/analytics/metrics/comparison.js +52 -24
- package/dist/utilities/analytics/metrics/core.d.ts +7 -2
- package/dist/utilities/analytics/metrics/core.js +327 -197
- package/dist/utilities/analytics/metrics/effort.d.ts +8 -3
- package/dist/utilities/analytics/metrics/effort.js +10 -5
- package/dist/utilities/analytics/metrics/sentence.js +17 -4
- package/dist/utilities/analytics/metrics/types.d.ts +39 -0
- package/dist/utilities/analytics/metrics/vocabulary.js +1 -1
- package/dist/utilities/analytics/reference/index.js +12 -1
- package/dist/utilities/translation/translationProcessor.d.ts +2 -1
- package/dist/utilities/translation/translationProcessor.js +5 -2
- 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
|
@@ -29,6 +29,8 @@ export declare const EFFORT_CONSTANTS: {
|
|
|
29
29
|
readonly REUSED_CLONE_FROM_OTHER_BONUS: 0.005;
|
|
30
30
|
readonly SCAN_STEP_COST: 0.015;
|
|
31
31
|
readonly SCAN_SELECTION_COST: 0.1;
|
|
32
|
+
readonly DEFAULT_SCAN_ERROR_RATE: 0.1;
|
|
33
|
+
readonly SCAN_RETRY_PENALTY: 1;
|
|
32
34
|
};
|
|
33
35
|
/**
|
|
34
36
|
* Calculate button size effort based on grid dimensions
|
|
@@ -68,12 +70,13 @@ export declare function visualScanEffort(priorButtons: number): number;
|
|
|
68
70
|
export declare function distanceEffort(x: number, y: number, entryX?: number, entryY?: number): number;
|
|
69
71
|
/**
|
|
70
72
|
* Calculate spelling effort for words not available in the board set
|
|
71
|
-
* Base cost + per-letter cost
|
|
72
73
|
*
|
|
73
74
|
* @param word - The word to spell
|
|
75
|
+
* @param entryEffort - Effort to reach the spelling/keyboard page
|
|
76
|
+
* @param perLetterEffort - Average effort per letter on the keyboard
|
|
74
77
|
* @returns Spelling effort score
|
|
75
78
|
*/
|
|
76
|
-
export declare function spellingEffort(word: string): number;
|
|
79
|
+
export declare function spellingEffort(word: string, entryEffort?: number, perLetterEffort?: number): number;
|
|
77
80
|
/**
|
|
78
81
|
* Calculate base board effort
|
|
79
82
|
* Combines button size and field size efforts
|
|
@@ -142,6 +145,8 @@ export declare function localScanEffort(distance: number): number;
|
|
|
142
145
|
*
|
|
143
146
|
* @param steps - Number of scan steps to reach target
|
|
144
147
|
* @param selections - Number of switch selections required
|
|
148
|
+
* @param stepCost - Optional override for scan step cost
|
|
149
|
+
* @param selectionCost - Optional override for scan selection cost
|
|
145
150
|
* @returns Scanning effort score
|
|
146
151
|
*/
|
|
147
|
-
export declare function scanningEffort(steps: number, selections: number): number;
|
|
152
|
+
export declare function scanningEffort(steps: number, selections: number, stepCost?: number, selectionCost?: number): number;
|
|
@@ -44,6 +44,8 @@ exports.EFFORT_CONSTANTS = {
|
|
|
44
44
|
REUSED_CLONE_FROM_OTHER_BONUS: 0.005,
|
|
45
45
|
SCAN_STEP_COST: 0.015, // Matches visual scan multiplier
|
|
46
46
|
SCAN_SELECTION_COST: 0.1, // Cost of a switch selection
|
|
47
|
+
DEFAULT_SCAN_ERROR_RATE: 0.1, // 10% chance of missing a selection
|
|
48
|
+
SCAN_RETRY_PENALTY: 1.0, // Cost multiplier for a full loop retry
|
|
47
49
|
};
|
|
48
50
|
/**
|
|
49
51
|
* Calculate button size effort based on grid dimensions
|
|
@@ -92,13 +94,14 @@ function distanceEffort(x, y, entryX = 1.0, entryY = 1.0) {
|
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
94
96
|
* Calculate spelling effort for words not available in the board set
|
|
95
|
-
* Base cost + per-letter cost
|
|
96
97
|
*
|
|
97
98
|
* @param word - The word to spell
|
|
99
|
+
* @param entryEffort - Effort to reach the spelling/keyboard page
|
|
100
|
+
* @param perLetterEffort - Average effort per letter on the keyboard
|
|
98
101
|
* @returns Spelling effort score
|
|
99
102
|
*/
|
|
100
|
-
function spellingEffort(word) {
|
|
101
|
-
return
|
|
103
|
+
function spellingEffort(word, entryEffort = 10, perLetterEffort = 2.5) {
|
|
104
|
+
return entryEffort + word.length * perLetterEffort;
|
|
102
105
|
}
|
|
103
106
|
/**
|
|
104
107
|
* Calculate base board effort
|
|
@@ -204,8 +207,10 @@ function localScanEffort(distance) {
|
|
|
204
207
|
*
|
|
205
208
|
* @param steps - Number of scan steps to reach target
|
|
206
209
|
* @param selections - Number of switch selections required
|
|
210
|
+
* @param stepCost - Optional override for scan step cost
|
|
211
|
+
* @param selectionCost - Optional override for scan selection cost
|
|
207
212
|
* @returns Scanning effort score
|
|
208
213
|
*/
|
|
209
|
-
function scanningEffort(steps, selections) {
|
|
210
|
-
return
|
|
214
|
+
function scanningEffort(steps, selections, stepCost = exports.EFFORT_CONSTANTS.SCAN_STEP_COST, selectionCost = exports.EFFORT_CONSTANTS.SCAN_SELECTION_COST) {
|
|
215
|
+
return steps * stepCost + selections * selectionCost;
|
|
211
216
|
}
|
|
@@ -40,10 +40,23 @@ class SentenceAnalyzer {
|
|
|
40
40
|
totalEffort += found.effort;
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
// Word not found -
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
// Word not found - check for dynamic prediction fallback
|
|
44
|
+
let wordEffort = 0;
|
|
45
|
+
const isTyped = true;
|
|
46
|
+
const baseSpell = (0, effort_1.spellingEffort)(word, metrics.spelling_effort_base || 10, metrics.spelling_effort_per_letter || 2.5);
|
|
47
|
+
if (metrics.has_dynamic_prediction) {
|
|
48
|
+
// Predictive fallback: Base + (limited letters) + selection
|
|
49
|
+
// We assume on average typing 40% of the word finds it in the dictionary
|
|
50
|
+
const predictiveEffort = (metrics.spelling_effort_base || 10) +
|
|
51
|
+
word.length * 0.4 * (metrics.spelling_effort_per_letter || 2.5) +
|
|
52
|
+
6.0; // Fixed selection cost from prediction bar
|
|
53
|
+
wordEffort = Math.min(baseSpell, predictiveEffort);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
wordEffort = baseSpell;
|
|
57
|
+
}
|
|
58
|
+
wordEfforts.push({ word, effort: wordEffort, typed: isTyped });
|
|
59
|
+
totalEffort += wordEffort;
|
|
47
60
|
typing = true;
|
|
48
61
|
missingWords.push(word);
|
|
49
62
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Defines the data structures used for AAC metrics analysis
|
|
5
5
|
*/
|
|
6
|
+
import { ScanningConfig } from '../../../types/aac';
|
|
6
7
|
/**
|
|
7
8
|
* Button-level metrics result
|
|
8
9
|
*/
|
|
@@ -52,6 +53,11 @@ export interface MetricsResult {
|
|
|
52
53
|
alternates?: {
|
|
53
54
|
[boardId: string]: AlternateBoardMetrics;
|
|
54
55
|
};
|
|
56
|
+
spelling_effort_base?: number;
|
|
57
|
+
spelling_effort_per_letter?: number;
|
|
58
|
+
spelling_page_id?: string;
|
|
59
|
+
has_dynamic_prediction?: boolean;
|
|
60
|
+
prediction_page_id?: string;
|
|
55
61
|
obfset?: any;
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
@@ -63,6 +69,32 @@ export interface AlternateBoardMetrics {
|
|
|
63
69
|
[level: number]: ButtonMetrics[];
|
|
64
70
|
};
|
|
65
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Options for metrics calculation
|
|
74
|
+
*/
|
|
75
|
+
export interface MetricsOptions {
|
|
76
|
+
/**
|
|
77
|
+
* Override scanning configuration
|
|
78
|
+
*/
|
|
79
|
+
scanningConfig?: ScanningConfig;
|
|
80
|
+
/**
|
|
81
|
+
* Path to core vocabulary lists to use for analysis
|
|
82
|
+
*/
|
|
83
|
+
coreLists?: string[];
|
|
84
|
+
/**
|
|
85
|
+
* Test sentences for sentence-level effort analysis
|
|
86
|
+
*/
|
|
87
|
+
testSentences?: string[];
|
|
88
|
+
/**
|
|
89
|
+
* Custom scanning costs
|
|
90
|
+
*/
|
|
91
|
+
scanStepCost?: number;
|
|
92
|
+
scanSelectionCost?: number;
|
|
93
|
+
/**
|
|
94
|
+
* Optional explicit ID of the spelling/keyboard page
|
|
95
|
+
*/
|
|
96
|
+
spellingPageId?: string;
|
|
97
|
+
}
|
|
66
98
|
/**
|
|
67
99
|
* Comparison result between two board sets
|
|
68
100
|
*/
|
|
@@ -76,6 +108,13 @@ export interface ComparisonResult extends MetricsResult {
|
|
|
76
108
|
columns: number;
|
|
77
109
|
};
|
|
78
110
|
comp_effort_score: number;
|
|
111
|
+
comp_spelling_effort_base?: number;
|
|
112
|
+
comp_spelling_effort_per_letter?: number;
|
|
113
|
+
comp_spelling_page_id?: string;
|
|
114
|
+
has_dynamic_prediction?: boolean;
|
|
115
|
+
prediction_page_id?: string;
|
|
116
|
+
comp_has_dynamic_prediction?: boolean;
|
|
117
|
+
comp_prediction_page_id?: string;
|
|
79
118
|
missing_words: string[];
|
|
80
119
|
extra_words: string[];
|
|
81
120
|
overlapping_words: string[];
|
|
@@ -130,7 +130,7 @@ class VocabularyAnalyzer {
|
|
|
130
130
|
if (btn) {
|
|
131
131
|
return btn.effort;
|
|
132
132
|
}
|
|
133
|
-
return (0, effort_1.spellingEffort)(word);
|
|
133
|
+
return (0, effort_1.spellingEffort)(word, metrics.spelling_effort_base, metrics.spelling_effort_per_letter);
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Check if a word is in the board set
|
|
@@ -75,7 +75,18 @@ class ReferenceLoader {
|
|
|
75
75
|
loadFringe() {
|
|
76
76
|
const filePath = path.join(this.dataDir, `fringe.${this.locale}.json`);
|
|
77
77
|
const content = fs.readFileSync(filePath, 'utf-8');
|
|
78
|
-
|
|
78
|
+
const data = JSON.parse(content);
|
|
79
|
+
// Flatten nested category words if needed
|
|
80
|
+
if (Array.isArray(data) && data.length > 0 && data[0].categories) {
|
|
81
|
+
const flattened = [];
|
|
82
|
+
data.forEach((list) => {
|
|
83
|
+
list.categories.forEach((cat) => {
|
|
84
|
+
flattened.push(...cat.words);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
return flattened;
|
|
88
|
+
}
|
|
89
|
+
return data;
|
|
79
90
|
}
|
|
80
91
|
/**
|
|
81
92
|
* Load base words hash map
|
|
@@ -39,6 +39,7 @@ export interface ButtonForTranslation {
|
|
|
39
39
|
message: string;
|
|
40
40
|
textToTranslate: string;
|
|
41
41
|
symbols: SymbolInfo[];
|
|
42
|
+
grammar?: any;
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
44
45
|
* LLM translation result with symbol mappings
|
|
@@ -68,7 +69,7 @@ export interface LLMLTranslationResult {
|
|
|
68
69
|
export declare function normalizeButtonForTranslation(buttonId: string, label: string, message: string, symbols: SymbolInfo[], context?: {
|
|
69
70
|
pageId?: string;
|
|
70
71
|
pageName?: string;
|
|
71
|
-
}): ButtonForTranslation;
|
|
72
|
+
}, grammar?: any): ButtonForTranslation;
|
|
72
73
|
/**
|
|
73
74
|
* Extract symbols from various button formats.
|
|
74
75
|
*
|
|
@@ -39,13 +39,14 @@ exports.validateTranslationResults = validateTranslationResults;
|
|
|
39
39
|
* @param context - Optional page context
|
|
40
40
|
* @returns Normalized button data for translation
|
|
41
41
|
*/
|
|
42
|
-
function normalizeButtonForTranslation(buttonId, label, message, symbols, context) {
|
|
42
|
+
function normalizeButtonForTranslation(buttonId, label, message, symbols, context, grammar) {
|
|
43
43
|
return {
|
|
44
44
|
buttonId,
|
|
45
45
|
label,
|
|
46
46
|
message,
|
|
47
47
|
textToTranslate: message || label, // Translate message if present, otherwise label
|
|
48
48
|
symbols,
|
|
49
|
+
grammar,
|
|
49
50
|
...context,
|
|
50
51
|
};
|
|
51
52
|
}
|
|
@@ -119,7 +120,8 @@ function extractAllButtonsForTranslation(buttons, contextFn) {
|
|
|
119
120
|
if (!label && !message)
|
|
120
121
|
continue;
|
|
121
122
|
const context = contextFn ? contextFn(button) : undefined;
|
|
122
|
-
|
|
123
|
+
const grammar = button.parameters?.grammar || undefined;
|
|
124
|
+
results.push(normalizeButtonForTranslation(buttonId, label, message, symbols || [], context, grammar));
|
|
123
125
|
}
|
|
124
126
|
return results;
|
|
125
127
|
}
|
|
@@ -144,6 +146,7 @@ Each button has:
|
|
|
144
146
|
- message: The text spoken when the button is activated
|
|
145
147
|
- textToTranslate: The actual text to translate (usually the message)
|
|
146
148
|
- symbols: Visual symbols attached to specific words
|
|
149
|
+
- grammar: Grammatical context (e.g., pos: Part of Speech, person, number)
|
|
147
150
|
|
|
148
151
|
IMPORTANT: After translation, you MUST reattach symbols to the correct translated words based on MEANING, not position.
|
|
149
152
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validation Namespace
|
|
3
|
+
*
|
|
4
|
+
* All validation functionality for AAC processors.
|
|
5
|
+
* Provides consistent validation across all supported formats.
|
|
6
|
+
*/
|
|
7
|
+
export { ValidationError, ValidationCheck, ValidationResult, ValidationOptions, ValidationRule, } from './validation/validationTypes';
|
|
8
|
+
export { BaseValidator } from './validation/baseValidator';
|
|
9
|
+
export { ObfValidator } from './validation/obfValidator';
|
|
10
|
+
export { GridsetValidator } from './validation/gridsetValidator';
|
|
11
|
+
export { SnapValidator } from './validation/snapValidator';
|
|
12
|
+
export { TouchChatValidator } from './validation/touchChatValidator';
|
|
13
|
+
export { getValidatorForFormat, getValidatorForFile } from './validation/index';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Validation Namespace
|
|
4
|
+
*
|
|
5
|
+
* All validation functionality for AAC processors.
|
|
6
|
+
* Provides consistent validation across all supported formats.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.getValidatorForFile = exports.getValidatorForFormat = exports.TouchChatValidator = exports.SnapValidator = exports.GridsetValidator = exports.ObfValidator = exports.BaseValidator = exports.ValidationError = void 0;
|
|
10
|
+
// Validation types and interfaces
|
|
11
|
+
var validationTypes_1 = require("./validation/validationTypes");
|
|
12
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validationTypes_1.ValidationError; } });
|
|
13
|
+
// Base validator
|
|
14
|
+
var baseValidator_1 = require("./validation/baseValidator");
|
|
15
|
+
Object.defineProperty(exports, "BaseValidator", { enumerable: true, get: function () { return baseValidator_1.BaseValidator; } });
|
|
16
|
+
// Format-specific validators
|
|
17
|
+
var obfValidator_1 = require("./validation/obfValidator");
|
|
18
|
+
Object.defineProperty(exports, "ObfValidator", { enumerable: true, get: function () { return obfValidator_1.ObfValidator; } });
|
|
19
|
+
var gridsetValidator_1 = require("./validation/gridsetValidator");
|
|
20
|
+
Object.defineProperty(exports, "GridsetValidator", { enumerable: true, get: function () { return gridsetValidator_1.GridsetValidator; } });
|
|
21
|
+
var snapValidator_1 = require("./validation/snapValidator");
|
|
22
|
+
Object.defineProperty(exports, "SnapValidator", { enumerable: true, get: function () { return snapValidator_1.SnapValidator; } });
|
|
23
|
+
var touchChatValidator_1 = require("./validation/touchChatValidator");
|
|
24
|
+
Object.defineProperty(exports, "TouchChatValidator", { enumerable: true, get: function () { return touchChatValidator_1.TouchChatValidator; } });
|
|
25
|
+
// Validator factory functions
|
|
26
|
+
var index_1 = require("./validation/index");
|
|
27
|
+
Object.defineProperty(exports, "getValidatorForFormat", { enumerable: true, get: function () { return index_1.getValidatorForFormat; } });
|
|
28
|
+
Object.defineProperty(exports, "getValidatorForFile", { enumerable: true, get: function () { return index_1.getValidatorForFile; } });
|
package/package.json
CHANGED
|
@@ -1,9 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willwade/aac-processors",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "A comprehensive TypeScript library for processing AAC (Augmentative and Alternative Communication) file formats with translation support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./gridset": {
|
|
13
|
+
"types": "./dist/gridset.d.ts",
|
|
14
|
+
"default": "./dist/gridset.js"
|
|
15
|
+
},
|
|
16
|
+
"./snap": {
|
|
17
|
+
"types": "./dist/snap.d.ts",
|
|
18
|
+
"default": "./dist/snap.js"
|
|
19
|
+
},
|
|
20
|
+
"./obf": {
|
|
21
|
+
"types": "./dist/obf.d.ts",
|
|
22
|
+
"default": "./dist/obf.js"
|
|
23
|
+
},
|
|
24
|
+
"./obfset": {
|
|
25
|
+
"types": "./dist/obfset.d.ts",
|
|
26
|
+
"default": "./dist/obfset.js"
|
|
27
|
+
},
|
|
28
|
+
"./touchchat": {
|
|
29
|
+
"types": "./dist/touchchat.d.ts",
|
|
30
|
+
"default": "./dist/touchchat.js"
|
|
31
|
+
},
|
|
32
|
+
"./dot": {
|
|
33
|
+
"types": "./dist/dot.d.ts",
|
|
34
|
+
"default": "./dist/dot.js"
|
|
35
|
+
},
|
|
36
|
+
"./excel": {
|
|
37
|
+
"types": "./dist/excel.d.ts",
|
|
38
|
+
"default": "./dist/excel.js"
|
|
39
|
+
},
|
|
40
|
+
"./opml": {
|
|
41
|
+
"types": "./dist/opml.d.ts",
|
|
42
|
+
"default": "./dist/opml.js"
|
|
43
|
+
},
|
|
44
|
+
"./applePanels": {
|
|
45
|
+
"types": "./dist/applePanels.d.ts",
|
|
46
|
+
"default": "./dist/applePanels.js"
|
|
47
|
+
},
|
|
48
|
+
"./astericsGrid": {
|
|
49
|
+
"types": "./dist/astericsGrid.d.ts",
|
|
50
|
+
"default": "./dist/astericsGrid.js"
|
|
51
|
+
},
|
|
52
|
+
"./translation": {
|
|
53
|
+
"types": "./dist/translation.d.ts",
|
|
54
|
+
"default": "./dist/translation.js"
|
|
55
|
+
},
|
|
56
|
+
"./validation": {
|
|
57
|
+
"types": "./dist/validation.d.ts",
|
|
58
|
+
"default": "./dist/validation.js"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
7
61
|
"files": [
|
|
8
62
|
"dist/**/*",
|
|
9
63
|
"docs/**/*",
|
|
@@ -69,8 +123,8 @@
|
|
|
69
123
|
},
|
|
70
124
|
"homepage": "https://github.com/willwade/AACProcessors-nodejs#readme",
|
|
71
125
|
"engines": {
|
|
72
|
-
"node": ">=
|
|
73
|
-
"npm": ">=
|
|
126
|
+
"node": ">=20.0.0",
|
|
127
|
+
"npm": ">=9.0.0"
|
|
74
128
|
},
|
|
75
129
|
"devDependencies": {
|
|
76
130
|
"@types/adm-zip": "^0.5.7",
|
|
@@ -96,7 +150,7 @@
|
|
|
96
150
|
"@types/xml2js": "^0.4.14",
|
|
97
151
|
"adm-zip": "^0.5.16",
|
|
98
152
|
"axios": "^1.11.0",
|
|
99
|
-
"better-sqlite3": "^
|
|
153
|
+
"better-sqlite3": "^12.5.0",
|
|
100
154
|
"commander": "^13.1.0",
|
|
101
155
|
"exceljs": "^4.4.0",
|
|
102
156
|
"fast-xml-parser": "^5.2.0",
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { AACPage, AACTree } from '../core/treeStructure';
|
|
2
|
-
export interface ScreenshotCell {
|
|
3
|
-
text: string;
|
|
4
|
-
row: number;
|
|
5
|
-
col: number;
|
|
6
|
-
isCategory?: boolean;
|
|
7
|
-
isNavigation?: boolean;
|
|
8
|
-
isEmpty?: boolean;
|
|
9
|
-
imageUrl?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface ScreenshotGrid {
|
|
12
|
-
rows: number;
|
|
13
|
-
cols: number;
|
|
14
|
-
cells: ScreenshotCell[];
|
|
15
|
-
categories: string[];
|
|
16
|
-
metadata?: {
|
|
17
|
-
timestamp?: string;
|
|
18
|
-
battery?: string;
|
|
19
|
-
date?: string;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
export interface ScreenshotPage {
|
|
23
|
-
filename: string;
|
|
24
|
-
grid: ScreenshotGrid;
|
|
25
|
-
extractedAt: Date;
|
|
26
|
-
pageName?: string;
|
|
27
|
-
parentPath?: string;
|
|
28
|
-
pageTitle?: string;
|
|
29
|
-
}
|
|
30
|
-
export interface PageHierarchy {
|
|
31
|
-
[pageId: string]: {
|
|
32
|
-
page: ScreenshotPage;
|
|
33
|
-
children: string[];
|
|
34
|
-
parent?: string;
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export interface ScreenshotConversionOptions {
|
|
38
|
-
includeEmptyCells: boolean;
|
|
39
|
-
generateIds: boolean;
|
|
40
|
-
targetPlatform?: 'grid3' | 'asterics' | 'snap' | 'touchchat';
|
|
41
|
-
language: string;
|
|
42
|
-
fallbackCategory: string;
|
|
43
|
-
filenameDelimiter?: string;
|
|
44
|
-
}
|
|
45
|
-
export declare class ScreenshotConverter {
|
|
46
|
-
private static defaultOptions;
|
|
47
|
-
/**
|
|
48
|
-
* Parse filename to extract page hierarchy and names
|
|
49
|
-
* Examples:
|
|
50
|
-
* - "Home.png" → pageName: "Home", parentPath: ""
|
|
51
|
-
* - "Home->Fragen.png" → pageName: "Fragen", parentPath: "Home"
|
|
52
|
-
* - "Home->Settings->Profile.jpg" → pageName: "Profile", parentPath: "Home->Settings"
|
|
53
|
-
*/
|
|
54
|
-
static parseFilename(filename: string, delimiter?: string): {
|
|
55
|
-
pageName: string;
|
|
56
|
-
parentPath: string;
|
|
57
|
-
};
|
|
58
|
-
/**
|
|
59
|
-
* Build page hierarchy from an array of screenshots
|
|
60
|
-
*/
|
|
61
|
-
static buildPageHierarchy(screenshots: ScreenshotPage[]): PageHierarchy;
|
|
62
|
-
static parseOCRText(ocrResult: string): ScreenshotGrid;
|
|
63
|
-
private static isCategoryToken;
|
|
64
|
-
private static isNavigationToken;
|
|
65
|
-
static convertToAACPage(screenshotPage: ScreenshotPage, pageHierarchy?: PageHierarchy, options?: Partial<ScreenshotConversionOptions>): AACPage;
|
|
66
|
-
private static createSemanticAction;
|
|
67
|
-
static convertToAACTree(screenshotPages: ScreenshotPage[], options?: Partial<ScreenshotConversionOptions>): AACTree;
|
|
68
|
-
private static sanitizePageId;
|
|
69
|
-
}
|