@Test public void testPeopleOfLocation() throws Exception { jCas.setDocumentText("The people of Scotland voted in an independence referendum"); Location l = new Location(jCas, 14, 22); l.addToIndexes(); processJCas(); assertEquals(0, JCasUtil.select(jCas, Location.class).size()); assertEquals(1, JCasUtil.select(jCas, Organisation.class).size()); assertEquals( "people of Scotland", JCasUtil.selectByIndex(jCas, Organisation.class, 0).getCoveredText()); }
private void peopleOfLocation(JCas jCas) { List<Location> toRemove = new ArrayList<>(); for (Location loc : JCasUtil.select(jCas, Location.class)) { String precedingText = jCas.getDocumentText().substring(0, loc.getBegin()).toLowerCase(); if (precedingText.endsWith("people of ")) { Organisation o = new Organisation(jCas, loc.getBegin() - 10, loc.getEnd()); addToJCasIndex(o); if (removeOriginal) toRemove.add(loc); } } removeFromJCasIndex(toRemove); }
People extends BaleenAnnotator { private void peopleOfLocation(JCas jCas) { List<Location> toRemove = new ArrayList<>(); for (Location loc : JCasUtil.select(jCas, Location.class)) { String precedingText = jCas.getDocumentText().substring(0, loc.getBegin()).toLowerCase(); if (precedingText.endsWith("people of ")) { Organisation o = new Organisation(jCas, loc.getBegin() - 10, loc.getEnd()); addToJCasIndex(o); if (removeOriginal) toRemove.add(loc); } } removeFromJCasIndex(toRemove); } }
People extends BaleenAnnotator { private void peopleOfLocation(JCas jCas) { List<Location> toRemove = new ArrayList<>(); for (Location loc : JCasUtil.select(jCas, Location.class)) { String precedingText = jCas.getDocumentText().substring(0, loc.getBegin()).toLowerCase(); if (precedingText.endsWith("people of ")) { Organisation o = new Organisation(jCas, loc.getBegin() - 10, loc.getEnd()); addToJCasIndex(o); if (removeOriginal) toRemove.add(loc); } } removeFromJCasIndex(toRemove); }  }
People extends BaleenAnnotator { private void peopleOfLocation(JCas jCas) { List<Location> toRemove = new ArrayList<>(); for (Location loc : JCasUtil.select(jCas, Location.class)) { String precedingText = jCas.getDocumentText().substring(0, loc.getBegin()).toLowerCase(); if (precedingText.endsWith("people of ")) { Organisation o = new Organisation(jCas, loc.getBegin() - 10, loc.getEnd()); addToJCasIndex(o); if (removeOriginal) toRemove.add(loc); } } removeFromJCasIndex(toRemove); }  @Override AnalysisEngineAction getAction(); }
People extends BaleenAnnotator { private void peopleOfLocation(JCas jCas) { List<Location> toRemove = new ArrayList<>(); for (Location loc : JCasUtil.select(jCas, Location.class)) { String precedingText = jCas.getDocumentText().substring(0, loc.getBegin()).toLowerCase(); if (precedingText.endsWith("people of ")) { Organisation o = new Organisation(jCas, loc.getBegin() - 10, loc.getEnd()); addToJCasIndex(o); if (removeOriginal) toRemove.add(loc); } } removeFromJCasIndex(toRemove); }  @Override AnalysisEngineAction getAction(); static final String PARAM_REMOVE_ORIGINAL; }