doc.setName(reportFile.getName());
doc.setText(text);
doc.getFilters().addAll(DocumentFilter.getDeIDFilters());
// combine terminologies into a single instance and add filters
CompositTerminology terminology = new CompositTerminology();
for(Template t: templates){
doc.getFilters().addAll(t.getFilters());
terminology.addTerminology(t.getTerminology());
}
// do a simple parsing of this document
long time = System.currentTimeMillis();
int offset = 0;
for(String line: getLines(doc.getFilteredDocument())){
// skip synoptic sections
if(doc.isSynopticSection(offset))
continue;
for(String sentence: getSentences(line)){
for(String phrase: getPhrases(sentence) ){
int offs = line.indexOf(phrase);
for(Concept c: terminology.search(phrase,IndexFinderTerminology.BEST_MATCH)){
for(Annotation a: c.getAnnotations()){
if(a.getOffset() < (offset+offs))
a.updateOffset(offset+offs);
doc.addAnnotation(a);
}