Examples of AggregateBuilder


Examples of org.uimafit.factory.AggregateBuilder

    CollectionReader collectionReader = CollectionReaderFactory.createCollectionReaderFromPath(
        "../ctakes-core/desc/collection_reader/FilesInDirectoryCollectionReader.xml",
        FilesInDirectoryCollectionReader.PARAM_INPUTDIR,
        options.getInputDirectory());

    AggregateBuilder aggregateBuilder = getLightweightPreprocessorAggregateBuilder();
    aggregateBuilder.add(EventAnnotator.createAnnotatorDescription(new File(options.getEventModelDirectory())));
    aggregateBuilder.add(BackwardsTimeAnnotator.createAnnotatorDescription(options.getTimeModelDirectory() + File.pathSeparator + "model.jar"));
    aggregateBuilder.add(EventTimeRelationAnnotator.createAnnotatorDescription(options.getEventTimeRelationModelDirectory() + File.separator + "model.jar"));
    if(options.getEventEventRelationModelDirectory()!=null){
      aggregateBuilder.add(EventEventRelationAnnotator.createAnnotatorDescription(options.getEventEventRelationModelDirectory() + File.separator + "model.jar"));
    }
   
    //aggregateBuilder.createAggregateDescription().toXML(new FileWriter("desc/analysis_engine/TemporalAggregateUMLSPipeline.xml"));
    AnalysisEngine xWriter = getXMIWriter(options.getOutputDirectory());
   
    SimplePipeline.runPipeline(
        collectionReader,
        aggregateBuilder.createAggregate(),
        xWriter);
  }
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

  /**
   * Preprocessing needed for relation extraction.
   */
  protected static AggregateBuilder getPreprocessorAggregateBuilder()
      throws Exception {
    AggregateBuilder aggregateBuilder = new AggregateBuilder();
    aggregateBuilder.add(ClinicalPipelineFactory.getDefaultPipeline());
    // add semantic role labeler
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(ClearNLPSemanticRoleLabelerAE.class));
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(ConstituencyParser.class));
    return aggregateBuilder;
  }
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

    }
  }
 
  @Override
  public void train(CollectionReader collectionReader, File directory) throws Exception {
    AggregateBuilder builder = new AggregateBuilder();
   
    //builder.add(AnalysisEngineFactory.createPrimitiveDescription(ReplaceCTakesEntityMentionsAndModifiersWithGold.class));

//    AnalysisEngineDescription assertionDescription = AssertionCleartkAnalysisEngine.getDescription(
//        CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
//        //MultiClassLIBSVMDataWriterFactory.class.getName(),
//        MaxentStringOutcomeDataWriter.class.getName(),
//        DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
//        directory.getPath());
//    builder.add(assertionDescription);
   
    AnalysisEngineDescription documentIdPrinterAnnotator = AnalysisEngineFactory.createPrimitiveDescription(DocumentIdPrinterAnalysisEngine.class);
    builder.add(documentIdPrinterAnnotator);
   
    AnalysisEngineDescription goldCopierIdentifiedAnnotsAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceIdentifiedAnnotationsSystemToGoldCopier.class);
    builder.add(goldCopierIdentifiedAnnotsAnnotator);
   
    AnalysisEngineDescription goldCopierSupportingAnnotsAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceSupportingAnnotationsSystemToGoldCopier.class);
    builder.add(goldCopierSupportingAnnotsAnnotator);
   
    AnalysisEngineDescription assertionAttributeClearerAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceAnnotationsSystemAssertionClearer.class);
    builder.add(assertionAttributeClearerAnnotator);
   
//    String generalSectionRegexFileUri =
//        "org/mitre/medfacts/zoner/section_regex.xml";
//    AnalysisEngineDescription zonerAnnotator =
//        AnalysisEngineFactory.createPrimitiveDescription(ZoneAnnotator.class,
//            ZoneAnnotator.PARAM_SECTION_REGEX_FILE_URI,
//            generalSectionRegexFileUri
//            );
//    builder.add(zonerAnnotator);
//
//    String mayoSectionRegexFileUri =
//        "org/mitre/medfacts/uima/mayo_sections.xml";
//    AnalysisEngineDescription mayoZonerAnnotator =
//        AnalysisEngineFactory.createPrimitiveDescription(ZoneAnnotator.class,
//            ZoneAnnotator.PARAM_SECTION_REGEX_FILE_URI,
//            mayoSectionRegexFileUri
//            );
//    builder.add(mayoZonerAnnotator);
 
