Examples of FSMatchConstraint


Examples of org.apache.uima.cas.FSMatchConstraint

    FeaturePath beginPath = getCAS().createFeaturePath();
    beginPath.addFeature(annotationType.getFeatureByBaseName("begin"));
    FSIntConstraint beginConstraint = cf.createIntConstraint();
    beginConstraint.geq(span.getStart());

    FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath, beginConstraint);

    FeaturePath endPath = getCAS().createFeaturePath();
    endPath.addFeature(annotationType.getFeatureByBaseName("end"));
    FSIntConstraint endConstraint = cf.createIntConstraint();
    endConstraint.leq(span.getEnd());

    FSMatchConstraint embeddedEnd = cf.embedConstraint(endPath, endConstraint);

    FSMatchConstraint strictType = new StrictTypeConstraint(type);

    FSMatchConstraint annotatioInSpanConstraint = cf.and(embeddedBegin, embeddedEnd);

    FSMatchConstraint annotationInSpanAndStrictTypeConstraint =
            cf.and(annotatioInSpanConstraint, strictType);

    FSIndex<AnnotationFS> allAnnotations = getCAS().getAnnotationIndex(type);

    FSIterator<AnnotationFS> annotationInsideSpanIndex =
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

      FSIterator<AnnotationFS> it = cas.getAnnotationIndex(tokenType).iterator();
      FSStringConstraint type1Constraint = cas.getConstraintFactory().createStringConstraint();
      type1Constraint.equals(lemma);
      FeaturePath path = cas.createFeaturePath();
      path.addFeature(lemmaFeat);
      FSMatchConstraint cons = cas.getConstraintFactory().embedConstraint(path, type1Constraint);
      it = cas.createFilteredIterator(it, cons);

      int count = 0;
      for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
        ++count;
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

      FSIterator<AnnotationFS> it = cas.getAnnotationIndex(tokenType).iterator();
      FSStringConstraint type1Constraint = cas.getConstraintFactory().createStringConstraint();
      type1Constraint.equals(lemma);
      ArrayList<String> path = new ArrayList<String>();
      path.add(lemmaFeat.getShortName());
      FSMatchConstraint cons = cas.getConstraintFactory().embedConstraint(path, type1Constraint);
      it = cas.createFilteredIterator(it, cons);

      int count = 0;
      for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
        ++count;
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

      FSTypeConstraint tc = cf.createTypeConstraint();
      tc.add(sepType);
      tc.add(eosType.getName());
      ArrayList<String> path = new ArrayList<String>();
      path.add(tokenTypeFeat.getShortName());
      FSMatchConstraint cons = cf.embedConstraint(path, tc);
      it = this.cas.createFilteredIterator(it, cons);
      int count = 0;
      for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
        ++count;
      }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    FeaturePath beginPath = cas.createFeaturePath();
    beginPath.addFeature(annotationType.getFeatureByBaseName("begin"));
    FSIntConstraint beginConstraint = cf.createIntConstraint();
    beginConstraint.geq(span.getStart());

    FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath, beginConstraint);

    FeaturePath endPath = cas.createFeaturePath();
    endPath.addFeature(annotationType.getFeatureByBaseName("end"));
    FSIntConstraint endConstraint = cf.createIntConstraint();
    endConstraint.leq(span.getEnd());

    FSMatchConstraint embeddedEnd = cf.embedConstraint(endPath, endConstraint);

    FSMatchConstraint strictType = new StrictTypeConstraint(type);

    FSMatchConstraint annotatioInSpanConstraint = cf.and(embeddedBegin, embeddedEnd);

    FSMatchConstraint annotationInSpanAndStrictTypeConstraint =
            cf.and(annotatioInSpanConstraint, strictType);

    FSIndex<AnnotationFS> allAnnotations = cas.getAnnotationIndex(type);

    FSIterator<AnnotationFS> annotationInsideSpanIndex =
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

    FeaturePath beginPath = cas.createFeaturePath();
    beginPath.addFeature(annotationType.getFeatureByBaseName("begin"));
    FSIntConstraint beginConstraint = cf.createIntConstraint();
    beginConstraint.geq(span.getStart());

    FSMatchConstraint embeddedBegin = cf.embedConstraint(beginPath, beginConstraint);

    FeaturePath endPath = cas.createFeaturePath();
    endPath.addFeature(annotationType.getFeatureByBaseName("end"));
    FSIntConstraint endConstraint = cf.createIntConstraint();
    endConstraint.leq(span.getEnd());

    FSMatchConstraint embeddedEnd = cf.embedConstraint(endPath, endConstraint);

    FSMatchConstraint strictType = new StrictTypeConstraint(type);

    FSMatchConstraint annotatioInSpanConstraint = cf.and(embeddedBegin, embeddedEnd);

    FSMatchConstraint annotationInSpanAndStrictTypeConstraint =
            cf.and(annotatioInSpanConstraint, strictType);

    FSIndex<AnnotationFS> allAnnotations = cas.getAnnotationIndex(type);

    FSIterator<AnnotationFS> annotationInsideSpanIndex =
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

   
    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;
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

   
    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;
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

   
    Feature sentenceEndFeature = annotationType.getFeatureByBaseName("end");
    FeaturePath sentenceEndFeaturePath = jcas.createFeaturePath();
    sentenceEndFeaturePath.addFeature(sentenceEndFeature);
   
    FSMatchConstraint beginAndEnd = constructConstraintByBeginEnd(
        problemBegin, problemEnd, cf, sentenceBeginFeaturePath,
        sentenceEndFeaturePath);
   
   
    FSTypeConstraint sentenceTypeConstraint = cf.createTypeConstraint();
    sentenceTypeConstraint.add(sentenceType);
   
    FSMatchConstraint beginAndEndAndType = cf.and(beginAndEnd, sentenceTypeConstraint);
   
    FSIterator<Annotation> filteredIterator =
        jcas.createFilteredIterator(jcas.getAnnotationIndex().iterator(),  beginAndEndAndType);
    return filteredIterator;
  }
View Full Code Here

Examples of org.apache.uima.cas.FSMatchConstraint

      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;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.