@Test public void testGetBest() { jCas.setDocumentText("Simon Brown"); Entity a = new Entity(jCas, 0, 5); Entity b = new Entity(jCas, 0, 11); Entity c = new Entity(jCas, 6, 11); List<Entity> entities = new ArrayList<>(); entities.add(a); entities.add(b); entities.add(c); assertEquals(b, ReferentToEntity.getBestEntity(entities)); }
protected static Entity getBestEntity(Collection<Entity> list) { return list.stream() .reduce((a, b) -> isBetterEntity(a, b) ? b : a) .orElseThrow(() -> new RuntimeException("Should always produce an entity")); }
ReferentToEntity extends BaleenAnnotator { protected static Entity getBestEntity(Collection<Entity> list) { return list.stream() .reduce((a, b) -> isBetterEntity(a, b) ? b : a) .orElseThrow(() -> new RuntimeException("Should always produce an entity")); } }
ReferentToEntity extends BaleenAnnotator { protected static Entity getBestEntity(Collection<Entity> list) { return list.stream() .reduce((a, b) -> isBetterEntity(a, b) ? b : a) .orElseThrow(() -> new RuntimeException("Should always produce an entity")); }  }
ReferentToEntity extends BaleenAnnotator { protected static Entity getBestEntity(Collection<Entity> list) { return list.stream() .reduce((a, b) -> isBetterEntity(a, b) ? b : a) .orElseThrow(() -> new RuntimeException("Should always produce an entity")); }  @Override AnalysisEngineAction getAction(); }
ReferentToEntity extends BaleenAnnotator { protected static Entity getBestEntity(Collection<Entity> list) { return list.stream() .reduce((a, b) -> isBetterEntity(a, b) ? b : a) .orElseThrow(() -> new RuntimeException("Should always produce an entity")); }  @Override AnalysisEngineAction getAction();  }