Loading native/jni/src/defines.h +1 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,7 @@ static inline void prof_out(void) { #define NOT_AN_INDEX (-1) #define NOT_A_PROBABILITY (-1) #define NOT_A_DICT_POS (S_INT_MIN) #define NOT_A_WORD_ID (S_INT_MIN) #define NOT_A_TIMESTAMP (-1) #define NOT_A_LANGUAGE_WEIGHT (-1.0f) Loading native/jni/src/suggest/core/dicnode/dic_node.h +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ class DicNode { } void initAsChild(const DicNode *const dicNode, const int ptNodePos, const int childrenPtNodeArrayPos, const int probability, const bool isTerminal, const int childrenPtNodeArrayPos, const int probability, const int wordId, const bool hasChildren, const bool isBlacklistedOrNotAWord, const uint16_t mergedNodeCodePointCount, const int *const mergedNodeCodePoints) { uint16_t newDepth = static_cast<uint16_t>(dicNode->getNodeCodePointCount() + 1); Loading @@ -144,7 +144,7 @@ class DicNode { const uint16_t newLeavingDepth = static_cast<uint16_t>( dicNode->mDicNodeProperties.getLeavingDepth() + mergedNodeCodePointCount); mDicNodeProperties.init(ptNodePos, childrenPtNodeArrayPos, mergedNodeCodePoints[0], probability, isTerminal, hasChildren, isBlacklistedOrNotAWord, newDepth, probability, wordId, hasChildren, isBlacklistedOrNotAWord, newDepth, newLeavingDepth, dicNode->mDicNodeProperties.getPrevWordsTerminalPtNodePos()); mDicNodeState.init(&dicNode->mDicNodeState, mergedNodeCodePointCount, mergedNodeCodePoints); Loading native/jni/src/suggest/core/dicnode/dic_node_vector.h +2 −2 Original line number Diff line number Diff line Loading @@ -59,13 +59,13 @@ class DicNodeVector { } void pushLeavingChild(const DicNode *const dicNode, const int ptNodePos, const int childrenPtNodeArrayPos, const int probability, const bool isTerminal, const int childrenPtNodeArrayPos, const int probability, const int wordId, const bool hasChildren, const bool isBlacklistedOrNotAWord, const uint16_t mergedNodeCodePointCount, const int *const mergedNodeCodePoints) { ASSERT(!mLock); mDicNodes.emplace_back(); mDicNodes.back().initAsChild(dicNode, ptNodePos, childrenPtNodeArrayPos, probability, isTerminal, hasChildren, isBlacklistedOrNotAWord, mergedNodeCodePointCount, wordId, hasChildren, isBlacklistedOrNotAWord, mergedNodeCodePointCount, mergedNodeCodePoints); } Loading native/jni/src/suggest/core/dicnode/internal/dic_node_properties.h +8 −8 Original line number Diff line number Diff line Loading @@ -31,20 +31,20 @@ class DicNodeProperties { AK_FORCE_INLINE DicNodeProperties() : mPtNodePos(NOT_A_DICT_POS), mChildrenPtNodeArrayPos(NOT_A_DICT_POS), mProbability(NOT_A_PROBABILITY), mDicNodeCodePoint(NOT_A_CODE_POINT), mIsTerminal(false), mHasChildrenPtNodes(false), mWordId(NOT_A_WORD_ID), mHasChildrenPtNodes(false), mIsBlacklistedOrNotAWord(false), mDepth(0), mLeavingDepth(0) {} ~DicNodeProperties() {} // Should be called only once per DicNode is initialized. void init(const int pos, const int childrenPos, const int nodeCodePoint, const int probability, const bool isTerminal, const bool hasChildren, const bool isBlacklistedOrNotAWord, const int wordId, const bool hasChildren, const bool isBlacklistedOrNotAWord, const uint16_t depth, const uint16_t leavingDepth, const int *const prevWordsNodePos) { mPtNodePos = pos; mChildrenPtNodeArrayPos = childrenPos; mDicNodeCodePoint = nodeCodePoint; mProbability = probability; mIsTerminal = isTerminal; mWordId = wordId; mHasChildrenPtNodes = hasChildren; mIsBlacklistedOrNotAWord = isBlacklistedOrNotAWord; mDepth = depth; Loading @@ -58,7 +58,7 @@ class DicNodeProperties { mChildrenPtNodeArrayPos = rootPtNodeArrayPos; mDicNodeCodePoint = NOT_A_CODE_POINT; mProbability = NOT_A_PROBABILITY; mIsTerminal = false; mWordId = NOT_A_WORD_ID; mHasChildrenPtNodes = true; mIsBlacklistedOrNotAWord = false; mDepth = 0; Loading @@ -71,7 +71,7 @@ class DicNodeProperties { mChildrenPtNodeArrayPos = dicNodeProp->mChildrenPtNodeArrayPos; mDicNodeCodePoint = dicNodeProp->mDicNodeCodePoint; mProbability = dicNodeProp->mProbability; mIsTerminal = dicNodeProp->mIsTerminal; mWordId = dicNodeProp->mWordId; mHasChildrenPtNodes = dicNodeProp->mHasChildrenPtNodes; mIsBlacklistedOrNotAWord = dicNodeProp->mIsBlacklistedOrNotAWord; mDepth = dicNodeProp->mDepth; Loading @@ -86,7 +86,7 @@ class DicNodeProperties { mChildrenPtNodeArrayPos = dicNodeProp->mChildrenPtNodeArrayPos; mDicNodeCodePoint = codePoint; // Overwrite the node char of a passing child mProbability = dicNodeProp->mProbability; mIsTerminal = dicNodeProp->mIsTerminal; mWordId = dicNodeProp->mWordId; mHasChildrenPtNodes = dicNodeProp->mHasChildrenPtNodes; mIsBlacklistedOrNotAWord = dicNodeProp->mIsBlacklistedOrNotAWord; mDepth = dicNodeProp->mDepth + 1; // Increment the depth of a passing child Loading Loading @@ -121,7 +121,7 @@ class DicNodeProperties { } bool isTerminal() const { return mIsTerminal; return mWordId != NOT_A_WORD_ID; } bool hasChildren() const { Loading @@ -144,7 +144,7 @@ class DicNodeProperties { int mChildrenPtNodeArrayPos; int mProbability; int mDicNodeCodePoint; bool mIsTerminal; int mWordId; bool mHasChildrenPtNodes; bool mIsBlacklistedOrNotAWord; uint16_t mDepth; Loading native/jni/src/suggest/core/policy/dictionary_structure_with_buffer_policy.h +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ class UnigramProperty; * This class abstracts the structure of dictionaries. * Implement this policy to support additional dictionaries. */ // TODO: Use word id instead of terminal PtNode position. class DictionaryStructureWithBufferPolicy { public: typedef std::unique_ptr<DictionaryStructureWithBufferPolicy> StructurePolicyPtr; Loading Loading
native/jni/src/defines.h +1 −0 Original line number Diff line number Diff line Loading @@ -299,6 +299,7 @@ static inline void prof_out(void) { #define NOT_AN_INDEX (-1) #define NOT_A_PROBABILITY (-1) #define NOT_A_DICT_POS (S_INT_MIN) #define NOT_A_WORD_ID (S_INT_MIN) #define NOT_A_TIMESTAMP (-1) #define NOT_A_LANGUAGE_WEIGHT (-1.0f) Loading
native/jni/src/suggest/core/dicnode/dic_node.h +2 −2 Original line number Diff line number Diff line Loading @@ -136,7 +136,7 @@ class DicNode { } void initAsChild(const DicNode *const dicNode, const int ptNodePos, const int childrenPtNodeArrayPos, const int probability, const bool isTerminal, const int childrenPtNodeArrayPos, const int probability, const int wordId, const bool hasChildren, const bool isBlacklistedOrNotAWord, const uint16_t mergedNodeCodePointCount, const int *const mergedNodeCodePoints) { uint16_t newDepth = static_cast<uint16_t>(dicNode->getNodeCodePointCount() + 1); Loading @@ -144,7 +144,7 @@ class DicNode { const uint16_t newLeavingDepth = static_cast<uint16_t>( dicNode->mDicNodeProperties.getLeavingDepth() + mergedNodeCodePointCount); mDicNodeProperties.init(ptNodePos, childrenPtNodeArrayPos, mergedNodeCodePoints[0], probability, isTerminal, hasChildren, isBlacklistedOrNotAWord, newDepth, probability, wordId, hasChildren, isBlacklistedOrNotAWord, newDepth, newLeavingDepth, dicNode->mDicNodeProperties.getPrevWordsTerminalPtNodePos()); mDicNodeState.init(&dicNode->mDicNodeState, mergedNodeCodePointCount, mergedNodeCodePoints); Loading
native/jni/src/suggest/core/dicnode/dic_node_vector.h +2 −2 Original line number Diff line number Diff line Loading @@ -59,13 +59,13 @@ class DicNodeVector { } void pushLeavingChild(const DicNode *const dicNode, const int ptNodePos, const int childrenPtNodeArrayPos, const int probability, const bool isTerminal, const int childrenPtNodeArrayPos, const int probability, const int wordId, const bool hasChildren, const bool isBlacklistedOrNotAWord, const uint16_t mergedNodeCodePointCount, const int *const mergedNodeCodePoints) { ASSERT(!mLock); mDicNodes.emplace_back(); mDicNodes.back().initAsChild(dicNode, ptNodePos, childrenPtNodeArrayPos, probability, isTerminal, hasChildren, isBlacklistedOrNotAWord, mergedNodeCodePointCount, wordId, hasChildren, isBlacklistedOrNotAWord, mergedNodeCodePointCount, mergedNodeCodePoints); } Loading
native/jni/src/suggest/core/dicnode/internal/dic_node_properties.h +8 −8 Original line number Diff line number Diff line Loading @@ -31,20 +31,20 @@ class DicNodeProperties { AK_FORCE_INLINE DicNodeProperties() : mPtNodePos(NOT_A_DICT_POS), mChildrenPtNodeArrayPos(NOT_A_DICT_POS), mProbability(NOT_A_PROBABILITY), mDicNodeCodePoint(NOT_A_CODE_POINT), mIsTerminal(false), mHasChildrenPtNodes(false), mWordId(NOT_A_WORD_ID), mHasChildrenPtNodes(false), mIsBlacklistedOrNotAWord(false), mDepth(0), mLeavingDepth(0) {} ~DicNodeProperties() {} // Should be called only once per DicNode is initialized. void init(const int pos, const int childrenPos, const int nodeCodePoint, const int probability, const bool isTerminal, const bool hasChildren, const bool isBlacklistedOrNotAWord, const int wordId, const bool hasChildren, const bool isBlacklistedOrNotAWord, const uint16_t depth, const uint16_t leavingDepth, const int *const prevWordsNodePos) { mPtNodePos = pos; mChildrenPtNodeArrayPos = childrenPos; mDicNodeCodePoint = nodeCodePoint; mProbability = probability; mIsTerminal = isTerminal; mWordId = wordId; mHasChildrenPtNodes = hasChildren; mIsBlacklistedOrNotAWord = isBlacklistedOrNotAWord; mDepth = depth; Loading @@ -58,7 +58,7 @@ class DicNodeProperties { mChildrenPtNodeArrayPos = rootPtNodeArrayPos; mDicNodeCodePoint = NOT_A_CODE_POINT; mProbability = NOT_A_PROBABILITY; mIsTerminal = false; mWordId = NOT_A_WORD_ID; mHasChildrenPtNodes = true; mIsBlacklistedOrNotAWord = false; mDepth = 0; Loading @@ -71,7 +71,7 @@ class DicNodeProperties { mChildrenPtNodeArrayPos = dicNodeProp->mChildrenPtNodeArrayPos; mDicNodeCodePoint = dicNodeProp->mDicNodeCodePoint; mProbability = dicNodeProp->mProbability; mIsTerminal = dicNodeProp->mIsTerminal; mWordId = dicNodeProp->mWordId; mHasChildrenPtNodes = dicNodeProp->mHasChildrenPtNodes; mIsBlacklistedOrNotAWord = dicNodeProp->mIsBlacklistedOrNotAWord; mDepth = dicNodeProp->mDepth; Loading @@ -86,7 +86,7 @@ class DicNodeProperties { mChildrenPtNodeArrayPos = dicNodeProp->mChildrenPtNodeArrayPos; mDicNodeCodePoint = codePoint; // Overwrite the node char of a passing child mProbability = dicNodeProp->mProbability; mIsTerminal = dicNodeProp->mIsTerminal; mWordId = dicNodeProp->mWordId; mHasChildrenPtNodes = dicNodeProp->mHasChildrenPtNodes; mIsBlacklistedOrNotAWord = dicNodeProp->mIsBlacklistedOrNotAWord; mDepth = dicNodeProp->mDepth + 1; // Increment the depth of a passing child Loading Loading @@ -121,7 +121,7 @@ class DicNodeProperties { } bool isTerminal() const { return mIsTerminal; return mWordId != NOT_A_WORD_ID; } bool hasChildren() const { Loading @@ -144,7 +144,7 @@ class DicNodeProperties { int mChildrenPtNodeArrayPos; int mProbability; int mDicNodeCodePoint; bool mIsTerminal; int mWordId; bool mHasChildrenPtNodes; bool mIsBlacklistedOrNotAWord; uint16_t mDepth; Loading
native/jni/src/suggest/core/policy/dictionary_structure_with_buffer_policy.h +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ class UnigramProperty; * This class abstracts the structure of dictionaries. * Implement this policy to support additional dictionaries. */ // TODO: Use word id instead of terminal PtNode position. class DictionaryStructureWithBufferPolicy { public: typedef std::unique_ptr<DictionaryStructureWithBufferPolicy> StructurePolicyPtr; Loading