Move initialization logic for from DicNode to DicNodeState.
Change-Id: Ic7075349e2e9c7f4ca707efa12ad1d24b49a2c87main
parent
258260bef2
commit
6066069f35
|
@ -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