Skip to content

Commit 54fd3a6

Browse files
committed
Fix another bounds check on the QuoteAnnotator
1 parent af46f29 commit 54fd3a6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/edu/stanford/nlp/quoteattribution/Sieves/QMSieves/VocativeSieve.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ public void vocativeQuoteToMention(Annotation doc) {
104104
List<Integer> animates = scanForAnimates(quoteRun);
105105
List<Pair<String, Integer>> animateVocatives = new ArrayList<>();
106106
for (int animateIndex : animates) {
107+
if (animateIndex < 2 || animateIndex >= toks.size() + 1)
108+
continue;
107109
String prevToken = toks.get(animateIndex - 1).word();
108110
String prevPrevToken = toks.get(animateIndex - 2).word();
109111
String nextToken = toks.get(animateIndex + 1).word();

0 commit comments

Comments
 (0)