private static void writeAnnotations(SpotlightFactory spotlightFactory, AnnotatedDataset evaluationCorpus,
File annotationsFolder) throws IOException {
DefaultParagraphAnnotator annotator = null;
//spotlightFactory.annotator(); --> HACK: DefaultAnnotator is not DefaultParagraphAnnotator
int i = 0;
for(Text text : evaluationCorpus.getTexts()){
i++;
if(new File(annotationsFolder, i + ".tsv").exists()) {
continue;
}
try{
List<DBpediaResourceOccurrence> annotatedOccurrences = annotator.annotate(text.text());
FileWriter fileWriter = new FileWriter(new File(annotationsFolder, i + ".tsv"));
for(DBpediaResourceOccurrence annotatedOccurrence : annotatedOccurrences){
fileWriter.write(annotatedOccurrence.toTsvString() + "\n");
}