@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
|
@@ -804,6 +804,10 @@ export class MetricsCalculator {
|
|
|
804
804
|
}
|
|
805
805
|
if (!parentMetrics)
|
|
806
806
|
return;
|
|
807
|
+
// Build set of original Suggest Words predictions (from Prediction.PredictThis).
|
|
808
|
+
// These require an extra confirmation tap from the user. Smart grammar
|
|
809
|
+
// morphology outcomes are generated automatically and need no extra tap.
|
|
810
|
+
const suggestWordsSet = new Set((btn.parameters?.predictions || []).map((w) => w.toLowerCase()));
|
|
807
811
|
// Calculate effort for each word form
|
|
808
812
|
btn.predictions.forEach((wordForm, index) => {
|
|
809
813
|
const wordFormLower = wordForm.toLowerCase();
|
|
@@ -816,8 +820,14 @@ export class MetricsCalculator {
|
|
|
816
820
|
// Using similar logic to button scanning effort
|
|
817
821
|
const predictionPriorItems = predictionRowIndex * predictionsGridCols + predictionColIndex;
|
|
818
822
|
const predictionSelectionEffort = visualScanEffort(predictionPriorItems);
|
|
819
|
-
//
|
|
820
|
-
|
|
823
|
+
// Add confirmation cost for Suggest Words outcomes only.
|
|
824
|
+
// Suggest Words requires an explicit tap on the prediction bar,
|
|
825
|
+
// while smart grammar morphology forms are auto-generated (no extra tap).
|
|
826
|
+
const suggestWordsConfirmation = suggestWordsSet.has(wordFormLower)
|
|
827
|
+
? EFFORT_CONSTANTS.SUGGEST_WORDS_SELECTION_EFFORT
|
|
828
|
+
: 0;
|
|
829
|
+
// Word form effort = parent button's cumulative effort + selection effort + confirmation
|
|
830
|
+
const wordFormEffort = parentMetrics.effort + predictionSelectionEffort + suggestWordsConfirmation;
|
|
821
831
|
// Check if this word already exists as a regular button
|
|
822
832
|
const existingBtn = existingLabels.get(wordFormLower);
|
|
823
833
|
// If word exists and has lower or equal effort, skip the word form
|
|
@@ -838,9 +848,10 @@ export class MetricsCalculator {
|
|
|
838
848
|
semantic_id: parentMetrics.semantic_id,
|
|
839
849
|
clone_id: parentMetrics.clone_id,
|
|
840
850
|
temporary_home_id: parentMetrics.temporary_home_id,
|
|
841
|
-
is_word_form: true,
|
|
842
|
-
|
|
843
|
-
|
|
851
|
+
is_word_form: true,
|
|
852
|
+
is_suggest_words: suggestWordsSet.has(wordFormLower) || undefined,
|
|
853
|
+
parent_button_id: btn.id,
|
|
854
|
+
parent_button_label: parentMetrics.label,
|
|
844
855
|
};
|
|
845
856
|
wordFormMetrics.push(wordFormBtn);
|
|
846
857
|
existingLabels.set(wordFormLower, wordFormBtn);
|
|
@@ -31,6 +31,7 @@ export const EFFORT_CONSTANTS = {
|
|
|
31
31
|
SCAN_SELECTION_COST: 0.1, // Cost of a switch selection
|
|
32
32
|
DEFAULT_SCAN_ERROR_RATE: 0.1, // 10% chance of missing a selection
|
|
33
33
|
SCAN_RETRY_PENALTY: 1.0, // Cost multiplier for a full loop retry
|
|
34
|
+
SUGGEST_WORDS_SELECTION_EFFORT: 0.5, // Extra tap to confirm a Suggest Words prediction
|
|
34
35
|
};
|
|
35
36
|
/**
|
|
36
37
|
* Calculate button size effort based on grid dimensions
|