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


Java CollectionReader.close方法代码示例

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


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

示例1: test

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
public void test() throws Exception, JDOMException {
  CollectionReader reader = FilesCollectionReader.getCollectionReaderWithView(
      this.inputFile.getPath(),
      TimeMlGoldAnnotator.TIMEML_VIEW_NAME);
  AnalysisEngine annotator = AnalysisEngineFactory.createEngine(TimeMlGoldAnnotator.getDescription());
  AnalysisEngine writer = AnalysisEngineFactory.createEngine(TempEval2007Writer.getDescription(this.outputDirectory.getPath()));

  reader.getNext(this.jCas.getCas());
  annotator.process(this.jCas);
  writer.process(this.jCas);
  reader.close();
  annotator.collectionProcessComplete();
  writer.collectionProcessComplete();

  String expected = FileUtils.file2String(this.inputFile);
  String actual = FileUtils.file2String(this.outputFile);
  this.assertEquals(this.getRoot(expected), this.getRoot(actual));
}
 
开发者ID:ClearTK,项目名称:cleartk,代码行数:20,代码来源:TempEval2007WriterTest.java

示例2: testCat

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
public void testCat() throws Exception {

    CollectionReader cr = createReader(
            PubmedWebServiceCollectionReader.class,//
            PARAM_QUERY, "mouse", PARAM_MAX_NR_RESULTS, 20);

    List<JCas> results = BlueCasUtil.asList(cr);
    assertEquals("20 results", 20, results.size());

    for (JCas jCas : results) {

        Header header = selectSingle(jCas, Header.class);
        LOG.debug("pmid: {}, text: {}", header.getDocId(),
                jCas.getDocumentText());
        assertNotNull(header.getDocId());
    }

    cr.close();
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:21,代码来源:PubmedWebServiceCollectionReaderTest.java

示例3: testNervousSystem

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
public void testNervousSystem() throws Exception {

    CollectionReader cr = PubmedWebServiceCollectionReader.getCR(
            "nervous system[mesh]", 20);

    int cnt = 0;
    Iterator<JCas> it = BlueCasUtil.iterator(cr);
    while (it.hasNext()) {
        JCas jCas = it.next();

        Header header = selectSingle(jCas, Header.class);
        LOG.debug("pmid: {}, text: {}", header.getDocId(),
                jCas.getDocumentText());
        assertNotNull(header.getDocId());
        ++cnt;
    }

    assertEquals("20 results", 20, cnt);
    cr.close();
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:22,代码来源:PubmedWebServiceCollectionReaderTest.java

示例4: testCount

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
   @Ignore
   // FIXME
   public void testCount() throws Exception {

CollectionReader cr = PubmedCentralCollectionReader.getCR("pmc_test_archive");

int i = 0;
while (cr.hasNext()) {
    CAS cas = CasCreationUtils.createCas(cr
	    .getProcessingResourceMetaData());
    cr.getNext(cas);
    i++;
}
cr.close();
assertEquals(6, i);
   }
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:18,代码来源:PubmedCentralCollectionReaderTest.java

示例5: testCount

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
public void testCount() throws Exception {

    CollectionReader cr = CollectionReaderFactory.createReader(
            BioNLPGeniaEventsCollectionReader.class,
            BlueUima.PARAM_INPUT_DIRECTORY, TEST_DIR);

    int i = 0;
    while (cr.hasNext()) {
        CAS cas = CasCreationUtils.createCas(cr
                .getProcessingResourceMetaData());
        cr.getNext(cas);
        LOG.debug(To.string("cas nr " + i, cas.getJCas()));
        i++;
    }
    cr.close();
    assertEquals(3, i);
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:19,代码来源:BioNLPGeniaEventsReaderTest.java

示例6: test

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
   public void test() throws Exception {

CollectionReader cr = CollectionReaderFactory.createReader(
	BioNLPGeniaEventsCollectionReader.class);

int i = 0;
while (cr.hasNext()) {
    CAS cas = CasCreationUtils.createCas(cr
	    .getProcessingResourceMetaData());
    cr.getNext(cas);

    // if (createHtml)
    // viewer.createHtml(cas.getJCas(), cas.getTypeSystem(),
    // styleMapFile, new File("target/" + i));

    i++;
}
cr.close();
assertEquals(259, i);

   }
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:23,代码来源:BioNLPGeniaEventsCollectionReaderTest.java

示例7: test

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
public void test() throws Exception {

    CollectionReader cr = createReader(XmlTestcaseCollectionReader.class,
            PARAM_INPUT_FILE, "testcases/example.xml");

    CAS cas = CasCreationUtils
            .createCas(cr.getProcessingResourceMetaData());
    cr.getNext(cas);
    cr.close();

    Collection<CellTypeProteinConcentration> prots = JCasUtil.select(
            cas.getJCas(), CellTypeProteinConcentration.class);
    assertTrue(prots.size() > 1);
    Prin.t(prots);
    // TODO assert on object
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:18,代码来源:XmlTestcaseCollectionReaderTest.java

示例8: testTestCorpus

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
public void testTestCorpus() throws Exception {

    CollectionReader cr = CollectionReaderFactory.createReader(
            Biocreative2GeneCollectionReader.class, BlueUima.PARAM_MODE,
            "test");

    CAS cas = CasCreationUtils
            .createCas(cr.getProcessingResourceMetaData());
    cr.getNext(cas);

    Collection<BioEntityMention> genes = JCasUtil.select(cas.getJCas(),
            BioEntityMention.class);
    assertEquals(2, genes.size());

    cr.close();
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:18,代码来源:Biocreative2GeneCollectionReaderTest.java

示例9: testFails

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
@Ignore
// LATER
public void testFails() throws Exception {

    CollectionReader cr = createReader(PdfCollectionReader.class,
             PARAM_INPUT_DIRECTORY, "pdf_fail");

    for (JCas jCas : asList(cr)) {
        LOG.warn("docid:{}, text:{}", getHeaderDocId(jCas),
                jCas.getDocumentText());
    }
    cr.close();
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:15,代码来源:PdfCollectionReaderTest.java

示例10: testFaster

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
@Test
public void testFaster() throws Exception {
    CollectionReader cr = createReader(GeniaCorpusCollectionReader.class);
    cr.hasNext();
    CAS cas = createCas(cr.getProcessingResourceMetaData());
    cr.getNext(cas);
    assertEquals("Activation of the CD", cas.getJCas().getDocumentText()
            .substring(0, 20));
    cr.close();
}
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:11,代码来源:GeniaCorpusCollectionReaderTest.java

示例11: close

import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
public void close() throws IOException {
for (CollectionReader reader : readers) {
    reader.close();
}
   }
 
开发者ID:BlueBrain,项目名称:bluima,代码行数:6,代码来源:AggregateCollectionReader.java


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