//String w = TextTools.normalize(a.getText(),true);
// this word was encountered before, saved previous annoation
// if the gap between last word and next word is more then 2 words,
// it must be a seperate mention and deserves a seperate annotation
if(lastWordOffset > -1 && (offs-lastWordOffset) > 2){
Annotation an = new Annotation();
an.setSearchString(text);
an.setConcept(c);
an.setOffset(st);
an.setText(text.substring(st,en));
list.add(an);
//usedWords.clear();
st = -1;
}
// start w/ first annotation
if(st < 0)
st = a.getStartPosition();
// remember end position
en = a.getEndPosition();
//usedWords.add(w);
lastWordOffset = offs;
}
// finish last annotation
if(st >= 0 && en >= 0){
Annotation an = new Annotation();
an.setSearchString(text);
an.setConcept(c);
an.setOffset(st);
an.setText(text.substring(st,en));
list.add(an);
}
}catch(Exception ex){
System.err.println("match: "+c.getMatchedTerm()+" | name: "+c.getName()+" | code: "+c.getCode());
System.err.println("annotations: "+Arrays.toString(c.getAnnotations()));