String[] ants = StringUtils.substringsBetween(annotatedText, "[", "]");
// map the ants to UIMA CAS
for (String ant : ants) {
if (ant.indexOf("[") > 0) {
AlchemyAnnotation alchemyAnnotation = new AlchemyAnnotation(cas);
int indexOfAnt = annotatedText.indexOf(ant);
alchemyAnnotation.setBegin(indexOfAnt - 1);
String antText = ant.substring(ant.indexOf("[") + 1);
alchemyAnnotation.setEnd(indexOfAnt + antText.length() - 1);
String antType = ant.substring(0, ant.indexOf("["));
alchemyAnnotation.setAlchemyType(antType);
alchemyAnnotation.addToIndexes();
annotatedText = annotatedText.replaceFirst("\\[" + ant.replace("[", "\\[") + "\\]\\]",
antText);
}
}