private void checkForAttrValue(IdentifiedAnnotation eMention, String role, String value) { if (role.contains("_normalization")) { if (role.startsWith("conditional")) { eMention.setConditional(Boolean.valueOf(value)); } else if (role.startsWith("generic")) { eMention.setGeneric(Boolean.valueOf(value)); } else if (role.startsWith("negation_indicator")) { // assumes that the string from Knowtator is exactly "negation_present" if (value.equals("negation_present")) { eMention.setPolarity(CONST.NE_POLARITY_NEGATION_PRESENT); } else { eMention.setPolarity(CONST.NE_POLARITY_NEGATION_ABSENT); } } else if (role.startsWith("subject")) { // assumes that the strings from Knowtator are exactly what's in the type system eMention.setSubject(value); } else if (role.startsWith("uncertainty_indicator")) { // assumes that the string from Knowtator is exactly "indicator_present" if (value.equals("indicator_present")) { eMention.setUncertainty(CONST.NE_UNCERTAINTY_PRESENT); } else { eMention.setUncertainty(CONST.NE_UNCERTAINTY_ABSENT); } } else if (role.startsWith("generic")) { eMention.setGeneric(Boolean.valueOf(value)); } } }
private void checkForAttrValue(IdentifiedAnnotation eMention, String role, String value) { if (role.contains("_normalization")) { if (role.startsWith("conditional")) { eMention.setConditional(Boolean.valueOf(value)); } else if (role.startsWith("generic")) { eMention.setGeneric(Boolean.valueOf(value)); } else if (role.startsWith("negation_indicator")) { // assumes that the string from Knowtator is exactly "negation_present" if (value.equals("negation_present")) { eMention.setPolarity(CONST.NE_POLARITY_NEGATION_PRESENT); } else { eMention.setPolarity(CONST.NE_POLARITY_NEGATION_ABSENT); } } else if (role.startsWith("subject")) { // assumes that the strings from Knowtator are exactly what's in the type system eMention.setSubject(value); } else if (role.startsWith("uncertainty_indicator")) { // assumes that the string from Knowtator is exactly "indicator_present" if (value.equals("indicator_present")) { eMention.setUncertainty(CONST.NE_UNCERTAINTY_PRESENT); } else { eMention.setUncertainty(CONST.NE_UNCERTAINTY_ABSENT); } } else if (role.startsWith("generic")) { eMention.setGeneric(Boolean.valueOf(value)); } } }
@Override public void setClassLabel( IdentifiedAnnotation entityOrEventMention, Instance<String> instance ) throws AnalysisEngineProcessException { if ( this.isTraining() ) { String uncertainty = (entityOrEventMention.getUncertainty() == CONST.NE_UNCERTAINTY_PRESENT) ? "uncertain" : "certain"; // downsampling. initialize probabilityOfKeepingADefaultExample to 1.0 for no downsampling if ( "certain".equals( uncertainty ) && coin.nextDouble() >= this.probabilityOfKeepingADefaultExample ) { return; } instance.setOutcome( uncertainty ); } else { String label = this.classifier.classify( instance.getFeatures() ); int uncertainty = 0; if ( label != null && label.equals( "uncertain" ) ) { uncertainty = CONST.NE_UNCERTAINTY_PRESENT; } else if ( label != null && label.equals( "certain" ) ) { uncertainty = CONST.NE_UNCERTAINTY_ABSENT; } entityOrEventMention.setUncertainty( uncertainty ); } }
@Override public void setClassLabel(IdentifiedAnnotation entityOrEventMention, Instance<String> instance) throws AnalysisEngineProcessException { if (this.isTraining()) { String uncertainty = (entityOrEventMention.getUncertainty() == CONST.NE_UNCERTAINTY_PRESENT) ? "uncertain" : "certain"; // downsampling. initialize probabilityOfKeepingADefaultExample to 1.0 for no downsampling if ("certain".equals(uncertainty) && coin.nextDouble() >= this.probabilityOfKeepingADefaultExample) { return; } instance.setOutcome(uncertainty); } else { String label = this.classifier.classify(instance.getFeatures()); int uncertainty = 0; if (label!= null && label.equals("uncertain")) { uncertainty = CONST.NE_UNCERTAINTY_PRESENT; } else if (label != null && label.equals("certain")) { uncertainty = CONST.NE_UNCERTAINTY_ABSENT; } entityOrEventMention.setUncertainty(uncertainty); } }
@Override public void setClassLabel(IdentifiedAnnotation entityOrEventMention, Instance<String> instance) throws AnalysisEngineProcessException { if (this.isTraining()) { String uncertainty = (entityOrEventMention.getUncertainty() == CONST.NE_UNCERTAINTY_PRESENT) ? "uncertain" : "certain"; // downsampling. initialize probabilityOfKeepingADefaultExample to 1.0 for no downsampling if ("certain".equals(uncertainty) && coin.nextDouble() >= this.probabilityOfKeepingADefaultExample) { return; } instance.setOutcome(uncertainty); } else { String label = this.classifier.classify(instance.getFeatures()); int uncertainty = 0; if (label!= null && label.equals("uncertain")) { uncertainty = CONST.NE_UNCERTAINTY_PRESENT; } else if (label != null && label.equals("certain")) { uncertainty = CONST.NE_UNCERTAINTY_ABSENT; } entityOrEventMention.setUncertainty(uncertainty); } }
public void consumeHit(JCas jcas, Annotation focusAnnot, int scope, ContextHit ctxHit) throws AnalysisEngineProcessException { Integer status = (Integer) ctxHit.getMetaData(StatusContextAnalyzer.CTX_HIT_KEY_STATUS_TYPE); if (focusAnnot instanceof IdentifiedAnnotation) { IdentifiedAnnotation neAnnot = (IdentifiedAnnotation) focusAnnot; //TODO: currently status is an int in the old system. Let's update this to a constant string? neAnnot.setUncertainty(status); if(StatusIndicator.HISTORY_STATUS == status || StatusIndicator.FAMILY_HISTORY_STATUS == status ) { neAnnot.setHistoryOf(1); } } createContextAnnot(jcas, focusAnnot, scope, ctxHit).addToIndexes(); } }
public void consumeHit(JCas jcas, Annotation focusAnnot, int scope, ContextHit ctxHit) throws AnalysisEngineProcessException { Integer status = (Integer) ctxHit.getMetaData(StatusContextAnalyzer.CTX_HIT_KEY_STATUS_TYPE); if (focusAnnot instanceof IdentifiedAnnotation) { IdentifiedAnnotation neAnnot = (IdentifiedAnnotation) focusAnnot; //TODO: currently status is an int in the old system. Let's update this to a constant string? neAnnot.setUncertainty(status); if(StatusIndicator.HISTORY_STATUS == status || StatusIndicator.FAMILY_HISTORY_STATUS == status ) { neAnnot.setHistoryOf(1); } } createContextAnnot(jcas, focusAnnot, scope, ctxHit).addToIndexes(); } }
static private void fillProperties( final IdentifiedAnnotation annotation, final int polarity, final int uncertainty, final boolean generic, final boolean conditional, final String subject, final float confidence ) { annotation.setPolarity( polarity ); annotation.setUncertainty( uncertainty ); annotation.setGeneric( generic ); annotation.setConditional( conditional ); annotation.setSubject( subject ); annotation.setConfidence( confidence ); }
static private void fillProperties( final IdentifiedAnnotation annotation, final int polarity, final int uncertainty, final boolean generic, final boolean conditional, final String subject, final float confidence ) { annotation.setPolarity( polarity ); annotation.setUncertainty( uncertainty ); annotation.setGeneric( generic ); annotation.setConditional( conditional ); annotation.setSubject( subject ); annotation.setConfidence( confidence ); }
mention.setUncertainty(CONST.NE_UNCERTAINTY_ABSENT); break; default:
mention.setUncertainty(CONST.NE_UNCERTAINTY_ABSENT); break; default:
mention.setSubject(CONST.ATTR_SUBJECT_FAMILY_MEMBER); } else if ("Possible".equals(status)) { mention.setUncertainty(CONST.NE_CERTAINTY_NEGATED); } else { throw new UnsupportedOperationException("Unknown status: " + status);
mention.setSubject(CONST.ATTR_SUBJECT_FAMILY_MEMBER); } else if ("Possible".equals(status)) { mention.setUncertainty(CONST.NE_CERTAINTY_NEGATED); } else { throw new UnsupportedOperationException("Unknown status: " + status);
mention.setSubject(CONST.ATTR_SUBJECT_FAMILY_MEMBER); } else if ("Possible".equals(status)) { mention.setUncertainty(CONST.NE_CERTAINTY_NEGATED); } else { throw new UnsupportedOperationException("Unknown status: " + status);
mention.setSubject(CONST.ATTR_SUBJECT_FAMILY_MEMBER); } else if ("Possible".equals(status)) { mention.setUncertainty(CONST.NE_CERTAINTY_NEGATED); } else { throw new UnsupportedOperationException("Unknown status: " + status);
break; case UNCERTAINTY: m.setUncertainty(mention.getUncertainty()); break;
break; case UNCERTAINTY: m.setUncertainty(mention.getUncertainty()); break;
/** * * @param goldAnnotation * @param jcas */ private static void copyAnnotation(Annotation goldAnnotation, JCas jcas) { Annotation newAnno; if (goldAnnotation instanceof IdentifiedAnnotation) { IdentifiedAnnotation ia = new IdentifiedAnnotation(jcas); ia.setConditional(((IdentifiedAnnotation) goldAnnotation).getConditional()); ia.setConfidence(((IdentifiedAnnotation) goldAnnotation).getConfidence()); ia.setDiscoveryTechnique(((IdentifiedAnnotation)goldAnnotation).getDiscoveryTechnique()); ia.setGeneric(((IdentifiedAnnotation) goldAnnotation).getGeneric()); ia.setHistoryOf(((IdentifiedAnnotation) goldAnnotation).getHistoryOf()); ia.setPolarity(((IdentifiedAnnotation) goldAnnotation).getPolarity()); ia.setSegmentID(((IdentifiedAnnotation) goldAnnotation).getSegmentID()); ia.setSentenceID(((IdentifiedAnnotation) goldAnnotation).getSentenceID()); ia.setSubject(((IdentifiedAnnotation) goldAnnotation).getSubject()); ia.setTypeID(((IdentifiedAnnotation) goldAnnotation).getTypeID()); ia.setUncertainty(((IdentifiedAnnotation) goldAnnotation).getUncertainty()); newAnno = ia; } else { throw new RuntimeException("Unexpected class of object " + goldAnnotation.getClass()); } newAnno.setBegin(goldAnnotation.getBegin()); newAnno.setEnd(goldAnnotation.getEnd()); newAnno.addToIndexes(); }
/** * * @param goldAnnotation * @param jcas */ private static void copyAnnotation(Annotation goldAnnotation, JCas jcas) { Annotation newAnno; if (goldAnnotation instanceof IdentifiedAnnotation) { IdentifiedAnnotation ia = new IdentifiedAnnotation(jcas); ia.setConditional(((IdentifiedAnnotation) goldAnnotation).getConditional()); ia.setConfidence(((IdentifiedAnnotation) goldAnnotation).getConfidence()); ia.setDiscoveryTechnique(((IdentifiedAnnotation)goldAnnotation).getDiscoveryTechnique()); ia.setGeneric(((IdentifiedAnnotation) goldAnnotation).getGeneric()); ia.setHistoryOf(((IdentifiedAnnotation) goldAnnotation).getHistoryOf()); ia.setPolarity(((IdentifiedAnnotation) goldAnnotation).getPolarity()); ia.setSegmentID(((IdentifiedAnnotation) goldAnnotation).getSegmentID()); ia.setSentenceID(((IdentifiedAnnotation) goldAnnotation).getSentenceID()); ia.setSubject(((IdentifiedAnnotation) goldAnnotation).getSubject()); ia.setTypeID(((IdentifiedAnnotation) goldAnnotation).getTypeID()); ia.setUncertainty(((IdentifiedAnnotation) goldAnnotation).getUncertainty()); newAnno = ia; } else { throw new RuntimeException("Unexpected class of object " + goldAnnotation.getClass()); } newAnno.setBegin(goldAnnotation.getBegin()); newAnno.setEnd(goldAnnotation.getEnd()); newAnno.addToIndexes(); }
annotation.setUncertainty( CONST.NE_UNCERTAINTY_PRESENT );