@Test public void testBegin() { final int testTokenIndex = 0; AdaptiveFeatureGenerator generator = new PosTaggerFeatureGenerator(); generator.createFeatures(features, testSentence, testTokenIndex, testTags); Assert.assertEquals(0, features.size()); }
@Override public void createFeatures(List<String> features, String[] tokens, int index, String[] tags) { String prev, prevprev = null; String tagprev, tagprevprev; tagprev = tagprevprev = null; if (index - 1 >= 0) { prev = tokens[index - 1]; tagprev = tags[index - 1]; if (index - 2 >= 0) { prevprev = tokens[index - 2]; tagprevprev = tags[index - 2]; } else { prevprev = SB; } } else { prev = SB; } if (prev != null) { if (tagprev != null) { features.add("t=" + tagprev); } if (prevprev != null) { if (tagprevprev != null) { features.add("t2=" + tagprevprev + "," + tagprev); } } } }
PosTaggerFeatureGenerator implements AdaptiveFeatureGenerator { @Override public void createFeatures(List<String> features, String[] tokens, int index, String[] tags) { String prev, prevprev = null; String tagprev, tagprevprev; tagprev = tagprevprev = null; if (index - 1 >= 0) { prev = tokens[index - 1]; tagprev = tags[index - 1]; if (index - 2 >= 0) { prevprev = tokens[index - 2]; tagprevprev = tags[index - 2]; } else { prevprev = SB; } } else { prev = SB; } if (prev != null) { if (tagprev != null) { features.add("t=" + tagprev); } if (prevprev != null) { if (tagprevprev != null) { features.add("t2=" + tagprevprev + "," + tagprev); } } } } }
PosTaggerFeatureGenerator implements AdaptiveFeatureGenerator { @Override public void createFeatures(List<String> features, String[] tokens, int index, String[] tags) { String prev, prevprev = null; String tagprev, tagprevprev; tagprev = tagprevprev = null; if (index - 1 >= 0) { prev = tokens[index - 1]; tagprev = tags[index - 1]; if (index - 2 >= 0) { prevprev = tokens[index - 2]; tagprevprev = tags[index - 2]; } else { prevprev = SB; } } else { prev = SB; } if (prev != null) { if (tagprev != null) { features.add("t=" + tagprev); } if (prevprev != null) { if (tagprevprev != null) { features.add("t2=" + tagprevprev + "," + tagprev); } } } }  }
PosTaggerFeatureGenerator implements AdaptiveFeatureGenerator { @Override public void createFeatures(List<String> features, String[] tokens, int index, String[] tags) { String prev, prevprev = null; String tagprev, tagprevprev; tagprev = tagprevprev = null; if (index - 1 >= 0) { prev = tokens[index - 1]; tagprev = tags[index - 1]; if (index - 2 >= 0) { prevprev = tokens[index - 2]; tagprevprev = tags[index - 2]; } else { prevprev = SB; } } else { prev = SB; } if (prev != null) { if (tagprev != null) { features.add("t=" + tagprev); } if (prevprev != null) { if (tagprevprev != null) { features.add("t2=" + tagprevprev + "," + tagprev); } } } }  @Override void createFeatures(List<String> features, String[] tokens, int index,
                             String[] tags); }
PosTaggerFeatureGenerator implements AdaptiveFeatureGenerator { @Override public void createFeatures(List<String> features, String[] tokens, int index, String[] tags) { String prev, prevprev = null; String tagprev, tagprevprev; tagprev = tagprevprev = null; if (index - 1 >= 0) { prev = tokens[index - 1]; tagprev = tags[index - 1]; if (index - 2 >= 0) { prevprev = tokens[index - 2]; tagprevprev = tags[index - 2]; } else { prevprev = SB; } } else { prev = SB; } if (prev != null) { if (tagprev != null) { features.add("t=" + tagprev); } if (prevprev != null) { if (tagprevprev != null) { features.add("t2=" + tagprevprev + "," + tagprev); } } } }  @Override void createFeatures(List<String> features, String[] tokens, int index,
                             String[] tags);  }