Skip to content

Commit dc48191

Browse files
committed
change(web): remove isSubstitutionAlignable
1 parent 9f6e300 commit dc48191

3 files changed

Lines changed: 1 addition & 186 deletions

File tree

web/src/engine/predictive-text/worker-thread/src/main/correction/alignment-helpers.ts

Lines changed: 0 additions & 104 deletions
This file was deleted.

web/src/engine/predictive-text/worker-thread/src/main/test-index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export * from './correction/context-token.js';
44
export * from './correction/context-tokenization.js';
55
export { ContextTracker } from './correction/context-tracker.js';
66
export { ContextTransition } from './correction/context-transition.js';
7-
export * from './correction/alignment-helpers.js';
87
export { ExtendedEditOperation, SegmentableDistanceCalculation } from './correction/segmentable-calculation.js';
98
export * from './correction/tokenization-subsets.js';
109
export * as correction from './correction/index.js';

web/src/test/auto/headless/engine/predictive-text/worker-thread/context/alignment-helpers.tests.ts

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8,84 +8,4 @@
88
* validating potential substitution edit operations.
99
*/
1010

11-
import { assert } from 'chai';
12-
import { isSubstitutionAlignable } from '@keymanapp/lm-worker/test-index';
13-
14-
describe('isSubstitutionAlignable', () => {
15-
it(`returns true: 'ca' => 'can'`, () => {
16-
assert.isTrue(isSubstitutionAlignable('can', 'ca'));
17-
});
18-
19-
// Leading word in context window starts sliding out of said window.
20-
it(`returns true: 'can' => 'an'`, () => {
21-
assert.isTrue(isSubstitutionAlignable('an', 'can'));
22-
});
23-
24-
// Same edits on both sides: not valid.
25-
it(`returns false: 'apple' => 'grapples'`, () => {
26-
assert.isFalse(isSubstitutionAlignable('grapples', 'apple'));
27-
});
28-
29-
// Edits on one side: valid.
30-
it(`returns true: 'apple' => 'grapple'`, () => {
31-
assert.isTrue(isSubstitutionAlignable('grapple', 'apple'));
32-
});
33-
34-
// Edits on one side: valid.
35-
it(`returns true: 'apple' => 'grapple'`, () => {
36-
assert.isTrue(isSubstitutionAlignable('apples', 'apple'));
37-
});
38-
39-
// Same edits on both sides: not valid.
40-
it(`returns false: 'grapples' => 'apple'`, () => {
41-
assert.isFalse(isSubstitutionAlignable('apple', 'grapples'));
42-
});
43-
44-
// Substitution: not valid when not permitted via parameter.
45-
it(`returns false: 'apple' => 'banana'`, () => {
46-
// edit path: 'insert' ('b' of banana), 'match' (on leading a), rest are 'substitute'.
47-
assert.isFalse(isSubstitutionAlignable('banana', 'apple'));
48-
});
49-
50-
// Substitution: not valid if too much is substituted, even if allowed via parameter.
51-
it(`returns false: 'apple' => 'banana' (subs allowed)`, () => {
52-
// edit path: 'insert' ('b' of banana), 'match' (on leading a), rest are 'substitute'.
53-
// 1 match vs 4 substitute = no bueno. It'd require too niche of a keyboard rule.
54-
assert.isFalse(isSubstitutionAlignable('banana', 'apple', true));
55-
});
56-
57-
it(`returns true: 'a' => 'à' (subs allowed)`, () => {
58-
assert.isTrue(isSubstitutionAlignable('à', 'a', true));
59-
});
60-
61-
// Leading substitution: valid if enough of the remaining word matches.
62-
// Could totally happen from a legit Keyman keyboard rule.
63-
it(`returns true: 'can' => 'van' (subs allowed)`, () => {
64-
assert.isTrue(isSubstitutionAlignable('van', 'can', true));
65-
});
66-
67-
// Trailing substitution: invalid if not allowed.
68-
it(`returns false: 'can' => 'cap' (subs not allowed)`, () => {
69-
assert.isFalse(isSubstitutionAlignable('cap', 'can'));
70-
});
71-
72-
// Trailing substitution: valid.
73-
it(`returns false: 'can' => 'cap' (subs allowed)`, () => {
74-
assert.isTrue(isSubstitutionAlignable('cap', 'can', true));
75-
});
76-
77-
it(`returns true: 'clasts' => 'clasps' (subs allowed)`, () => {
78-
assert.isTrue(isSubstitutionAlignable('clasps', 'clasts', true));
79-
});
80-
81-
// random deletion at the start + later substitution = still permitted
82-
it(`returns false: 'clasts' => 'lasps' (subs allowed)`, () => {
83-
assert.isTrue(isSubstitutionAlignable('lasps', 'clasts', true));
84-
});
85-
86-
// deletion, then sub at the start, duplicate letters with one dropped
87-
it(`returns true: 'applesauce' => 'plesauce' (subs not allowed)`, () => {
88-
// The double-p adds a fun complication once the first gets dropped.
89-
assert.isTrue(isSubstitutionAlignable('applesauce', 'plesauce'));
90-
});
91-
});
11+
// No longer needed.

0 commit comments

Comments
 (0)