@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(EventAnnotator .createAnnotatorDescription("/org/apache/ctakes/temporal/ae/eventannotator/model.jar")); SimplePipeline.runPipeline(jcas, builder.createAggregateDescription()); Collection<EventMention> mentions = JCasUtil.select(jcas, EventMention.class); ArrayList<String> temp = new ArrayList<>(); for (EventMention mention : mentions) { LOGGER.info("Event: " + mention.getCoveredText() ); temp.add(mention.getCoveredText()); } assertEquals( 5, temp.size() ); assertTrue(temp.contains("old")); assertTrue(temp.contains("referred")); assertTrue( temp.contains( "diagnosed" ) ); assertTrue( temp.contains( "cancer" ) ); assertTrue( temp.contains( "blood" ) ); }
public static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( EventAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, new File(modelDirectory, "model.jar"), EventAnnotator.PARAM_FEATURE_SELECTION_URI, EventAnnotator.createFeatureSelectionURI(modelDirectory)); }
EventAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( EventAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, new File(modelDirectory, "model.jar"), EventAnnotator.PARAM_FEATURE_SELECTION_URI, EventAnnotator.createFeatureSelectionURI(modelDirectory)); } }
EventAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( EventAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, new File(modelDirectory, "model.jar"), EventAnnotator.PARAM_FEATURE_SELECTION_URI, EventAnnotator.createFeatureSelectionURI(modelDirectory)); }  }
EventAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( EventAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, new File(modelDirectory, "model.jar"), EventAnnotator.PARAM_FEATURE_SELECTION_URI, EventAnnotator.createFeatureSelectionURI(modelDirectory)); }  static AnalysisEngineDescription createDataWriterDescription(
      Class<?> dataWriter,
      File outputDirectory,
      float downratio,
      float featureSelect, float smoteNeighborNumber); static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory); static AnalysisEngineDescription createAnnotatorDescription(String modelPath); static AnalysisEngineDescription createAnnotatorDescription(); static FeatureSelection<String> createFeatureSelection(double threshold); static URI createFeatureSelectionURI(File outputDirectoryName); @Override void initialize(UimaContext context); @Override void process(JCas jCas, Segment segment); }
EventAnnotator extends TemporalEntityAnnotator_ImplBase { public static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory) throws ResourceInitializationException { return AnalysisEngineFactory.createEngineDescription( EventAnnotator.class, CleartkAnnotator.PARAM_IS_TRAINING, false, GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH, new File(modelDirectory, "model.jar"), EventAnnotator.PARAM_FEATURE_SELECTION_URI, EventAnnotator.createFeatureSelectionURI(modelDirectory)); }  static AnalysisEngineDescription createDataWriterDescription(
      Class<?> dataWriter,
      File outputDirectory,
      float downratio,
      float featureSelect, float smoteNeighborNumber); static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory); static AnalysisEngineDescription createAnnotatorDescription(String modelPath); static AnalysisEngineDescription createAnnotatorDescription(); static FeatureSelection<String> createFeatureSelection(double threshold); static URI createFeatureSelectionURI(File outputDirectoryName); @Override void initialize(UimaContext context); @Override void process(JCas jCas, Segment segment); static final String PARAM_PROBABILITY_OF_KEEPING_A_NEGATIVE_EXAMPLE; static final String PARAM_FEATURE_SELECTION_THRESHOLD; static final String PARAM_SMOTE_NUM_NEIGHBORS; static final String PARAM_FEATURE_SELECTION_URI; }