@Test public void testPipeline() throws UIMAException, IOException { String note = "The patient is a 55-year-old man referred by Dr. Good for recently diagnosed colorectal cancer. " + "The patient was well till 6 months ago, when he started having a little blood with stool."; JCas jcas = JCasFactory.createJCas(); jcas.setDocumentText(note); AggregateBuilder builder = new AggregateBuilder(); builder.add(getTokenProcessingPipeline()); builder.add(AnalysisEngineFactory .createEngineDescription(CopyNPChunksToLookupWindowAnnotations.class)); builder.add(AnalysisEngineFactory .createEngineDescription(RemoveEnclosedLookupWindows.class)); builder.add(ClearNLPDependencyParserAE.createAnnotatorDescription()); builder.add(BackwardsTimeAnnotator .createAnnotatorDescription("/org/apache/ctakes/temporal/ae/timeannotator/model.jar")); builder.add(EventAnnotator .createAnnotatorDescription("/org/apache/ctakes/temporal/ae/eventannotator/model.jar")); builder.add(ContextualModalityAnnotator .createAnnotatorDescription("/org/apache/ctakes/temporal/ae/contextualmodality/model.jar")); builder.add(DocTimeRelAnnotator .createAnnotatorDescription("/org/apache/ctakes/temporal/ae/doctimerel/model.jar")); SimplePipeline.runPipeline(jcas, builder.createAggregateDescription()); Collection<EventMention> mentions = JCasUtil.select(jcas, EventMention.class); ArrayList<String> temp = new ArrayList<>(); for (EventMention entity : mentions) { String property = null; if (entity.getEvent() != null && entity.getEvent().getProperties() != null && entity.getEvent().getProperties() .getContextualModality() != null) { property = entity.getEvent().getProperties() .getContextualModality(); temp.add(entity.getCoveredText()); } LOGGER.info("Entity: " + entity.getCoveredText() + "ContextualModality:" + property); } }
public static AnalysisEngineDescription createAnnotatorDescription(String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( ContextualModalityAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); }
ContextualModalityAnnotator extends CleartkAnnotator<String> { public static AnalysisEngineDescription createAnnotatorDescription(String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( ContextualModalityAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); } }
ContextualModalityAnnotator extends CleartkAnnotator<String> { public static AnalysisEngineDescription createAnnotatorDescription(String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( ContextualModalityAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); }  }
ContextualModalityAnnotator extends CleartkAnnotator<String> { public static AnalysisEngineDescription createAnnotatorDescription(String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( ContextualModalityAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); }  static AnalysisEngineDescription createDataWriterDescription(
      Class<? extends DataWriter<String>> dataWriterClass,
      File outputDirectory); static AnalysisEngineDescription createAnnotatorDescription(String modelPath); static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory); @Override void initialize(UimaContext context); @Override void process(JCas jCas); }
ContextualModalityAnnotator extends CleartkAnnotator<String> { public static AnalysisEngineDescription createAnnotatorDescription(String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( ContextualModalityAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); }  static AnalysisEngineDescription createDataWriterDescription(
      Class<? extends DataWriter<String>> dataWriterClass,
      File outputDirectory); static AnalysisEngineDescription createAnnotatorDescription(String modelPath); static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory); @Override void initialize(UimaContext context); @Override void process(JCas jCas);  }