code: def __init__(self, vocabulary: List[str], tokenizer: TokenizerSpec):
      self.vocabulary = vocabulary
      self.tokenizer = tokenizer
  
      if tokenizer is None:
          self.reverse_map = {
              self.vocabulary[i]: i for i in range(len(self.vocabulary))
          }
  
      self.vocab_len = len(self.vocabulary)
  
      if (
          (self.tokenizer is not None)
          and hasattr(self.tokenizer, "unk_id")
          and self.tokenizer.unk_id is not None
      ):
          self.unknown_id = self.tokenizer.unk_id
      elif " " in self.vocabulary:
          self.unknown_id = self.token_to_id(" ")
      elif "<unk>" in self.vocabulary:
          self.unknown_id = self.token_to_id("<unk>")
      else:
          self.unknown_id = -1
  
imports: import itertools
  import math
  from typing import Iterable, List, Optional, Tuple, Union
  import numpy
  import torch
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.core.classes import NeuralModule, typecheck
  from nemo.core.neural_types import LengthsType, LogprobsType, NeuralType, PredictionsType
label_desc: Use image node_id 1 to create a new _TokensWrapper object  with example: obj = _TokensWrapper(vocabulary, tokenizer)