Skip to content

Commit cb9bace

Browse files
committed
Not sure where it's getting the incorrect path from... try to print that out
1 parent ef31e6b commit cb9bace

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

src/edu/stanford/nlp/coref/CorefScorer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,19 @@
1818
* @author Kevin Clark
1919
*/
2020
public class CorefScorer {
21-
public static String getEvalSummary(String evalScript,
22-
String goldFile, String predictFile) throws IOException {
21+
public static class ScorerMissingException extends RuntimeException {
22+
private static final long serialVersionUID = 13589668547630427L;
23+
24+
public ScorerMissingException(String s) {
25+
super(s);
26+
}
27+
}
28+
29+
public static String getEvalSummary(String evalScript, String goldFile, String predictFile) throws IOException {
30+
File evalFile = new File(evalScript);
31+
if (!evalFile.exists()) {
32+
throw new ScorerMissingException(evalScript);
33+
}
2334
ProcessBuilder process = new ProcessBuilder(evalScript, "all", goldFile, predictFile, "none");
2435
StringOutputStream errSos = new StringOutputStream();
2536
StringOutputStream outSos = new StringOutputStream();

src/edu/stanford/nlp/coref/hybrid/HybridCorefSystem.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,16 @@ public ThreadsafeProcessor<Pair<Document, HybridCorefSystem>, StringBuilder[]> n
185185

186186
// scoring
187187
if (HybridCorefProperties.doScore(props)) {
188-
String summary = CorefScorer.getEvalSummary(CorefProperties.getScorerPath(props), goldOutput, beforeCorefOutput);
188+
String scorerPath = CorefProperties.getScorerPath(props);
189+
String summary;
190+
try {
191+
summary = CorefScorer.getEvalSummary(scorerPath, goldOutput, beforeCorefOutput);
192+
} catch (CorefScorer.ScorerMissingException e) {
193+
throw new RuntimeException("Missing scorer! Properties were:\n" + props);
194+
}
189195
CorefScorer.printScoreSummary(summary, logger, false);
190196

191-
summary = CorefScorer.getEvalSummary(CorefProperties.getScorerPath(props), goldOutput, afterCorefOutput);
197+
summary = CorefScorer.getEvalSummary(scorerPath, goldOutput, afterCorefOutput);
192198
CorefScorer.printScoreSummary(summary, logger, true);
193199
CorefScorer.printFinalConllScore(summary, logger);
194200
}

0 commit comments

Comments
 (0)