@Test public void testDefault() { final int testTokenIndex = 3; AdaptiveFeatureGenerator generator = new CharacterNgramFeatureGenerator(); generator.createFeatures(features, testSentence, testTokenIndex, null); assertContainsNg(features, "ex", "exa", "exam", "examp", "xa", "xam", "xamp", "xampl", "am", "amp", "ampl", "ample", "mp", "mpl", "mple", "pl", "ple", "le"); }
public void createFeatures(List<String> features, String[] tokens, int index, String[] preds) { NGramModel model = new NGramModel(); model.add(tokens[index], minLength, maxLength); for (StringList tokenList : model) { if (tokenList.size() > 0) { features.add("ng=" + StringUtil.toLowerCase(tokenList.getToken(0))); } } }
CharacterNgramFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] preds) { NGramModel model = new NGramModel(); model.add(tokens[index], minLength, maxLength); for (StringList tokenList : model) { if (tokenList.size() > 0) { features.add("ng=" + StringUtil.toLowerCase(tokenList.getToken(0))); } } } }
CharacterNgramFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] preds) { NGramModel model = new NGramModel(); model.add(tokens[index], minLength, maxLength); for (StringList tokenList : model) { if (tokenList.size() > 0) { features.add("ng=" + StringUtil.toLowerCase(tokenList.getToken(0))); } } } CharacterNgramFeatureGenerator(int minLength, int maxLength);  CharacterNgramFeatureGenerator(); }
CharacterNgramFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] preds) { NGramModel model = new NGramModel(); model.add(tokens[index], minLength, maxLength); for (StringList tokenList : model) { if (tokenList.size() > 0) { features.add("ng=" + StringUtil.toLowerCase(tokenList.getToken(0))); } } } CharacterNgramFeatureGenerator(int minLength, int maxLength);  CharacterNgramFeatureGenerator(); void createFeatures(List<String> features, String[] tokens, int index, String[] preds); }
CharacterNgramFeatureGenerator implements AdaptiveFeatureGenerator { public void createFeatures(List<String> features, String[] tokens, int index, String[] preds) { NGramModel model = new NGramModel(); model.add(tokens[index], minLength, maxLength); for (StringList tokenList : model) { if (tokenList.size() > 0) { features.add("ng=" + StringUtil.toLowerCase(tokenList.getToken(0))); } } } CharacterNgramFeatureGenerator(int minLength, int maxLength);  CharacterNgramFeatureGenerator(); void createFeatures(List<String> features, String[] tokens, int index, String[] preds);  }