code: def numericalize(vocabs, example):
      """ """
      decoder_start_token = vocabs["decoder_start_token"]
      numeric = example
      numeric["src"]["src_ids"] = []
      if vocabs["data_task"] == ModelTask.SEQ2SEQ:
          src_text = example["src"]["src"].split()
          numeric["src"]["src_ids"] = vocabs["src"](src_text)
          if example["tgt"] is not None:
              numeric["tgt"]["tgt_ids"] = []
              tgt_text = example["tgt"]["tgt"].split()
              numeric["tgt"]["tgt_ids"] = vocabs["tgt"](
                  [decoder_start_token] + tgt_text + [DefaultTokens.EOS]
              )
  
      elif vocabs["data_task"] == ModelTask.LANGUAGE_MODEL:
          src_text = example["src"]["src"].split()
          if decoder_start_token != "":
              src_text = [decoder_start_token] + src_text
          numeric["src"]["src_ids"] = vocabs["src"](src_text)
          if example["tgt"] is not None:
              numeric["tgt"]["tgt_ids"] = []
              tgt_text = example["tgt"]["tgt"].split()
              numeric["tgt"]["tgt_ids"] = vocabs["tgt"](
                  tgt_text + [DefaultTokens.EOS]
              )
      else:
          raise ValueError(
              f"Something went wrong with task {vocabs['data_task']}"
          )
  
      if "feats" in example["src"]:
          numeric_feats = []
          for fv, feat in zip(
              vocabs["src_feats"], example["src"]["feats"]
          ):
              numeric_feats.append(fv(feat.split()))
          numeric["src"]["feats"] = numeric_feats
  
      return numeric
  
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 6 for calling a global function with example usage: numericalize(vocabs, example) and returns: numeric