Hi All, Please help me on this issue, I have written below code..
package com.shyam.Test; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory; import org.apache.ctakes.dictionary.lookup.ae.UmlsDictionaryLookupAnnotator; import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation; import org.apache.uima.UIMAException; import org.apache.uima.analysis_engine.AnalysisEngineDescription; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.cas.CASRuntimeException; import org.apache.uima.fit.factory.JCasFactory; import org.apache.uima.fit.pipeline.SimplePipeline; import org.apache.uima.fit.util.JCasUtil; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; public class DefaultPipeLine { public static void main(String[] args) { try { final String note = " History of diabetes and hypertension." + " Mother had breast cancer." + " Sister with multiple sclerosis." + " The patient is suffering from extreme pain due to shark bite." + " Recommend continuing use of aspirin, oxycodone, and coumadin." + " Continue exercise for obesity and hypertension."; final JCas jcas = JCasFactory.createJCas(); jcas.setDocumentText( note ); // final AnalysisEngineDescription aed = ClinicalPipelineFactory.getDef aultPipeline(); final AnalysisEngineDescription aed = ClinicalPipelineFactory.getFastPipeline(); // Outputs from default and fast pipelines are identical // final AnalysisEngineDescription uml = UmlsDictionaryLookupAnnotator.createAnnotatorDescription(); SimplePipeline.runPipeline( jcas, aed ); final Collection<String> codes = new ArrayList<>(); for ( IdentifiedAnnotation entity : JCasUtil.select( jcas, IdentifiedAnnotation.class ) ) { System.out.println( "Entity: " + entity.getCoveredText() + " === Polarity: " + entity.getPolarity() ); // System.out.println("!!!!!!!!!! Task is Completed !!!!!!!!!!!!!!!"); } } catch (CASRuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (AnalysisEngineProcessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ResourceInitializationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UIMAException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } o/p is : Entity: History of === Polarity: 1 Entity: History === Polarity: 1 Entity: diabetes === Polarity: 1 Entity: hypertension === Polarity: 1 Entity: breast cancer === Polarity: 1 Entity: breast === Polarity: 1 Entity: cancer === Polarity: 1 Entity: multiple sclerosis === Polarity: 1 Entity: sclerosis === Polarity: 1 Entity: pain === Polarity: 1 Entity: shark bite === Polarity: 1 Entity: bite === Polarity: 1 Entity: bite === Polarity: 1 Entity: aspirin === Polarity: 1 Entity: oxycodone === Polarity: 1 Entity: oxycodone === Polarity: 1 Entity: coumadin === Polarity: 1 Entity: exercise === Polarity: 1 Entity: obesity === Polarity: 1 Entity: hypertension === Polarity: 1 im getting non medical and medical terms , so how can avoid non medical terms , i want o/p is only medical terms . please help me. regards, shyam k.