Package org.apache.uima.analysis_engine

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


        monitor.setTaskName("Processing " + path.lastSegment() + "... ");
        try {

          if (cas == null) {
            cas = ae.newCAS();
          } else {
            cas.reset();
          }
          if (path.getFileExtension().equals("xmi")) {
            XmiCasDeserializer.deserialize(new FileInputStream(path.toPortableString()), cas, true);
View Full Code Here


              new String[] { resourceFile.getPath() });
    }

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

    ae.destroy();
View Full Code Here

      if (mon.isCanceled()) {
        break;
      }
      try {
        if (cas == null) {
          cas = ae.newCAS();
        } else {
          cas.reset();
        }
        if (each.getName().endsWith("xmi")) {
          XmiCasDeserializer.deserialize(new FileInputStream(each), cas, true);
View Full Code Here

    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.");
    Type type = cas.getTypeSystem().getType(TEST_TYPE);
    AnnotationFS createAnnotation = newView.createAnnotation(type, 10, 13);
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");
    cas.addFsToIndexes(cas.createAnnotation(typeCW, 0, 5));
View Full Code Here

    tsdi.setTypes(new TypeDescription[] {ti1, ti2});
   
    String script = "CW SW{-> MARK(Test1)};\n Test1 SW{-> MARK(Test2)};";
    AnalysisEngineDescription aed = Ruta.createAnalysisEngineDescription(script, tsdi);
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aed);
    CAS cas = ae.newCAS();
    cas.setDocumentText("Only some text.");
    ae.process(cas);

    Type type1 = cas.getTypeSystem().getType(t1);
    AnnotationIndex<AnnotationFS> ai1 = cas.getAnnotationIndex(type1);
View Full Code Here

    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.");
    Type type = cas.getTypeSystem().getType(TEST_TYPE);
    AnnotationFS createAnnotation = newView.createAnnotation(type, 5, 7);
View Full Code Here

      throw new IllegalArgumentException("Passed arguments are invalid!");
    }

    AnalysisEngine ae = Ruta.wrapAnalysisEngine(descriptor.toURI().toURL(), view, true, inputEncoding);
    configure(ae);
    CAS cas = ae.newCAS();

    List<File> inputFiles = getFiles(inputFolder, inputRecursive);
    for (File file : inputFiles) {
      processFile(file, ae, cas);
    }
View Full Code Here

              "org/apache/uima/ruta/engine/HtmlConverter.xml");
    }
    XMLInputSource in = new XMLInputSource(url);
    ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
    CAS cas = ae.newCAS();

    ae.setConfigParameterValue(HtmlConverter.OUTPUT_VIEW, outputViewName);
    ae.setConfigParameterValue(HtmlConverter.CONVERSION_POLICY, "explicit");
    ae.setConfigParameterValue(HtmlConverter.CONVERSION_PATTERNS, new String[] { "&nbsp;" });
    ae.setConfigParameterValue(HtmlConverter.CONVERSION_REPLACEMENTS, new String[] { " " });
View Full Code Here

              "org/apache/uima/ruta/engine/HtmlConverter.xml");
    }
    XMLInputSource in = new XMLInputSource(url);
    ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(in);
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(specifier);
    CAS cas = ae.newCAS();

    ae.setConfigParameterValue(HtmlConverter.OUTPUT_VIEW, outputViewName);
    ae.reconfigure();
    cas.reset();
    cas.setDocumentText(htmlDecoding);
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.