mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-17 03:17:33 +00:00
Merge branch 'fix/web/sliding-tokenization-alignment' into refactor/web/independent-compute-alignment
This commit is contained in:
commit
8b3b0affd4
1 changed files with 8 additions and 4 deletions
|
|
@ -124,11 +124,15 @@ export class ContextTokenization {
|
|||
if(leadTokenShift < 0) {
|
||||
tokenization.splice(0, -leadTokenShift);
|
||||
} else if(leadTokenShift > 0) {
|
||||
// TODO: insert token(s) at the start to match the text that's back within the
|
||||
// insert token(s) at the start to match the text that's back within the
|
||||
// sliding context window.
|
||||
//
|
||||
// (was not part of original source method [`attemptContextMatch`])
|
||||
return null;
|
||||
|
||||
const reinsertedTokens = tokenizedContext.slice(0, leadTokenShift);
|
||||
while(reinsertedTokens.length > 0) {
|
||||
const reinserted = reinsertedTokens.pop();
|
||||
const token = new ContextToken(lexicalModel, reinserted.text);
|
||||
tokenization.unshift(token);
|
||||
}
|
||||
}
|
||||
|
||||
// If no TAIL mutations have happened, we're safe to return now.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue