Ejemplo n.º 1
0
 public void initializeCCLParserEval() throws EvalError, CorpusError {
   checkNPsGoldStandard();
   checkPPsGoldStandard();
   checkClumpGoldStandard();
   treebankEval = new TreebankEval("asTrees", getGoldUnlabeledBracketSets());
   npsEval = ChunkingEval.fromChunkedCorpus(OutputType.NPS, npsGoldStandard);
   clumpsEval = ChunkingEval.fromChunkedCorpus(OutputType.CLUMP, clumpGoldStandard);
   ubsFromClumpsEval =
       new TreebankEval("clumps Recall", clumpGoldStandard.toUnlabeledBracketSetCorpus());
   ubsFromNPsEval = new TreebankEval("NPs Recall", npsGoldStandard.toUnlabeledBracketSetCorpus());
   ubsFromPPsEval = new TreebankEval("PPs Recall", ppsGoldStandard.toUnlabeledBracketSetCorpus());
 }
Ejemplo n.º 2
0
  private void initParseEvaluationTypes() throws EvalError, CorpusError {
    for (final OutputType t : evalTypes) {
      switch (t) {
        case CLUMP:
          evals.add(ChunkingEval.fromChunkedCorpus(t, getClumpGoldStandard()));
          break;

        case NPS:
          evals.add(ChunkingEval.fromChunkedCorpus(t, getNPsGoldStandard()));
          break;

        case PPS:
          evals.add(ChunkingEval.fromChunkedCorpus(t, getPPsGoldStandard()));
          break;

        case TREEBANKPREC:
          evals.add(
              TreebankPrecisionEval.fromUnlabeledBracketSets(t, getGoldUnlabeledBracketSets()));
          break;

        case TREEBANKFLAT:
          evals.add(TreebankFlatEval.fromUnlabeledBracketSets(t, getGoldUnlabeledBracketSets()));
          break;

        case TREEBANKRB:
          evals.add(TreebankRBEval.fromUnlabeledBracketSets(t, getGoldUnlabeledBracketSets()));
          break;

        case NONE:
          evals.add(NullEval.instance());
          break;

        default:
          throw new EvalError("Unexpected evaluation type: " + t);
      }
    }
  }
Ejemplo n.º 3
0
  public void evalParserOutput(final UnlabeledBracketSetCorpus output, final OutputManager man)
      throws CorpusError, EvalError, IOException {
    final ChunkedCorpus chunked = CorpusUtil.getChunkedCorpusClumps(alpha, output);
    treebankEval.getExperiment("asTrees", output.getTrees()).writeSummary(man.getResultsStream());

    clumpsEval.addExperiment(clumpsEval.newChunkingExperiment("clumps", chunked));
    clumpsEval.writeSummary(evalReportType, man.getResultsStream(), false);

    ubsFromClumpsEval.getExperiment("", output.getTrees()).writeSummary(man.getResultsStream());

    npsEval.addExperiment(npsEval.newChunkingExperiment("NPs", chunked));
    npsEval.writeSummary(evalReportType, man.getResultsStream(), false);

    ubsFromNPsEval.getExperiment("", output.getTrees()).writeSummary(man.getResultsStream());

    ubsFromPPsEval.getExperiment("", output.getTrees()).writeSummary(man.getResultsStream());

    if (!man.isNull()) {
      BufferedWriter bw = Util.bufferedWriter(man.treeOutputFilename());
      output.writeTo(bw, outputText);
      bw = Util.bufferedWriter(man.clumpsOutputFilename());
      chunked.writeTo(bw, outputText);
    }
  }