From f61cdfb1ded32fc419267c10d6213ea66645eadc Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Thu, 13 Nov 2025 08:47:18 -0600 Subject: [PATCH] change(web): address MD PR review concerns --- .../worker-thread/src/main/correction/context-token.ts | 5 +++-- .../src/main/correction/context-tokenization.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/web/src/engine/predictive-text/worker-thread/src/main/correction/context-token.ts b/web/src/engine/predictive-text/worker-thread/src/main/correction/context-token.ts index 4b8927e4f9..685a2fc525 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/correction/context-token.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/correction/context-token.ts @@ -124,6 +124,7 @@ export class ContextToken { rawText ||= ''; // Supports the old pathway for: updateWithBackspace(tokenText: string, transformId: number) + // Build a token that represents the current text with no ambiguity - probability at max (1.0) const rawTransformDistributions: Distribution[] = textToCharTransforms(rawText).map(function(transform) { return [{sample: transform, p: 1.0}]; }); @@ -131,9 +132,9 @@ export class ContextToken { this._inputRange.push({ trueTransform: entry[0].sample, inputStartIndex: 0, - bestProbFromSet: 1 + bestProbFromSet: entry[0].p }); - this.searchSpace.addInput(entry, 1); + this.searchSpace.addInput(entry, entry[0].p); }); } } diff --git a/web/src/engine/predictive-text/worker-thread/src/main/correction/context-tokenization.ts b/web/src/engine/predictive-text/worker-thread/src/main/correction/context-tokenization.ts index e1055964a7..98f1459849 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/correction/context-tokenization.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/correction/context-tokenization.ts @@ -586,7 +586,7 @@ export class ContextTokenization { if(affectedToken.inputRange.length == 0 && distribution[0].sample.deleteLeft != 0) { distribution = distribution.map((mass) => ({sample: { ...mass.sample, deleteLeft: 0 }, p: mass.p })); } - affectedToken.addInput({trueTransform: sourceInput, inputStartIndex: appliedLength, bestProbFromSet: bestProbFromSet}, distribution); + affectedToken.addInput({trueTransform: sourceInput, inputStartIndex: appliedLength, bestProbFromSet}, distribution); appliedLength += KMWString.length(distribution[0].sample.insert); const tokenize = determineModelTokenizer(lexicalModel);