/** * @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public Organisation(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
/** * @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public Organisation(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
@Test public void testStrictHeadMatch() throws AnalysisEngineProcessException, ResourceInitializationException { String text = "The Florida Supreme Court sat today, and the Florida Court made a decision."; jCas.setDocumentText(text); Organisation fsc = new Organisation(jCas); fsc.setBegin(text.indexOf("Florida Supreme Court")); fsc.setEnd(fsc.getBegin() + "Florida Supreme Court".length()); fsc.addToIndexes(); Organisation fc = new Organisation(jCas); fc.setBegin(text.indexOf("Florida Court")); fc.setEnd(fc.getBegin() + "Florida Court".length()); fc.addToIndexes(); processJCas(); processJCasWithSieve(5); List<ReferenceTarget> targets = new ArrayList<>(JCasUtil.select(jCas, ReferenceTarget.class)); assertEquals(1, targets.size()); }
public static Organisation createOrganisation(JCas jCas, int begin, int end, String value) { Organisation p = new Organisation(jCas); p.setValue(value); p.setBegin(begin); p.setEnd(end); p.addToIndexes(); return p; }
@Test public void testPreciseConstructAcronym() throws AnalysisEngineProcessException, ResourceInitializationException { String text = "The British Broadcasting Corporation or the BBC if you prefer shows television programmes."; // British Broadcasting Corporation - BBC jCas.setDocumentText(text); // We need these in otherwise we just get one long setence from the mention detector Organisation beeb = new Organisation(jCas); beeb.setBegin(text.indexOf("British Broadcasting Corporation")); beeb.setEnd(beeb.getBegin() + "British Broadcasting Corporation".length()); beeb.addToIndexes(); Organisation bbc = new Organisation(jCas); bbc.setBegin(text.indexOf("BBC")); bbc.setEnd(bbc.getBegin() + "BBC".length()); bbc.addToIndexes(); processJCas(); processJCasWithSieve(4); List<ReferenceTarget> targets = new ArrayList<>(JCasUtil.select(jCas, ReferenceTarget.class)); assertEquals(1, targets.size()); List<Organisation> orgs = new ArrayList<Organisation>(JCasUtil.select(jCas, Organisation.class)); assertEquals(2, orgs.size()); assertNotNull(orgs.get(0).getReferent()); assertEquals( orgs.get(0).getReferent().getInternalId(), orgs.get(1).getReferent().getInternalId()); }
@Test public void testRelaxedStringMatch() throws AnalysisEngineProcessException, ResourceInitializationException { String text = "The University of Warwick is near Coventry and that was the University at which Chris studied."; // university of warwick - university jCas.setDocumentText(text); Person chris = new Person(jCas); chris.setBegin(text.indexOf("Chris")); chris.setEnd(chris.getBegin() + "Chris".length()); chris.addToIndexes(); Organisation uow = new Organisation(jCas); uow.setBegin(text.indexOf("University of Warwick")); uow.setEnd(uow.getBegin() + "University of Warwick".length()); uow.addToIndexes(); Organisation u = new Organisation(jCas); u.setBegin(text.indexOf("University", uow.getEnd())); u.setEnd(u.getBegin() + "University".length()); u.addToIndexes(); processJCas(); processJCasWithSieve(2); List<ReferenceTarget> targets = new ArrayList<>(JCasUtil.select(jCas, ReferenceTarget.class)); List<Organisation> location = new ArrayList<>(JCasUtil.select(jCas, Organisation.class)); assertEquals(1, targets.size()); assertSame(targets.get(0), location.get(0).getReferent()); assertSame(targets.get(0), location.get(1).getReferent()); }
o.setBegin(15); o.setEnd(19); o.setConfidence(0.96);