public AnalysisEngineDescription getReplacementNormalization(
      String aModelLocation, SrcSurroundings aSrc, TargetSurroundings aTarget)
      throws ResourceInitializationException {
    AggregateBuilder ab = new AggregateBuilder();
    ab.add(
        createEngineDescription(
            ReplacementFileNormalizer.class,
            ReplacementFileNormalizer.PARAM_MODEL_LOCATION,
            aModelLocation,
            ReplacementFileNormalizer.PARAM_SRC_SURROUNDINGS,
            aSrc,
            ReplacementFileNormalizer.PARAM_TARGET_SURROUNDINGS,
            aTarget),
        CAS.NAME_DEFAULT_SOFA,
        getSourceView());
    ab.add(
        createEngineDescription(ApplyChangesAnnotator.class),
        ApplyChangesAnnotator.VIEW_SOURCE,
        getSourceView(),
        ApplyChangesAnnotator.VIEW_TARGET,
        getTargetView());
    AnalysisEngineDescription aed = ab.createAggregateDescription();
    //	aed.setAnnotatorImplementationName(new File(filepath).getName().split("\\")[0]);

    return aed;
  }
  public AnalysisEngineDescription getUmlautSharpSNormalization(
      ExternalResourceDescription aFrequencyProvider, int aMinFrequency)
      throws ResourceInitializationException {
    AggregateBuilder ab = new AggregateBuilder();
    ab.add(
        createEngineDescription(BreakIteratorSegmenter.class),
        CAS.NAME_DEFAULT_SOFA,
        getSourceView());
    ab.add(
        createEngineDescription(
            SharpSNormalizer.class,
            SharpSNormalizer.FREQUENCY_PROVIDER,
            aFrequencyProvider,
            SharpSNormalizer.PARAM_MIN_FREQUENCY_THRESHOLD,
            aMinFrequency),
        CAS.NAME_DEFAULT_SOFA,
        getSourceView());
    ab.add(
        createEngineDescription(ApplyChangesAnnotator.class),
        ApplyChangesAnnotator.VIEW_SOURCE,
        getSourceView(),
        ApplyChangesAnnotator.VIEW_TARGET,
        getTargetView());
    AnalysisEngineDescription aed = ab.createAggregateDescription();
    aed.setAnnotatorImplementationName("Umlaute");

    return aed;
  }
  public AnalysisEngineDescription getCapitalizationNormalization(
      ExternalResourceDescription aFrequencyProvider) throws ResourceInitializationException {
    AggregateBuilder ab = new AggregateBuilder();
    ab.add(
        createEngineDescription(BreakIteratorSegmenter.class),
        CAS.NAME_DEFAULT_SOFA,
        getSourceView());
    ab.add(
        createEngineDescription(
            CapitalizationNormalizer.class,
            CapitalizationNormalizer.FREQUENCY_PROVIDER,
            aFrequencyProvider),
        CAS.NAME_DEFAULT_SOFA,
        getSourceView());
    ab.add(
        createEngineDescription(ApplyChangesAnnotator.class),
        ApplyChangesAnnotator.VIEW_SOURCE,
        getSourceView(),
        ApplyChangesAnnotator.VIEW_TARGET,
        getTargetView());
    AnalysisEngineDescription aed = ab.createAggregateDescription();
    aed.setAnnotatorImplementationName("Capitalization");

    return aed;
  }
Exemplo n.º 4
0
  public static void main(String[] args) throws Exception {
    Options options = CliFactory.parseArguments(Options.class, args);

    List<File> testFiles =
        DocumentClassificationEvaluation.getFilesFromDirectory(options.getTestDirectory());

    DocumentClassificationEvaluation evaluation =
        new DocumentClassificationEvaluation(options.getModelsDirectory());
    CollectionReader collectionReader = evaluation.getCollectionReader(testFiles);

    AggregateBuilder builder =
        DocumentClassificationEvaluation.createDocumentClassificationAggregate(
            options.getModelsDirectory(), AnnotatorMode.CLASSIFY);

    SimplePipeline.runPipeline(
        collectionReader,
        builder.createAggregateDescription(),
        AnalysisEngineFactory.createEngineDescription(PrintClassificationsAnnotator.class));
  }
  public AnalysisEngineDescription getSpellcorrection(String aModelLocation)
      throws ResourceInitializationException {
    AggregateBuilder ab = new AggregateBuilder();
    ab.add(
        createEngineDescription(BreakIteratorSegmenter.class),
        CAS.NAME_DEFAULT_SOFA,
        getSourceView());
    ab.add(
        createEngineDescription(
            JazzyChecker.class, JazzyChecker.PARAM_MODEL_LOCATION, aModelLocation),
        CAS.NAME_DEFAULT_SOFA,
        getSourceView());
    ab.add(
        createEngineDescription(SpellingNormalizer.class), CAS.NAME_DEFAULT_SOFA, getSourceView());
    ab.add(
        createEngineDescription(ApplyChangesAnnotator.class),
        ApplyChangesAnnotator.VIEW_SOURCE,
        getSourceView(),
        ApplyChangesAnnotator.VIEW_TARGET,
        getTargetView());
    AnalysisEngineDescription aed = ab.createAggregateDescription();
    aed.setAnnotatorImplementationName("Spell");

    return aed;
  }