@willwade/aac-processors 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/processors/gridsetProcessor.js +254 -232
- package/dist/browser/utilities/analytics/metrics/core.js +16 -5
- package/dist/browser/utilities/analytics/metrics/effort.js +1 -0
- package/dist/processors/gridsetProcessor.js +254 -232
- package/dist/utilities/analytics/metrics/core.js +16 -5
- package/dist/utilities/analytics/metrics/effort.d.ts +1 -0
- package/dist/utilities/analytics/metrics/effort.js +1 -0
- package/dist/utilities/analytics/metrics/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -807,6 +807,10 @@ class MetricsCalculator {
|
|
|
807
807
|
}
|
|
808
808
|
if (!parentMetrics)
|
|
809
809
|
return;
|
|
810
|
+
// Build set of original Suggest Words predictions (from Prediction.PredictThis).
|
|
811
|
+
// These require an extra confirmation tap from the user. Smart grammar
|
|
812
|
+
// morphology outcomes are generated automatically and need no extra tap.
|
|
813
|
+
const suggestWordsSet = new Set((btn.parameters?.predictions || []).map((w) => w.toLowerCase()));
|
|
810
814
|
// Calculate effort for each word form
|
|
811
815
|
btn.predictions.forEach((wordForm, index) => {
|
|
812
816
|
const wordFormLower = wordForm.toLowerCase();
|
|
@@ -819,8 +823,14 @@ class MetricsCalculator {
|
|
|
819
823
|
// Using similar logic to button scanning effort
|
|
820
824
|
const predictionPriorItems = predictionRowIndex * predictionsGridCols + predictionColIndex;
|
|
821
825
|
const predictionSelectionEffort = (0, effort_1.visualScanEffort)(predictionPriorItems);
|
|
822
|
-
//
|
|
823
|
-
|
|
826
|
+
// Add confirmation cost for Suggest Words outcomes only.
|
|
827
|
+
// Suggest Words requires an explicit tap on the prediction bar,
|
|
828
|
+
// while smart grammar morphology forms are auto-generated (no extra tap).
|
|
829
|
+
const suggestWordsConfirmation = suggestWordsSet.has(wordFormLower)
|
|
830
|
+
? effort_1.EFFORT_CONSTANTS.SUGGEST_WORDS_SELECTION_EFFORT
|
|
831
|
+
: 0;
|
|
832
|
+
// Word form effort = parent button's cumulative effort + selection effort + confirmation
|
|
833
|
+
const wordFormEffort = parentMetrics.effort + predictionSelectionEffort + suggestWordsConfirmation;
|
|
824
834
|
// Check if this word already exists as a regular button
|
|
825
835
|
const existingBtn = existingLabels.get(wordFormLower);
|
|
826
836
|
// If word exists and has lower or equal effort, skip the word form
|
|
@@ -841,9 +851,10 @@ class MetricsCalculator {
|
|
|
841
851
|
semantic_id: parentMetrics.semantic_id,
|
|
842
852
|
clone_id: parentMetrics.clone_id,
|
|
843
853
|
temporary_home_id: parentMetrics.temporary_home_id,
|
|
844
|
-
is_word_form: true,
|
|
845
|
-
|
|
846
|
-
|
|
854
|
+
is_word_form: true,
|
|
855
|
+
is_suggest_words: suggestWordsSet.has(wordFormLower) || undefined,
|
|
856
|
+
parent_button_id: btn.id,
|
|
857
|
+
parent_button_label: parentMetrics.label,
|
|
847
858
|
};
|
|
848
859
|
wordFormMetrics.push(wordFormBtn);
|
|
849
860
|
existingLabels.set(wordFormLower, wordFormBtn);
|
|
@@ -31,6 +31,7 @@ export declare const EFFORT_CONSTANTS: {
|
|
|
31
31
|
readonly SCAN_SELECTION_COST: 0.1;
|
|
32
32
|
readonly DEFAULT_SCAN_ERROR_RATE: 0.1;
|
|
33
33
|
readonly SCAN_RETRY_PENALTY: 1;
|
|
34
|
+
readonly SUGGEST_WORDS_SELECTION_EFFORT: 0.5;
|
|
34
35
|
};
|
|
35
36
|
/**
|
|
36
37
|
* Calculate button size effort based on grid dimensions
|
|
@@ -47,6 +47,7 @@ exports.EFFORT_CONSTANTS = {
|
|
|
47
47
|
SCAN_SELECTION_COST: 0.1, // Cost of a switch selection
|
|
48
48
|
DEFAULT_SCAN_ERROR_RATE: 0.1, // 10% chance of missing a selection
|
|
49
49
|
SCAN_RETRY_PENALTY: 1.0, // Cost multiplier for a full loop retry
|
|
50
|
+
SUGGEST_WORDS_SELECTION_EFFORT: 0.5, // Extra tap to confirm a Suggest Words prediction
|
|
50
51
|
};
|
|
51
52
|
/**
|
|
52
53
|
* Calculate button size effort based on grid dimensions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willwade/aac-processors",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
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
|
"browser": "dist/browser/index.browser.js",
|