Package org.apache.uima.analysis_engine

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


    FileUtils.saveString2File(script, scriptFile);
    ae.setConfigParameterValue(RutaEngine.SCRIPT_PATHS, new String[] { scriptFile.getParentFile()
            .getAbsolutePath() });
    String name = scriptFile.getName().substring(0, scriptFile.getName().length() - 5);
    ae.setConfigParameterValue(RutaEngine.MAIN_SCRIPT, name);
    ae.reconfigure();
    ae.process(cas);
    scriptFile.delete();
    ae.destroy();
  }
View Full Code Here


    // CFE currently requires that the config file be specified as an absolute path.
    File configFile = JUnitExtension.getFile("CFEConfig.xml");
    specifier.getAnalysisEngineMetaData().getConfigurationParameterSettings().setParameterValue("ConfigurationFile", configFile.getAbsolutePath());
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
    ae.setConfigParameterValue("ConfigurationFile", configFile.getAbsolutePath());
    ae.reconfigure();
    CAS cas = ae.newCAS();
    File docFile = JUnitExtension.getFile("testData.txt");
    String document = FileUtils.file2String(docFile);
    cas.setDocumentText(document);
    cas.setDocumentLanguage("en");
View Full Code Here

        // store AE instance on List to be released later
        toRelease.add(ae);

        // reconfigure
        ae.reconfigure();
      }
    } finally {
      // release all AnalysisEngines back to pool
      Iterator it = toRelease.iterator();
      while (it.hasNext()) {
View Full Code Here

        }
      }
    }

    try {
      targetEngine.reconfigure();
    } catch (ResourceConfigurationException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

    }
    ae.setConfigParameterValue(RutaEngine.PARAM_MAIN_SCRIPT, name);
    ae.setConfigParameterValue(RutaEngine.PARAM_SEEDERS, new String[0]);
    ae.setConfigParameterValue(RutaEngine.PARAM_DEFAULT_FILTERED_TYPES, new String[0]);

    ae.reconfigure();
    CAS cas = ae.newCAS();
    cas.setDocumentText(FileUtils.file2String(textFile, "UTF-8"));
   
    Type typeCW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.CW");
    Type typeSW = cas.getTypeSystem().getType("org.apache.uima.ruta.type.SW");
View Full Code Here

    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
    ae.setConfigParameterValue(ViewWriter.INPUT_VIEW, NEW_VIEW);
    ae.setConfigParameterValue(ViewWriter.OUTPUT_VIEW, CAS.NAME_DEFAULT_SOFA);
    ae.setConfigParameterValue(ViewWriter.OUTPUT, tempFile.getAbsolutePath());
    ae.reconfigure();

    CAS cas = ae.newCAS();
    cas.setDocumentText("This is the default view.");
    CAS newView = cas.createView(NEW_VIEW);
    newView.setDocumentText("This is a new view.");
View Full Code Here

            .getAbsolutePath() });
    String aeName = descFile.getName().substring(0, descFile.getName().length() - 4);
    ae.setConfigParameterValue(RutaEngine.PARAM_ADDITIONAL_ENGINES, new String[] { aeName });
    ae.setConfigParameterValue(RutaEngine.PARAM_DESCRIPTOR_PATHS, new String[] { descFile.getParentFile()
            .getAbsolutePath() });
    ae.reconfigure();

    CAS cas = ae.newCAS();
    cas.setDocumentText("This is the default view.");
    CAS newView = cas.createView(NEW_VIEW);
    newView.setDocumentText("This is a new view.");
View Full Code Here

    if (resourceFile != null) {
      ae.setConfigParameterValue(RutaEngine.PARAM_RESOURCE_PATHS, new String[]{resourceFile.getPath()});
    }

    ae.reconfigure();
    if (cas == null) {
      cas = ae.newCAS();
      cas.setDocumentText(FileUtils.file2String(textFile, "UTF-8"));
    }
    ae.process(cas);
View Full Code Here

      assertTrue(FlowControllerForErrorTest.failedAEs.contains("Segmenter"));

      //configure AE to continue after error
      ae = UIMAFramework.produceAnalysisEngine(aggWithBadSegmenterDesc);
      ae.setConfigParameterValue("ContinueOnFailure", Boolean.TRUE);
      ae.reconfigure();
      FlowControllerForErrorTest.reset();

      cas.reset();
      cas.setDocumentText("Line one\nLine two\nLine three");
      iter = ae.processAndOutputNewCASes(cas);
View Full Code Here

      assertTrue(FlowControllerForErrorTest.abortedDocuments.isEmpty());
      assertTrue(FlowControllerForErrorTest.failedAEs.isEmpty());
     
      //configure AE to continue after error
      ae.setConfigParameterValue("ContinueOnFailure", Boolean.TRUE);
      ae.reconfigure();
      cas.reset();
      cas.setDocumentText("ERROR");
      ae.process(cas); //should not throw exception now
     
      //document should not have aborted, but FC should have been notified of the failiure
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.