diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
index e55bb1664b1f688eddfba521e3e6bde77aad3515..29f11466228eec28aadc04fef41c2addd46cfcad 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderUtils.java
@@ -323,7 +323,7 @@ public final class BinaryDictDecoderUtils {
     /**
      * Reads and returns the PtNode count out of a buffer and forwards the pointer.
      */
-    public static int readPtNodeCount(final DictBuffer dictBuffer) {
+    /* package */ static int readPtNodeCount(final DictBuffer dictBuffer) {
         final int msb = dictBuffer.readUnsignedByte();
         if (FormatSpec.MAX_PTNODES_FOR_ONE_BYTE_PTNODE_COUNT >= msb) {
             return msb;
diff --git a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java b/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
index 245f0038bab0efdb46bd4cf25ed566aeb6a0458a..a08e28c8bb4f2da28ba7611d628396cf3732501d 100644
--- a/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
+++ b/java/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtils.java
@@ -169,7 +169,7 @@ public final class BinaryDictIOUtils {
      * @throws UnsupportedFormatException if the format of the file is not recognized.
      */
     @UsedForTesting
-    public static int getTerminalPosition(final Ver3DictDecoder dictDecoder,
+    /* package */ static int getTerminalPosition(final Ver3DictDecoder dictDecoder,
             final String word) throws IOException, UnsupportedFormatException {
         final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
         if (word == null) return FormatSpec.NOT_VALID_WORD;
diff --git a/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
index 5be506999e031a3d9d12e713914cf75192178235..d5fcacc09dd53d12009304fbbcd1f20cc7f58eb4 100644
--- a/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
+++ b/java/src/com/android/inputmethod/latin/makedict/DictDecoder.java
@@ -58,6 +58,19 @@ public interface DictDecoder {
     public FusionDictionary readDictionaryBinary(final FusionDictionary dict)
             throws FileNotFoundException, IOException, UnsupportedFormatException;
 
+    /**
+     * Gets the address of the last PtNode of the exact matching word in the dictionary.
+     * If no match is found, returns NOT_VALID_WORD.
+     *
+     * @param word the word we search for.
+     * @return the address of the terminal node.
+     * @throws IOException if the file can't be read.
+     * @throws UnsupportedFormatException if the format of the file is not recognized.
+     */
+    @UsedForTesting
+    public int getTerminalPosition(final String word)
+            throws IOException, UnsupportedFormatException;
+
     // Flags for DictionaryBufferFactory.
     public static final int USE_READONLY_BYTEBUFFER = 0x01000000;
     public static final int USE_BYTEARRAY = 0x02000000;
diff --git a/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java b/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java
index 77dba8853e830631fdb05206bde7d506ed4d5e81..bf3d1910151c45e815413f9779154c4034508b5f 100644
--- a/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java
+++ b/java/src/com/android/inputmethod/latin/makedict/DynamicBinaryDictIOUtils.java
@@ -60,7 +60,7 @@ public final class DynamicBinaryDictIOUtils {
         final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
         dictBuffer.position(0);
         final FileHeader header = dictDecoder.readHeader();
-        final int wordPosition = BinaryDictIOUtils.getTerminalPosition(dictDecoder, word);
+        final int wordPosition = dictDecoder.getTerminalPosition(word);
         if (wordPosition == FormatSpec.NOT_VALID_WORD) return;
 
         dictBuffer.position(wordPosition);
@@ -263,7 +263,7 @@ public final class DynamicBinaryDictIOUtils {
         final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
         if (bigramStrings != null) {
             for (final WeightedString bigram : bigramStrings) {
-                int position = BinaryDictIOUtils.getTerminalPosition(dictDecoder, bigram.mWord);
+                int position = dictDecoder.getTerminalPosition(bigram.mWord);
                 if (position == FormatSpec.NOT_VALID_WORD) {
                     // TODO: figure out what is the correct thing to do here.
                 } else {
diff --git a/java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java b/java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java
index 51e101f9407c28eb6a051eebcd4ecf467304018a..77e6393ee9c0dcd202ddb75ac7338118ae14ba31 100644
--- a/java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java
+++ b/java/src/com/android/inputmethod/latin/makedict/Ver3DictDecoder.java
@@ -309,4 +309,12 @@ public class Ver3DictDecoder implements DictDecoder {
         }
         return BinaryDictDecoderUtils.readDictionaryBinary(this, dict);
     }
+
+    @Override
+    public int getTerminalPosition(String word) throws IOException, UnsupportedFormatException {
+        if (mDictBuffer == null) {
+            openDictBuffer();
+        }
+        return BinaryDictIOUtils.getTerminalPosition(this, word);
+    }
 }
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
index 98f06a6c289395d27f27ac01529cf554e2cb5ac5..bb5b96a485c84fad7bad7b94637e58578484ced7 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictDecoderEncoderTests.java
@@ -555,7 +555,7 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
         int position = -1;
         try {
             final long now = System.nanoTime();
-            position = BinaryDictIOUtils.getTerminalPosition(dictDecoder, word);
+            position = dictDecoder.getTerminalPosition(word);
             diff = System.nanoTime() - now;
         } catch (IOException e) {
             Log.e(TAG, "IOException while getTerminalPosition", e);
@@ -596,16 +596,13 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
         try {
             // too long word
             final String longWord = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
-            assertEquals(FormatSpec.NOT_VALID_WORD,
-                    BinaryDictIOUtils.getTerminalPosition(dictDecoder, longWord));
+            assertEquals(FormatSpec.NOT_VALID_WORD, dictDecoder.getTerminalPosition(longWord));
 
             // null
-            assertEquals(FormatSpec.NOT_VALID_WORD,
-                    BinaryDictIOUtils.getTerminalPosition(dictDecoder, null));
+            assertEquals(FormatSpec.NOT_VALID_WORD, dictDecoder.getTerminalPosition(null));
 
             // empty string
-            assertEquals(FormatSpec.NOT_VALID_WORD,
-                    BinaryDictIOUtils.getTerminalPosition(dictDecoder, ""));
+            assertEquals(FormatSpec.NOT_VALID_WORD, dictDecoder.getTerminalPosition(""));
         } catch (IOException e) {
         } catch (UnsupportedFormatException e) {
         }
@@ -655,16 +652,16 @@ public class BinaryDictDecoderEncoderTests extends AndroidTestCase {
 
         try {
             MoreAsserts.assertNotEqual(FormatSpec.NOT_VALID_WORD,
-                    BinaryDictIOUtils.getTerminalPosition(dictDecoder, sWords.get(0)));
+                    dictDecoder.getTerminalPosition(sWords.get(0)));
             DynamicBinaryDictIOUtils.deleteWord(dictDecoder, sWords.get(0));
             assertEquals(FormatSpec.NOT_VALID_WORD,
-                    BinaryDictIOUtils.getTerminalPosition(dictDecoder, sWords.get(0)));
+                    dictDecoder.getTerminalPosition(sWords.get(0)));
 
             MoreAsserts.assertNotEqual(FormatSpec.NOT_VALID_WORD,
-                    BinaryDictIOUtils.getTerminalPosition(dictDecoder, sWords.get(5)));
+                    dictDecoder.getTerminalPosition(sWords.get(5)));
             DynamicBinaryDictIOUtils.deleteWord(dictDecoder, sWords.get(5));
             assertEquals(FormatSpec.NOT_VALID_WORD,
-                    BinaryDictIOUtils.getTerminalPosition(dictDecoder, sWords.get(5)));
+                    dictDecoder.getTerminalPosition(sWords.get(5)));
         } catch (IOException e) {
         } catch (UnsupportedFormatException e) {
         }
diff --git a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java
index be9323b81d6b370a0d0d542eeca6139deec408c1..7a6708bb397e2ab593abcb2daa75aa059e876c07 100644
--- a/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOUtilsTests.java
@@ -142,8 +142,7 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
 
         try {
             final Ver3DictDecoder dictDecoder = new Ver3DictDecoder(file);
-            dictDecoder.openDictBuffer();
-            position = BinaryDictIOUtils.getTerminalPosition(dictDecoder, word);
+            position = dictDecoder.getTerminalPosition(word);
         } catch (IOException e) {
         } catch (UnsupportedFormatException e) {
         }
@@ -161,7 +160,7 @@ public class BinaryDictIOUtilsTests extends AndroidTestCase {
      */
     private static PtNodeInfo findWordByBinaryDictReader(final Ver3DictDecoder dictDecoder,
             final String word) throws IOException, UnsupportedFormatException {
-        int position = BinaryDictIOUtils.getTerminalPosition(dictDecoder, word);
+        int position = dictDecoder.getTerminalPosition(word);
         final DictBuffer dictBuffer = dictDecoder.getDictBuffer();
         if (position != FormatSpec.NOT_VALID_WORD) {
             dictBuffer.position(0);