From 4e3721325d553bde976adbb7e16dca94e9ed9dd1 Mon Sep 17 00:00:00 2001 From: John Bauer Date: Thu, 12 Oct 2023 21:32:37 -0700 Subject: [PATCH] Need to compare EmptyIndex as well when looking at isCopy --- src/edu/stanford/nlp/ling/IndexedWord.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/edu/stanford/nlp/ling/IndexedWord.java b/src/edu/stanford/nlp/ling/IndexedWord.java index 0747e6772d..6f2fffa6b8 100644 --- a/src/edu/stanford/nlp/ling/IndexedWord.java +++ b/src/edu/stanford/nlp/ling/IndexedWord.java @@ -402,6 +402,13 @@ public boolean isCopy(IndexedWord otherWord) { return false; } + // compare empty word index + Integer myEmptyIndex = get(CoreAnnotations.EmptyIndexAnnotation.class); + Integer otherEmptyIndex = otherWord.get(CoreAnnotations.EmptyIndexAnnotation.class); + if ( ! Objects.equals(myEmptyIndex, otherEmptyIndex)) { + return false; + } + if (copyCount() == 0 || otherWord.copyCount() != 0) { return false; }