/** * Returns true if the given two spans denote the same consistent NER chunk. That is, if we call * {@link Util#extractNER(List, Span)} on these two spans, they would return the same span. * * @param tokens The tokens in the sentence. * @param a The first span. * @param b The second span. * @param parse The parse tree to traverse looking for coreference chains to exploit. * @return True if these two spans contain exactly the same NER. */ public static boolean nerOverlap( List<CoreLabel> tokens, Span a, Span b, Optional<SemanticGraph> parse) { Span nerA = extractNER(tokens, a); Span nerB = extractNER(tokens, b); return nerA.equals(nerB); }