Skip to content

Commit

Permalink
Not sure where it's getting the incorrect path from... try to print t…
Browse files Browse the repository at this point in the history
…hat out
  • Loading branch information
AngledLuffa committed Jun 4, 2024
1 parent ef31e6b commit cb9bace
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/edu/stanford/nlp/coref/CorefScorer.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@
* @author Kevin Clark
*/
public class CorefScorer {
public static String getEvalSummary(String evalScript,
String goldFile, String predictFile) throws IOException {
public static class ScorerMissingException extends RuntimeException {
private static final long serialVersionUID = 13589668547630427L;

public ScorerMissingException(String s) {
super(s);
}
}

public static String getEvalSummary(String evalScript, String goldFile, String predictFile) throws IOException {
File evalFile = new File(evalScript);
if (!evalFile.exists()) {
throw new ScorerMissingException(evalScript);
}
ProcessBuilder process = new ProcessBuilder(evalScript, "all", goldFile, predictFile, "none");
StringOutputStream errSos = new StringOutputStream();
StringOutputStream outSos = new StringOutputStream();
Expand Down
10 changes: 8 additions & 2 deletions src/edu/stanford/nlp/coref/hybrid/HybridCorefSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,16 @@ public ThreadsafeProcessor<Pair<Document, HybridCorefSystem>, StringBuilder[]> n

// scoring
if (HybridCorefProperties.doScore(props)) {
String summary = CorefScorer.getEvalSummary(CorefProperties.getScorerPath(props), goldOutput, beforeCorefOutput);
String scorerPath = CorefProperties.getScorerPath(props);
String summary;
try {
summary = CorefScorer.getEvalSummary(scorerPath, goldOutput, beforeCorefOutput);
} catch (CorefScorer.ScorerMissingException e) {
throw new RuntimeException("Missing scorer! Properties were:\n" + props);
}
CorefScorer.printScoreSummary(summary, logger, false);

summary = CorefScorer.getEvalSummary(CorefProperties.getScorerPath(props), goldOutput, afterCorefOutput);
summary = CorefScorer.getEvalSummary(scorerPath, goldOutput, afterCorefOutput);
CorefScorer.printScoreSummary(summary, logger, true);
CorefScorer.printFinalConllScore(summary, logger);
}
Expand Down

0 comments on commit cb9bace

Please sign in to comment.