@Test public void testFeatureGeneration() throws IOException { POSTaggerNameFeatureGenerator fg = new POSTaggerNameFeatureGenerator( POSTaggerMETest.trainPOSModel(ModelType.MAXENT)); String[] tokens = {"Hi", "Mike", ",", "it", "'s", "Stefanie", "Schmidt", "."}; for (int i = 0; i < tokens.length; i++) { List<String> feats = new ArrayList<>(); fg.createFeatures(feats, tokens, i, null); Assert.assertTrue(feats.get(0).startsWith("pos=")); } }
public void createFeatures(List<String> feats, String[] toks, int index, String[] preds) { if (!Arrays.equals(this.cachedTokens, toks)) { this.cachedTokens = toks; this.cachedTags = this.posTagger.tag(toks); } feats.add("pos=" + this.cachedTags[index]); }
POSTaggerNameFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> feats, String[] toks, int index, String[] preds) { if (!Arrays.equals(this.cachedTokens, toks)) { this.cachedTokens = toks; this.cachedTags = this.posTagger.tag(toks); } feats.add("pos=" + this.cachedTags[index]); } }
POSTaggerNameFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> feats, String[] toks, int index, String[] preds) { if (!Arrays.equals(this.cachedTokens, toks)) { this.cachedTokens = toks; this.cachedTags = this.posTagger.tag(toks); } feats.add("pos=" + this.cachedTags[index]); } POSTaggerNameFeatureGenerator(POSTagger aPosTagger);  POSTaggerNameFeatureGenerator(POSModel aPosModel); }
POSTaggerNameFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> feats, String[] toks, int index, String[] preds) { if (!Arrays.equals(this.cachedTokens, toks)) { this.cachedTokens = toks; this.cachedTags = this.posTagger.tag(toks); } feats.add("pos=" + this.cachedTags[index]); } POSTaggerNameFeatureGenerator(POSTagger aPosTagger);  POSTaggerNameFeatureGenerator(POSModel aPosModel); void createFeatures(List<String> feats, String[] toks, int index, String[] preds); }
POSTaggerNameFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> feats, String[] toks, int index, String[] preds) { if (!Arrays.equals(this.cachedTokens, toks)) { this.cachedTokens = toks; this.cachedTags = this.posTagger.tag(toks); } feats.add("pos=" + this.cachedTags[index]); } POSTaggerNameFeatureGenerator(POSTagger aPosTagger);  POSTaggerNameFeatureGenerator(POSModel aPosModel); void createFeatures(List<String> feats, String[] toks, int index, String[] preds);  }