code: def clean(self, tagged_sentence):
      tags, word = list(zip(*tagged_sentence))
      nouns = [t[1] if t and t[0] == "N" else None for t in tags]
      verbs = [
          t[1] if t and t[0] == "VB" and t[1] in nouns else None
          for t in tags
      ]
      nouns = [nt if nt in verbs else None for nt in nouns]
  
      nouns_contract = []
      verbs_contract = []
      words_contract = []
  
      for n, v, w in zip(nouns, verbs, word):
          if (
              not nouns_contract
              or v != verbs_contract[-1]
              or n != nouns_contract[-1]
          ):
              nouns_contract.append(n)
              verbs_contract.append(v)
              words_contract.append(w)
          else:
              words_contract[-1] += " " + w
      final_segment_verbs = [v for v in verbs_contract if v is not None]
      associations = [
          final_segment_verbs.index(idx) if idx else None
          for idx in nouns_contract
      ]
      output_lab = []
      output_text = ""
      for n, v, w, a in zip(
          nouns_contract, verbs_contract, words_contract, associations
      ):
          if n or v:
              offset = 1 if output_text else 0
              output_lab.append(
                  {
                      "start": len(output_text) + offset,
                      "end": len(output_text) + len(w) + offset,
                      "text": w,
                      "label": "noun_phrase" if n else "verb",
                  }
              )
              if a is not None:
                  output_lab[-1]["association"] = {
                      "index": a,
                      "relationship": "has_verb",
                  }
          if output_text:
              output_text += " "
          output_text += w
  
      return output_text, output_lab
  
file_path: finetune/finetune/datasets/treebank_association.py
imports: import logging
  import nltk
  from nltk.corpus import treebank
  from sklearn.model_selection import train_test_split
  from finetune import Association
label_desc: Use image node_id 4 for calling the TreebankNounVP obj's underlying member method code with example usage: obj.clean(tagged_sentence) and returns: output_text,  output_lab