protected AnnotationSet renameAnnotations(AnnotationSet annots2Export,
Map<String,String> renameMap){
Iterator<Annotation> iter = annots2Export.iterator();
AnnotationSet as = document.getAnnotations(DUMPING_PR_SET);
if (!as.isEmpty())
as.clear();
while(iter.hasNext()) {
Annotation annot = iter.next();
if (!renameMap.containsKey(annot.getType()))
renameMap.put(annot.getType(), annot.getType());
try{
as.add(annot.getId(),
annot.getStartNode().getOffset(),
annot.getEndNode().getOffset(),
renameMap.get(annot.getType()),
annot.getFeatures());
} catch (InvalidOffsetException ex) {
throw new GateRuntimeException("DumpingPR: " + ex.getMessage());
}
}
return as;
}