Search in sources :

Example 6 with WordInfo

use of com.android.inputmethod.latin.NgramContext.WordInfo in project android_packages_inputmethods_LatinIME by CyanogenMod.

the class NgramContextTests method testGetNextNgramContext.

public void testGetNextNgramContext() {
    final NgramContext ngramContext_a = new NgramContext(new WordInfo("a"));
    final NgramContext ngramContext_b_a = ngramContext_a.getNextNgramContext(new WordInfo("b"));
    assertEquals("b", ngramContext_b_a.getNthPrevWord(1));
    assertEquals("a", ngramContext_b_a.getNthPrevWord(2));
    final NgramContext ngramContext_bos_b = ngramContext_b_a.getNextNgramContext(WordInfo.BEGINNING_OF_SENTENCE_WORD_INFO);
    assertTrue(ngramContext_bos_b.isBeginningOfSentenceContext());
    assertEquals("b", ngramContext_bos_b.getNthPrevWord(2));
    final NgramContext ngramContext_c_bos = ngramContext_b_a.getNextNgramContext(new WordInfo("c"));
    assertEquals("c", ngramContext_c_bos.getNthPrevWord(1));
}
Also used : WordInfo(com.android.inputmethod.latin.NgramContext.WordInfo)

Aggregations

WordInfo (com.android.inputmethod.latin.NgramContext.WordInfo)6 NgramContext (com.android.inputmethod.latin.NgramContext)2 Nonnull (javax.annotation.Nonnull)1