code: def textbatch_to_tensor(vocabs, batch, device, is_train=False):
      """
      This is a hack to transform a simple batch of texts
      into a tensored batch to pass through _translate()
      """
      numeric = []
      infer_iter = []
      for i, ex in enumerate(batch):
          # Keep it consistent with dynamic data
          ex["srclen"] = len(ex["src"]["src"].split())
          ex["in_in_bucket"] = i
          ex["cid"] = "text"
          ex["cid_line_number"] = i
          ex["align"] = None
          numeric.append((numericalize(vocabs, ex), i))
      infer_iter = [
          (tensorify(vocabs, numeric, device), 0)
      ]  # force bucket_idx to 0
      return infer_iter
  
file_path: OpenNMT-py/onmt/inputters/text_utils.py
imports: import torch
  import pyonmttok
  from onmt.constants import DefaultTokens, CorpusTask, ModelTask
  from torch.nn.utils.rnn import pad_sequence
  from onmt.utils.logging import logger
  from collections import Counter
label_desc: Use image node_id 9 for calling a global function with example usage: textbatch_to_tensor(vocabs, batch, device, is_train) and returns: infer_iter