public void process(JCas jcas) throws AnalysisEngineProcessException {
logger.info(" process(JCas)");
String originalText = null;
DocumentMetaData dmd;
try {
JCas originalView = jcas.getView("_InitialView");
originalText = originalView.getSofaDataString();
PreProcessor pp = new ClinicalNotePreProcessor(
dtdFile,
includeSectionMarkers.booleanValue());
dmd = pp.process(originalText);
String text = dmd.getText();
StringBuffer sb = new StringBuffer(text);
applyTextModifier(text, sb);
// Create a view (and its Sofa) to hold the plain text version of
// the CDA document
JCas plaintextView = jcas.createView("plaintext");
plaintextView.setDocumentText(sb.toString());
// Add section (segment) annotations
Iterator<String> segmentItr = (Iterator<String>)dmd.getSegmentIdentifiers().iterator();
while (segmentItr.hasNext())
{
String segmentID = (String) segmentItr.next();
SegmentMetaData smd = dmd.getSegment(segmentID);
Segment sa = new Segment(plaintextView);
sa.setBegin(smd.span.start);
sa.setEnd(smd.span.end);
sa.setId(smd.id);
sa.addToIndexes();
}
// Store meta data about the document
Pairs propAnnot = new Pairs(plaintextView);
Map metaDataMap = dmd.getMetaData();
String docID = (String)metaDataMap.get(ClinicalNotePreProcessor.MD_KEY_DOC_ID);
if (docID!=null) {
DocumentID newDocId = new DocumentID(plaintextView);
newDocId.setDocumentID(docID);