private CommsIdentifier addEmailToHeaderBlock( final String v, final int offset, final StringBuilder sb, final JCas jCas) { final CommsIdentifier ci = new CommsIdentifier(jCas); ci.setSubType("email"); return addToHeaderBlock(v, offset, sb, ci); }
/** * @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 CommsIdentifier(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
protected void createEntitiesDocument() { jCas.reset(); jCas.setDocumentText( "James went to London on 19th February 2015. His e-mail address is james@example.com"); Annotations.createPerson(jCas, 0, 5, "James"); Annotations.createLocation( jCas, 14, 20, "London", "{\"type\": \"Point\", \"coordinates\": [-0.1, 51.5]}"); Temporal d = Annotations.createTemporal(jCas, 24, 42, ""); d.setConfidence(1.0); CommsIdentifier ci = new CommsIdentifier(jCas); ci.setBegin(66); ci.setEnd(83); ci.setSubType("email"); ci.addToIndexes(); }
@Test public void testIds() throws Exception { JCas jCas = JCasSingleton.getJCasInstance(); jCas.setDocumentText("E-mail address: example@foo.com"); long currId = IdentityUtils.getInstance().getNewId(); BaleenAnnotation ba1 = new BaleenAnnotation(jCas); assertEquals(currId + 1, ba1.getInternalId()); assertEquals(HASH_ONE, ba1.getExternalId()); BaleenAnnotation ba2 = new BaleenAnnotation(jCas); assertEquals(currId + 2, ba2.getInternalId()); assertEquals(HASH_ONE, ba2.getExternalId()); BaleenAnnotation ba3 = new BaleenAnnotation(jCas); ba3.setInternalId(999); assertEquals(999, ba3.getInternalId()); assertEquals(HASH_ONE, ba3.getExternalId()); CommsIdentifier ci = new CommsIdentifier(jCas); ci.setBegin(16); ci.setEnd(31); ci.setSubType("email"); ci.addToIndexes(); assertEquals(currId + 4, ci.getInternalId()); assertEquals(HASH_TWO, ci.getExternalId()); } }
private void createDocument() { DocumentAnnotation da = (DocumentAnnotation) jCas.getDocumentAnnotationFs(); da.setSourceUri(TEST1_TXT); CommsIdentifier ci = new CommsIdentifier(jCas); ci.addToIndexes(); Person p = new Person(jCas); p.addToIndexes(); }
return Optional.of(new CommsIdentifier(jCas)); case "Frequency": return Optional.of(new Frequency(jCas));
@Test public void testLocalhost() throws Exception { jCas.setDocumentText("Here's the localhost IPv6 address: ::1"); processJCas(); assertEquals(1, JCasUtil.select(jCas, CommsIdentifier.class).size()); CommsIdentifier ip = JCasUtil.selectByIndex(jCas, CommsIdentifier.class, 0); assertEquals("::1", ip.getCoveredText()); assertEquals("ipv6address", ip.getSubType()); } }
CommsIdentifier c = new CommsIdentifier(jCas); c.setBegin(cursor); c.setEnd(cursor + cell2.length()); c.addToIndexes();
return Optional.of(new CommsIdentifier(jCas)); case "Frequency": return Optional.of(new Frequency(jCas));
@Test public void testDropLeadingZeroes() throws Exception { jCas.setDocumentText( "Here's an IPv6 address with leading zeroes dropped: fe80:0:0:0:204:61ff:fe9d:f156."); processJCas(); assertEquals(1, JCasUtil.select(jCas, CommsIdentifier.class).size()); CommsIdentifier ip = JCasUtil.selectByIndex(jCas, CommsIdentifier.class, 0); assertEquals("fe80:0:0:0:204:61ff:fe9d:f156", ip.getCoveredText()); assertEquals("ipv6address", ip.getSubType()); }
dt.setConfidence(1.0); CommsIdentifier ci = new CommsIdentifier(jCas); ci.setBegin(66); ci.setEnd(83); ci.setSubType("email"); ci.setValue(EMAIL); ci.addToIndexes();
/** * @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 CommsIdentifier(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
private CommsIdentifier addEmailToHeaderBlock( final String v, final int offset, final StringBuilder sb, final JCas jCas) { final CommsIdentifier ci = new CommsIdentifier(jCas); ci.setSubType("email"); return addToHeaderBlock(v, offset, sb, ci); }
e1a.addToIndexes(); Entity e2 = new CommsIdentifier(jCas, 36, 47); e2.setValue("foo@bar.com"); e2.addToIndexes();
@Test public void testCollapseLeadingZeroes() throws Exception { jCas.setDocumentText( "Here's an IPv6 address with collapsed leading zeroes: (fe80::204:61ff:fe9d:f156)"); processJCas(); assertEquals(1, JCasUtil.select(jCas, CommsIdentifier.class).size()); CommsIdentifier ip = JCasUtil.selectByIndex(jCas, CommsIdentifier.class, 0); assertEquals("fe80::204:61ff:fe9d:f156", ip.getCoveredText()); assertEquals("ipv6address", ip.getSubType()); }
@Test public void testFull() throws Exception { jCas.setDocumentText( "Here's a full IPv6 address fe80:0000:0000:0000:0204:61ff:fe9d:f156 and some text after it"); processJCas(); assertEquals(1, JCasUtil.select(jCas, CommsIdentifier.class).size()); CommsIdentifier ip = JCasUtil.selectByIndex(jCas, CommsIdentifier.class, 0); assertEquals("fe80:0000:0000:0000:0204:61ff:fe9d:f156", ip.getCoveredText()); assertEquals("ipv6address", ip.getSubType()); }