}
private static JCas getJcas(File f) {
List<File> list = new ArrayList<File>();
list.add(f);
CollectionReader cr;
AggregateBuilder builder;
try {
cr = getCollectionReader(list);
builder = new AggregateBuilder();
// uimafit find available type systems on classpath
TypeSystemDescription typeSystemDescription = TypeSystemDescriptionFactory.createTypeSystemDescription();
AnalysisEngineDescription noOp = AnalysisEngineFactory.createPrimitiveDescription(NoOpAnnotator.class, typeSystemDescription);
builder.add(noOp);
} catch (ResourceInitializationException e) {
throw new RuntimeException(e);
}
try {
//SimplePipeline.runPipeline(cr, builder.createAggregate());
AnalysisEngine engine = builder.createAggregate();
final List<ResourceMetaData> metaData = new ArrayList<ResourceMetaData>();
metaData.add(cr.getMetaData());
metaData.add(engine.getMetaData());
final CAS cas;
cas = CasCreationUtils.createCas(metaData);
if (cr.hasNext()) { // assumes just one document to process
cr.getNext(cas);
engine.process(cas); // SimplePipeline.runPipeline(cas, engine);
}
engine.collectionProcessComplete();