code: def extract_mentions_spans(doc, blacklist, debug=False):
      """
      Extract potential mentions from a spacy parsed Doc
      """
      if debug:
          print("===== doc ====:", doc)
      for c in doc:
          if debug:
              print(
                  "🚧 span search:",
                  c,
                  "head:",
                  c.head,
                  "tag:",
                  c.tag_,
                  "pos:",
                  c.pos_,
                  "dep:",
                  c.dep_,
              )
      # Named entities
      mentions_spans = list(
          ent for ent in doc.ents if ent.label_ in ACCEPTED_ENTS
      )
  
      if debug:
          print(
              "==-- ents:",
              list(((ent, ent.label_) for ent in mentions_spans)),
          )
      for spans in parallel_process(
          [
              {"doc": doc, "span": sent, "blacklist": blacklist}
              for sent in doc.sents
          ],
          _extract_from_sent,
          use_kwargs=True,
          front_num=0,
      ):
          mentions_spans = mentions_spans + spans
      spans_set = set()
      cleaned_mentions_spans = []
      for spans in mentions_spans:
          if (
              spans.end > spans.start
              and (spans.start, spans.end) not in spans_set
          ):
              cleaned_mentions_spans.append(spans)
              spans_set.add((spans.start, spans.end))
  
      return cleaned_mentions_spans
  
imports: import re
  import io
  from six import string_types, integer_types
  from spacy.tokens import Span, Token
  from neuralcoref.train.compat import unicode_
  from neuralcoref.train.utils import encode_distance, parallel_process
  import spacy
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: extract_mentions_spans(doc, blacklist, debug) and returns: cleaned_mentions_spans