code: def get_sentences_and_tokens_from_spacy(text, spacy_nlp):
      document = spacy_nlp(text)
      # sentences
      sentences = []
      for span in document.sents:
          sentence = [document[i] for i in range(span.start, span.end)]
          sentence_tokens = []
          for token in sentence:
              token_dict = {}
              (
                  token_dict["start"],
                  token_dict["end"],
              ) = get_start_and_end_offset_of_token_from_spacy(token)
              token_dict["text"] = text[
                  token_dict["start"] : token_dict["end"]
              ]
              if token_dict["text"].strip() in ["\n", "\t", " ", ""]:
                  continue
              # Make sure that the token text does not contain any space
              if len(token_dict["text"].split(" ")) != 1:
                  print(
                      "WARNING: the text of the token contains space character, replaced with hyphen\n\t{0}\n\t{1}".format(
                          token_dict["text"],
                          token_dict["text"].replace(" ", "-"),
                      )
                  )
                  token_dict["text"] = token_dict["text"].replace(
                      " ", "-"
                  )
              sentence_tokens.append(token_dict)
          sentences.append(sentence_tokens)
      return sentences
  
file_path: NeuroNER/neuroner/brat_to_conll.py
imports: import codecs
  import glob
  import json
  import os
  from pycorenlp import StanfordCoreNLP
  import spacy
  from neuroner import utils_nlp
label_desc: Use image node_id 2 for calling a global function with example usage: get_sentences_and_tokens_from_spacy(text, spacy_nlp) and returns: sentences