}
@Override
protected AnnotationStatistics<String> test(CollectionReader collectionReader, File directory)
throws Exception {
AggregateBuilder builder = new AggregateBuilder();
// replace cTAKES entity mentions and modifiers in the system view with the gold annotations
builder.add(AnalysisEngineFactory.createPrimitiveDescription(ReplaceCTakesEntityMentionsAndModifiersWithGold.class));
// add the relation extractor, configured for classification mode
AnalysisEngineDescription classifierAnnotator = AnalysisEngineFactory.createPrimitiveDescription(
this.classifierAnnotatorClass,
this.additionalParameters);
ConfigurationParameterFactory.addConfigurationParameters(
classifierAnnotator,
GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH,
new File(directory, "model.jar").getPath());
builder.add(classifierAnnotator);
// statistics will be based on the "category" feature of the BinaryTextRelations
AnnotationStatistics<String> stats = new AnnotationStatistics<String>();
Function<BinaryTextRelation, HashableArguments> getSpan = new Function<BinaryTextRelation, HashableArguments>() {
@Override
public HashableArguments apply(BinaryTextRelation relation) {
return new HashableArguments(relation);
}
};
Function<BinaryTextRelation, String> getOutcome = AnnotationStatistics.annotationToFeatureValue("category");
// calculate statistics, iterating over the results of the classifier
AnalysisEngine engine = builder.createAggregate();
for (JCas jCas : new JCasIterable(collectionReader, engine)) {
// get the gold view
JCas goldView;
try {