public Optional<CoreNLPParseNode> nodeForOffsets(
      final OffsetRange<CharOffset> offsets) {
    // we use the reverse of the preorder traversal because it will iterate over smaller nodes
    // before any of their parents, preferring the smallest node that contains these offsets.
    for (final CoreNLPParseNode n : ImmutableList.copyOf(parse.get().root().preorderDFSTraversal())
        .reverse()) {
      if (n.span().isPresent() && n.span().get().contains(offsets)) {
        return Optional.of(n);
      }
    }
    return Optional.absent();
  }
public Optional < CoreNLPParseNode > nodeForOffsets ( final OffsetRange < CharOffset > offsets ) { for ( final CoreNLPParseNode n : ImmutableList . copyOf ( parse . get ( ) . root ( ) . preorderDFSTraversal ( ) ) . reverse ( ) ) { if ( n . span ( ) . isPresent ( ) && n . span ( ) . get ( ) . contains ( offsets ) ) { return Optional . of ( n ) ; } } return Optional . absent ( ) ; }
Finds the smallest {@code ConstituentNode} containing these offsets. {@code CoreNLPParseNode}s
will not generally contain whitespace.