mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-30 04:07:42 +00:00
fix(web): assert matching transition IDs in SearchPath constructor
This commit is contained in:
parent
df580c2fad
commit
a625596f4d
1 changed files with 7 additions and 1 deletions
|
|
@ -74,10 +74,16 @@ export abstract class SearchQuotientSpur implements SearchQuotientNode {
|
|||
inputStartIndex: 0
|
||||
}
|
||||
};
|
||||
const inputSrc = inputSource as TokenInputSource;
|
||||
|
||||
const transitionId = (inputs?.[0].sample.id);
|
||||
if(transitionId !== undefined && inputSrc?.trueTransform.id != transitionId) {
|
||||
throw new Error("Input distribution and input-source transition IDs must match");
|
||||
}
|
||||
|
||||
this.parentNode = parentNode;
|
||||
this.inputSource = inputSource as TokenInputSource;
|
||||
this.lowestPossibleSingleCost = (parentNode?.lowestPossibleSingleCost ?? 0) - Math.log(this.inputSource?.bestProbFromSet ?? 1);
|
||||
this.lowestPossibleSingleCost = (parentNode?.lowestPossibleSingleCost ?? 0) - Math.log(inputSrc?.bestProbFromSet ?? 1);
|
||||
this.inputs = inputs?.length > 0 ? inputs : null;
|
||||
this.inputCount = (parentNode?.inputCount ?? 0) + (this.inputs ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue