@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 until 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(org.apache.ctakes.temporal.eval.Evaluation_ImplBase.CopyNPChunksToLookupWindowAnnotations.class)); builder.add(AnalysisEngineFactory .createEngineDescription(org.apache.ctakes.temporal.eval.Evaluation_ImplBase.RemoveEnclosedLookupWindows.class)); builder.add(ClearNLPDependencyParserAE.createAnnotatorDescription()); builder.add(BackwardsTimeAnnotator .createAnnotatorDescription("/org/apache/ctakes/temporal/ae/timeannotator/model.jar")); SimplePipeline.runPipeline(jcas, builder.createAggregateDescription()); Collection<TimeMention> mentions = JCasUtil.select(jcas, TimeMention.class); ArrayList<String> temp = new ArrayList<>(); for (TimeMention mention : mentions) { LOGGER.info("Time: " + mention.getCoveredText()); LOGGER.info("Time class: " + mention.getTimeClass()); temp.add(mention.getCoveredText()); } assertEquals(2, temp.size()); assertTrue(temp.contains("recently")); assertTrue(temp.contains("until 6 months ago")); }
public static AnalysisEngineDescription createAnnotatorDescription( String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( BackwardsTimeAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); }
BackwardsTimeAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription( String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( BackwardsTimeAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); } }
BackwardsTimeAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription( String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( BackwardsTimeAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, modelPath); }  }
BackwardsTimeAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription( String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( BackwardsTimeAnnotator.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 createEnsembleDescription(String modelPath,
	      String viewName); static AnalysisEngineDescription createAnnotatorDescription(
      File modelDirectory); static AnalysisEngineDescription createEnsembleDescription(File modelDirectory,
      String viewName); @Override void initialize(UimaContext context); @Override void process(JCas jCas, Segment segment); }
BackwardsTimeAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription( String modelPath) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( BackwardsTimeAnnotator.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 createEnsembleDescription(String modelPath,
	      String viewName); static AnalysisEngineDescription createAnnotatorDescription(
      File modelDirectory); static AnalysisEngineDescription createEnsembleDescription(File modelDirectory,
      String viewName); @Override void initialize(UimaContext context); @Override void process(JCas jCas, Segment segment); static final String PARAM_TIMEX_VIEW; }