@Test void annotate() { Annotator annotator = new TokenAnnotator(); List<String> tokens = Collections.singletonList("Single"); String expected = "Single"; List<Rule> actual = annotator.annotate(tokens); assertEquals(1, actual.size()); assertEquals("$TOKEN", 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) { if(tokens.size() == 1) return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(tokens.get(0)))); return Collections.emptyList(); }
TokenAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { if(tokens.size() == 1) return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(tokens.get(0)))); return Collections.emptyList(); } }
TokenAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { if(tokens.size() == 1) return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(tokens.get(0)))); return Collections.emptyList(); }  }
TokenAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { if(tokens.size() == 1) return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(tokens.get(0)))); return Collections.emptyList(); }  @Override List<Rule> annotate(List<String> tokens); }
TokenAnnotator implements Annotator { @Override public List<Rule> annotate(List<String> tokens) { if(tokens.size() == 1) return Collections.singletonList( new Rule(SYMBOL, StringTuple.fromList(tokens), SemanticUtils.valueFn(tokens.get(0)))); return Collections.emptyList(); }  @Override List<Rule> annotate(List<String> tokens); static final Annotator INSTANCE; }