当前位置: 首页>>代码示例>>Java>>正文


Java UIMAFramework.produceCollectionProcessingEngine方法代码示例

本文整理汇总了Java中org.apache.uima.UIMAFramework.produceCollectionProcessingEngine方法的典型用法代码示例。如果您正苦于以下问题:Java UIMAFramework.produceCollectionProcessingEngine方法的具体用法?Java UIMAFramework.produceCollectionProcessingEngine怎么用?Java UIMAFramework.produceCollectionProcessingEngine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.uima.UIMAFramework的用法示例。


在下文中一共展示了UIMAFramework.produceCollectionProcessingEngine方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import org.apache.uima.UIMAFramework; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, UIMAException,
        CpeDescriptorException {
    if (args.length != 1) {
        System.err.println("Usage: <cpeDescriptorPath>");
        return;
    }
    String cpeDescPath = args[0];

    XMLInputSource cpeDescSource = new XMLInputSource(cpeDescPath);
    CpeDescription cpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(cpeDescSource);

    // produce
    CollectionProcessingEngine cpe = UIMAFramework
            .produceCollectionProcessingEngine(cpeDesc);
    cpe.addStatusCallbackListener(new ReportingStatusCallbackListener(cpe));

    // run
    cpe.process();
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:20,代码来源:CpeLauncher.java

示例2: create

import org.apache.uima.UIMAFramework; //导入方法依赖的package包/类
public static TestCPERunner create(CpeDescription cpeDescription) throws BiomedicusException {
  try {
    return new TestCPERunner(UIMAFramework.produceCollectionProcessingEngine(cpeDescription));
  } catch (ResourceInitializationException e) {
    throw new BiomedicusException(e);
  }
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:8,代码来源:TestCPERunner.java

示例3: SimpleRunCPE_fixed

import org.apache.uima.UIMAFramework; //导入方法依赖的package包/类
/**
 * Constructor for the class.
 * 
 * @param args
 *          command line arguments into the program - see class description
 */
public SimpleRunCPE_fixed(String args[]) throws Exception {
  mStartTime = System.currentTimeMillis();

  // check command line args
  if (args.length < 1) {
    printUsageMessage();
    System.exit(1);
  }

  // parse CPE descriptor
  System.out.println("Parsing CPE Descriptor");
  CpeDescription cpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(
          new XMLInputSource(args[0]));
  // instantiate CPE
  System.out.println("Instantiating CPE");
  mCPE = UIMAFramework.produceCollectionProcessingEngine(cpeDesc);

  // Create and register a Status Callback Listener
  mCPE.addStatusCallbackListener(new StatusCallbackListenerImpl());

  // Start Processing
  System.out.println("Running CPE");
  mCPE.process();

  // Allow user to abort by pressing Enter
  System.out.println("To abort processing, type \"abort\" and press enter.");
  while (true) {
    String line = new BufferedReader(new InputStreamReader(System.in)).readLine();
    if ("abort".equals(line) && mCPE.isProcessing()) {
      System.out.println("Aborting...");
      mCPE.stop();
      break;
    }
  }
}
 
开发者ID:oaqa,项目名称:knn4qa,代码行数:42,代码来源:SimpleRunCPE_fixed.java

示例4: main

import org.apache.uima.UIMAFramework; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, UIMAException,
        CpeDescriptorException {
    if (args.length != 2) {
        System.err.println("Usage: <txtInputDir> <xmiOutputDir>");
        return;
    }
    String cpeDescPath = "desc/cpe/cpe-txt-to-xmi.xml";
    String inputDirPath = args[0];
    String outputDirPath = args[1];

    XMLInputSource cpeDescSource = new XMLInputSource(cpeDescPath);
    CpeDescription cpeDesc = UIMAFramework.getXMLParser().parseCpeDescription(cpeDescSource);

    // configure reader
    cpeDesc.getAllCollectionCollectionReaders()[0]
            .getConfigurationParameterSettings().setParameterValue("DirectoryPath",
            inputDirPath);

    // configure writer
    cpeDesc.getCpeCasProcessors().getAllCpeCasProcessors()[0]
            .getConfigurationParameterSettings()
            .setParameterValue("XmiOutputDir", outputDirPath);

    // produce
    CollectionProcessingEngine cpe = UIMAFramework
            .produceCollectionProcessingEngine(cpeDesc);
    cpe.addStatusCallbackListener(new ReportingStatusCallbackListener(cpe));

    // run
    cpe.process();
}
 
开发者ID:textocat,项目名称:textokit-core,代码行数:32,代码来源:TxtToXmiLauncher.java

示例5: createCpe

import org.apache.uima.UIMAFramework; //导入方法依赖的package包/类
public CollectionProcessingEngine createCpe(StatusCallbackListener aListener)
        throws ResourceInitializationException, CpeDescriptorException {
    ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();

    // max errors
    if (maxErrors != 0) {
        for (CpeCasProcessor cpeCasProcessor : cpeDesc
                .getCpeCasProcessors().getAllCpeCasProcessors()) {
            if (maxErrors == -1) // infinite nr errors ok
                cpeCasProcessor.setActionOnMaxError("continue");
            else if (maxErrors > 0)
                cpeCasProcessor.setMaxErrorCount(maxErrors);
        }
    }

    // thread cnt
    if (maxProcessingUnitThreatCount == 0) {
        cpeDesc.getCpeCasProcessors().setPoolSize(3);
    } else {
        cpeDesc.getCpeCasProcessors().setPoolSize(
                maxProcessingUnitThreatCount + 2);
        cpeDesc.setProcessingUnitThreadCount(maxProcessingUnitThreatCount);
    }

    CollectionProcessingEngine cpe = UIMAFramework
            .produceCollectionProcessingEngine(cpeDesc, resMgr, null);
    cpe.addStatusCallbackListener(aListener);
    return cpe;
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:30,代码来源:CpeBuilder.java

示例6: main

import org.apache.uima.UIMAFramework; //导入方法依赖的package包/类
/**
 * @param args
 * @throws IOException 
 * @throws InvalidXMLException 
 * @throws ResourceInitializationException 
 */
public static void main(String[] args) throws InvalidXMLException, IOException, ResourceInitializationException {
	
	CpeDescription cpeDesc = UIMAFramework.getXMLParser().
	        parseCpeDescription(new XMLInputSource(desc_fname));
	      
	//instantiate CPE
	CollectionProcessingEngine mCPE = UIMAFramework.produceCollectionProcessingEngine(cpeDesc);
	
	mCPE.process();
}
 
开发者ID:UTHealth-CCB,项目名称:Medex,代码行数:17,代码来源:MedexUIMACPE.java

示例7: SimpleRunCPE

import org.apache.uima.UIMAFramework; //导入方法依赖的package包/类
public SimpleRunCPE(CpeDescription cpeDesc) throws ResourceInitializationException {
  LOGGER.info("Instantiating CPE");
  collectionProcessingEngine = UIMAFramework.produceCollectionProcessingEngine(cpeDesc);
  collectionProcessingEngine.addStatusCallbackListener(new StatusCallbackListener() {
    @Override
    public void initializationComplete() {
      LOGGER.info("CPM Initialization Complete");
    }

    @Override
    public void batchProcessComplete() {
      LOGGER.info("Completed " + entityCount + " documents");
      if (size > 0) {
        LOGGER.info("; " + size + " characters");
      }
    }

    @Override
    public void collectionProcessComplete() {
      LOGGER.info("Completed " + entityCount + " documents");
      if (size > 0) {
        LOGGER.info("; " + size + " characters");
      }
      LOGGER.info(
          "PERFORMANCE REPORT \n" + collectionProcessingEngine.getPerformanceReport().toString());

      completionSemaphore.release();
    }

    @Override
    public void paused() {
      LOGGER.info("Paused");
    }

    @Override
    public void resumed() {
      LOGGER.info("Resumed");
    }

    @Override
    public void aborted() {
      LOGGER.error("CPE processing was aborted");

      completionSemaphore.release();
    }

    @Override
    public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
      List<Exception> exceptions = aStatus.getExceptions();
      LOGGER.debug(aStatus.getStatusMessage());

      for (Exception exception : exceptions) {
        LOGGER.error("Exception processing a CAS: ", exception);
      }
      if (exceptions.size() > 0) {
        throw new RuntimeException("Processing exception");
      }

      entityCount++;
      String docText = aCas.getDocumentText();
      if (docText != null) {
        size += docText.length();
      }
    }
  });
}
 
开发者ID:nlpie,项目名称:biomedicus,代码行数:67,代码来源:SimpleRunCPE.java


注:本文中的org.apache.uima.UIMAFramework.produceCollectionProcessingEngine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。