code: def char_map_detokenize(
      char_map, tokenizer, token_space_index=None, wordwise=True
  ):
      """Returns a function that recovers the original sequence from one that has been
      tokenized using a character map
  
      Arguments
      ---------
      char_map: dict
          a character-to-output-token-map
      tokenizer: speechbrain.tokenizers.SentencePiece.SentencePiece
          a tokenizer instance
      token_space_index: int
          the index of the "space" token
  
      Returns
      -------
      f: callable
          the tokenizer function
  
      """
  
      def detokenize_wordwise(item):
          """Detokenizes the sequence one word at a time"""
          return _wordwise_detokenize(
              tokenizer(), item, " ", token_space_index
          )
  
      def detokenize_regular(item):
          """Detokenizes the entire sequence"""
          return tokenizer().sp.decode_ids(item)
  
      detokenize = (
          detokenize_wordwise if wordwise else detokenize_regular
      )
  
      def f(tokens):
          """The tokenizer function"""
          decoded_tokens = [detokenize(item) for item in tokens]
          mapped_tokens = _map_tokens_batch(decoded_tokens, char_map)
          return mapped_tokens
  
      return f
  
imports: from functools import reduce
  from speechbrain.wordemb.util import expand_to_chars
  import speechbrain
  import torch
  import re
label_desc: Use image node_id 16 for calling a global function with example usage: char_map_detokenize(char_map, tokenizer, token_space_index, wordwise) and returns: f, _wordwise_detokenize, tokenizer, mapped_tokens