From ed15bf89c6f5fe631c3defc0252439d497b2ee11 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Mon, 22 Jun 2026 10:14:14 -0500 Subject: [PATCH 1/2] docs(web): document TokenizationCorrector fields, rearrange into proper groups --- .../src/main/correction/tokenization-corrector.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/web/src/engine/predictive-text/worker-thread/src/main/correction/tokenization-corrector.ts b/web/src/engine/predictive-text/worker-thread/src/main/correction/tokenization-corrector.ts index 835f9eef38..c1e3173d52 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/correction/tokenization-corrector.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/correction/tokenization-corrector.ts @@ -47,8 +47,16 @@ export type TokenResult = { * range. */ export class TokenizationCorrector implements CorrectionSearchable, TokenizationResultMapping> { + /** + * The root ContextTokenization all generated corrections are based upon. + */ public readonly tokenization: ContextTokenization; - private readonly tailCorrectionLength: number; + + /** + * Indicates whether or not the correction range of this TokenizationCorrector + * started with any tokens considered "correctable". + */ + public readonly modelsCorrectables: boolean; // public read-only via properties private readonly _uncorrectables: QuotientNodeFinalizer[]; @@ -58,13 +66,13 @@ export class TokenizationCorrector implements CorrectionSearchable; private tokenCostMap: Map; private tokenLookupMap: Map; private lastTotalCost: number; private handleHasBeenCalled: boolean = false; private predictableMatchFound: boolean = false; + private readonly tailCorrectionLength: number; get currentCost(): number { const correctable = this.selectionQueue.peek(); From 03d20f1d1c343b3c07c908f876f8e48d0db1a166 Mon Sep 17 00:00:00 2001 From: Joshua Horton Date: Mon, 29 Jun 2026 12:17:51 -0500 Subject: [PATCH 2/2] change(web): rework type nomenclature --- .../worker-thread/src/main/predict-helpers.ts | 32 ++++++------- .../early-correction-search-stopping.tests.ts | 4 +- .../prediction-helpers/auto-correct.tests.ts | 48 +++++++++---------- .../create-default-keep.tests.ts | 14 +++--- ...ine-tokenized-correction-sequence.tests.ts | 4 +- ...raversalless-correction-sequences.tests.ts | 4 +- .../suggestion-deduplication.tests.ts | 10 ++-- .../suggestion-finalization.tests.ts | 10 ++-- .../suggestion-similarity.tests.ts | 18 +++---- 9 files changed, 72 insertions(+), 72 deletions(-) diff --git a/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts b/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts index 914f31cb95..3a7bcdf6ef 100644 --- a/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts +++ b/web/src/engine/predictive-text/worker-thread/src/main/predict-helpers.ts @@ -174,7 +174,7 @@ export interface PredictionMetadata { preservationTransform?: Transform; } -export interface IntermediateCompositedPrediction { +export interface CompositedIntermediatePrediction { /** * Contains the fully composited predictive-text Suggestion and its underlying correction string. */ @@ -185,7 +185,7 @@ export interface IntermediateCompositedPrediction { metadata: PredictionMetadata; } -type IntermediatePrediction = IntermediateCompositedPrediction; +type IntermediatePrediction = CompositedIntermediatePrediction; /** * An enum to be used when categorizing the level of similarity between @@ -494,7 +494,7 @@ export interface PredictionParameters { * @param entry * @returns */ - applyInPost: (entry: IntermediateCompositedPrediction) => void + applyInPost: (entry: CompositedIntermediatePrediction) => void } export function buildCorrectionSequence( @@ -577,7 +577,7 @@ export function determineTokenizedCorrectionSequence( return { ...suggestionParams, - applyInPost: (entry: IntermediateCompositedPrediction) => { + applyInPost: (entry: CompositedIntermediatePrediction) => { entry.metadata.preservationTransform = tokenization.taillessTrueKeystroke; // // Will need an extra lookup layer if the suggestion is generated from within a cluster. // entry.baseTokenization = transition.final.tokenizationSourceMap.get(tokenization); @@ -612,7 +612,7 @@ export async function correctAndEnumerate( /** * The suggestions generated based on the user's input state. */ - rawPredictions: IntermediateCompositedPrediction[]; + rawPredictions: CompositedIntermediatePrediction[]; /** * The id of a prior ContextTransition event that triggered a Suggestion found @@ -668,7 +668,7 @@ export async function correctAndEnumerate( const searchModules = tokenizations.map(t => t.tail.searchModule); // Only run the correction search when corrections are enabled. - let rawPredictions: IntermediateCompositedPrediction[] = []; + let rawPredictions: CompositedIntermediatePrediction[] = []; let bestCorrectionCost: number; for await(const match of getBestTokenMatches(searchModules, timer)) { // Corrections obtained: now to predict from them! @@ -721,7 +721,7 @@ export async function correctAndEnumerate( export function shouldStopSearchingEarly( bestCorrectionCost: number, currentCorrectionCost: number, - rawPredictions: IntermediateCompositedPrediction[] + rawPredictions: CompositedIntermediatePrediction[] ) { if(currentCorrectionCost >= bestCorrectionCost + CORRECTION_SEARCH_THRESHOLDS.MAX_SEARCH_THRESHOLD) { return true; @@ -767,7 +767,7 @@ export function predictFromCorrectionSequence( corrections: ProbabilityMass[], rootContext: Context, transitionId: number -): IntermediateCompositedPrediction[] { +): CompositedIntermediatePrediction[] { let predictionPrefixSequence: ProbabilityMass[] = []; let tailPredictions: ProbabilityMass[]; @@ -816,7 +816,7 @@ export function predictFromCorrectionSequence( return []; } - const predictions: IntermediateCompositedPrediction[] = tailPredictions.map((p) => { + const predictions: CompositedIntermediatePrediction[] = tailPredictions.map((p) => { // Concat corrections + predictions for their components. const predictionSequence = [...predictionPrefixSequence, p]; const fullPrediction: ProbabilityMass = predictionSequence.reduce((prev, curr) => { @@ -896,13 +896,13 @@ export function applySuggestionCasing(suggestion: Suggestion, baseWord: string, */ export function dedupeSuggestions( lexicalModel: LexicalModel, - rawPredictions: IntermediateCompositedPrediction[], + rawPredictions: CompositedIntermediatePrediction[], context: Context ) { const wordbreak = determineModelWordbreaker(lexicalModel); - let suggestionDistribMap: {[key: string]: IntermediateCompositedPrediction} = {}; - let suggestionDistribution: IntermediateCompositedPrediction[] = []; + let suggestionDistribMap: {[key: string]: CompositedIntermediatePrediction} = {}; + let suggestionDistribution: CompositedIntermediatePrediction[] = []; // Deduplicator + annotator of 'keep' suggestions. for(let tuple of rawPredictions) { @@ -953,7 +953,7 @@ export function dedupeSuggestions( */ export function processSimilarity( lexicalModel: LexicalModel, - suggestionDistribution: IntermediateCompositedPrediction[], + suggestionDistribution: CompositedIntermediatePrediction[], context: Context, trueInput: ProbabilityMass ): boolean { @@ -1030,7 +1030,7 @@ export function createDefaultKeep( lexicalModel: LexicalModel, context: Context, trueInput: ProbabilityMass -): IntermediateCompositedPrediction { +): CompositedIntermediatePrediction { const { sample: inputTransform, p: inputTransformProb } = trueInput; const wordbreak = determineModelWordbreaker(lexicalModel); const tokenizer = determineModelTokenizer(lexicalModel); @@ -1111,7 +1111,7 @@ export function correctionValidForAutoSelect(correction: string) { return false; } -export function predictionAutoSelect(suggestionDistribution: IntermediateCompositedPrediction[]) { +export function predictionAutoSelect(suggestionDistribution: CompositedIntermediatePrediction[]) { if(suggestionDistribution.length == 0) { return; } @@ -1205,7 +1205,7 @@ export function predictionAutoSelect(suggestionDistribution: IntermediateComposi */ export function finalizeSuggestions( lexicalModel: LexicalModel, - deduplicatedSuggestionTuples: IntermediateCompositedPrediction[], + deduplicatedSuggestionTuples: CompositedIntermediatePrediction[], context: Context, inputTransform: Transform, verbose?: boolean diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/early-correction-search-stopping.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/early-correction-search-stopping.tests.ts index 430d9c6c7e..bed2c0f225 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/early-correction-search-stopping.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/correction-search/early-correction-search-stopping.tests.ts @@ -1,6 +1,6 @@ import { assert } from 'chai'; -import { CORRECTION_SEARCH_THRESHOLDS, IntermediateCompositedPrediction, ModelCompositor, shouldStopSearchingEarly } from "@keymanapp/lm-worker/test-index"; +import { CORRECTION_SEARCH_THRESHOLDS, CompositedIntermediatePrediction, ModelCompositor, shouldStopSearchingEarly } from "@keymanapp/lm-worker/test-index"; function mockIntermediatePrediction(value: number) { return { @@ -9,7 +9,7 @@ function mockIntermediatePrediction(value: number) { total: value } } - } as IntermediateCompositedPrediction + } as CompositedIntermediatePrediction } describe('correction-search: shouldStopSearchingEarly', () => { diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/auto-correct.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/auto-correct.tests.ts index b55886bb42..ecb4b09357 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/auto-correct.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/auto-correct.tests.ts @@ -1,6 +1,6 @@ import { assert } from 'chai'; -import { AUTOSELECT_PROPORTION_THRESHOLD, IntermediateCompositedPrediction, predictionAutoSelect, SuggestionSimilarity, tupleDisplayOrderSort } from "@keymanapp/lm-worker/test-index"; +import { AUTOSELECT_PROPORTION_THRESHOLD, CompositedIntermediatePrediction, predictionAutoSelect, SuggestionSimilarity, tupleDisplayOrderSort } from "@keymanapp/lm-worker/test-index"; /* * Preconditions: * - there should always be a 'keep' option. Now, whether or not that option @@ -9,7 +9,7 @@ import { AUTOSELECT_PROPORTION_THRESHOLD, IntermediateCompositedPrediction, pred */ describe('predictionAutoSelect', () => { it(`does not throw when no suggestions are available`, () => { - const predictions: IntermediateCompositedPrediction[] = []; + const predictions: CompositedIntermediatePrediction[] = []; const originalPredictions = [].concat(predictions); assert.doesNotThrow(() => predictionAutoSelect(predictions)); @@ -17,7 +17,7 @@ describe('predictionAutoSelect', () => { }); it(`selects solitary 'keep' suggestion that does match the model`, () => { - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ { components: { prediction: { @@ -51,7 +51,7 @@ describe('predictionAutoSelect', () => { }); it(`does not select suggestions if the root correction has no letters`, () => { - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ { components: { prediction: { @@ -106,7 +106,7 @@ describe('predictionAutoSelect', () => { }); it(`does not select solitary 'keep' suggestion that doesn't match the model`, () => { - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ { components: { prediction: { @@ -140,7 +140,7 @@ describe('predictionAutoSelect', () => { }); it(`selects 'keep' suggestion that does match the model over any alternatives`, () => { - const keepSuggestion: IntermediateCompositedPrediction = { + const keepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { tag: 'keep', @@ -163,7 +163,7 @@ describe('predictionAutoSelect', () => { } } - const highestNonKeepSuggestion: IntermediateCompositedPrediction = { + const highestNonKeepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { transform: { // can be null / "mocked out" @@ -184,7 +184,7 @@ describe('predictionAutoSelect', () => { } }; - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ keepSuggestion, highestNonKeepSuggestion, { @@ -238,7 +238,7 @@ describe('predictionAutoSelect', () => { }); it(`selects solitary non-'keep' suggestion when 'keep' does not match model`, () => { - const keepSuggestion: IntermediateCompositedPrediction = { + const keepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { tag: 'keep', @@ -265,7 +265,7 @@ describe('predictionAutoSelect', () => { // This threshold may be subject to change. // // Refer to AUTOSELECT_PROPORTION_THRESHOLD in predict-helpers.ts. - const onlyNonKeepSuggestion: IntermediateCompositedPrediction = { + const onlyNonKeepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { transform: { // can be null / "mocked out" @@ -286,7 +286,7 @@ describe('predictionAutoSelect', () => { } }; - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ keepSuggestion, onlyNonKeepSuggestion ]; @@ -305,7 +305,7 @@ describe('predictionAutoSelect', () => { }); it(`does not select non-'keep' without sufficient winning probability`, () => { - const keepSuggestion: IntermediateCompositedPrediction = { + const keepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { tag: 'keep', @@ -332,7 +332,7 @@ describe('predictionAutoSelect', () => { // This threshold may be subject to change. // // Refer to AUTOSELECT_PROPORTION_THRESHOLD in predict-helpers.ts. - const highestNonKeepSuggestion: IntermediateCompositedPrediction = { + const highestNonKeepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { transform: { // can be null / "mocked out" @@ -353,7 +353,7 @@ describe('predictionAutoSelect', () => { } }; - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ keepSuggestion, highestNonKeepSuggestion, { @@ -412,7 +412,7 @@ describe('predictionAutoSelect', () => { }); it(`does select non-'keep' with sufficient winning probability`, () => { - const keepSuggestion: IntermediateCompositedPrediction = { + const keepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { tag: 'keep', @@ -435,7 +435,7 @@ describe('predictionAutoSelect', () => { } } - const highestNonKeepSuggestion: IntermediateCompositedPrediction = { + const highestNonKeepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { transform: { // can be null / "mocked out" @@ -456,7 +456,7 @@ describe('predictionAutoSelect', () => { } }; - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ keepSuggestion, highestNonKeepSuggestion, { @@ -513,7 +513,7 @@ describe('predictionAutoSelect', () => { }); it('ignores non key-matched suggestions when key-matched suggestions exist', () => { - const keepSuggestion: IntermediateCompositedPrediction = { + const keepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { tag: 'keep', @@ -537,7 +537,7 @@ describe('predictionAutoSelect', () => { } } - const expectedSuggestion: IntermediateCompositedPrediction = { + const expectedSuggestion: CompositedIntermediatePrediction = { components: { prediction: { transform: { // can be null / "mocked out" @@ -559,7 +559,7 @@ describe('predictionAutoSelect', () => { } }; - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ keepSuggestion, expectedSuggestion, { @@ -597,7 +597,7 @@ describe('predictionAutoSelect', () => { // The idea: avoid "over-correcting" when a potential correction has a // super-high-frequency word. it('does not auto-select suggestion if its root correction is not most likely', () => { - const keepSuggestion: IntermediateCompositedPrediction = { + const keepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { tag: 'keep', @@ -620,7 +620,7 @@ describe('predictionAutoSelect', () => { } } - const highestCorrectionSuggestion: IntermediateCompositedPrediction = { + const highestCorrectionSuggestion: CompositedIntermediatePrediction = { components: { prediction: { transform: { // can be null / "mocked out" @@ -641,7 +641,7 @@ describe('predictionAutoSelect', () => { } }; - const highestNonKeepSuggestion: IntermediateCompositedPrediction = { + const highestNonKeepSuggestion: CompositedIntermediatePrediction = { components: { prediction: { transform: { // can be null / "mocked out" @@ -662,7 +662,7 @@ describe('predictionAutoSelect', () => { } }; - const predictions: IntermediateCompositedPrediction[] = [ + const predictions: CompositedIntermediatePrediction[] = [ keepSuggestion, highestNonKeepSuggestion, highestCorrectionSuggestion diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/create-default-keep.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/create-default-keep.tests.ts index afc0d4d232..8943b85da5 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/create-default-keep.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/create-default-keep.tests.ts @@ -12,7 +12,7 @@ import { assert } from 'chai'; import { LexicalModelTypes } from "@keymanapp/common-types"; import * as wordBreakers from '@keymanapp/models-wordbreakers'; -import { IntermediateCompositedPrediction, createDefaultKeep, models, SuggestionSimilarity } from "@keymanapp/lm-worker/test-index"; +import { CompositedIntermediatePrediction, createDefaultKeep, models, SuggestionSimilarity } from "@keymanapp/lm-worker/test-index"; import CasingFunction = LexicalModelTypes.CasingFunction; import Context = LexicalModelTypes.Context; @@ -108,7 +108,7 @@ describe('createDefaultKeep', () => { p: 1 }; - const expectedKeep: IntermediateCompositedPrediction = { + const expectedKeep: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -152,7 +152,7 @@ describe('createDefaultKeep', () => { p: 1 }; - const expectedKeep: IntermediateCompositedPrediction = { + const expectedKeep: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -196,7 +196,7 @@ describe('createDefaultKeep', () => { p: 1 }; - const expectedKeep: IntermediateCompositedPrediction = { + const expectedKeep: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -240,7 +240,7 @@ describe('createDefaultKeep', () => { p: 1 }; - const expectedKeep: IntermediateCompositedPrediction = { + const expectedKeep: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -284,7 +284,7 @@ describe('createDefaultKeep', () => { p: 1 }; - const expectedKeep: IntermediateCompositedPrediction = { + const expectedKeep: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -328,7 +328,7 @@ describe('createDefaultKeep', () => { p: 1 }; - const expectedKeep: IntermediateCompositedPrediction = { + const expectedKeep: CompositedIntermediatePrediction = { components: { prediction: { transform: { diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-tokenized-correction-sequence.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-tokenized-correction-sequence.tests.ts index 5cd7b67072..6f5729a7c8 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-tokenized-correction-sequence.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-tokenized-correction-sequence.tests.ts @@ -21,7 +21,7 @@ import { ContextState, ContextToken, ContextTokenization, - IntermediateCompositedPrediction, + CompositedIntermediatePrediction, ModelCompositor, TokenizationResultMapping } from "@keymanapp/lm-worker/test-index"; @@ -341,7 +341,7 @@ describe('determineTokenizedCorrectionSequence', () => { }); assert.approximately(results.tokenizedCorrection[0].p, Math.pow(trueInput.p, ModelCompositor.SINGLE_CHAR_KEY_PROB_EXPONENT), Number.EPSILON*1000); - const dummiedTuple: IntermediateCompositedPrediction = { + const dummiedTuple: CompositedIntermediatePrediction = { components: { prediction: { transform: { insert: 'dog', deleteLeft: 0 }, diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-traversalless-correction-sequences.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-traversalless-correction-sequences.tests.ts index a1872641d3..112c61d2a8 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-traversalless-correction-sequences.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/determine-traversalless-correction-sequences.tests.ts @@ -13,7 +13,7 @@ import { LexicalModelTypes } from "@keymanapp/common-types"; import * as wordBreakers from '@keymanapp/models-wordbreakers'; import { KMWString } from 'keyman/common/web-utils'; -import { IntermediateCompositedPrediction, ModelCompositor, determineTraversallessCorrectionSequences, models } from "@keymanapp/lm-worker/test-index"; +import { CompositedIntermediatePrediction, ModelCompositor, determineTraversallessCorrectionSequences, models } from "@keymanapp/lm-worker/test-index"; import Context = LexicalModelTypes.Context; import DummyModel = models.DummyModel; @@ -377,7 +377,7 @@ describe('determineTraversallessCorrectionSequences', () => { }); assert.approximately(entry.tokenizedCorrection[0].p, Math.pow(trueInput.p, ModelCompositor.SINGLE_CHAR_KEY_PROB_EXPONENT), Number.EPSILON*1000); - const dummiedTuple: IntermediateCompositedPrediction = { + const dummiedTuple: CompositedIntermediatePrediction = { components: { prediction: { transform: { insert: 'dog', deleteLeft: 0 }, diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-deduplication.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-deduplication.tests.ts index 4a2afcf60d..d28d7a6343 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-deduplication.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-deduplication.tests.ts @@ -4,7 +4,7 @@ import * as wordBreakers from '@keymanapp/models-wordbreakers'; import { deepCopy } from 'keyman/common/web-utils'; import { LexicalModelTypes } from '@keymanapp/common-types'; -import { IntermediateCompositedPrediction, dedupeSuggestions, models } from "@keymanapp/lm-worker/test-index"; +import { CompositedIntermediatePrediction, dedupeSuggestions, models } from "@keymanapp/lm-worker/test-index"; import Context = LexicalModelTypes.Context; import DummyModel = models.DummyModel; @@ -24,7 +24,7 @@ const testModel = new DummyModel({ * @returns */ const build_its_is_set = () => { - const its: IntermediateCompositedPrediction = { + const its: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -46,7 +46,7 @@ const build_its_is_set = () => { } }; - const it_is: IntermediateCompositedPrediction = { + const it_is: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -67,7 +67,7 @@ const build_its_is_set = () => { } }; - const is: IntermediateCompositedPrediction = { + const is: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -88,7 +88,7 @@ const build_its_is_set = () => { } }; - const is_not: IntermediateCompositedPrediction = { + const is_not: CompositedIntermediatePrediction = { components: { prediction: { transform: { diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-finalization.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-finalization.tests.ts index 9ba1faec74..2bf9a6f96a 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-finalization.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-finalization.tests.ts @@ -5,7 +5,7 @@ import { deepCopy } from 'keyman/common/web-utils'; import * as wordBreakers from '@keymanapp/models-wordbreakers'; import { LexicalModelTypes } from '@keymanapp/common-types'; -import { IntermediateCompositedPrediction, finalizeSuggestions, models } from "@keymanapp/lm-worker/test-index"; +import { CompositedIntermediatePrediction, finalizeSuggestions, models } from "@keymanapp/lm-worker/test-index"; import DummyModel = models.DummyModel; import Outcome = LexicalModelTypes.Outcome; @@ -48,7 +48,7 @@ const testModelWithoutSpacing = new DummyModel({ */ const build_its_is_set = (verbose?: string) => { const verboseFlag = (verbose == 'verbose' ? true : false); - const its: IntermediateCompositedPrediction = { + const its: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -70,7 +70,7 @@ const build_its_is_set = (verbose?: string) => { } }; - const it_is: IntermediateCompositedPrediction = { + const it_is: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -91,7 +91,7 @@ const build_its_is_set = (verbose?: string) => { } }; - const is: IntermediateCompositedPrediction = { + const is: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -112,7 +112,7 @@ const build_its_is_set = (verbose?: string) => { } }; - const is_not: IntermediateCompositedPrediction = { + const is_not: CompositedIntermediatePrediction = { components: { prediction: { transform: { diff --git a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-similarity.tests.ts b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-similarity.tests.ts index 6a97039d24..76a605e869 100644 --- a/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-similarity.tests.ts +++ b/web/src/test/auto/headless/engine/predictive-text/worker-thread/prediction-helpers/suggestion-similarity.tests.ts @@ -5,7 +5,7 @@ import * as wordBreakers from '@keymanapp/models-wordbreakers'; import { deepCopy } from 'keyman/common/web-utils'; import { LexicalModelTypes } from '@keymanapp/common-types'; -import { IntermediateCompositedPrediction, models, processSimilarity, SuggestionSimilarity, toAnnotatedSuggestion } from "@keymanapp/lm-worker/test-index"; +import { CompositedIntermediatePrediction, models, processSimilarity, SuggestionSimilarity, toAnnotatedSuggestion } from "@keymanapp/lm-worker/test-index"; import CasingFunction = LexicalModelTypes.CasingFunction; import Context = LexicalModelTypes.Context; @@ -109,7 +109,7 @@ const testModelWithCasing = new DummyModel({ * @returns */ const build_its_is_set = () => { - const its: IntermediateCompositedPrediction = { + const its: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -131,7 +131,7 @@ const build_its_is_set = () => { } }; - const it_is: IntermediateCompositedPrediction = { + const it_is: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -152,7 +152,7 @@ const build_its_is_set = () => { } }; - const is: IntermediateCompositedPrediction = { + const is: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -173,7 +173,7 @@ const build_its_is_set = () => { } }; - const is_not: IntermediateCompositedPrediction = { + const is_not: CompositedIntermediatePrediction = { components: { prediction: { transform: { @@ -222,7 +222,7 @@ describe('processSimilarity', () => { const testSet = build_its_is_set(); const distribution = [...Object.values(testSet)]; - const expectation: IntermediateCompositedPrediction[] = [...Object.values(testSet)]; + const expectation: CompositedIntermediatePrediction[] = [...Object.values(testSet)]; expectation[0].metadata.matchLevel = SuggestionSimilarity.exact; // its expectation[1].metadata.matchLevel = SuggestionSimilarity.sameKey; // it_is expectation[2].metadata.matchLevel = SuggestionSimilarity.none; // is @@ -259,7 +259,7 @@ describe('processSimilarity', () => { const testSet = build_its_is_set(); const distribution = [...Object.values(testSet)]; - const expectation: IntermediateCompositedPrediction[] = [...Object.values(testSet)]; + const expectation: CompositedIntermediatePrediction[] = [...Object.values(testSet)]; expectation[0].metadata.matchLevel = SuggestionSimilarity.sameKey; // its expectation[1].metadata.matchLevel = SuggestionSimilarity.exact; // it_is expectation[2].metadata.matchLevel = SuggestionSimilarity.none; // is @@ -313,7 +313,7 @@ describe('processSimilarity', () => { const distribution = [...Object.values(testSet)]; - const expectation: IntermediateCompositedPrediction[] = [...Object.values(testSet)]; + const expectation: CompositedIntermediatePrediction[] = [...Object.values(testSet)]; expectation[0].metadata.matchLevel = SuggestionSimilarity.sameKey; // its expectation[1].metadata.matchLevel = SuggestionSimilarity.sameText; // it_is expectation[2].metadata.matchLevel = SuggestionSimilarity.none; // is @@ -355,7 +355,7 @@ describe('processSimilarity', () => { const distribution = [...Object.values(testSet)]; - const expectation: IntermediateCompositedPrediction[] = [...Object.values(testSet)]; + const expectation: CompositedIntermediatePrediction[] = [...Object.values(testSet)]; expectation.forEach((entry) => entry.metadata.matchLevel = SuggestionSimilarity.none); processSimilarity(testModelWithoutCasing, distribution, context, trueInput);