code: def extract_nps(annotation_list, text=None):
      """
      Extract Noun Phrases from given text tokens and phrase annotations.
      Returns a list of tuples with start/end indexes.
  
      Args:
          annotation_list (list): a list of annotation tags in str
          text (list, optional): a list of token texts in str
  
      Returns:
          list of start/end markers of noun phrases, if text is provided a list of noun phrase texts
      """
      np_starts = [
          i
          for i in range(len(annotation_list))
          if annotation_list[i] == "B-NP"
      ]
      np_markers = []
      for s in np_starts:
          i = 1
          while (
              s + i < len(annotation_list)
              and annotation_list[s + i] == "I-NP"
          ):
              i += 1
          np_markers.append((s, s + i))
      return_markers = np_markers
      if text:
          assert len(text) == len(
              annotation_list
          ), "annotations/text length mismatch"
          return_markers = [" ".join(text[s:e]) for s, e in np_markers]
      return return_markers
  
imports: import re
  import string
  import sys
  from os import path
  from typing import List, Tuple
  import spacy
  from nltk import WordNetLemmatizer
  from nltk.stem.snowball import EnglishStemmer
  from spacy.cli.download import download
  from spacy.lang.en import LEMMA_EXC, LEMMA_INDEX, LEMMA_RULES
  from spacy.lemmatizer import Lemmatizer
  from nlp_architect.utils.generic import license_prompt
  from joblib import Parallel, delayed
  from functools import partial
  from spacy.util import minibatch
  from nlp_architect.common.core_nlp_doc import CoreNLPDoc
  from pathlib import Path
label_desc: Use image node_id 9 for calling a global function with example usage: extract_nps(annotation_list, text) and returns: return_markers