@Test public void maxNgrams() { NGramExtractor gram = new NGramExtractor(3, 4, 10000, 3, new KeywordAnalyzer()); Automaton automaton = new RegExp("hero of legend").toAutomaton(); assertEquals( new And<>(leaves("her", "ero", "ro ")), gram.extract(automaton)); }
public Expression<String> extract(Automaton automaton) { if (automaton.isAccept(0)) { return True.instance(); } return new NGramAutomaton(automaton, gramSize, maxExpand, maxStatesTraced, maxNgrams, ngramAnalyzer).expression().simplify(); }
NGramExtractor { public Expression<String> extract(Automaton automaton) { if (automaton.isAccept(0)) { return True.instance(); } return new NGramAutomaton(automaton, gramSize, maxExpand, maxStatesTraced, maxNgrams, ngramAnalyzer).expression().simplify(); } }
NGramExtractor { public Expression<String> extract(Automaton automaton) { if (automaton.isAccept(0)) { return True.instance(); } return new NGramAutomaton(automaton, gramSize, maxExpand, maxStatesTraced, maxNgrams, ngramAnalyzer).expression().simplify(); } NGramExtractor(int gramSize, int maxExpand, int maxStatesTraced, int maxNgrams, Analyzer ngramAnalyzer); }
NGramExtractor { public Expression<String> extract(Automaton automaton) { if (automaton.isAccept(0)) { return True.instance(); } return new NGramAutomaton(automaton, gramSize, maxExpand, maxStatesTraced, maxNgrams, ngramAnalyzer).expression().simplify(); } NGramExtractor(int gramSize, int maxExpand, int maxStatesTraced, int maxNgrams, Analyzer ngramAnalyzer); Expression<String> extract(Automaton automaton); }
NGramExtractor { public Expression<String> extract(Automaton automaton) { if (automaton.isAccept(0)) { return True.instance(); } return new NGramAutomaton(automaton, gramSize, maxExpand, maxStatesTraced, maxNgrams, ngramAnalyzer).expression().simplify(); } NGramExtractor(int gramSize, int maxExpand, int maxStatesTraced, int maxNgrams, Analyzer ngramAnalyzer); Expression<String> extract(Automaton automaton);  }