am da5b4fb6: Merge "Move initialization logic for from DicNode to DicNodeState."
* commit 'da5b4fb6da45281630ab19684859c30cf0ca05ac': Move initialization logic for from DicNode to DicNodeState.main
commit
5c4704ffad
|
@ -130,21 +130,9 @@ class DicNode {
|
|||
NOT_A_PROBABILITY /* probability */, false /* isTerminal */,
|
||||
true /* hasChildren */, false /* isBlacklistedOrNotAWord */, 0 /* depth */,
|
||||
0 /* terminalDepth */);
|
||||
// TODO: Move to dicNodeState?
|
||||
mDicNodeState.mDicNodeStateOutput.init(); // reset for next word
|
||||
mDicNodeState.mDicNodeStateInput.init(
|
||||
&dicNode->mDicNodeState.mDicNodeStateInput, true /* resetTerminalDiffCost */);
|
||||
mDicNodeState.mDicNodeStateScoring.init(
|
||||
&dicNode->mDicNodeState.mDicNodeStateScoring);
|
||||
mDicNodeState.mDicNodeStatePrevWord.init(
|
||||
dicNode->mDicNodeState.mDicNodeStatePrevWord.getPrevWordCount() + 1,
|
||||
mDicNodeState.initAsRootWithPreviousWord(&dicNode->mDicNodeState,
|
||||
dicNode->mDicNodeProperties.getPtNodePos(),
|
||||
dicNode->mDicNodeState.mDicNodeStatePrevWord.mPrevWord,
|
||||
dicNode->mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength(),
|
||||
dicNode->getOutputWordBuf(),
|
||||
dicNode->mDicNodeProperties.getDepth(),
|
||||
dicNode->mDicNodeState.mDicNodeStatePrevWord.getSecondWordFirstInputIndex(),
|
||||
mDicNodeState.mDicNodeStateInput.getInputIndex(0) /* lastInputIndex */);
|
||||
dicNode->mDicNodeProperties.getDepth());
|
||||
PROF_NODE_COPY(&dicNode->mProfiler, mProfiler);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,24 @@ class DicNodeState {
|
|||
mDicNodeStateScoring.init();
|
||||
}
|
||||
|
||||
// Init with previous word.
|
||||
void initAsRootWithPreviousWord(const DicNodeState *prevWordDicNodeState,
|
||||
const int prevWordPos, const int prevWordCodePointCount) {
|
||||
mDicNodeStateOutput.init(); // reset for next word
|
||||
mDicNodeStateInput.init(
|
||||
&prevWordDicNodeState->mDicNodeStateInput, true /* resetTerminalDiffCost */);
|
||||
mDicNodeStateScoring.init(&prevWordDicNodeState->mDicNodeStateScoring);
|
||||
mDicNodeStatePrevWord.init(
|
||||
prevWordDicNodeState->mDicNodeStatePrevWord.getPrevWordCount() + 1,
|
||||
prevWordPos,
|
||||
prevWordDicNodeState->mDicNodeStatePrevWord.mPrevWord,
|
||||
prevWordDicNodeState->mDicNodeStatePrevWord.getPrevWordLength(),
|
||||
prevWordDicNodeState->mDicNodeStateOutput.mCodePointsBuf,
|
||||
prevWordCodePointCount,
|
||||
prevWordDicNodeState->mDicNodeStatePrevWord.getSecondWordFirstInputIndex(),
|
||||
prevWordDicNodeState->mDicNodeStateInput.getInputIndex(0) /* lastInputIndex */);
|
||||
}
|
||||
|
||||
// Init by copy
|
||||
AK_FORCE_INLINE void init(const DicNodeState *const src) {
|
||||
mDicNodeStateInput.init(&src->mDicNodeStateInput);
|
||||
|
|
Loading…
Reference in New Issue