json.put(FIELD_EXTERNAL_ID, id); json.put(FIELD_BEGIN, coord.getBegin()); json.put(FIELD_END, coord.getEnd()); json.put(FIELD_VALUE, coord.getValue()); json.put(FIELD_CONFIDENCE, coord.getConfidence());
@Test public void testExactStringMatch() throws AnalysisEngineProcessException, ResourceInitializationException { String text = "Chris went to London and in London he saw Big Ben."; // london - london jCas.setDocumentText(text); Person chris = new Person(jCas); chris.setBegin(text.indexOf("Chris")); chris.setEnd(chris.getBegin() + "Chris".length()); chris.addToIndexes(); Location london = new Location(jCas); london.setBegin(text.indexOf("London")); london.setEnd(london.getBegin() + "London".length()); london.addToIndexes(); Location london2 = new Location(jCas); london2.setBegin(text.indexOf("London", london.getEnd())); london2.setEnd(london2.getBegin() + "London".length()); london2.addToIndexes(); processJCas(); processJCasWithSieve(1); List<ReferenceTarget> targets = new ArrayList<>(JCasUtil.select(jCas, ReferenceTarget.class)); List<Location> location = new ArrayList<>(JCasUtil.select(jCas, Location.class)); assertEquals(1, targets.size()); assertSame(targets.get(0), location.get(0).getReferent()); assertSame(targets.get(0), location.get(1).getReferent()); }
public void assertLocationMatches() { final Location inLocation = JCasUtil.selectSingle(in, Location.class); final Location outLocation = JCasUtil.selectSingle(out, Location.class); assertEquals(inLocation.getGeoJson(), outLocation.getGeoJson()); assertEquals(inLocation.getBegin(), outLocation.getBegin()); assertEquals(inLocation.getEnd(), outLocation.getEnd()); assertEquals(inLocation.getValue(), outLocation.getValue()); assertEquals(0, inLocation.getConfidence(), outLocation.getConfidence()); }
"ent1", e4.getBegin(), e4.getEnd(), e4.getType().getShortName(), e4.getValue());