@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
package/dist/types/aac.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.CellScanningOrder = exports.ScanningSelectionMethod = void 0;
|
|
|
7
7
|
*/
|
|
8
8
|
var ScanningSelectionMethod;
|
|
9
9
|
(function (ScanningSelectionMethod) {
|
|
10
|
-
/** Automatically advance through items at timed intervals */
|
|
10
|
+
/** Automatically advance through items at timed intervals (1 Switch) */
|
|
11
11
|
ScanningSelectionMethod["AutoScan"] = "AutoScan";
|
|
12
12
|
/** Automatic scanning with overscan (two-stage scanning) */
|
|
13
13
|
ScanningSelectionMethod["AutoScanWithOverscan"] = "AutoScanWithOverscan";
|
|
@@ -15,8 +15,12 @@ var ScanningSelectionMethod;
|
|
|
15
15
|
ScanningSelectionMethod["HoldToAdvance"] = "HoldToAdvance";
|
|
16
16
|
/** Hold to advance with overscan */
|
|
17
17
|
ScanningSelectionMethod["HoldToAdvanceWithOverscan"] = "HoldToAdvanceWithOverscan";
|
|
18
|
-
/** Tap switch to advance, tap again to select */
|
|
18
|
+
/** Tap switch to advance, tap again to select (Automatic) */
|
|
19
19
|
ScanningSelectionMethod["TapToAdvance"] = "TapToAdvance";
|
|
20
|
+
/** Tap switch to advance, another switch to select (2 Switch Step Scan) */
|
|
21
|
+
ScanningSelectionMethod["StepScan2Switch"] = "StepScan2Switch";
|
|
22
|
+
/** Tap switch 1 to advance, tap switch 1 again to select (1 Switch Step Scan) */
|
|
23
|
+
ScanningSelectionMethod["StepScan1Switch"] = "StepScan1Switch";
|
|
20
24
|
})(ScanningSelectionMethod || (exports.ScanningSelectionMethod = ScanningSelectionMethod = {}));
|
|
21
25
|
/**
|
|
22
26
|
* Cell scanning order patterns
|
|
@@ -16,25 +16,33 @@ class ComparisonAnalyzer {
|
|
|
16
16
|
this.sentenceAnalyzer = new sentence_1.SentenceAnalyzer();
|
|
17
17
|
this.referenceLoader = new index_1.ReferenceLoader();
|
|
18
18
|
}
|
|
19
|
+
normalize(word) {
|
|
20
|
+
return word
|
|
21
|
+
.toLowerCase()
|
|
22
|
+
.trim()
|
|
23
|
+
.replace(/[.?!,]/g, '');
|
|
24
|
+
}
|
|
19
25
|
/**
|
|
20
26
|
* Compare two board sets
|
|
21
27
|
*/
|
|
22
28
|
compare(targetResult, compareResult, options) {
|
|
23
29
|
// Create base result from target
|
|
24
30
|
const baseResult = { ...targetResult };
|
|
25
|
-
// Create word maps
|
|
31
|
+
// Create word maps with normalized keys
|
|
26
32
|
const targetWords = new Map();
|
|
27
33
|
targetResult.buttons.forEach((btn) => {
|
|
28
|
-
const
|
|
34
|
+
const key = this.normalize(btn.label);
|
|
35
|
+
const existing = targetWords.get(key);
|
|
29
36
|
if (!existing || btn.effort < existing.effort) {
|
|
30
|
-
targetWords.set(
|
|
37
|
+
targetWords.set(key, btn);
|
|
31
38
|
}
|
|
32
39
|
});
|
|
33
40
|
const compareWords = new Map();
|
|
34
41
|
compareResult.buttons.forEach((btn) => {
|
|
35
|
-
const
|
|
42
|
+
const key = this.normalize(btn.label);
|
|
43
|
+
const existing = compareWords.get(key);
|
|
36
44
|
if (!existing || btn.effort < existing.effort) {
|
|
37
|
-
compareWords.set(
|
|
45
|
+
compareWords.set(key, btn);
|
|
38
46
|
}
|
|
39
47
|
});
|
|
40
48
|
// Find missing/extra/overlapping words
|
|
@@ -62,7 +70,8 @@ class ComparisonAnalyzer {
|
|
|
62
70
|
overlappingWords.sort((a, b) => a.localeCompare(b));
|
|
63
71
|
// Add comparison metrics to buttons
|
|
64
72
|
const enrichedButtons = targetResult.buttons.map((btn) => {
|
|
65
|
-
const
|
|
73
|
+
const key = this.normalize(btn.label);
|
|
74
|
+
const compBtn = compareWords.get(key);
|
|
66
75
|
return {
|
|
67
76
|
...btn,
|
|
68
77
|
comp_level: compBtn?.level,
|
|
@@ -124,8 +133,9 @@ class ComparisonAnalyzer {
|
|
|
124
133
|
let targetCovered = 0;
|
|
125
134
|
let compareCovered = 0;
|
|
126
135
|
list.words.forEach((word) => {
|
|
127
|
-
const
|
|
128
|
-
const
|
|
136
|
+
const key = this.normalize(word);
|
|
137
|
+
const targetBtn = targetWords.get(key);
|
|
138
|
+
const compareBtn = compareWords.get(key);
|
|
129
139
|
if (targetBtn) {
|
|
130
140
|
targetCovered++;
|
|
131
141
|
targetTotal += targetBtn.effort;
|
|
@@ -140,6 +150,9 @@ class ComparisonAnalyzer {
|
|
|
140
150
|
list: list.words,
|
|
141
151
|
average_effort: targetCovered > 0 ? targetTotal / targetCovered : 0,
|
|
142
152
|
comp_effort: compareCovered > 0 ? compareTotal / compareCovered : 0,
|
|
153
|
+
target_covered: targetCovered,
|
|
154
|
+
compare_covered: compareCovered,
|
|
155
|
+
total_words: list.words.length,
|
|
143
156
|
};
|
|
144
157
|
});
|
|
145
158
|
// Analyze missing from specific lists
|
|
@@ -147,7 +160,8 @@ class ComparisonAnalyzer {
|
|
|
147
160
|
coreLists.forEach((list) => {
|
|
148
161
|
const listMissing = [];
|
|
149
162
|
list.words.forEach((word) => {
|
|
150
|
-
|
|
163
|
+
const key = this.normalize(word);
|
|
164
|
+
if (!targetWords.has(key)) {
|
|
151
165
|
listMissing.push(word);
|
|
152
166
|
}
|
|
153
167
|
});
|
|
@@ -172,6 +186,13 @@ class ComparisonAnalyzer {
|
|
|
172
186
|
comp_words: compareResult.total_words,
|
|
173
187
|
comp_grid: compareResult.grid,
|
|
174
188
|
comp_effort_score: this.calculateEffortScore(compareResult),
|
|
189
|
+
comp_spelling_effort_base: compareResult.spelling_effort_base,
|
|
190
|
+
comp_spelling_effort_per_letter: compareResult.spelling_effort_per_letter,
|
|
191
|
+
comp_spelling_page_id: compareResult.spelling_page_id,
|
|
192
|
+
has_dynamic_prediction: targetResult.has_dynamic_prediction,
|
|
193
|
+
prediction_page_id: targetResult.prediction_page_id,
|
|
194
|
+
comp_has_dynamic_prediction: compareResult.has_dynamic_prediction,
|
|
195
|
+
comp_prediction_page_id: compareResult.prediction_page_id,
|
|
175
196
|
// Vocabulary comparison
|
|
176
197
|
missing_words: missingWords,
|
|
177
198
|
extra_words: extraWords,
|
|
@@ -196,19 +217,21 @@ class ComparisonAnalyzer {
|
|
|
196
217
|
* Calculate CARE component scores
|
|
197
218
|
*/
|
|
198
219
|
calculateCareComponents(targetResult, compareResult, _overlappingWords) {
|
|
199
|
-
// Create word maps
|
|
220
|
+
// Create word maps with normalized keys
|
|
200
221
|
const targetWords = new Map();
|
|
201
222
|
targetResult.buttons.forEach((btn) => {
|
|
202
|
-
const
|
|
223
|
+
const key = this.normalize(btn.label);
|
|
224
|
+
const existing = targetWords.get(key);
|
|
203
225
|
if (!existing || btn.effort < existing.effort) {
|
|
204
|
-
targetWords.set(
|
|
226
|
+
targetWords.set(key, btn);
|
|
205
227
|
}
|
|
206
228
|
});
|
|
207
229
|
const compareWords = new Map();
|
|
208
230
|
compareResult.buttons.forEach((btn) => {
|
|
209
|
-
const
|
|
231
|
+
const key = this.normalize(btn.label);
|
|
232
|
+
const existing = compareWords.get(key);
|
|
210
233
|
if (!existing || btn.effort < existing.effort) {
|
|
211
|
-
compareWords.set(
|
|
234
|
+
compareWords.set(key, btn);
|
|
212
235
|
}
|
|
213
236
|
});
|
|
214
237
|
// Load reference data
|
|
@@ -223,9 +246,10 @@ class ComparisonAnalyzer {
|
|
|
223
246
|
list.words.forEach((word) => allCoreWords.add(word.toLowerCase()));
|
|
224
247
|
});
|
|
225
248
|
allCoreWords.forEach((word) => {
|
|
226
|
-
|
|
249
|
+
const key = this.normalize(word);
|
|
250
|
+
if (targetWords.has(key))
|
|
227
251
|
coreCount++;
|
|
228
|
-
if (compareWords.has(
|
|
252
|
+
if (compareWords.has(key))
|
|
229
253
|
compCoreCount++;
|
|
230
254
|
});
|
|
231
255
|
// Calculate sentence construction effort
|
|
@@ -234,8 +258,9 @@ class ComparisonAnalyzer {
|
|
|
234
258
|
let sentenceWordCount = 0;
|
|
235
259
|
sentences.forEach((words) => {
|
|
236
260
|
words.forEach((word) => {
|
|
237
|
-
const
|
|
238
|
-
const
|
|
261
|
+
const key = this.normalize(word);
|
|
262
|
+
const targetBtn = targetWords.get(key);
|
|
263
|
+
const compareBtn = compareWords.get(key);
|
|
239
264
|
if (targetBtn) {
|
|
240
265
|
sentenceEffort += targetBtn.effort;
|
|
241
266
|
}
|
|
@@ -258,8 +283,9 @@ class ComparisonAnalyzer {
|
|
|
258
283
|
let compFringeCount = 0;
|
|
259
284
|
let commonFringeCount = 0;
|
|
260
285
|
fringe.forEach((word) => {
|
|
261
|
-
const
|
|
262
|
-
const
|
|
286
|
+
const key = this.normalize(word);
|
|
287
|
+
const inTarget = targetWords.has(key);
|
|
288
|
+
const inCompare = compareWords.has(key);
|
|
263
289
|
if (inTarget)
|
|
264
290
|
fringeCount++;
|
|
265
291
|
if (inCompare)
|
|
@@ -285,8 +311,9 @@ class ComparisonAnalyzer {
|
|
|
285
311
|
const fringe = this.referenceLoader.loadFringe();
|
|
286
312
|
const result = [];
|
|
287
313
|
fringe.forEach((word) => {
|
|
288
|
-
const
|
|
289
|
-
const
|
|
314
|
+
const key = this.normalize(word);
|
|
315
|
+
const targetBtn = targetWords.get(key);
|
|
316
|
+
const compareBtn = compareWords.get(key);
|
|
290
317
|
if (targetBtn) {
|
|
291
318
|
result.push({
|
|
292
319
|
word,
|
|
@@ -305,8 +332,9 @@ class ComparisonAnalyzer {
|
|
|
305
332
|
const fringe = this.referenceLoader.loadFringe();
|
|
306
333
|
const result = [];
|
|
307
334
|
fringe.forEach((word) => {
|
|
308
|
-
const
|
|
309
|
-
const
|
|
335
|
+
const key = this.normalize(word);
|
|
336
|
+
const targetBtn = targetWords.get(key);
|
|
337
|
+
const compareBtn = compareWords.get(key);
|
|
310
338
|
if (targetBtn && compareBtn) {
|
|
311
339
|
result.push({
|
|
312
340
|
word,
|
|
@@ -7,16 +7,21 @@
|
|
|
7
7
|
* Based on: aac-metrics/lib/aac-metrics/metrics.rb
|
|
8
8
|
*/
|
|
9
9
|
import { AACTree } from '../../../core/treeStructure';
|
|
10
|
-
import { MetricsResult } from './types';
|
|
10
|
+
import { MetricsOptions, MetricsResult } from './types';
|
|
11
11
|
export declare class MetricsCalculator {
|
|
12
12
|
private locale;
|
|
13
13
|
/**
|
|
14
14
|
* Main analysis function - calculates metrics for an AAC tree
|
|
15
15
|
*
|
|
16
16
|
* @param tree - The AAC tree to analyze
|
|
17
|
+
* @param options - Optional configuration for metrics calculation
|
|
17
18
|
* @returns Complete metrics result
|
|
18
19
|
*/
|
|
19
|
-
analyze(tree: AACTree): MetricsResult;
|
|
20
|
+
analyze(tree: AACTree, options?: MetricsOptions): MetricsResult;
|
|
21
|
+
/**
|
|
22
|
+
* Identify keyboard/spelling page and calculate base/avg effort
|
|
23
|
+
*/
|
|
24
|
+
private identifySpellingMetrics;
|
|
20
25
|
/**
|
|
21
26
|
* Build reference maps for semantic_id and clone_id frequencies
|
|
22
27
|
*/
|