docstr: Generate Type Name + Text Span
  :param generated:
  :param prefix_tree:
  :param src_sentence:
  :param end_search_tokens:
  :return:
docstr_tok: ["Generate","Type","Name","+","Text","Span",":","param","generated",":",":","param","prefix_tree",":",":","param","src_sentence",":",":","param","end_search_tokens",":",":","return",":"]
code: def search_prefix_tree(
      self,
      generated: List[str],
      prefix_tree: Dict,
      end_search_tokens: List[str] = None,
  ):
      """
      Generate Type Name + Text Span
      :param generated:
      :param prefix_tree:
      :param src_sentence:
      :param end_search_tokens:
      :return:
      """
      tree = prefix_tree
      for index, token in enumerate(generated):
          tree = tree[token]
          is_tree_end = len(tree) == 1 and self.tree_end in tree
  
          if is_tree_end:
              return end_search_tokens
  
      valid_token = list(tree.keys())
      if self.tree_end in valid_token:
          valid_token.remove(self.tree_end)
          valid_token += end_search_tokens
      return valid_token
  
file_path: DeepKE/src/deepke/name_entity_re/cross/seq2seq/constraint_decoder/spotasoc_constraint_decoder.py
imports: import os
  from typing import List, Dict
  from ...extraction.label_tree import get_label_name_tree
  from ...extraction.constants import span_start, type_start, type_end, null_span, text_start
  from ...seq2seq.constraint_decoder.constraint_decoder import ConstraintDecoder, find_bracket_position, generated_search_src_sequence
label_desc: Use image node_id 5 for calling the SpotAsocConstraintDecoder obj's underlying member method code with example usage: obj.search_prefix_tree(generated, prefix_tree, end_search_tokens) and returns: valid_token, end_search_tokens