code: def make_lexical_tree(word_dict, word_unk):
      """Make a prefix tree"""
      # node [dict(subword_id -> node), word_id, word_set[start-1, end]]
      root = [{}, -1, None]
      for w, wid in word_dict.items():
          if wid > 0 and wid != word_unk:
              succ = root[0]
              for i, cid in enumerate(w):
                  if cid not in succ:
                      succ[cid] = [{}, -1, (wid - 1, wid)]
                  else:
                      prev = succ[cid][2]
                      succ[cid][2] = (
                          min(prev[0], wid - 1),
                          max(prev[1], wid),
                      )
                  if i == len(w) - 1:
                      succ[cid][1] = wid
                  succ = succ[cid][0]
      return root
  
imports: import json
  import math
  import random
  from functools import partial
  from typing import List
  import sentencepiece
  import torch
  import torchaudio
  from data_module import LibriSpeechDataModule
  from lightning import Batch
label_desc: Use image node_id 5 for calling a global function with example usage: make_lexical_tree(word_dict, word_unk) and returns: root