本文整理了Java中org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation.setSubject()
方法的一些代码示例,展示了IdentifiedAnnotation.setSubject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IdentifiedAnnotation.setSubject()
方法的具体详情如下:
包路径:org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation
类名称:IdentifiedAnnotation
方法名:setSubject
[英]setter for subject - sets
[中]主题集设置器
代码示例来源:origin: apache/ctakes
@Override
public void setValueFrom(Map<String, ? extends TOP> annotationMap) {
super.setValueFrom(annotationMap);
if (mention.getSubject() == null) {
mention.setSubject(CONST.ATTR_SUBJECT_PATIENT);
}
}
});
代码示例来源:origin: apache/ctakes
/**
* {@inheritDoc}
*/
@Override
public void process( final JCas jCas ) throws AnalysisEngineProcessException {
LOGGER.info( "Adjusting Subject based upon Section ..." );
final Collection<Segment> sections = JCasUtil.select( jCas, Segment.class );
for ( Segment section : sections ) {
if ( !FAMILY_HISTORY.contains( section.getPreferredText() ) ) {
continue;
}
final Collection<IdentifiedAnnotation> annotations
= JCasUtil.selectCovered( jCas, IdentifiedAnnotation.class, section );
if ( annotations == null ) {
continue;
}
for ( IdentifiedAnnotation annotation : annotations ) {
annotation.setSubject( CONST.ATTR_SUBJECT_FAMILY_MEMBER );
}
}
LOGGER.info( "Finished Processing" );
}
代码示例来源:origin: org.apache.ctakes/ctakes-core
@Override
public void setValueFrom(Map<String, ? extends TOP> annotationMap) {
super.setValueFrom(annotationMap);
if (mention.getSubject() == null) {
mention.setSubject(CONST.ATTR_SUBJECT_PATIENT);
}
}
});
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
@Override
public void process(JCas jCas) throws AnalysisEngineProcessException {
for (IdentifiedAnnotation mention : JCasUtil.select(jCas, IdentifiedAnnotation.class)) {
// For each mention, set the subject attribute
// if (mention.getGeneric() == true ) {
// mention.setSubject (null);
// } else {
String oldsubj = mention.getSubject();
mention.setSubject( SubjectAttributeClassifier.getSubject(jCas, mention) );
// System.err.println("Word:"+mention.getCoveredText()+", overwrote subject "+oldsubj+" with "+mention.getSubject());
// }
}
}
}
代码示例来源:origin: apache/ctakes
@Override
public void process(JCas jCas) throws AnalysisEngineProcessException {
for (IdentifiedAnnotation mention : JCasUtil.select(jCas, IdentifiedAnnotation.class)) {
// For each mention, set the subject attribute
// if (mention.getGeneric() == true ) {
// mention.setSubject (null);
// } else {
String oldsubj = mention.getSubject();
mention.setSubject( SubjectAttributeClassifier.getSubject(jCas, mention) );
// System.err.println("Word:"+mention.getCoveredText()+", overwrote subject "+oldsubj+" with "+mention.getSubject());
// }
}
}
}
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
@Override
public void setValueFrom(Map<String, ? extends TOP> annotationMap) {
super.setValueFrom(annotationMap);
if (mention.getSubject() == null) {
mention.setSubject(CONST.ATTR_SUBJECT_PATIENT);
}
}
});
代码示例来源:origin: apache/ctakes
@Override
public void setValueFrom(Map<String, ? extends TOP> annotationMap) {
super.setValueFrom(annotationMap);
if (mention.getSubject() == null) {
mention.setSubject(CONST.ATTR_SUBJECT_PATIENT);
}
}
});
代码示例来源:origin: apache/ctakes
"df=donor_family_member, do=donor_other, o=other... or s=skip");
if (response.startsWith("p")) {
mention.setSubject(CONST.ATTR_SUBJECT_PATIENT);
} else if (response.startsWith("f")) {
mention.setSubject(CONST.ATTR_SUBJECT_FAMILY_MEMBER);
} else if (response.startsWith("df")) {
mention.setSubject(CONST.ATTR_SUBJECT_DONOR_FAMILY_MEMBER);
} else if (response.equals("do")) {
mention.setSubject(CONST.ATTR_SUBJECT_DONOR_OTHER);
} else if (response.startsWith("o")) {
mention.setSubject(CONST.ATTR_SUBJECT_OTHER);
} else {
System.out.println("hmm... i'm skipping it.");
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
"df=donor_family_member, do=donor_other, o=other... or s=skip");
if (response.startsWith("p")) {
mention.setSubject(CONST.ATTR_SUBJECT_PATIENT);
} else if (response.startsWith("f")) {
mention.setSubject(CONST.ATTR_SUBJECT_FAMILY_MEMBER);
} else if (response.startsWith("df")) {
mention.setSubject(CONST.ATTR_SUBJECT_DONOR_FAMILY_MEMBER);
} else if (response.equals("do")) {
mention.setSubject(CONST.ATTR_SUBJECT_DONOR_OTHER);
} else if (response.startsWith("o")) {
mention.setSubject(CONST.ATTR_SUBJECT_OTHER);
} else {
System.out.println("hmm... i'm skipping it.");
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
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));
}
}
}
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
@Override
public void setClassLabel(IdentifiedAnnotation entityOrEventMention,
Instance<String> instance) throws AnalysisEngineProcessException {
if (this.isTraining())
{
String subj = entityOrEventMention.getSubject();
// downsampling. initialize probabilityOfKeepingADefaultExample to 1.0 for no downsampling
if ("patient".equals(subj)
&& coin.nextDouble() >= this.probabilityOfKeepingADefaultExample) {
return;
}
instance.setOutcome(subj);
logger.log(Level.DEBUG, String.format("[%s] expected: ''; actual: ''; features: %s",
this.getClass().getSimpleName(),
instance.toString()
));
} else
{
String label = this.classifier.classify(instance.getFeatures());
entityOrEventMention.setSubject(label);
logger.log(Level.DEBUG, "SUBJECT is being set on an IdentifiedAnnotation: "+label+" "+entityOrEventMention.getSubject());
}
}
public static FeatureSelection<String> createFeatureSelection(double threshold) {
代码示例来源:origin: apache/ctakes
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));
}
}
}
代码示例来源:origin: apache/ctakes
@Override
public void setClassLabel( IdentifiedAnnotation entityOrEventMention,
Instance<String> instance ) throws AnalysisEngineProcessException {
if ( this.isTraining() ) {
String subj = entityOrEventMention.getSubject();
// downsampling. initialize probabilityOfKeepingADefaultExample to 1.0 for no downsampling
if ( "patient".equals( subj )
&& coin.nextDouble() >= this.probabilityOfKeepingADefaultExample ) {
return;
}
instance.setOutcome( subj );
logger.log( Level.DEBUG, String.format( "[%s] expected: ''; actual: ''; features: %s",
this.getClass().getSimpleName(),
instance.toString()
) );
} else {
String label = this.classifier.classify( instance.getFeatures() );
entityOrEventMention.setSubject( label );
logger.log( Level.DEBUG,
"SUBJECT is being set on an IdentifiedAnnotation: " + label + " " + entityOrEventMention.getSubject() );
}
}
代码示例来源:origin: apache/ctakes
@Override
public void setClassLabel(IdentifiedAnnotation entityOrEventMention,
Instance<String> instance) throws AnalysisEngineProcessException {
if (this.isTraining())
{
String subj = entityOrEventMention.getSubject();
// downsampling. initialize probabilityOfKeepingADefaultExample to 1.0 for no downsampling
if ("patient".equals(subj)
&& coin.nextDouble() >= this.probabilityOfKeepingADefaultExample) {
return;
}
instance.setOutcome(subj);
logger.log(Level.DEBUG, String.format("[%s] expected: ''; actual: ''; features: %s",
this.getClass().getSimpleName(),
instance.toString()
));
} else
{
String label = this.classifier.classify(instance.getFeatures());
entityOrEventMention.setSubject(label);
logger.log(Level.DEBUG, "SUBJECT is being set on an IdentifiedAnnotation: "+label+" "+entityOrEventMention.getSubject());
}
}
public static FeatureSelection<String> createFeatureSelection(double threshold) {
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
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 );
}
代码示例来源:origin: apache/ctakes
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 );
}
代码示例来源:origin: apache/ctakes
break;
case SUBJECT:
m.setSubject(mention.getSubject());
break;
case UNCERTAINTY:
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
break;
case SUBJECT:
m.setSubject(mention.getSubject());
break;
case UNCERTAINTY:
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
/**
*
* @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();
}
代码示例来源:origin: apache/ctakes
/**
*
* @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();
}
内容来源于网络,如有侵权,请联系作者删除!