public void createTrainDescriptor() throws Exception
{
File trainDirectory = new File("/tmp/assertion_data/train");
File directory = trainDirectory;
AggregateBuilder builder = new AggregateBuilder();
////
AnalysisEngineDescription goldCopierIdentifiedAnnotsAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceIdentifiedAnnotationsSystemToGoldCopier.class);
builder.add(goldCopierIdentifiedAnnotsAnnotator);
AnalysisEngineDescription goldCopierSupportingAnnotsAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceSupportingAnnotationsSystemToGoldCopier.class);
builder.add(goldCopierSupportingAnnotsAnnotator);
AnalysisEngineDescription assertionAttributeClearerAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceAnnotationsSystemAssertionClearer.class);
builder.add(assertionAttributeClearerAnnotator);
String generalSectionRegexFileUri =
"org/mitre/medfacts/zoner/section_regex.xml";
AnalysisEngineDescription zonerAnnotator =
AnalysisEngineFactory.createPrimitiveDescription(ZoneAnnotator.class,
ZoneAnnotator.PARAM_SECTION_REGEX_FILE_URI,
generalSectionRegexFileUri
);
builder.add(zonerAnnotator);
String mayoSectionRegexFileUri =
"org/mitre/medfacts/uima/mayo_sections.xml";
AnalysisEngineDescription mayoZonerAnnotator =
AnalysisEngineFactory.createPrimitiveDescription(ZoneAnnotator.class,
ZoneAnnotator.PARAM_SECTION_REGEX_FILE_URI,
mayoSectionRegexFileUri
);
builder.add(mayoZonerAnnotator);
AnalysisEngineDescription polarityAnnotator = AnalysisEngineFactory.createPrimitiveDescription(PolarityCleartkAnalysisEngine.class); //, this.additionalParamemters);
ConfigurationParameterFactory.addConfigurationParameters(
polarityAnnotator,
AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
AssertionEvaluation.GOLD_VIEW_NAME,
CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
this.dataWriterFactoryClass.getName(),
DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
new File(directory, "polarity").getPath()
);
builder.add(polarityAnnotator);
AnalysisEngineDescription conditionalAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ConditionalCleartkAnalysisEngine.class); //, this.additionalParamemters);
ConfigurationParameterFactory.addConfigurationParameters(
conditionalAnnotator,
AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
AssertionEvaluation.GOLD_VIEW_NAME,
CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
this.dataWriterFactoryClass.getName(),
DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
new File(directory, "conditional").getPath()
);
builder.add(conditionalAnnotator);
AnalysisEngineDescription uncertaintyAnnotator = AnalysisEngineFactory.createPrimitiveDescription(UncertaintyCleartkAnalysisEngine.class); //, this.additionalParamemters);
ConfigurationParameterFactory.addConfigurationParameters(
uncertaintyAnnotator,
AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
AssertionEvaluation.GOLD_VIEW_NAME,
CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
this.dataWriterFactoryClass.getName(),
DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
new File(directory, "uncertainty").getPath()
);
builder.add(uncertaintyAnnotator);
AnalysisEngineDescription subjectAnnotator = AnalysisEngineFactory.createPrimitiveDescription(SubjectCleartkAnalysisEngine.class); //, this.additionalParamemters);
ConfigurationParameterFactory.addConfigurationParameters(
subjectAnnotator,
AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
AssertionEvaluation.GOLD_VIEW_NAME,
CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
this.dataWriterFactoryClass.getName(),
DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
new File(directory, "subject").getPath()
);
builder.add(subjectAnnotator);
AnalysisEngineDescription genericAnnotator = AnalysisEngineFactory.createPrimitiveDescription(GenericCleartkAnalysisEngine.class); //, this.additionalParamemters);
ConfigurationParameterFactory.addConfigurationParameters(
genericAnnotator,
AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
AssertionEvaluation.GOLD_VIEW_NAME,
CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
this.dataWriterFactoryClass.getName(),
DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
new File(directory, "generic").getPath()
);
builder.add(genericAnnotator);
////
FileOutputStream outputStream = new FileOutputStream("desc/analysis_engine/assertion_train.xml");
AnalysisEngineDescription description = builder.createAggregateDescription();
description.toXML(outputStream);
}