Package org.apache.uima.cas

Examples of org.apache.uima.cas.FSIterator.moveToFirst()


      return;
    }
    ++this.iteratorIndex;
    while (this.iteratorIndex < this.iterators.size()) {
      current = (FSIterator) this.iterators.get(this.iteratorIndex);
      current.moveToFirst();
      if (current.isValid()) {
        return;
      }
      ++this.iteratorIndex;
    }
View Full Code Here


            + index.getType().getName() + "</font> [" + size + "]</html>";
    this.root = new FSNode(this, FSNode.DISPLAY_NODE, 0, null);
    this.fss = new ArrayList();
    FSIterator it = index.iterator();
    int count = 0;
    for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
      FeatureStructure fs = it.get();
      this.fss.add(new FSNode(this, getNodeType(fs.getType()), fs.hashCode(), count));
      ++count;
    }
    ArrayList kids = createArrayChildren(0, size, this.fss, this);
View Full Code Here

    // assert(it != null);
    // Now create sentences. We do this as follows: a sentence starts where
    // the first token after an EOS starts, and ends with an EOS.
    long time = System.currentTimeMillis();
    int endOfSentenceCounter = 0;
    it.moveToFirst();
    boolean lookForStart = true;
    int start = 0, end; // Initialize start to pacify compiler.
    FeatureStructure tokenFS, sentFS;
    while (it.isValid()) {
      if (lookForStart) {
View Full Code Here

    }

    // Count number of annotations.
    it = cas.getAnnotationIndex().iterator();
    int countAll = 0;
    for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
      ++countAll;
    }

    // create filtered iterator over annotations
    it = cas.getAnnotationIndex().iterator();
View Full Code Here

      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;
      }

      // /////////////////////////////////////////////////////////////
      // Count instances of tokens with lemma "the".
View Full Code Here

      FSIndex tokenIndex = cas.getAnnotationIndex(tokenType);
      FSIterator tokenIt = tokenIndex.iterator();
      // Create a counter.
      int theCount = 0;
      // Iterate over the tokens.
      for (tokenIt.moveToFirst(); tokenIt.isValid(); tokenIt.moveToNext()) {
        AnnotationFS tok = (AnnotationFS) tokenIt.get();
        if (tok.getStringValue(lemmaFeat).equals(lemma)) {
          ++theCount;
          // System.out.println("Found token: " + tok.getCoveredText());
        }
View Full Code Here

      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;
      }

      // /////////////////////////////////////////////////////////////
      // Count instances of tokens with lemma "the".
View Full Code Here

      FSIndex tokenIndex = cas.getAnnotationIndex(tokenType);
      FSIterator tokenIt = tokenIndex.iterator();
      // Create a counter.
      int theCount = 0;
      // Iterate over the tokens.
      for (tokenIt.moveToFirst(); tokenIt.isValid(); tokenIt.moveToNext()) {
        AnnotationFS tok = (AnnotationFS) tokenIt.get();
        if (tok.getStringValue(lemmaFeat).equals(lemma)) {
          ++theCount;
          // System.out.println("Found token: " + tok.getCoveredText());
        }
View Full Code Here

      ArrayList path = new ArrayList();
      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;
      }
      assertTrue(count == 4);

    } catch (Exception e) {
View Full Code Here

    assertTrue(down == 0);

    // Get all indexed, create copy and iterate in parallel.
    it = getAllIndexed();
    FSIterator copy = it.copy();
    copy.moveToFirst();
    for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
      assertTrue(copy.isValid());
      assertTrue(it.get().equals(copy.get()));
      copy.moveToNext();
    }
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.