am d5f5dd74: Quit suggest words that do not include proximity chars.

* commit 'd5f5dd74c2e0946d4686a4f22cda1591b34b6729':
  Quit suggest words that do not include proximity chars.
main
Keisuke Kuroyanagi 2013-12-17 21:40:52 -08:00 committed by Android Git Automerger
commit 43afae3a48
2 changed files with 10 additions and 0 deletions

View File

@ -280,6 +280,13 @@ class DicNode {
return !(currentDepth > 0 && (currentDepth != 1 || prevWordLen != 1)); return !(currentDepth > 0 && (currentDepth != 1 || prevWordLen != 1));
} }
bool hasMatchedOrProximityCodePoints() const {
// This DicNode does not have matched or proximity code points when all code points have
// been handled as edit corrections so far.
return mDicNodeState.mDicNodeStateScoring.getEditCorrectionCount()
< getNodeCodePointCount();
}
bool isTotalInputSizeExceedingLimit() const { bool isTotalInputSizeExceedingLimit() const {
const int prevWordsLen = mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength(); const int prevWordsLen = mDicNodeState.mDicNodeStatePrevWord.getPrevWordLength();
const int currentWordDepth = getNodeCodePointCount(); const int currentWordDepth = getNodeCodePointCount();

View File

@ -459,6 +459,9 @@ void Suggest::processTerminalDicNode(
Weighting::addCostAndForwardInputIndex(WEIGHTING, CT_TERMINAL_INSERTION, traverseSession, 0, Weighting::addCostAndForwardInputIndex(WEIGHTING, CT_TERMINAL_INSERTION, traverseSession, 0,
&terminalDicNode, traverseSession->getMultiBigramMap()); &terminalDicNode, traverseSession->getMultiBigramMap());
} }
if (!dicNode->hasMatchedOrProximityCodePoints()) {
return;
}
Weighting::addCostAndForwardInputIndex(WEIGHTING, CT_TERMINAL, traverseSession, 0, Weighting::addCostAndForwardInputIndex(WEIGHTING, CT_TERMINAL, traverseSession, 0,
&terminalDicNode, traverseSession->getMultiBigramMap()); &terminalDicNode, traverseSession->getMultiBigramMap());
traverseSession->getDicTraverseCache()->copyPushTerminal(&terminalDicNode); traverseSession->getDicTraverseCache()->copyPushTerminal(&terminalDicNode);