@Test
public void simple() {

    NGramExtractor gram = new NGramExtractor(3, 4, 10000, 100, new KeywordAnalyzer());
    Automaton automaton = new RegExp("hero of legend").toAutomaton();
    assertEquals(
            new And<>(leaves("her", "ero", "ro ", "o o", " of",
                    "of ", "f l", " le", "leg", "ege", "gen", "end")),
            gram.extract(automaton));
    automaton = new RegExp("").toAutomaton();
    assertEquals(True.<String> instance(), gram.extract(automaton));
    automaton = new RegExp(".*").toAutomaton();
    assertEquals(True.<String> instance(), gram.extract(automaton));
    automaton = new RegExp("he").toAutomaton();
    assertEquals(True.<String> instance(), gram.extract(automaton));
    automaton = new RegExp("her").toAutomaton();
    assertEquals(new Leaf<>("her"), gram.extract(automaton));
}