Package org.apache.uima.analysis_engine

Examples of org.apache.uima.analysis_engine.AnalysisEngine.processAndOutputNewCASes()


      assertFalse(sdiIter.hasNext());
      // --
      assertFalse(iter.hasNext());

      // input third CAS. We should get back one more segment.
      iter = ae.processAndOutputNewCASes(inputCas3);
      assertTrue(iter.hasNext());
      outCas = iter.next();
      assertEquals("This is two.", outCas.getDocumentText());
      // -- check SourceDocumentInformation FSs
      sdiIter = outCas.getAnnotationIndex(sdiType).iterator();
View Full Code Here


      if (ae == null) // timeout elapsed
      {
        throw new AnalysisEngineProcessException(AnalysisEngineProcessException.TIMEOUT_ELAPSED,
                new Object[] { Integer.valueOf(getTimeout()) });
      }      
      return ae.processAndOutputNewCASes(aCAS);
    } finally {
      if (ae != null) {
        mPool.releaseAnalysisEngine(ae);
      }
      exitProcess(); // stop timer for collecting performance stats
View Full Code Here

      //  Start the heap dump timer. This timer is only started if explicitly enabled
      //  via System property: -DheapDumpThreshold=<x> where is number of seconds the
      //  method is allowed to complete. If the method is not complete in allowed window
      //  the heap and stack trace dump of all threads will be produced.
      stackDumpTimer = ifEnabledStartHeapDumpTimer();
      CasIterator casIterator = ae.processAndOutputNewCASes(aCAS);
      if ( stackDumpTimer != null ) {
        stackDumpTimer.cancel();
        stackDumpTimer = null;   // nullify timer instance so that we dont have to worry about
          // it in case an exception happens below
      }
View Full Code Here

    try {
      // Checkout an instance of AE from the pool
      ae = aeInstancePool.checkout();
      // Get input CAS entry from the InProcess cache
      long time = super.getCpuTime();
      CasIterator casIterator = ae.processAndOutputNewCASes(aCAS);
      // Store how long it took to call processAndOutputNewCASes()
      totalProcessTime = (super.getCpuTime() - time);
      long sequence = 1;
      long hasNextTime = 0; // stores time in hasNext()
      long getNextTime = 0; // stores time in next();
View Full Code Here

       
        return;
      }
      long time = System.nanoTime();
      long totalProcessTime = 0// stored total time spent producing ALL CASes
      CasIterator casIterator = ae.processAndOutputNewCASes(aCAS);
      //  Store how long it took to call processAndOutputNewCASes()
      totalProcessTime = ( System.nanoTime() - time);
      long sequence = 1;
      String newCasReferenceId = null;
      long hasNextTime = 0;         // stores time in hasNext()
View Full Code Here

      CAS initialCas = ae.newCAS();
      initialCas.setDocumentText(document);

      // pass the CAS to the AnalysisEngine and get back
      // a CasIterator for stepping over the output CASes that are produced.
      CasIterator casIterator = ae.processAndOutputNewCASes(initialCas);
      while (casIterator.hasNext()) {
        CAS outCas = casIterator.next();

        // dump the document text and annotations for this segment
        System.out.println("********* NEW SEGMENT *********");
 
View Full Code Here

      {
        throw new AnalysisEngineProcessException(AnalysisEngineProcessException.TIMEOUT_ELAPSED,
                new Object[] { new Integer(getTimeout()) });
      }

      return ae.processAndOutputNewCASes(aCAS);
    } finally {
      if (ae != null) {
        mPool.releaseAnalysisEngine(ae);
      }
      exitProcess(); // stop timer for collecting performance stats
View Full Code Here

              String nextAeKey = ((SimpleStep) nextStep).getAnalysisEngineKey();
              AnalysisEngine nextAe = (AnalysisEngine) mComponentAnalysisEngineMap.get(nextAeKey);
              if (nextAe != null) {
                // invoke next AE in flow
                CasIterator casIter;
                casIter = nextAe.processAndOutputNewCASes(cas);
                if (casIter.hasNext()) // new CASes are output
                {
                  // get the first output CAS
                  CAS outputCas = casIter.next();
                  // push the CasIterator, original CAS, and Flow onto a stack so we
View Full Code Here

                      new XMLInputSource(JUnitExtension
                              .getFile("TextAnalysisEngineImplTest/NewlineSegmenter.xml")));
      AnalysisEngine tae = UIMAFramework.produceAnalysisEngine(segmenterDesc);
      CAS cas = tae.newCAS();
      cas.setDocumentText("Line one\nLine two\nLine three");
      CasIterator iter = tae.processAndOutputNewCASes(cas);
      assertTrue(iter.hasNext());
      CAS outCas = iter.next();
      assertEquals("Line one", outCas.getDocumentText());
      outCas.release();
      assertTrue(iter.hasNext());
View Full Code Here

                      new XMLInputSource(JUnitExtension
                              .getFile("TextAnalysisEngineImplTest/AggregateWithSegmenter.xml")));
      tae = UIMAFramework.produceAnalysisEngine(aggSegDesc);
      cas = tae.newCAS();
      cas.setDocumentText("Line one\nLine two\nLine three");
      iter = tae.processAndOutputNewCASes(cas);
      assertTrue(iter.hasNext());
      outCas = iter.next();
      assertEquals("Line one", outCas.getDocumentText());
      assertEquals("Line one", TestAnnotator.lastDocument);
      outCas.release();
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.