ACPOSContextGenerator implements POSContextGenerator { @Override public String[] getContext(int pos, String[] tokens, String[] prevTags, Object[] ac) { ArrayList<String> result = Lists.newArrayListWithExpectedSize( ac == null ? 0 : ac.length + 2); for (Object acVal : ac) { if (acVal instanceof String) { result.add((String) acVal); } } ContextGeneratorUtils.addPreviousTags(pos, prevTags, prevTagsInHistory, result); return result.toArray(new String[result.size()]); } ACPOSContextGenerator();  ACPOSContextGenerator(int prevTagsInHistory); @Override String[] getContext(int pos, String[] tokens, String[] prevTags, Object[] ac);  }
@Test public void testWithNullPrevTags() { POSContextGenerator cg = new ACPOSContextGenerator(2); Assert.assertArrayEquals(new String[]{"w=what"}, cg.getContext(0, TOKENS_1, null, AC_1[0])); }
@Test public void testWithEmptyPrevTags() { POSContextGenerator cg = new ACPOSContextGenerator(2); Assert.assertArrayEquals(new String[]{"w=what"}, cg.getContext(0, TOKENS_1, new String[0], AC_1[0])); }
@Test public void testWithSinglePrevTag() { POSContextGenerator cg = new ACPOSContextGenerator(2); Assert.assertArrayEquals(new String[]{"w=do", "pt1=wh"}, cg.getContext(1, TOKENS_1, new String[]{"wh"}, AC_1[1])); }
@Test public void testWithPrevTags2() { POSContextGenerator cg = new ACPOSContextGenerator(2); Assert.assertArrayEquals(new String[]{"w=you", "pt1=v", "pt2=wh"}, cg.getContext(2, TOKENS_1, new String[]{"wh", "v"}, AC_1[2])); }
@Test public void testWithPrevTags3() { POSContextGenerator cg = new ACPOSContextGenerator(2); Assert.assertArrayEquals(new String[]{"w=see", "pt1=pr", "pt2=v"}, cg.getContext(3, TOKENS_1, new String[]{"wh", "v", "pr"}, AC_1[3])); }