Package org.apache.uima.cas

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


    try
    {
      //iterate and print annotations
      FSIterator typeIterator = aCAS.getAnnotationIndex().iterator();

      for (typeIterator.moveToFirst(); typeIterator.isValid(); typeIterator.moveToNext())
      {
        Iterator it = types.keySet().iterator();

        while (it.hasNext())
        {
View Full Code Here


  private void outputAll(CAS cas, List<ResultEntry> resultEntries) {
    checkCreateDefaultMap(cas.getTypeSystem());
    // Output everything except the document annotation.
    Type docAnnotationType = cas.getTypeSystem().getType(CAS.TYPE_NAME_DOCUMENT_ANNOTATION);
    FSIterator it = cas.getAnnotationIndex().iterator();
    for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
      AnnotationFS annot = (AnnotationFS) it.get();
      if (annot.getType().equals(docAnnotationType)) {
        // Skip the document annotation
        continue;
      }
View Full Code Here

  private List<String> getCurrentTagList(JCas cas) {
    List<String> tagList = new ArrayList<String>();
    AnnotationIndex tokenIndex = cas.getAnnotationIndex(TokenAnnotation.type);
    FSIterator tokIt = tokenIndex.iterator();
    TokenAnnotation token = null;
    for (tokIt.moveToFirst(); tokIt.isValid(); tokIt.moveToNext()) {
      token = (TokenAnnotation) tokIt.get();
      tagList.add(token.getPosTag());
    }
    return tagList;
  }
View Full Code Here

    Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
        "moby-tag-list.txt"), "utf-8"));
    AnnotationIndex tokenIndex = cas.getAnnotationIndex(TokenAnnotation.type);
    FSIterator tokIt = tokenIndex.iterator();
    TokenAnnotation token = null;
    for (tokIt.moveToFirst(); tokIt.isValid(); tokIt.moveToNext()) {
      token = (TokenAnnotation) tokIt.get();
      writer.write(token.getPosTag());
      writer.write('\n');
    }
    writer.close();
View Full Code Here

  }

  private static final int countIndexMembers(FSIndex idx) {
    FSIterator it = idx.iterator();
    int count = 0;
    for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
      ++count;
    }
    return count;
  }
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

  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

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

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

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.