docstr: Code is exactly same as torchtext.legacy.data.Field.numericalize() except the
  call to self._get_idx(x) instead of self.vocab.stoi[x] for getting the
  index of an item from vocab.
  This is needed because torchtext doesn't allow custom UNKification.
  So, TextFeatureFieldWithSpecialUnk field's constructor accepts a function
  unkify_func() that can be used to UNKifying instead of assigning all UNKs
  a default value.
docstr_tok: ["Code","is","exactly","same","as","torchtext.legacy.data.Field.numericalize","(",")","except","the","call","to","self._get_idx","(","x",")","instead","of","self.vocab.stoi","[","x","]","for","getting","the","index","of","an","item","from","vocab",".","This","is","needed","because","torchtext","does","n't","allow","custom","UNKification",".","So",",","TextFeatureFieldWithSpecialUnk","field","'s","constructor","accepts","a","function","unkify_func","(",")","that","can","be","used","to","UNKifying","instead","of","assigning","all","UNKs","a","default","value","."]
code: def numericalize(
      self,
      arr: Union[List[List[str]], Tuple[List[List[str]], List[int]]],
      device: Optional[Union[str, torch.device]] = None,
  ):
      """
      Code is exactly same as torchtext.legacy.data.Field.numericalize() except the
      call to self._get_idx(x) instead of self.vocab.stoi[x] for getting the
      index of an item from vocab.
      This is needed because torchtext doesn't allow custom UNKification.
      So, TextFeatureFieldWithSpecialUnk field's constructor accepts a function
      unkify_func() that can be used to UNKifying instead of assigning all UNKs
      a default value.
      """
      if self.include_lengths and not isinstance(arr, tuple):
          raise ValueError(
              "Field has include_lengths set to True, but "
              "input data is not a tuple of "
              "(data batch, batch lengths)."
          )
      if isinstance(arr, tuple):
          arr, lengths = arr
          lengths = torch.tensor(
              lengths, dtype=self.dtype, device=device
          )
  
      if self.use_vocab:
          if self.sequential:
              arr = [[self._get_idx(x) for x in ex] for ex in arr]
          else:
              arr = [self._get_idx(x) for x in arr]
  
          if self.postprocessing is not None:
              arr = self.postprocessing(arr, self.vocab)
      else:
          if self.dtype not in self.dtypes:
              raise ValueError(
                  "Specified Field dtype {} can not be used with "
                  "use_vocab=False because we do not know how to numericalize it. "
                  "Please raise an issue at "
                  "https://github.com/pytorch/text/issues".format(
                      self.dtype
                  )
              )
          numericalization_func = self.dtypes[self.dtype]
          # It doesn't make sense to explicitly coerce to a numeric type if
          # the data is sequential, since it's unclear how to coerce padding tokens
          # to a numeric type.
          if not self.sequential:
              arr = [
                  numericalization_func(x)
                  if isinstance(x, six.string_types)
                  else x
                  for x in arr
              ]
          if self.postprocessing is not None:
              arr = self.postprocessing(arr, None)
  
      var = torch.tensor(arr, dtype=self.dtype, device=device)
  
      if self.sequential and not self.batch_first:
          var.t_()
      if self.sequential:
          var = var.contiguous()
  
      if self.include_lengths:
          return var, lengths
      return var
  
file_path: pytext/pytext/fields/text_field_with_special_unk.py
imports: from collections import Counter, OrderedDict
  from itertools import chain
  from typing import List, Optional, Tuple, Union
  import six
  import torch
  from pytext.common.constants import VocabMeta
  from pytext.fields import TextFeatureField
  from pytext.legacy import data
  from pytext.utils.data import is_number, unkify
label_desc: Use image node_id 3 for calling the TextFeatureFieldWithSpecialUnk obj's underlying member method code with example usage: obj.numericalize(arr, device) and returns: var, var,  lengths