@Test public void testExisting() throws AnalysisEngineProcessException, ResourceInitializationException { jCas.setDocumentText("Alice Cox"); Person p = new Person(jCas); p.setBegin(10); p.setEnd(19); p.setGender("MALE"); p.addToIndexes(); processJCas( AddGenderToPerson.KEY_GENDER_MULTIPLICITY, erd); // If the entity is not ignored, it will be made female. Collection<Person> select = JCasUtil.select(jCas, Person.class); assertEquals(1, select.size()); Person out = select.iterator().next(); assertEquals("MALE", out.getGender()); } }
@Test public void testEntityExternalId() throws UIMAException, BaleenException { JCas jCas = JCasSingleton.getJCasInstance(); jCas.setDocumentText("Hello World"); Person p1 = new Person(jCas); p1.setGender("female"); p1.setValue("Jane Doe"); p1.addToIndexes(jCas); Person p2 = new Person(jCas); p2.setGender("female"); p2.setValue("J. Doe"); p2.addToIndexes(jCas); assertEquals( ConsumerUtils.getExternalId(ImmutableSet.of(p1, p2)), ConsumerUtils.getExternalId(ImmutableSet.of(p1, p2))); assertEquals( "d3c514ea1fb3367430959255917ee4de12468004897d683d60114b475d37264a", ConsumerUtils.getExternalId(ImmutableSet.of(p1, p2))); assertNotEquals( ConsumerUtils.getExternalId(ImmutableSet.of(p1)), ConsumerUtils.getExternalId(ImmutableSet.of(p1, p2))); } }
e1.setGender("male"); e1.addToIndexes();
public JCasSerializationTester() throws UIMAException { out = JCasFactory.createJCas(); in = JCasFactory.createJCas(); in.setDocumentText("This is a test"); final DocumentAnnotation inDA = (DocumentAnnotation) in.getDocumentAnnotationFs(); inDA.setDocumentClassification("CLASS"); final Location l = new Location(in); l.setBegin(10); l.setEnd(12); l.setGeoJson(GEO_JSON); l.setValue("Dinagat Islands"); l.setConfidence(0.9d); l.addToIndexes(in); final ReferenceTarget rt = new ReferenceTarget(in); rt.setBegin(0); rt.setEnd(1); rt.addToIndexes(in); final Person p = new Person(in); p.setBegin(2); p.setEnd(8); p.setGender("Male"); p.setValue("Peter"); p.setConfidence(0.5d); p.setReferent(rt); p.addToIndexes(in); }
js.setBegin(25); js.setEnd(35); js.setGender("Male"); js.setValue("John Smith"); js.setConfidence(0.9d); jd.setBegin(50); jd.setEnd(58); jd.setGender("Female"); jd.setValue("Jane Doe"); jd.setConfidence(0.8d); he.setBegin(60); he.setEnd(62); he.setGender("Male"); he.setValue("He"); he.setConfidence(0.9d);