@Test public void testTF() { AdaptiveFeatureGenerator generator = new SentenceFeatureGenerator(true, false); generator.createFeatures(features, testSentence, 2, null); Assert.assertEquals(0, features.size()); generator.createFeatures(features, testSentence, 0, null); Assert.assertEquals(1, features.size()); Assert.assertEquals("S=begin", features.get(0)); features.clear(); generator.createFeatures(features, testSentence, testSentence.length - 1, null); Assert.assertEquals(0, features.size()); features.clear(); generator.createFeatures(features, testShort, 0, null); Assert.assertEquals(1, features.size()); Assert.assertEquals("S=begin", features.get(0)); }
public void createFeatures(List<String> features, String[] tokens, int index, String[] previousOutcomes) { if (isGenerateFirstWordFeature && index == 0) { features.add("S=begin"); } if (isGenerateLastWordFeature && tokens.length == index + 1) { features.add("S=end"); } }
SentenceFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] previousOutcomes) { if (isGenerateFirstWordFeature && index == 0) { features.add("S=begin"); } if (isGenerateLastWordFeature && tokens.length == index + 1) { features.add("S=end"); } } }
SentenceFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] previousOutcomes) { if (isGenerateFirstWordFeature && index == 0) { features.add("S=begin"); } if (isGenerateLastWordFeature && tokens.length == index + 1) { features.add("S=end"); } } SentenceFeatureGenerator(boolean isGenerateFirstWordFeature,
      boolean isGenerateLastWordFeature); }
SentenceFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] previousOutcomes) { if (isGenerateFirstWordFeature && index == 0) { features.add("S=begin"); } if (isGenerateLastWordFeature && tokens.length == index + 1) { features.add("S=end"); } } SentenceFeatureGenerator(boolean isGenerateFirstWordFeature,
      boolean isGenerateLastWordFeature); void createFeatures(List<String> features, String[] tokens, int index,
      String[] previousOutcomes); }
SentenceFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] previousOutcomes) { if (isGenerateFirstWordFeature && index == 0) { features.add("S=begin"); } if (isGenerateLastWordFeature && tokens.length == index + 1) { features.add("S=end"); } } SentenceFeatureGenerator(boolean isGenerateFirstWordFeature,
      boolean isGenerateLastWordFeature); void createFeatures(List<String> features, String[] tokens, int index,
      String[] previousOutcomes);  }