class_docstr: ASR model wrapper to perform alignment building.
  Functionality is limited to the components needed to build an alignment.
docstr: Transforms alignment information from character level to word level.
  This method includes separator (typically the space) information in the results.
  
  Used with character-based models (no self._model.tokenizer).
docstr_tok: ["Transforms","alignment","information","from","character","level","to","word","level",".","This","method","includes","separator","(","typically","the","space",")","information","in","the","results",".","Used","with","character-based","models","(","no","self._model.tokenizer",")","."]
code: def _process_char_with_space_to_words(
      self,
      tokens: List[str],
      token_begin: List[int],
      token_len: List[int],
      token_prob: List[float],
      words: List[str],
  ) -> Tuple[List[str], List[int], List[int], List[float]]:
      """Transforms alignment information from character level to word level.
      This method includes separator (typically the space) information in the results.
  
      Used with character-based models (no self._model.tokenizer).
      """
      # suppose that there are no whitespaces anywhere except between words
      space_idx = (np.array(tokens) == " ").nonzero()[0].tolist()
      assert len(words) == len(space_idx) + 1
      token_len_nonzero = [(t_l if t_l > 0 else 1) for t_l in token_len]
      if len(space_idx) == 0:
          word_begin = [token_begin[0]]
          word_len = [sum(token_len)]
          denominator = sum(token_len_nonzero)
          word_prob = [
              sum(
                  t_p * t_l
                  for t_p, t_l in zip(token_prob, token_len_nonzero)
              )
              / denominator
          ]
      else:
          space_word = "[SEP]"
          word_begin = [token_begin[0]]
          word_len = [sum(token_len[: space_idx[0]])]
          denominator = sum(token_len_nonzero[: space_idx[0]])
          word_prob = [
              sum(
                  token_prob[k] * token_len_nonzero[k]
                  for k in range(space_idx[0])
              )
              / denominator
          ]
          words_with_space = [words[0]]
          for word, i, j in zip(
              words[1:], space_idx, space_idx[1:] + [len(tokens)]
          ):
              # append space
              word_begin.append(token_begin[i])
              word_len.append(token_len[i])
              word_prob.append(token_prob[i])
              words_with_space.append(space_word)
              # append next word
              word_begin.append(token_begin[i + 1])
              word_len.append(sum(token_len[i + 1 : j]))
              denominator = sum(token_len_nonzero[i + 1 : j])
              word_prob.append(
                  sum(
                      token_prob[k] * token_len_nonzero[k]
                      for k in range(i + 1, j)
                  )
                  / denominator
              )
              words_with_space.append(word)
          words = words_with_space
      return words, word_begin, word_len, word_prob
  
imports: import copy
  import os
  from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from omegaconf import DictConfig, OmegaConf, open_dict
  from tqdm.auto import tqdm
  from nemo.collections.asr.data.audio_to_ctm_dataset import FrameCtmUnit
  from nemo.collections.asr.data.audio_to_text_dali import DALIOutputs
  from nemo.collections.asr.models.asr_model import ASRModel
  from nemo.utils import logging
label_desc: Use image node_id 10 for calling the AlignerWrapperModel obj's underlying member method code with example usage: obj._process_char_with_space_to_words(tokens, token_begin, token_len, token_prob, words) and returns: words,  word_begin,  word_len,  word_prob