@Test void annotate() { Annotator annotator = new PhraseAnnotator(); List<String> tokens = Arrays.asList( "The", "boy", "who", "cried" ); String expected = "The boy who cried"; List<Rule> actual = annotator.annotate(tokens); assertEquals(1, actual.size()); assertEquals("$PHRASE", actual.get(0).getLHS()); assertEquals(expected, actual.get(0).getRHS().toString()); assertEquals(expected, actual.get(0) .getSemantics().apply(null) .get(0).get(SemanticUtils.KEY_UNNAMED));; }
@Override public List<Rule> annotate(List<String> tokens) { String phrase = StringTuple.joinList(" ", tokens); return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(phrase))); }
PhraseAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { String phrase = StringTuple.joinList(" ", tokens); return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(phrase))); } }
PhraseAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { String phrase = StringTuple.joinList(" ", tokens); return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(phrase))); }  }
PhraseAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { String phrase = StringTuple.joinList(" ", tokens); return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(phrase))); }  @Override List<Rule> annotate(List<String> tokens); }
PhraseAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { String phrase = StringTuple.joinList(" ", tokens); return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(phrase))); }  @Override List<Rule> annotate(List<String> tokens); static final Annotator INSTANCE; }