本文整理汇总了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));
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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
}
示例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();
}
示例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();
}
示例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();
}
示例11: close
import org.apache.uima.collection.CollectionReader; //导入方法依赖的package包/类
public void close() throws IOException {
for (CollectionReader reader : readers) {
reader.close();
}
}