//    URL assertionCuePhraseLookupAnnotatorDescriptorUrl1 = this.getClass().getClassLoader().getResource("org/apache/ctakes/dictionary/lookup/AssertionCuePhraseDictionaryLookupAnnotator.xml");
//    logger.info(String.format("assertionCuePhraseLookupAnnotatorDescriptorUrl1 (slashes): %s", assertionCuePhraseLookupAnnotatorDescriptorUrl1));
//    URL assertionCuePhraseLookupAnnotatorDescriptorUrl2 = this.getClass().getClassLoader().getResource("org.apache.ctakes.dictionary.lookup.AssertionCuePhraseDictionaryLookupAnnotator.xml");
//    logger.info(String.format("assertionCuePhraseLookupAnnotatorDescriptorUrl2 (periods): %s", assertionCuePhraseLookupAnnotatorDescriptorUrl2));
//
//   
//    AnalysisEngineDescription cuePhraseLookupAnnotator =
//        AnalysisEngineFactory.createAnalysisEngineDescription("org/apache/ctakes/dictionary/lookup/AssertionCuePhraseDictionaryLookupAnnotator");
//    builder.add(cuePhraseLookupAnnotator);

    // Set up Feature Selection parameters
    Float featureSelectionThreshold = options.featureSelectionThreshold;
    Class<? extends DataWriter> dataWriterClassFirstPass = getDataWriterClass();
    if (options.featureSelectionThreshold==null) {
      featureSelectionThreshold = 0f;
    }
   
    // Add each assertion Analysis Engine to the pipeline!
    builder.add(AnalysisEngineFactory.createPrimitiveDescription(AlternateCuePhraseAnnotator.class, new Object[]{}));
   
    if (!options.ignorePolarity)
    {
      AnalysisEngineDescription polarityAnnotator;
      if (options.useYtexNegation) {
         polarityAnnotator = AnalysisEngineFactory.createAnalysisEngineDescription(YTEX_NEGATION_DESCRIPTOR);
      } else {
        if (options.feda) {
          polarityAnnotator = AnalysisEngineFactory.createPrimitiveDescription(PolarityFedaCleartkAnalysisEngine.class);

            ConfigurationParameterFactory.addConfigurationParameters(
                polarityAnnotator,
                AssertionCleartkAnalysisEngine.FILE_TO_DOMAIN_MAP,
                options.trainDirectory
                );
        } else {
          // default: cleartk-based polarity, no domain adaptation
          polarityAnnotator = AnalysisEngineFactory.createPrimitiveDescription(PolarityCleartkAnalysisEngine.class); //,  this.additionalParamemters);
          }
        ConfigurationParameterFactory.addConfigurationParameters(
            polarityAnnotator,
            AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
            AssertionEvaluation.GOLD_VIEW_NAME,
//            CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
//            this.dataWriterFactoryClass.getName(),
            DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
            dataWriterClassFirstPass,
            DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
            new File(directory, "polarity").getPath(),
            AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_URI,
            PolarityCleartkAnalysisEngine.createFeatureSelectionURI(new File(directory, "polarity")),
            AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_THRESHOLD,
            featureSelectionThreshold,
            AssertionCleartkAnalysisEngine.PARAM_FEATURE_CONFIG,
            options.featConfig
            );
      }
    builder.add(polarityAnnotator);
    }

    if (!options.ignoreConditional)
    {
      AnalysisEngineDescription conditionalAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ConditionalCleartkAnalysisEngine.class); //,  this.additionalParamemters);
      ConfigurationParameterFactory.addConfigurationParameters(
          conditionalAnnotator,
          AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
          AssertionEvaluation.GOLD_VIEW_NAME,
//          CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
//          this.dataWriterFactoryClass.getName(),
          DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      dataWriterClassFirstPass,
          DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
          new File(directory, "conditional").getPath(),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_URI,
      ConditionalCleartkAnalysisEngine.createFeatureSelectionURI(new File(directory, "conditional")),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_THRESHOLD,
      featureSelectionThreshold
          );
      builder.add(conditionalAnnotator);
    }

    if (!options.ignoreUncertainty)
    {
      AnalysisEngineDescription uncertaintyAnnotator = AnalysisEngineFactory.createPrimitiveDescription(UncertaintyCleartkAnalysisEngine.class); //,  this.additionalParamemters);
      ConfigurationParameterFactory.addConfigurationParameters(
          uncertaintyAnnotator,
          AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
          AssertionEvaluation.GOLD_VIEW_NAME,
//          CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
//          this.dataWriterFactoryClass.getName(),
          DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      dataWriterClassFirstPass,
          DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
          new File(directory, "uncertainty").getPath(),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_URI,
      UncertaintyCleartkAnalysisEngine.createFeatureSelectionURI(new File(directory, "uncertainty")),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_THRESHOLD,
      featureSelectionThreshold,
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_CONFIG,
      options.featConfig
          );
      builder.add(uncertaintyAnnotator);
    }

    if (!options.ignoreSubject)
    {
      AnalysisEngineDescription subjectAnnotator = AnalysisEngineFactory.createPrimitiveDescription(SubjectCleartkAnalysisEngine.class); //,  this.additionalParamemters);
      ConfigurationParameterFactory.addConfigurationParameters(
          subjectAnnotator,
          AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
          AssertionEvaluation.GOLD_VIEW_NAME,
//          CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
//          this.dataWriterFactoryClass.getName(),
          DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      dataWriterClassFirstPass,
          DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
          new File(directory, "subject").getPath(),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_URI,
      SubjectCleartkAnalysisEngine.createFeatureSelectionURI(new File(directory, "subject")),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_THRESHOLD,
      featureSelectionThreshold
          );
      builder.add(subjectAnnotator);
    }

    if (!options.ignoreGeneric)
    {
    AnalysisEngineDescription genericAnnotator = AnalysisEngineFactory.createPrimitiveDescription(GenericCleartkAnalysisEngine.class); //,  this.additionalParamemters);
    ConfigurationParameterFactory.addConfigurationParameters(
        genericAnnotator,
        AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
        AssertionEvaluation.GOLD_VIEW_NAME,
//        CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
//        this.dataWriterFactoryClass.getName(),
        DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      dataWriterClassFirstPass,
        DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
        new File(directory, "generic").getPath(),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_URI,
      GenericCleartkAnalysisEngine.createFeatureSelectionURI(new File(directory, "generic")),
      AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_THRESHOLD,
      featureSelectionThreshold
        );
    builder.add(genericAnnotator);
    }
   
    // 2/20/13 srh adding
    if (!options.ignoreHistory) {
      AnalysisEngineDescription historyAnnotator = AnalysisEngineFactory.createPrimitiveDescription(HistoryCleartkAnalysisEngine.class);
      ConfigurationParameterFactory.addConfigurationParameters(
          historyAnnotator,
          AssertionCleartkAnalysisEngine.PARAM_GOLD_VIEW_NAME,
          AssertionEvaluation.GOLD_VIEW_NAME,
//          CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
//          this.dataWriterFactoryClass.getName(),
          DefaultDataWriterFactory.PARAM_DATA_WRITER_CLASS_NAME,
      dataWriterClassFirstPass,
          DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
          new File(directory, "historyOf").getPath(),
        AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_URI,
        HistoryCleartkAnalysisEngine.createFeatureSelectionURI(new File(directory, "historyOf")),
        AssertionCleartkAnalysisEngine.PARAM_FEATURE_SELECTION_THRESHOLD,
        featureSelectionThreshold
          );
      builder.add(historyAnnotator);
    }

