value = Boolean.toString(annotation.getConditional()); } else if (property == CTAKESAnnotationProperty.CONFIDENCE) { value = Float.toString(annotation.getConfidence()); } else if (property == CTAKESAnnotationProperty.DISCOVERY_TECNIQUE) { value = Integer.toString(annotation.getDiscoveryTechnique());
@Override public List<Feature> extract(JCas jCas, IdentifiedAnnotation ante, IdentifiedAnnotation ana) throws AnalysisEngineProcessException { List<Feature> feats = new ArrayList<>(); feats.add(new Feature("MP_ANTE_SALIENCE", ante.getConfidence())); feats.add(new Feature("MP_ANA_SALIENCE", ana.getConfidence())); return feats; }
@Override public List<Feature> extract(JCas jCas, IdentifiedAnnotation ante, IdentifiedAnnotation ana) throws AnalysisEngineProcessException { List<Feature> feats = new ArrayList<>(); feats.add(new Feature("MP_ANTE_SALIENCE", ante.getConfidence())); feats.add(new Feature("MP_ANA_SALIENCE", ana.getConfidence())); return feats; }
@Override protected String getRelationCategory( Map<List<Annotation>, BinaryTextRelation> relationLookup, IdentifiedAnnotation ante, IdentifiedAnnotation ana) { String cat = super.getRelationCategory(relationLookup, ante, ana); int dist = sentsBetween(ante, ana); if(cat != null && !cat.equals(NO_RELATION_CATEGORY)){ // cat is some coref category foundAnaphors.add(ana); logger.info(String.format("DISTSALIENCE: (%d,%f,1)\n", dist, ante.getConfidence())); }else{ // sample 10 percent of negative examples: if(Math.random() < 0.1){ logger.info(String.format("DISTSALIENCE: (%d,%f,0)\n", dist, ante.getConfidence())); } } return cat; }
@Override protected String getRelationCategory( Map<List<Annotation>, BinaryTextRelation> relationLookup, IdentifiedAnnotation ante, IdentifiedAnnotation ana) { String cat = super.getRelationCategory(relationLookup, ante, ana); int dist = sentsBetween(ante, ana); if(cat != null && !cat.equals(NO_RELATION_CATEGORY)){ // cat is some coref category foundAnaphors.add(ana); logger.info(String.format("DISTSALIENCE: (%d,%f,1)\n", dist, ante.getConfidence())); }else{ // sample 10 percent of negative examples: if(Math.random() < 0.1){ logger.info(String.format("DISTSALIENCE: (%d,%f,0)\n", dist, ante.getConfidence())); } } return cat; }
public int compare(IdentifiedAnnotationPair o1, IdentifiedAnnotationPair o2) { if(o1 == o2) return 0; int sim; IdentifiedAnnotation ante1 = o1.getArg1(); IdentifiedAnnotation ante2 = o2.getArg1(); IdentifiedAnnotation ana1 = o1.getArg2(); IdentifiedAnnotation ana2 = o2.getArg2(); // first level sorting is by anaphor: if(ana1.getBegin() != ana2.getBegin()){ sim = ana1.getBegin() - ana2.getBegin() > 0 ? 1 : -1; }else if(ana1.getEnd() != ana2.getEnd()){ sim = ana1.getEnd() - ana2.getEnd() > 0 ? 1 : -1; }else{ // sort by antecedent if(ante1.getConfidence() > ante2.getConfidence()){ sim = -1; }else if(ante1.getConfidence() < ante2.getConfidence()){ sim = 1; }else{ sim = 0; } } return sim; }
value = Boolean.toString(annotation.getConditional()); } else if (property == CTAKESAnnotationProperty.CONFIDENCE) { value = Float.toString(annotation.getConfidence()); } else if (property == CTAKESAnnotationProperty.DISCOVERY_TECNIQUE) { value = Integer.toString(annotation.getDiscoveryTechnique());
public int compare(IdentifiedAnnotationPair o1, IdentifiedAnnotationPair o2) { if(o1 == o2) return 0; int sim; IdentifiedAnnotation ante1 = o1.getArg1(); IdentifiedAnnotation ante2 = o2.getArg1(); IdentifiedAnnotation ana1 = o1.getArg2(); IdentifiedAnnotation ana2 = o2.getArg2(); // first level sorting is by anaphor: if(ana1.getBegin() != ana2.getBegin()){ sim = ana1.getBegin() - ana2.getBegin() > 0 ? 1 : -1; }else if(ana1.getEnd() != ana2.getEnd()){ sim = ana1.getEnd() - ana2.getEnd() > 0 ? 1 : -1; }else{ // sort by antecedent if(ante1.getConfidence() > ante2.getConfidence()){ sim = -1; }else if(ante1.getConfidence() < ante2.getConfidence()){ sim = 1; }else{ sim = 0; } } return sim; }
value = Boolean.toString(annotation.getConditional()); } else if (property == CTAKESAnnotationProperty.CONFIDENCE) { value = Float.toString(annotation.getConfidence()); } else if (property == CTAKESAnnotationProperty.DISCOVERY_TECNIQUE) { value = Integer.toString(annotation.getDiscoveryTechnique());
/** * * @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(); }
mention.setEnd(original.getEnd()); mention.setConditional(original.getConditional()); mention.setConfidence(original.getConfidence()); mention.setDiscoveryTechnique(original.getDiscoveryTechnique()); mention.setGeneric(original.getGeneric());