diff --git a/native/src/unigram_dictionary.cpp b/native/src/unigram_dictionary.cpp
index 9f8f04e50ae02cca9cce51f4f32edd7d9ca8f3ad..b95da99a3f3b95bc264b036c6ca1bfe1afebd535 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) {