/*
    AnalysisEngineDescription classifierAnnotator = AnalysisEngineFactory.createPrimitiveDescription(
        this.classifierAnnotatorClass,
        this.additionalParameters);
    ConfigurationParameterFactory.addConfigurationParameters(
        classifierAnnotator,
        RelationExtractorAnnotator.PARAM_GOLD_VIEW_NAME,
        RelationExtractorEvaluation.GOLD_VIEW_NAME,
        CleartkAnnotator.PARAM_DATA_WRITER_FACTORY_CLASS_NAME,
        this.dataWriterFactoryClass.getName(),
        DirectoryDataWriterFactory.PARAM_OUTPUT_DIRECTORY,
        directory.getPath());
    builder.add(classifierAnnotator);
*/   
   
    SimplePipeline.runPipeline(collectionReader,  builder.createAggregateDescription());
   
    //HideOutput hider = new HideOutput();
    for (String currentAssertionAttribute : annotationTypes)
    {
      File currentDirectory = new File(directory, currentAssertionAttribute);
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(ConstituencyParser.class));
    return aggregateBuilder;
  }
 
  protected static AggregateBuilder getLightweightPreprocessorAggregateBuilder() throws Exception{
    AggregateBuilder aggregateBuilder = new AggregateBuilder();
   
    /** Consider using ClinicalPipelineFactory.getDefaultPipeline()
     *
     */
    // identify segments; use simple segment annotator on non-mayo notes
    // aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(SegmentsFromBracketedSectionTagsAnnotator.class));
   
    aggregateBuilder.add(SimpleSegmentAnnotator.createAnnotatorDescription());
    aggregateBuilder.add(SentenceDetector.createAnnotatorDescription());
    aggregateBuilder.add(TokenizerAnnotatorPTB.createAnnotatorDescription());
    aggregateBuilder.add(ContextDependentTokenizerAnnotator.createAnnotatorDescription());
    aggregateBuilder.add(POSTagger.createAnnotatorDescription());
    aggregateBuilder.add(Chunker.createAnnotatorDescription());
    aggregateBuilder.add(ClearNLPDependencyParserAE.createAnnotatorDescription());
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(ClearNLPSemanticRoleLabelerAE.class));
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(ConstituencyParser.class));

    return aggregateBuilder;
  }
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

      throws Exception {
//    AnalysisEngine classifierAnnotator = AnalysisEngineFactory.createPrimitive(AssertionCleartkAnalysisEngine.getDescription(
//        GenericJarClassifierFactory.PARAM_CLASSIFIER_JAR_PATH,
//        new File(directory, "model.jar").getPath()));

    AggregateBuilder builder = new AggregateBuilder();
   
    // directory is such as /cTAKES/workspaces/Apache-cTAKES-trunk/ctakes/ctakes-assertion/sharp_data/model/eval.model
   
    AnalysisEngineDescription goldCopierAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceIdentifiedAnnotationsSystemToGoldCopier.class);
    builder.add(goldCopierAnnotator);
   
    AnalysisEngineDescription assertionAttributeClearerAnnotator = AnalysisEngineFactory.createPrimitiveDescription(ReferenceAnnotationsSystemAssertionClearer.class);
    builder.add(assertionAttributeClearerAnnotator);
   
    if ( options.noCleartk ) {
      addExternalAttributeAnnotatorsToAggregate(builder);
    } else {
      addCleartkAttributeAnnotatorsToAggregate(directory, builder);
    }

    if (options.evalOnly && evaluationOutputDirectory != null) {
      // short circuit any other stuff in the pipeline
      builder = new AggregateBuilder();
     
      // uimafit find available type systems on classpath
      TypeSystemDescription typeSystemDescription = TypeSystemDescriptionFactory.createTypeSystemDescription();
     
        AnalysisEngineDescription noOp =
        AnalysisEngineFactory.createPrimitiveDescription(
              NoOpAnnotator.class,
              typeSystemDescription);
      builder.add(noOp);
     
        AnalysisEngineDescription mergeGold =
        AnalysisEngineFactory.createPrimitiveDescription(org.apache.ctakes.assertion.eval.MergeGoldViewFromOneCasIntoInitialViewOfAnotherCas.class, typeSystemDescription);
      builder.add(mergeGold);
     
    } else if (evaluationOutputDirectory!=null)  {
        AnalysisEngineDescription xwriter =
        AnalysisEngineFactory.createPrimitiveDescription(
              XWriter.class,
              AssertionComponents.CTAKES_CTS_TYPE_SYSTEM_DESCRIPTION,
              XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
              evaluationOutputDirectory,
              XWriter.PARAM_XML_SCHEME_NAME,
              XWriter.XMI,
              XWriter.PARAM_FILE_NAMER_CLASS_NAME,
              CtakesFileNamer.class.getName());
        builder.add(xwriter);
    }
   
    //SimplePipeline.runPipeline(collectionReader,  builder.createAggregateDescription());
    //AnalysisEngineDescription aggregateDescription = builder.createAggregateDescription();
   
    AnalysisEngine aggregate = builder.createAggregate();
   
    AnnotationStatisticsCompact polarityStats = new AnnotationStatisticsCompact();
    AnnotationStatisticsCompact conditionalStats = new AnnotationStatisticsCompact();
    AnnotationStatisticsCompact uncertaintyStats = new AnnotationStatisticsCompact();
    AnnotationStatisticsCompact subjectStats = new AnnotationStatisticsCompact();
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

    CollectionReader collectionReader = CollectionReaderFactory.createCollectionReaderFromPath(
        "../ctakes-core/desc/collection_reader/FilesInDirectoryCollectionReader.xml",
        FilesInDirectoryCollectionReader.PARAM_INPUTDIR,
        options.getInputDirectory());

    AggregateBuilder aggregateBuilder = getPreprocessorAggregateBuilder();
    aggregateBuilder.add(EventAnnotator.createAnnotatorDescription(new File(options.getModelDirectory())));
   
    AnalysisEngine xWriter = AnalysisEngineFactory.createPrimitive(
        XWriter.class,
        XWriter.PARAM_OUTPUT_DIRECTORY_NAME,
        options.getOutputDirectory());
   
    SimplePipeline.runPipeline(
        collectionReader,
        aggregateBuilder.createAggregate(),
        xWriter);
  }
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

  }

  @Override
  protected void train(CollectionReader collectionReader, File directory) throws Exception
       {
    AggregateBuilder aggregateBuilder = this.getPreprocessorAggregateBuilder();
    aggregateBuilder.add(CopyFromGold.getDescription(EventMention.class, TimeMention.class, BinaryTextRelation.class));
    //      aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(MergeContainsOverlap.class));
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(RemoveNonContainsRelations.class));
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(RemoveCrossSentenceRelations.class));
    // TODO -- see if this applies to this relation:
    //      if (this.useClosure) {
    //        aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(AddTransitiveContainsRelations.class));
    //      }
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(PreserveEventEventRelations.class));
    aggregateBuilder.add(EventEventRelationAnnotator.createDataWriterDescription(
        LIBSVMStringOutcomeDataWriter.class,
//                  TKSVMlightStringOutcomeDataWriter.class,
        directory,
        1.0));
    SimplePipeline.runPipeline(collectionReader, aggregateBuilder.createAggregate());

    HideOutput hider = new HideOutput();
    // libsvm:
    JarClassifierBuilder.trainAndPackage(directory,  "-t", "0", "-c", "10");
    // tksvmlight with no tk features:
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

  }

  @Override
  protected AnnotationStatistics<String> test(
      CollectionReader collectionReader, File directory) throws Exception {
    AggregateBuilder aggregateBuilder = this.getPreprocessorAggregateBuilder();
    aggregateBuilder.add(CopyFromGold.getDescription(EventMention.class, TimeMention.class));
    //      aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(MergeContainsOverlap.class,
    //          MergeContainsOverlap.PARAM_RELATION_VIEW,
    //          GOLD_VIEW_NAME));
    aggregateBuilder.add(
        AnalysisEngineFactory.createPrimitiveDescription(RemoveNonContainsRelations.class),
        CAS.NAME_DEFAULT_SOFA,
        GOLD_VIEW_NAME);
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(
        RemoveCrossSentenceRelations.class,
        RemoveCrossSentenceRelations.PARAM_SENTENCE_VIEW,
        CAS.NAME_DEFAULT_SOFA,
        RemoveCrossSentenceRelations.PARAM_RELATION_VIEW,
        GOLD_VIEW_NAME));
    // TODO - use if relevant.
    //      if (this.useClosure) {
    //        aggregateBuilder.add(
    //            AnalysisEngineFactory.createPrimitiveDescription(AddTransitiveContainsRelations.class),
    //            CAS.NAME_DEFAULT_SOFA,
    //            GOLD_VIEW_NAME);
    //      }
    aggregateBuilder.add(
        AnalysisEngineFactory.createPrimitiveDescription(PreserveEventEventRelations.class),
        CAS.NAME_DEFAULT_SOFA,
        GOLD_VIEW_NAME);

    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(RemoveRelations.class));
    aggregateBuilder.add(
        EventEventRelationAnnotator.createAnnotatorDescription(directory));

    Function<BinaryTextRelation, ?> getSpan = new Function<BinaryTextRelation, HashableArguments>() {
      public HashableArguments apply(BinaryTextRelation relation) {
        return new HashableArguments(relation);
      }
    };
    Function<BinaryTextRelation, String> getOutcome = AnnotationStatistics.annotationToFeatureValue("category");

    AnnotationStatistics<String> stats = new AnnotationStatistics<String>();
    JCasIterable jcasIter =new JCasIterable(collectionReader, aggregateBuilder.createAggregate());
    JCas jCas = null;
    while(jcasIter.hasNext()) {
      jCas = jcasIter.next();
      JCas goldView = jCas.getView(GOLD_VIEW_NAME);
      JCas systemView = jCas.getView(CAS.NAME_DEFAULT_SOFA);
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

      for (File file : setTextDirectory.listFiles()) {
        files.add(file);
      }
    }
    CollectionReader reader = UriCollectionReader.getCollectionReaderFromFiles(files);
    AggregateBuilder builder = new AggregateBuilder();
    builder.add(UriToDocumentTextAnnotator.getDescription());
    builder.add(AnalysisEngineFactory.createPrimitiveDescription(
        THYMEKnowtatorXMLReader.class,
        THYMEKnowtatorXMLReader.PARAM_KNOWTATOR_XML_DIRECTORY,
        options.getKnowtatorXMLDirectory()));
    builder.add(AnalysisEngineFactory.createPrimitiveDescription(SegmentsFromBracketedSectionTagsAnnotator.class));
    builder.add(AnalysisEngineFactory.createPrimitiveDescription(
            SentenceDetector.class,
            SentenceDetector.SD_MODEL_FILE_PARAM,
            "org/apache/ctakes/core/sentdetect/sd-med-model.zip"));
    builder.add(AnalysisEngineFactory.createPrimitiveDescription(TokenizerAnnotatorPTB.class));
    for (JCas jCas : new JCasIterable(reader, builder.createAggregate())) {
      for (EventMention event : JCasUtil.select(jCas, EventMention.class)) {
        List<BaseToken> tokens = JCasUtil.selectCovered(jCas, BaseToken.class, event);
        if (tokens.size() > 1) {
          System.err.printf(
              "Multi-token event \"%s\" in %s\n",
View Full Code Here

Examples of org.uimafit.factory.AggregateBuilder

  public static void main(String[] args) throws UIMAException, IOException {
    Options options = CliFactory.parseArguments(Options.class, args);
    List<Integer> patientSets = options.getPatients().getList();
    List<Integer> trainItems = THYMEData.getTrainPatientSets(patientSets);
    CollectionReader reader = UriCollectionReader.getCollectionReaderFromFiles(getFilesFor(options.getRawTextDirectory(), trainItems));
    AggregateBuilder aggregateBuilder = new AggregateBuilder();
    aggregateBuilder.add(UriToDocumentTextAnnotator.getDescription());
    aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(
        XMIReader.class,
        XMIReader.PARAM_XMI_DIRECTORY,
        options.getXMIDirectory()));

    CounterMap<String> timeClassCounts = new CounterMap<String>();
   
    JCasIterable casIter = new JCasIterable(reader, aggregateBuilder.createAggregate());
    while(casIter.hasNext()){
      JCas jcas = casIter.next();
      JCas goldView = jcas.getView(Evaluation_ImplBase.GOLD_VIEW_NAME);
      Collection<TemporalTextRelation> rels = JCasUtil.select(goldView, TemporalTextRelation.class);
      for(BinaryTextRelation rel : rels){
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.