Package org.apache.uima.cas

Examples of org.apache.uima.cas.CAS.reset()


        CAS runCas = CasCreationUtils.createCas(tsd, null, null);
        CAS goldCas = CasCreationUtils.createCas(tsd, null, null);
        for (TestCasData td : testCasData) {
          // init etc
          runCas.reset();
          goldCas.reset();
          // deserialize CASes
          IPath path2RunFile = runTestPath.append(td.getPath().toFile().getName());
          String runFilePath = path2RunFile.toPortableString();
          File runFile = new File(runFilePath);
          deserializeCASs(goldCas, td, runCas, runFile);
View Full Code Here


        CAS cleanCas = getEmptyCas(tsd);

        for (TestCasData td : testCasData) {
          // init etc
          cleanCas.reset(); // clean
          // deserialize CASes
          FileInputStream inputStreamRun = null;
          try {
            inputStreamRun = new FileInputStream(new File(td.getPath().toPortableString()));
            XmiCasDeserializer.deserialize(inputStreamRun, cleanCas, true);
View Full Code Here

        CAS testCas = getEmptyCas(descriptor);

        for (TestCasData td : testCasData) {
          // init td etc
          runCas.reset();
          testCas.reset();
          String elementName = fScript.getLocation().lastSegment();
          monitor.setTaskName("Processing [w/o classpatch ext.] " + td.getPath().lastSegment());
          int lastIndexOf = elementName.lastIndexOf(RutaEngine.SCRIPT_FILE_EXTENSION);
          if (lastIndexOf != -1) {
            elementName = elementName.substring(0, lastIndexOf);
View Full Code Here

        return Status.CANCEL_STATUS;
      }
      TreePath treePath = null;
      final IAnnotationCheckTreeNode root = new AnnotationCheckRootNode();
      for (File file : listFiles) {
        cas.reset();
        try {
          XmiCasDeserializer.deserialize(new FileInputStream(file), cas, true);
        } catch (FileNotFoundException e) {
          RutaAddonsPlugin.error(e);
        } catch (SAXException e) {
View Full Code Here

    // process(CAS)
    CAS tcas = tae.newCAS();
    tcas.setDocumentText("new test");
    tae.process(tcas);
    assertEquals("new test", TestAnnotator.lastDocument);
    tcas.reset();

    // process(CAS,ResultSpecification)
    ResultSpecification resultSpec = new ResultSpecification_impl(tcas.getTypeSystem());
    resultSpec.addResultType("NamedEntity", true);
View Full Code Here

    tcas.setDocumentText("testing...");
    tae.process(tcas, resultSpec);
    assertEquals("testing...", TestAnnotator.lastDocument);
    assertEquals(resultSpec, TestAnnotator.lastResultSpec);
    tcas.reset();
  }

  class ProcessThread extends Thread {
    ProcessThread(AnalysisEngine aAE) {
      mAE = aAE;
View Full Code Here

        // process(CAS)
        CAS tcas = mAE.newCAS();
        mLastTypeSystem = tcas.getTypeSystem();
        tcas.setDocumentText("new test");
        mAE.process(tcas);
        tcas.reset();

        // process(CAS,ResultSpecification)
        ResultSpecification resultSpec = new ResultSpecification_impl(tcas.getTypeSystem());
        resultSpec.addResultType("NamedEntity", true);
View Full Code Here

        ResultSpecification resultSpec = new ResultSpecification_impl(tcas.getTypeSystem());
        resultSpec.addResultType("NamedEntity", true);

        tcas.setDocumentText("testing...");
        mAE.process(tcas, resultSpec);
        tcas.reset();

      } catch (Throwable t) {
        t.printStackTrace();
        //can't cause unit test to fail by throwing exception from thread.
        //record the failure and the main thread will check for it later.
View Full Code Here

        for (int i = 0; i < 5; i++) {
          CAS tcas = mAE.newCAS();
          mLastTypeSystem = tcas.getTypeSystem();
          tcas.setDocumentText("new test");
          mAE.process(tcas);
          tcas.reset();
 
          // process(CAS,ResultSpecification)
          ResultSpecification resultSpec = new ResultSpecification_impl(tcas.getTypeSystem());
          resultSpec.addResultType("NamedEntity", true);
 
View Full Code Here

          ResultSpecification resultSpec = new ResultSpecification_impl(tcas.getTypeSystem());
          resultSpec.addResultType("NamedEntity", true);
 
          tcas.setDocumentText("testing...");
          mAE.process(tcas, resultSpec);
          tcas.reset();
        }
      } catch (Throwable t) {
        t.printStackTrace();
        //can't cause unit test to fail by throwing exception from thread.
        //record the failure and the main thread will check for it later.
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.