private boolean shouldMerge(Entity e) { return listMergeTypes.contains(e.getType().getShortName()); }
mention.setEnd(e.getEnd()); mention.setType(e.getType().getShortName()); mention.setSubType(e.getSubType()); mention.setValue(e.getValue());
.append(FIELD_RELATIONSHIP_SUBTYPE, r.getRelationSubType()) .append(FIELD_SOURCE_VALUE, r.getSource().getValue()) .append(FIELD_SOURCE_TYPE, r.getSource().getType().getShortName()) .append(FIELD_SOURCE_TYPE_FULL, r.getSource().getType().getName()) .append(FIELD_VALUE, r.getValue()) .append(FIELD_TARGET_VALUE, r.getTarget().getValue()) .append(FIELD_TARGET_TYPE, r.getTarget().getType().getShortName()) .append(FIELD_TARGET_TYPE_FULL, r.getTarget().getType().getName()) .append(FIELD_SENTENCE, sentence) .append(FIELD_DOCUMENT_ID, documentId)
new Document() .append("entityId", entity.getExternalId()) .append(FIELD_TYPE, entity.getType().getShortName()) .append(FIELD_SUBTYPE, entity.getSubType()) .append(FIELD_VALUE, entity.getValue())
@Test public void testInteger() { Entity e = new Entity(jCas); e.setBegin(5); e.addToIndexes(); Feature f = e.getType().getFeatureByBaseName("begin"); Object o = FeatureUtils.featureToObject(f, e); assertTrue(o instanceof Integer); assertEquals(new Integer(5), (Integer) o); }
@Test public void testDouble() { Entity e = new Entity(jCas); e.setConfidence(0.5); e.addToIndexes(); Feature f = e.getType().getFeatureByBaseName("confidence"); Object o = FeatureUtils.featureToObject(f, e); assertTrue(o instanceof Double); assertEquals(new Double(0.5), (Double) o); }
@Test public void testLong() { Entity e = new Entity(jCas); e.setInternalId(123456789); e.addToIndexes(); Feature f = e.getType().getFeatureByBaseName("internalId"); Object o = FeatureUtils.featureToObject(f, e); assertTrue(o instanceof Long); assertEquals(new Long(123456789), (Long) o); }
@Test public void testDouble() { Entity e = new Entity(jCas); e.setConfidence(0.5); e.addToIndexes(); Feature feature = e.getType().getFeatureByBaseName("confidence"); NewFeatureUtils.setPrimitive(e, feature, 1.0); assertEquals(1.0, e.getDoubleValue(feature), 0.0); }
@Test public void testLong() { Entity e = new Entity(jCas); e.setInternalId(12345); e.addToIndexes(); Feature feature = e.getType().getFeatureByBaseName("internalId"); NewFeatureUtils.setPrimitive(e, feature, 54321); assertEquals(54321, e.getLongValue(feature)); }
@Test public void testFloat() { Entity e = new Entity(jCas); e.setIsNormalised(false); e.addToIndexes(); Feature feature = e.getType().getFeatureByBaseName("isNormalised"); NewFeatureUtils.setPrimitive(e, feature, true); assertTrue(e.getBooleanValue(feature)); }
@Test public void testString() { Entity e = new Entity(jCas); e.setValue("Test Value"); e.addToIndexes(); Feature f = e.getType().getFeatureByBaseName("value"); Object o = FeatureUtils.featureToObject(f, e); assertTrue(o instanceof String); assertEquals("Test Value", (String) o); }
@Test public void testString() { Entity e = new Entity(jCas); e.setValue("entity"); e.addToIndexes(); Feature feature = e.getType().getFeatureByBaseName("value"); NewFeatureUtils.setPrimitive(e, feature, "newValue"); assertEquals("newValue", e.getStringValue(feature)); }
@Test public void testInteger() { Entity e = new Entity(jCas); e.setBegin(0); e.addToIndexes(); Feature feature = e.getType().getFeatureByBaseName("begin"); NewFeatureUtils.setPrimitive(e, feature, 1); assertEquals(1, e.getIntValue(feature)); }