Package org.apache.uima.analysis_engine

Examples of org.apache.uima.analysis_engine.ResultSpecification


      // System.out.println("Processing text: \"" + text + "\"");
      // Set the document text on the CAS.
      cas.setDocumentText(text);
      cas.setDocumentLanguage("ja");
      // Process the sample document.
      ResultSpecification resultSpec = UIMAFramework.getResourceSpecifierFactory()
              .createResultSpecification();
      resultSpec.addCapabilities(ae.getAnalysisEngineMetaData().getCapabilities());
      ae.process(cas, resultSpec);
      // check fileoutput
      Assert.assertTrue(FileCompare.compare(outputReferenceFile, JUnitExtension
              .getFile("SequencerTest/SequencerCapabilityLanguageExpectedJaResultSpec.txt")));
      outputReferenceFile.delete();
View Full Code Here


      // System.out.println("Processing text: \"" + text + "\"");
      // Set the document text on the CAS.
      cas.setDocumentText(text);
      cas.setDocumentLanguage("x-unspecified");
      // Process the sample document.
      ResultSpecification resultSpec = UIMAFramework.getResourceSpecifierFactory()
              .createResultSpecification();
      resultSpec.addCapabilities(ae.getAnalysisEngineMetaData().getCapabilities());
      ae.process(cas, resultSpec);
      // check fileoutput
      Assert.assertTrue(FileCompare.compare(outputReferenceFile, JUnitExtension
              .getFile("SequencerTest/SequencerCapabilityLanguageExpectedXunSpec.txt")));
      outputReferenceFile.delete();
View Full Code Here

      // System.out.println("Processing text: \"" + text + "\"");
      // Set the document text on the CAS.
      cas.setDocumentText(text);
      cas.setDocumentLanguage("foo-BAR");
      // Process the sample document.
      ResultSpecification resultSpec = UIMAFramework.getResourceSpecifierFactory()
              .createResultSpecification();
      resultSpec.addCapabilities(ae.getAnalysisEngineMetaData().getCapabilities());
      ae.process(cas, resultSpec);
      // check fileoutput
      Assert.assertTrue(FileCompare.compare(outputReferenceFile, JUnitExtension
              .getFile("SequencerTest/SequencerCapabilityLanguageExpectedEsUnknown.txt")));
      outputReferenceFile.delete();
View Full Code Here

      // System.out.println("Processing text: \"" + text + "\"");
      // Set the document text on the CAS.
      cas.setDocumentText(text);
      cas.setDocumentLanguage("zh-cn");
      // Process the sample document.
      ResultSpecification resultSpec = UIMAFramework.getResourceSpecifierFactory()
              .createResultSpecification();
      resultSpec.addCapabilities(ae.getAnalysisEngineMetaData().getCapabilities());
      ae.process(cas, resultSpec);
      // check fileoutput
      Assert.assertTrue(FileCompare.compare(outputReferenceFile, JUnitExtension
              .getFile("SequencerTest/SequencerCapabilityLanguageExpectedEsZhCNResultSpec.txt")));
      outputReferenceFile.delete();
View Full Code Here

    // does nothing by default (for service adapters)
    // overridden in both primitive and aggregate AE implementations
  }

  public void resetResultSpecificationToDefault() {
    ResultSpecification resultSpec = new ResultSpecification_impl();
    resultSpec.addCapabilities(this.getAnalysisEngineMetaData().getCapabilities());
    setResultSpecification(resultSpec);
  }
View Full Code Here

        // current analysis node which contains the current analysis engine
        AnalysisSequenceCapabilityNode node;

        // result spec for the current analysis engine
        ResultSpecification currentAnalysisResultSpec = null;

        // flag if current analysis engine should be called or not
        boolean shouldEngineBeCalled = false;

        // check output capabilites from the current result spec
        do {
          // get next analysis engine from the sequence node
          node = (AnalysisSequenceCapabilityNode) mNodeList.get(mIndex++);

          // get capability container from the current analysis engine
          CapabilityContainer capabilityContainer = node.getCapabilityContainer();

          // create current analysis result spec without any language information
          currentAnalysisResultSpec = UIMAFramework.getResourceSpecifierFactory()
                  .createResultSpecification();

          // check if engine should be called - loop over all ouput capabilities of the result spec
          for (int i = 0; i < ouputCapabilities.length; i++) {
            // check if current ToF can be produced by the current analysis engine
            if (capabilityContainer.hasOutputTypeOrFeature(ouputCapabilities[i], documentLanguage,
                    true)) {
              currentAnalysisResultSpec.addResultTypeOrFeature(ouputCapabilities[i]);
              shouldEngineBeCalled = true;

              // remove current ToF from the result spec
              mResultSpec.removeTypeOrFeature(ouputCapabilities[i]);
            }
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 resultSpec = new ResultSpecification_impl();
      resultSpec.addResultType("NamedEntity", true);
      assertEquals(resultSpec, TestAnnotator.getLastResultSpec());

    } 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();
    resultSpec.addResultType("NamedEntity", true);

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

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

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

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

    } 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 componentIter = _getASB().getComponentAnalysisEngines().values().iterator();
      while (componentIter.hasNext()) {
        AnalysisEngine ae = (AnalysisEngine) componentIter.next();
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.