Skip to content

Commit cc67874

Browse files
committed
Log this error state rather than simply crashing
1 parent c026e51 commit cc67874

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/edu/stanford/nlp/parser/shiftreduce/PerceptronModel.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,17 @@ private Pair<Integer, Integer> trainTree(int index, List<Tree> binarizedTrees, L
351351
break;
352352
}
353353

354+
if (highestScoringState == null) {
355+
System.err.println("Unable to find a best transition!");
356+
System.err.println("Previous agenda:");
357+
for (State state : agenda) {
358+
System.err.println(state);
359+
}
360+
System.err.println("Gold transitions:");
361+
System.err.println(transitionLists.get(index));
362+
break;
363+
}
364+
354365
State newGoldState = goldTransition.apply(goldState, 0.0);
355366

356367
// if highest scoring state used the correct transition, no training

0 commit comments

Comments
 (0)