From f071e75b781ebb9e1b8dd5b3111af9a92de66bc1 Mon Sep 17 00:00:00 2001
From: satok <satok@google.com>
Date: Thu, 4 Aug 2011 18:32:37 +0900
Subject: [PATCH] Change the prune condition

Change-Id: I92aef12e0e1d89cfe1b346ddc6ef4df158ffe0b3
---
 native/src/unigram_dictionary.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp
index 9f8f04e50a..b95da99a3f 100644
--- a/native/src/unigram_dictionary.cpp
+++ b/native/src/unigram_dictionary.cpp
@@ -808,7 +808,8 @@ inline bool UnigramDictionary::processCurrentNode(const int initialPos, const in
             }
         }
         // Optimization: Prune out words that are too long compared to how much was typed.
-        if (correctionState->getOutputIndex() >= maxDepth || diffs > mMaxEditDistance) {
+        if (isTerminal
+                && (correctionState->getOutputIndex() >= maxDepth || diffs > mMaxEditDistance)) {
             // We are giving up parsing this node and its children. Skip the rest of the node,
             // output the sibling position, and return that we don't want to traverse children.
             if (!isLastChar) {
-- 
GitLab