code: private static Span[] getConstituencySpans(final Parse parse) {
  
      final Stack<Parse> stack = new Stack<Parse>();
  
      if (parse.getChildCount() > 0) {
        for (final Parse child : parse.getChildren()) {
          stack.push(child);
        }
      }
      final List<Span> consts = new ArrayList<Span>();
  
      while (!stack.isEmpty()) {
  
        final Parse constSpan = stack.pop();
  
        if (!constSpan.isPosTag()) {
          final Span span = constSpan.getSpan();
          consts
              .add(new Span(span.getStart(), span.getEnd(), constSpan.getType()));
  
          for (final Parse child : constSpan.getChildren()) {
            stack.push(child);
          }
        }
      }
  
      return consts.toArray(new Span[consts.size()]);
    }
docs: Obtain {@code Span}s for every parse in the sentence.
  
  @param parse
  the parse from which to obtain the spans
  @return an array containing every span for the parse