Examples of moveToFirst()


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

  public synchronized void processCas(CAS aCAS) throws ResourceProcessException {
    try {
      // iterate and print annotations
      FSIterator typeIterator = aCAS.getCurrentView().getAnnotationIndex().iterator();

      for (typeIterator.moveToFirst(); typeIterator.isValid(); typeIterator.moveToNext()) {
        AnnotationFS annot = (AnnotationFS) typeIterator.get();

        this.fileWriter.write(annot.getCoveredText());
        this.fileWriter.write(System.getProperty("line.separator"));
        this.fileWriter.write(annot.toString());
View Full Code Here

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

    // 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

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

    // Go through the iterators, starting with the first one
    this.iteratorIndex = 0;
    while (this.iteratorIndex < this.iterators.size()) {
      FSIterator it = (FSIterator) this.iterators.get(this.iteratorIndex);
      // Reset iterator to first position
      it.moveToFirst();
      // If the iterator is valid (i.e., non-empty), return...
      if (it.isValid()) {
        return;
      }
      // ...else try the next one
View Full Code Here

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

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

            + 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

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

    // 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

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

    }

    // 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

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

      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

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

      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

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

      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
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.