/** * @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 Entity(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 Entity(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
private <T extends Entity> T addToHeaderBlock( final String v, final int offset, final StringBuilder sb, final T annotation) { final int begin = sb.length() + offset; sb.append(v); final int end = sb.length() + offset; sb.append("\n"); annotation.setBegin(begin); annotation.setEnd(end); annotation.setConfidence(1); annotation.setValue(v); annotation.addToIndexes(); return annotation; }
private <T extends Entity> T addToHeaderBlock( final String v, final int offset, final StringBuilder sb, final T annotation) { final int begin = sb.length() + offset; sb.append(v); final int end = sb.length() + offset; sb.append("\n"); annotation.setBegin(begin); annotation.setEnd(end); annotation.setConfidence(1); annotation.setValue(v); annotation.addToIndexes(); return annotation; }
/** * Copy entity. * * @param jCas the j cas * @param begin the begin * @param end the end * @param entity the entity * @return the entity */ public static Entity copyEntity(JCas jCas, int begin, int end, Entity entity) { // TODO: This could be better, but would suggest if better is need try { final Entity instance = entity.getClass().getConstructor(JCas.class).newInstance(jCas); instance.setBegin(begin); instance.setEnd(end); instance.setReferent(entity.getReferent()); instance.setValue(entity.getValue()); return instance; } catch (final Exception e) { LOGGER.warn("Unable to copy entity", e); return null; } }
/** * Copy entity. * * @param jCas the j cas * @param begin the begin * @param end the end * @param entity the entity * @return the entity */ public static Entity copyEntity(JCas jCas, int begin, int end, Entity entity) { // TODO: This could be better, but would suggest if better is need try { final Entity instance = entity.getClass().getConstructor(JCas.class).newInstance(jCas); instance.setBegin(begin); instance.setEnd(end); instance.setReferent(entity.getReferent()); instance.setValue(entity.getValue()); return instance; } catch (final Exception e) { LOGGER.warn("Unable to copy entity", e); return null; } }
public static Entity createEntity(JCas jCas, int begin, int end, String value) { Entity e = new Entity(jCas); e.setBegin(begin); e.setEnd(end); if (value != null) { e.setValue(e.getCoveredText()); } e.addToIndexes(); return e; }
final Entity a = entity.get(); a.setBegin(e.getBegin()); a.setEnd(e.getEnd()); a.setValue(e.getValue()); a.setConfidence(e.getConfidence());
final Entity a = entity.get(); a.setBegin(e.getBegin()); a.setEnd(e.getEnd()); a.setValue(e.getValue()); a.setConfidence(e.getConfidence());
@Test public void testOverlaps() { final Entity a = new Entity(jCas); a.setBegin(0); a.setEnd(10); final Entity b = new Entity(jCas); b.setBegin(8); b.setEnd(15); final Entity c = new Entity(jCas); c.setBegin(20); c.setEnd(30); assertTrue(ComparableEntitySpanUtils.overlaps(a, b)); assertTrue(ComparableEntitySpanUtils.overlaps(b, a)); assertFalse(ComparableEntitySpanUtils.overlaps(a, c)); assertFalse(ComparableEntitySpanUtils.overlaps(c, a)); } }
protected void createEntitiesDocument2() { jCas.reset(); jCas.setDocumentText( "Paula went to London on 12th February 2017. In Paris, she met a UID male."); Annotations.createPerson(jCas, 0, 5, "Paula"); Annotations.createLocation(jCas, 47, 53, "Paris", null); Temporal d = Annotations.createTemporal(jCas, 24, 42, ""); d.setConfidence(1.0); Entity e = new Entity(jCas); e.setBegin(14); e.setEnd(20); e.setValue("London"); e.addToIndexes(); }