am da93bc54: Merge "Remove useless methods from DicNode."

* commit 'da93bc54b26db57a8590634746f74954717dac37':
  Remove useless methods from DicNode.
main
Keisuke Kuroyanagi 2014-04-01 05:46:19 +00:00 committed by Android Git Automerger
commit 95ea6eb6c5
1 changed files with 8 additions and 35 deletions

View File

@ -44,7 +44,8 @@
+ mDicNodeState.mDicNodeStateOutput.getPrevWordsLength(), \ + mDicNodeState.mDicNodeStateOutput.getPrevWordsLength(), \
charBuf, NELEMS(charBuf)); \ charBuf, NELEMS(charBuf)); \
AKLOGI("#%8s, %5f, %5f, %5f, %5f, %s, %d, %5f,", header, \ AKLOGI("#%8s, %5f, %5f, %5f, %5f, %s, %d, %5f,", header, \
getSpatialDistanceForScoring(), getLanguageDistanceForScoring(), \ getSpatialDistanceForScoring(), \
mDicNodeState.mDicNodeStateScoring.getLanguageDistance(), \
getNormalizedCompoundDistance(), getRawLength(), charBuf, \ getNormalizedCompoundDistance(), getRawLength(), charBuf, \
getInputIndex(0), getNormalizedCompoundDistanceAfterFirstWord()); \ getInputIndex(0), getNormalizedCompoundDistanceAfterFirstWord()); \
} while (0) } while (0)
@ -121,8 +122,10 @@ class DicNode {
void initAsPassingChild(DicNode *parentDicNode) { void initAsPassingChild(DicNode *parentDicNode) {
mIsCachedForNextSuggestion = parentDicNode->mIsCachedForNextSuggestion; mIsCachedForNextSuggestion = parentDicNode->mIsCachedForNextSuggestion;
const int parentCodePoint = parentDicNode->getNodeTypedCodePoint(); const int codePoint =
mDicNodeProperties.init(&parentDicNode->mDicNodeProperties, parentCodePoint); parentDicNode->mDicNodeState.mDicNodeStateOutput.getCurrentWordCodePointAt(
parentDicNode->getNodeCodePointCount());
mDicNodeProperties.init(&parentDicNode->mDicNodeProperties, codePoint);
mDicNodeState.initByCopy(&parentDicNode->mDicNodeState); mDicNodeState.initByCopy(&parentDicNode->mDicNodeState);
PROF_NODE_COPY(&parentDicNode->mProfiler, mProfiler); PROF_NODE_COPY(&parentDicNode->mProfiler, mProfiler);
} }
@ -168,11 +171,6 @@ class DicNode {
mIsCachedForNextSuggestion = true; mIsCachedForNextSuggestion = true;
} }
// Used to expand the node in DicNodeUtils
int getNodeTypedCodePoint() const {
return mDicNodeState.mDicNodeStateOutput.getCurrentWordCodePointAt(getNodeCodePointCount());
}
// Check if the current word and the previous word can be considered as a valid multiple word // Check if the current word and the previous word can be considered as a valid multiple word
// suggestion. // suggestion.
bool isValidMultipleWordSuggestion() const { bool isValidMultipleWordSuggestion() const {
@ -243,17 +241,13 @@ class DicNode {
} }
bool isTotalInputSizeExceedingLimit() const { bool isTotalInputSizeExceedingLimit() const {
const int prevWordsLen = mDicNodeState.mDicNodeStateOutput.getPrevWordsLength();
const int currentWordDepth = getNodeCodePointCount();
// TODO: 3 can be 2? Needs to be investigated. // TODO: 3 can be 2? Needs to be investigated.
// TODO: Have a const variable for 3 (or 2) // TODO: Have a const variable for 3 (or 2)
return prevWordsLen + currentWordDepth > MAX_WORD_LENGTH - 3; return getTotalNodeCodePointCount() > MAX_WORD_LENGTH - 3;
} }
void outputResult(int *dest) const { void outputResult(int *dest) const {
const uint16_t prevWordLength = mDicNodeState.mDicNodeStateOutput.getPrevWordsLength(); memmove(dest, getOutputWordBuf(), getTotalNodeCodePointCount() * sizeof(dest[0]));
const uint16_t currentDepth = getNodeCodePointCount();
memmove(dest, getOutputWordBuf(), (prevWordLength + currentDepth) * sizeof(dest[0]));
DUMP_WORD_AND_SCORE("OUTPUT"); DUMP_WORD_AND_SCORE("OUTPUT");
} }
@ -311,11 +305,6 @@ class DicNode {
return mDicNodeState.mDicNodeStateScoring.getCompoundDistance(languageWeight); return mDicNodeState.mDicNodeStateScoring.getCompoundDistance(languageWeight);
} }
// Used to commit input partially
int getPrevWordPtNodePos() const {
return mDicNodeProperties.getPrevWordTerminalPtNodePos();
}
AK_FORCE_INLINE const int *getOutputWordBuf() const { AK_FORCE_INLINE const int *getOutputWordBuf() const {
return mDicNodeState.mDicNodeStateOutput.getCodePointBuf(); return mDicNodeState.mDicNodeStateOutput.getCodePointBuf();
} }
@ -378,10 +367,6 @@ class DicNode {
return mDicNodeState.mDicNodeStateScoring.getSpatialDistance(); return mDicNodeState.mDicNodeStateScoring.getSpatialDistance();
} }
float getLanguageDistanceForScoring() const {
return mDicNodeState.mDicNodeStateScoring.getLanguageDistance();
}
// For space-aware gestures, we store the normalized distance at the char index // For space-aware gestures, we store the normalized distance at the char index
// that ends the first word of the suggestion. We call this the distance after // that ends the first word of the suggestion. We call this the distance after
// first word. // first word.
@ -389,22 +374,10 @@ class DicNode {
return mDicNodeState.mDicNodeStateScoring.getNormalizedCompoundDistanceAfterFirstWord(); return mDicNodeState.mDicNodeStateScoring.getNormalizedCompoundDistanceAfterFirstWord();
} }
float getLanguageDistanceRatePerWordForScoring() const {
const float langDist = getLanguageDistanceForScoring();
const float totalWordCount =
static_cast<float>(mDicNodeState.mDicNodeStateOutput.getPrevWordCount() + 1);
return langDist / totalWordCount;
}
float getRawLength() const { float getRawLength() const {
return mDicNodeState.mDicNodeStateScoring.getRawLength(); return mDicNodeState.mDicNodeStateScoring.getRawLength();
} }
bool isLessThanOneErrorForScoring() const {
return mDicNodeState.mDicNodeStateScoring.getEditCorrectionCount()
+ mDicNodeState.mDicNodeStateScoring.getProximityCorrectionCount() <= 1;
}
DoubleLetterLevel getDoubleLetterLevel() const { DoubleLetterLevel getDoubleLetterLevel() const {
return mDicNodeState.mDicNodeStateScoring.getDoubleLetterLevel(); return mDicNodeState.mDicNodeStateScoring.getDoubleLetterLevel();
} }