Package org.apache.uima.analysis_engine

Examples of org.apache.uima.analysis_engine.ResultSpecification


    } else {
      // To form the result spec that will be passed down to each component,
      // we take the union aResultSpec with the inputs of all components in this
      // aggregate. This forms the complete list of types that any component in
      // this aggregate might ever need to produce.
      ResultSpecification resultSpecForComponents = (ResultSpecification) aResultSpec.clone();
      resultSpecForComponents.addCapabilities(getAllComponentCapabilities(), false);

      // now iterate over components and call their setResultSpecification methods
      Iterator<AnalysisEngine> componentIter = _getASB().getComponentAnalysisEngines().values().iterator();
      while (componentIter.hasNext()) {
        AnalysisEngine ae = (AnalysisEngine) componentIter.next();
View Full Code Here


  protected void _testProcess(AnalysisEngineDescription aTaeDesc) throws UIMAException {
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aTaeDesc);
    CAS tcas = ae.newCAS();

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

    _testProcessInner(ae, tcas, resultSpec, resultSpec);
  }
View Full Code Here

  protected void _testProcess(AnalysisEngineDescription aTaeDesc, String[] languages) throws UIMAException {
    AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aTaeDesc);
    CAS tcas = ae.newCAS();

    // process(CAS,ResultSpecification)
    ResultSpecification resultSpec = new ResultSpecification_impl(tcas.getTypeSystem());
    resultSpec.addResultType("NamedEntity", true);   // includes subtypes Person, Sentence, Place, Paragraph
                                                     // sets for lang = x-unspecified
   
    ResultSpecification expectedLastResultSpec = new ResultSpecification_impl(tcas.getTypeSystem());
    // interesting case:
    //   Because the annotator extends a UIMA Version 1.x impl class, we go thru an "adapter" interface
    //     which normally replaces the result spec with one that is based on language x-unspecified
    //       (guessing because version 1.x didn't properly support languages)
    //     However there's an exception to this: if the result spec would have no types or features
    //       for the language in the CAS, the original result spec is used, rather than a
    //       new one based on x-unspecified.
    expectedLastResultSpec.addResultType("NamedEntity", true, languages)

    _testProcessInner(ae, tcas, resultSpec, expectedLastResultSpec);
  }
View Full Code Here

        tcas.setDocumentText("new test");
        mAE.process(tcas);
        tcas.reset();

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

        tcas.setDocumentText("testing...");
        mAE.process(tcas, resultSpec);
        tcas.reset();
View Full Code Here

  public void process(JCas aJCas) {
    jcas = aJCas;
    input = jcas.getDocumentText();

    // Create Annotations
    ResultSpecification resultSpec = getResultSpecification();
    if (resultSpec.containsType("org.apache.uima.tutorial.TimeAnnot",aJCas.getDocumentLanguage()))
      makeAnnotations(timeAnnotationMaker, hoursMinutesPattern, dfTimeShort);
    if (resultSpec.containsType("org.apache.uima.tutorial.DateAnnot",aJCas.getDocumentLanguage()))
      makeAnnotations(dateAnnotationMaker, numericDatePattern, dfDateShort);
    if (resultSpec.containsType("org.apache.uima.tutorial.DateAnnot",aJCas.getDocumentLanguage()))
      makeAnnotations(dateAnnotationMaker, mediumDatePattern, dfDateMedium);
    if (resultSpec.containsType("org.apache.uima.tutorial.DateAnnot",aJCas.getDocumentLanguage()))
      makeAnnotations(dateAnnotationMaker, longDatePattern, dfDateLong);
  }
View Full Code Here

     
      //Check TestAnnotator fields only at the very end of processing,
      //we can't test from the threads themsleves since the state of
      //these fields is nondeterministic during the multithreaded processing.
      assertEquals("testing...", TestAnnotator.getLastDocument());
      ResultSpecification lastResultSpec = TestAnnotator.getLastResultSpec();
      ResultSpecification resultSpec = new ResultSpecification_impl(lastResultSpec.getTypeSystem());
      resultSpec.addResultType("NamedEntity", true);
      assertEquals(resultSpec, lastResultSpec);

    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
View Full Code Here

    tae.process(tcas);
    assertEquals("new test", TestAnnotator.lastDocument);
    tcas.reset();

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

    tcas.setDocumentText("testing...");
    tae.process(tcas, resultSpec);
    assertEquals("testing...", TestAnnotator.lastDocument);
    assertEquals(resultSpec, TestAnnotator.lastResultSpec);
View Full Code Here

      // Set the document text on the CAS.
      cas.setDocumentText(text);
      cas.setDocumentLanguage(language);
      // Process the sample document.
      if (doResultSpec) {
        ResultSpecification resultSpec = UIMAFramework.getResourceSpecifierFactory()
                .createResultSpecification();
        resultSpec.addCapabilities(ae.getAnalysisEngineMetaData().getCapabilities());
        ae.process(cas, resultSpec);
      } else {
        ae.process(cas);
      }
      // check fileoutput
View Full Code Here

    ae.process(tcas);
    assertEquals("new test", TestAnnotator.lastDocument);
    tcas.reset();

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

    tcas.setDocumentText("testing...");
    ae.process(tcas, resultSpec);
    assertEquals("testing...", TestAnnotator.lastDocument);
    assertEquals(resultSpec, TestAnnotator.lastResultSpec);
View Full Code Here

              .parseAnalysisEngineDescription(
                      new XMLInputSource(JUnitExtension.getFile("SequencerTest/Annotator1.xml")));
      PrimitiveAnalysisEngine_impl ae = (PrimitiveAnalysisEngine_impl) UIMAFramework
              .produceAnalysisEngine(aeDesc);
      CAS cas = ae.newCAS();
      ResultSpecification resultSpec = new ResultSpecification_impl();
      resultSpec.addResultType("uima.tt.TokenLikeAnnotation", true);
      resultSpec.setTypeSystem(cas.getTypeSystem());
      ResultSpecification acResultSpec = ae.computeAnalysisComponentResultSpec(resultSpec, ae
              .getAnalysisEngineMetaData().getCapabilities());
      assertTrue(acResultSpec.containsType("uima.tt.TokenAnnotation"));
      assertFalse(acResultSpec.containsType("uima.tt.SentenceAnnotation"));
      assertFalse(acResultSpec.containsType("uima.tt.Lemma"));
    } catch (Exception e) {
      JUnitExtension.handleException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.analysis_engine.ResultSpecification

Copyright © 2018 www.massapicom. 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.