Beispiel #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());
 }
Beispiel #2
0
  private void makeClumpGoldStandard() throws EvalError {
    switch (testFileType) {
      case WSJ:
        clumpGoldStandard = CorpusUtil.wsjClumpGoldStandard(alpha, corpusFiles);
        break;

      case NEGRA:
        clumpGoldStandard = CorpusUtil.negraClumpGoldStandard(alpha, corpusFiles);
        break;

      case CTB:
        clumpGoldStandard = CorpusUtil.ctbClumpGoldStandard(alpha, corpusFiles);
        break;

      case SPL:
        evalTypes.clear();
        evalTypes.add(OutputType.NONE);
        evals.clear();
        evals.add(NullEval.instance());
        break;

      default:
        throw new EvalError("Unexpected file type for clumping gold standard: " + corpusFiles);
    }

    if (filterLength > 0)
      clumpGoldStandard = clumpGoldStandard.filterBySentenceLength(filterLength);
  }
Beispiel #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);
    }
  }