Example usage for opennlp.uima.util UimaUtil MODEL_PARAMETER

List of usage examples for opennlp.uima.util UimaUtil MODEL_PARAMETER

Introduction

In this page you can find the example usage for opennlp.uima.util UimaUtil MODEL_PARAMETER.

Prototype

String MODEL_PARAMETER

To view the source code for opennlp.uima.util UimaUtil MODEL_PARAMETER.

Click Source Link

Document

The model parameter.

Usage

From source file:eu.crydee.alignment.aligner.VideoLecturesP.java

public static void main(String[] args)
        throws ResourceInitializationException, UIMAException, IOException, ParseException {
    Params params = parseArguments(args);
    CollectionReader cr = createReader(VideoLecturesCR.class, VideoLecturesCR.PARAM_TEI_DIRPATH,
            params.TEI_DIRPATH, VideoLecturesCR.PARAM_DFXP_DIRPATH, params.DFXP_DIRPATH,
            VideoLecturesCR.PARAM_VIEW_TEI, Config.videoLecturesTei, VideoLecturesCR.PARAM_VIEW_DFXP,
            Config.videoLecturesDfxp);/*w w  w  .  j  a v  a 2  s  .  c om*/
    AnalysisEngineDescription dfxpExtractor = createEngineDescription(DFXPExtractorAE.class,
            DFXPExtractorAE.PARAM_VIEW_DFXP, Config.videoLecturesDfxp, DFXPExtractorAE.PARAM_VIEW_ELEMENTARY,
            Config.videoLecturesTalk);
    AnalysisEngineDescription teiExtractor = createEngineDescription(TEIExtractorAE.class,
            TEIExtractorAE.PARAM_VIEW_TEI, Config.videoLecturesTei, TEIExtractorAE.PARAM_VIEW_REGULAR,
            Config.videoLecturesArticle);
    AnalysisEngineDescription sentDetector = createEngineDescription(SentenceDetector.class,
            UimaUtil.MODEL_PARAMETER,
            createExternalResourceDescription(SentenceModelResourceImpl.class,
                    "file:org/apache/opennlp/en-sent.bin"),
            UimaUtil.SENTENCE_TYPE_PARAMETER, Sentence.class.getName());
    AnalysisEngineDescription windowSentDetector = createEngineDescription(WindowSentenceSplitterAE.class,
            WindowSentenceSplitterAE.PARAM_WINDOW_SIZE, 15);
    AnalysisEngineDescription tokenizer = createEngineDescription(Tokenizer.class, UimaUtil.MODEL_PARAMETER,
            createExternalResourceDescription(TokenizerModelResourceImpl.class,
                    "file:org/apache/opennlp/en-token.bin"),
            UimaUtil.SENTENCE_TYPE_PARAMETER, Sentence.class.getName(), UimaUtil.TOKEN_TYPE_PARAMETER,
            Token.class.getName());
    AnalysisEngineDescription stopWords = createEngineDescription(StopWordsAE.class);
    AnalysisEngineDescription isf = createEngineDescription(IsfAE.class, IsfAE.PARAM_VIEW_ELEMENTARY,
            Config.videoLecturesTalk, IsfAE.PARAM_VIEW_REGULAR, Config.videoLecturesArticle);
    AnalysisEngineDescription cosineSimilarity = createEngineDescription(CosineSimilarityAE.class,
            CosineSimilarityAE.PARAM_VIEW_LEFT, Config.videoLecturesTalk, CosineSimilarityAE.PARAM_VIEW_RIGHT,
            Config.videoLecturesArticle);
    AnalysisEngineDescription copierTalkBest = createEngineDescription(ViewCopierAE.class,
            ViewCopierAE.PARAM_VIEW_SOURCE, Config.videoLecturesTalk, ViewCopierAE.PARAM_VIEW_DESTINATION,
            Config.videoLecturesTalkBest);
    AnalysisEngineDescription copierArticleBest = createEngineDescription(ViewCopierAE.class,
            ViewCopierAE.PARAM_VIEW_SOURCE, Config.videoLecturesArticle, ViewCopierAE.PARAM_VIEW_DESTINATION,
            Config.videoLecturesArticleBest);
    AnalysisEngineDescription copierTalkThreshold = createEngineDescription(ViewCopierAE.class,
            ViewCopierAE.PARAM_VIEW_SOURCE, Config.videoLecturesTalk, ViewCopierAE.PARAM_VIEW_DESTINATION,
            Config.videoLecturesTalkThreshold);
    AnalysisEngineDescription copierArticleThreshold = createEngineDescription(ViewCopierAE.class,
            ViewCopierAE.PARAM_VIEW_SOURCE, Config.videoLecturesArticle, ViewCopierAE.PARAM_VIEW_DESTINATION,
            Config.videoLecturesArticleThreshold);
    AnalysisEngineDescription alignerBest = createEngineDescription(AlignBestAE.class,
            AlignBestAE.PARAM_VIEW_LEFT, Config.videoLecturesTalkBest, AlignBestAE.PARAM_VIEW_RIGHT,
            Config.videoLecturesArticleBest);
    AnalysisEngineDescription alignerThreshold = createEngineDescription(AlignThresholdAE.class,
            AlignThresholdAE.PARAM_VIEW_LEFT, Config.videoLecturesTalkThreshold,
            AlignThresholdAE.PARAM_VIEW_RIGHT, Config.videoLecturesArticleThreshold);
    AnalysisEngineDescription casWriter = createEngineDescription(XmiSerializerC.class,
            XmiSerializerC.PARAM_OUT_FOLDER, Config.videoLecturesCas);
    AnalysisEngineDescription tafWriterBest = createEngineDescription(TAFC.class, TAFC.PARAM_OUTPUT_FOLDER,
            Config.videoLecturesTafBest, TAFC.PARAM_VIEW_LEFT, Config.videoLecturesTalkBest,
            TAFC.PARAM_VIEW_RIGHT, Config.videoLecturesArticleBest);
    AnalysisEngineDescription tafWriterThreshold = createEngineDescription(TAFC.class, TAFC.PARAM_OUTPUT_FOLDER,
            Config.videoLecturesTafThreshold, TAFC.PARAM_VIEW_LEFT, Config.videoLecturesTalkThreshold,
            TAFC.PARAM_VIEW_RIGHT, Config.videoLecturesArticleThreshold);
    AnalysisEngineDescription oneVOneMetrics = createEngineDescription(MetricsOneVsOneC.class,
            MetricsOneVsOneC.PARAM_TAF_FOLDER_1, Config.videoLecturesTafBest,
            MetricsOneVsOneC.PARAM_TAF_FOLDER_2, Config.videoLecturesTafThreshold,
            MetricsOneVsOneC.PARAM_LEFT_ALGO_NAME, "Best candidate stupid alignment",
            MetricsOneVsOneC.PARAM_RIGHT_ALGO_NAME, "Thresholded stupid alignment",
            MetricsOneVsOneC.PARAM_HTML_OUTPUT_FILEPATH, Config.videoLecturesHtml,
            MetricsOneVsOneC.PARAM_METRICS_TO_SUMMARIZE, new String[] { Complete.LEFT_ORDER_CONSERVATION_KEY,
                    Complete.SYMMETRY, Complete.LEFT_COOCCURRENCE });
    AggregateBuilder b = new AggregateBuilder();
    b.add(dfxpExtractor);
    b.add(teiExtractor);
    b.add(windowSentDetector, CAS.NAME_DEFAULT_SOFA, Config.videoLecturesTalk);
    b.add(sentDetector, CAS.NAME_DEFAULT_SOFA, Config.videoLecturesArticle);
    b.add(tokenizer, CAS.NAME_DEFAULT_SOFA, Config.videoLecturesArticle);
    b.add(stopWords, CAS.NAME_DEFAULT_SOFA, Config.videoLecturesTalk);
    b.add(stopWords, CAS.NAME_DEFAULT_SOFA, Config.videoLecturesArticle);
    b.add(isf);
    b.add(cosineSimilarity);
    b.add(copierTalkBest);
    b.add(copierArticleBest);
    b.add(alignerBest);
    b.add(copierTalkThreshold);
    b.add(copierArticleThreshold);
    b.add(alignerThreshold);
    b.add(casWriter);
    b.add(tafWriterBest);
    b.add(tafWriterThreshold);
    b.add(oneVOneMetrics);
    SimplePipeline.runPipeline(cr, b.createAggregate());
}