There are 3 code examples for org.apache.uima.cas.FSIntConstraint.
The API names are highlighted below.
You can use
button
to vote the code example(s) you like. The best code example will be ranked first next time. Thanks a lot for your feedback.
Project Name: icTAKES Package: edu.mayo.bmi.uima.core.util
Source Code: FSUtil.java (Click to view .java file)
Method Code:
@Deprecated public static FSIterator getAnnotationsInSpanIterator(JCas jcas,int type,int beginSpan,int endSpan){
ConstraintFactory constraintFactory=jcas.getConstraintFactory();
FSIntConstraint windowConstraint=constraintFactory.createIntConstraint();
windowConstraint.gt(beginSpan - 1);
windowConstraint.lt(endSpan);
Type annotType=jcas.getCasType(type);
Feature beginSpanFeature=annotType.getFeatureByBaseName("begin");
Feature endSpanFeature=annotType.getFeatureByBaseName("end");
FeaturePath beginFeaturePath=jcas.createFeaturePath();
beginFeaturePath.addFeature(beginSpanFeature);
FSMatchConstraint beginSpanConstraint=constraintFactory.embedConstraint(beginFeaturePath,windowConstraint);
FeaturePath endFeaturePath=jcas.createFeaturePath();
endFeaturePath.addFeature(endSpanFeature);
FSMatchConstraint endSpanConstraint=constraintFactory.embedConstraint(endFeaturePath,windowConstraint);
FSMatchConstraint spanConstraint=constraintFactory.and(beginSpanConstraint,endSpanConstraint);
JFSIndexRepository indexes=jcas.getJFSIndexRepository();
FSIndex annotIndex=indexes.getAnnotationIndex(type);
FSIterator annotsInSpanItr=jcas.createFilteredIterator(annotIndex.iterator(),spanConstraint);
return annotsInSpanItr;
}
Project Name: icTAKES Package: org.mitre.medfacts.i2b2.api.ctakes
Source Code: ConstraintConstructorFindContainedWithin.java (Click to view .java file)
Method Code:
/**
* @param problemBegin
* @param problemEnd
* @param cf
* @param sentenceBeginFeaturePath
* @param sentenceEndFeaturePath
* @return
*/
public FSMatchConstraint constructContainedByConstraint(int problemBegin,int problemEnd,ConstraintFactory cf,FeaturePath sentenceBeginFeaturePath,FeaturePath sentenceEndFeaturePath){
FSIntConstraint sentenceBeginIntConstraint=cf.createIntConstraint();
sentenceBeginIntConstraint.geq(problemBegin);
FSIntConstraint sentenceEndIntConstraint=cf.createIntConstraint();
sentenceEndIntConstraint.leq(problemEnd);
FSMatchConstraint begin=cf.embedConstraint(sentenceBeginFeaturePath,sentenceBeginIntConstraint);
FSMatchConstraint end=cf.embedConstraint(sentenceEndFeaturePath,sentenceEndIntConstraint);
FSMatchConstraint beginAndEnd=cf.and(begin,end);
return beginAndEnd;
}
Project Name: icTAKES Package: org.mitre.medfacts.i2b2.api.ctakes
Source Code: ConstraintConstructorFindContainedBy.java (Click to view .java file)
Method Code:
/**
* @param problemBegin
* @param problemEnd
* @param cf
* @param sentenceBeginFeaturePath
* @param sentenceEndFeaturePath
* @return
*/
public FSMatchConstraint constructContainedByConstraint(int problemBegin,int problemEnd,ConstraintFactory cf,FeaturePath sentenceBeginFeaturePath,FeaturePath sentenceEndFeaturePath){
FSIntConstraint sentenceBeginIntConstraint=cf.createIntConstraint();
sentenceBeginIntConstraint.leq(problemBegin);
FSIntConstraint sentenceEndIntConstraint=cf.createIntConstraint();
sentenceEndIntConstraint.geq(problemEnd);
FSMatchConstraint begin=cf.embedConstraint(sentenceBeginFeaturePath,sentenceBeginIntConstraint);
FSMatchConstraint end=cf.embedConstraint(sentenceEndFeaturePath,sentenceEndIntConstraint);
FSMatchConstraint beginAndEnd=cf.and(begin,end);
return beginAndEnd;
}