示例#1
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);
  }
示例#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);
      }
    }
  }
示例#3
0
 public void setParserEvaluationTypes(final String string) throws EvalError, CorpusError {
   if (string.equals("")) {
     evalTypes.add(OutputType.CLUMP);
     evalTypes.add(OutputType.NPS);
   } else for (final String s : string.split(",")) evalTypes.add(OutputType.valueOf(s));
 }
示例#4
0
 public void addChunkerOutput(final String comment, final ChunkedSegmentedCorpus output)
     throws EvalError, CorpusError {
   if (evals.size() == 0) initParseEvaluationTypes();
   for (final Eval eval : evals) eval.eval(comment, output);
 }
示例#5
0
 private boolean noEvals() throws EvalError, CorpusError {
   if (evals.size() == 0) initParseEvaluationTypes();
   return evals.size() == 0 || (evals.size() == 1 && evals.get(0) == null);
 }
示例#6
0
 public StopSegmentCorpus getEvalStopSegmentCorpus() throws CorpusError, EvalError {
   if (evals.size() == 0 && testFileType != CorpusType.SPL) initParseEvaluationTypes();
   if (testStopSegmentCorpus == null) makeEvalStopSegmentCorpus();
   return testStopSegmentCorpus;
 }