Remove mHasChildrenPtNodes from DicNodeProperties.
Bug: 14425059 Change-Id: I3a9511e7f7c3a722f9942f525530f04def5965damain
parent
9ff6fee838
commit
d028294890
|
@ -136,16 +136,15 @@ class DicNode {
|
|||
}
|
||||
|
||||
void initAsChild(const DicNode *const dicNode, const int childrenPtNodeArrayPos,
|
||||
const int probability, const int wordId, const bool hasChildren,
|
||||
const bool isBlacklistedOrNotAWord, const uint16_t mergedNodeCodePointCount,
|
||||
const int *const mergedNodeCodePoints) {
|
||||
const int probability, const int wordId, const bool isBlacklistedOrNotAWord,
|
||||
const uint16_t mergedNodeCodePointCount, const int *const mergedNodeCodePoints) {
|
||||
uint16_t newDepth = static_cast<uint16_t>(dicNode->getNodeCodePointCount() + 1);
|
||||
mIsCachedForNextSuggestion = dicNode->mIsCachedForNextSuggestion;
|
||||
const uint16_t newLeavingDepth = static_cast<uint16_t>(
|
||||
dicNode->mDicNodeProperties.getLeavingDepth() + mergedNodeCodePointCount);
|
||||
mDicNodeProperties.init(childrenPtNodeArrayPos, mergedNodeCodePoints[0],
|
||||
probability, wordId, hasChildren, isBlacklistedOrNotAWord, newDepth,
|
||||
newLeavingDepth, dicNode->mDicNodeProperties.getPrevWordIds());
|
||||
probability, wordId, isBlacklistedOrNotAWord, newDepth, newLeavingDepth,
|
||||
dicNode->mDicNodeProperties.getPrevWordIds());
|
||||
mDicNodeState.init(&dicNode->mDicNodeState, mergedNodeCodePointCount,
|
||||
mergedNodeCodePoints);
|
||||
PROF_NODE_COPY(&dicNode->mProfiler, mProfiler);
|
||||
|
|
|
@ -59,14 +59,12 @@ class DicNodeVector {
|
|||
}
|
||||
|
||||
void pushLeavingChild(const DicNode *const dicNode, const int childrenPtNodeArrayPos,
|
||||
const int probability, const int wordId, const bool hasChildren,
|
||||
const bool isBlacklistedOrNotAWord, const uint16_t mergedNodeCodePointCount,
|
||||
const int *const mergedNodeCodePoints) {
|
||||
const int probability, const int wordId, const bool isBlacklistedOrNotAWord,
|
||||
const uint16_t mergedNodeCodePointCount, const int *const mergedNodeCodePoints) {
|
||||
ASSERT(!mLock);
|
||||
mDicNodes.emplace_back();
|
||||
mDicNodes.back().initAsChild(dicNode, childrenPtNodeArrayPos, probability,
|
||||
wordId, hasChildren, isBlacklistedOrNotAWord, mergedNodeCodePointCount,
|
||||
mergedNodeCodePoints);
|
||||
wordId, isBlacklistedOrNotAWord, mergedNodeCodePointCount, mergedNodeCodePoints);
|
||||
}
|
||||
|
||||
DicNode *operator[](const int id) {
|
||||
|
|
|
@ -31,20 +31,18 @@ class DicNodeProperties {
|
|||
AK_FORCE_INLINE DicNodeProperties()
|
||||
: mChildrenPtNodeArrayPos(NOT_A_DICT_POS), mProbability(NOT_A_PROBABILITY),
|
||||
mDicNodeCodePoint(NOT_A_CODE_POINT), mWordId(NOT_A_WORD_ID),
|
||||
mHasChildrenPtNodes(false), mIsBlacklistedOrNotAWord(false), mDepth(0),
|
||||
mLeavingDepth(0) {}
|
||||
mIsBlacklistedOrNotAWord(false), mDepth(0), mLeavingDepth(0) {}
|
||||
|
||||
~DicNodeProperties() {}
|
||||
|
||||
// Should be called only once per DicNode is initialized.
|
||||
void init(const int childrenPos, const int nodeCodePoint, const int probability,
|
||||
const int wordId, const bool hasChildren, const bool isBlacklistedOrNotAWord,
|
||||
const uint16_t depth, const uint16_t leavingDepth, const int *const prevWordIds) {
|
||||
const int wordId, const bool isBlacklistedOrNotAWord, const uint16_t depth,
|
||||
const uint16_t leavingDepth, const int *const prevWordIds) {
|
||||
mChildrenPtNodeArrayPos = childrenPos;
|
||||
mDicNodeCodePoint = nodeCodePoint;
|
||||
mProbability = probability;
|
||||
mWordId = wordId;
|
||||
mHasChildrenPtNodes = hasChildren;
|
||||
mIsBlacklistedOrNotAWord = isBlacklistedOrNotAWord;
|
||||
mDepth = depth;
|
||||
mLeavingDepth = leavingDepth;
|
||||
|
@ -57,7 +55,6 @@ class DicNodeProperties {
|
|||
mDicNodeCodePoint = NOT_A_CODE_POINT;
|
||||
mProbability = NOT_A_PROBABILITY;
|
||||
mWordId = NOT_A_WORD_ID;
|
||||
mHasChildrenPtNodes = true;
|
||||
mIsBlacklistedOrNotAWord = false;
|
||||
mDepth = 0;
|
||||
mLeavingDepth = 0;
|
||||
|
@ -69,7 +66,6 @@ class DicNodeProperties {
|
|||
mDicNodeCodePoint = dicNodeProp->mDicNodeCodePoint;
|
||||
mProbability = dicNodeProp->mProbability;
|
||||
mWordId = dicNodeProp->mWordId;
|
||||
mHasChildrenPtNodes = dicNodeProp->mHasChildrenPtNodes;
|
||||
mIsBlacklistedOrNotAWord = dicNodeProp->mIsBlacklistedOrNotAWord;
|
||||
mDepth = dicNodeProp->mDepth;
|
||||
mLeavingDepth = dicNodeProp->mLeavingDepth;
|
||||
|
@ -82,7 +78,6 @@ class DicNodeProperties {
|
|||
mDicNodeCodePoint = codePoint; // Overwrite the node char of a passing child
|
||||
mProbability = dicNodeProp->mProbability;
|
||||
mWordId = dicNodeProp->mWordId;
|
||||
mHasChildrenPtNodes = dicNodeProp->mHasChildrenPtNodes;
|
||||
mIsBlacklistedOrNotAWord = dicNodeProp->mIsBlacklistedOrNotAWord;
|
||||
mDepth = dicNodeProp->mDepth + 1; // Increment the depth of a passing child
|
||||
mLeavingDepth = dicNodeProp->mLeavingDepth;
|
||||
|
@ -115,7 +110,7 @@ class DicNodeProperties {
|
|||
}
|
||||
|
||||
bool hasChildren() const {
|
||||
return mHasChildrenPtNodes || mDepth != mLeavingDepth;
|
||||
return (mChildrenPtNodeArrayPos != NOT_A_DICT_POS) || mDepth != mLeavingDepth;
|
||||
}
|
||||
|
||||
bool isBlacklistedOrNotAWord() const {
|
||||
|
@ -138,7 +133,6 @@ class DicNodeProperties {
|
|||
int mProbability;
|
||||
int mDicNodeCodePoint;
|
||||
int mWordId;
|
||||
bool mHasChildrenPtNodes;
|
||||
bool mIsBlacklistedOrNotAWord;
|
||||
uint16_t mDepth;
|
||||
uint16_t mLeavingDepth;
|
||||
|
|
|
@ -78,7 +78,7 @@ void Ver4PatriciaTriePolicy::createAndGetAllChildDicNodes(const DicNode *const d
|
|||
}
|
||||
const int wordId = isTerminal ? ptNodeParams.getHeadPos() : NOT_A_WORD_ID;
|
||||
childDicNodes->pushLeavingChild(dicNode, ptNodeParams.getChildrenPos(),
|
||||
ptNodeParams.getProbability(), wordId, ptNodeParams.hasChildren(),
|
||||
ptNodeParams.getProbability(), wordId,
|
||||
ptNodeParams.isBlacklisted()
|
||||
|| ptNodeParams.isNotAWord() /* isBlacklistedOrNotAWord */,
|
||||
ptNodeParams.getCodePointCount(), ptNodeParams.getCodePoints());
|
||||
|
|
|
@ -378,7 +378,6 @@ int PatriciaTriePolicy::createAndGetLeavingChildNode(const DicNode *const dicNod
|
|||
if (CharUtils::isInUnicodeSpace(mergedNodeCodePoints[0])) {
|
||||
const int wordId = PatriciaTrieReadingUtils::isTerminal(flags) ? ptNodePos : NOT_A_WORD_ID;
|
||||
childDicNodes->pushLeavingChild(dicNode, childrenPos, probability, wordId,
|
||||
PatriciaTrieReadingUtils::hasChildrenInFlags(flags),
|
||||
PatriciaTrieReadingUtils::isBlacklisted(flags)
|
||||
|| PatriciaTrieReadingUtils::isNotAWord(flags),
|
||||
mergedNodeCodePointCount, mergedNodeCodePoints);
|
||||
|
|
|
@ -68,7 +68,7 @@ void Ver4PatriciaTriePolicy::createAndGetAllChildDicNodes(const DicNode *const d
|
|||
}
|
||||
const int wordId = isTerminal ? ptNodeParams.getTerminalId() : NOT_A_WORD_ID;
|
||||
childDicNodes->pushLeavingChild(dicNode, ptNodeParams.getChildrenPos(),
|
||||
ptNodeParams.getProbability(), wordId, ptNodeParams.hasChildren(),
|
||||
ptNodeParams.getProbability(), wordId,
|
||||
ptNodeParams.isBlacklisted()
|
||||
|| ptNodeParams.isNotAWord() /* isBlacklistedOrNotAWord */,
|
||||
ptNodeParams.getCodePointCount(), ptNodeParams.getCodePoints());
|
||||
|
|
Loading…
Reference in New Issue