docstr: Working with `numpy` arrays of strings requires setting the data type to avoid
  truncating examples. This function estimates the longest sentence expected
  during the sampling process, which is used to set the number of characters
  for the samples and examples arrays. This depends on the perturbation method
  used for sampling.
docstr_tok: ["Working","with","`","numpy","`","arrays","of","strings","requires","setting","the","data","type","to","avoid","truncating","examples",".","This","function","estimates","the","longest","sentence","expected","during","the","sampling","process",",","which","is","used","to","set","the","number","of","characters","for","the","samples","and","examples","arrays",".","This","depends","on","the","perturbation","method","used","for","sampling","."]
code: def set_data_type(self) -> None:
      """
      Working with `numpy` arrays of strings requires setting the data type to avoid
      truncating examples. This function estimates the longest sentence expected
      during the sampling process, which is used to set the number of characters
      for the samples and examples arrays. This depends on the perturbation method
      used for sampling.
      """
  
      # get the vocabulary
      vocab = self.model.tokenizer.get_vocab()
      max_len = 0
  
      # go through the vocabulary and compute the maximum length of a token
      for token in vocab.keys():
          max_len = len(token) if len(token) > max_len else max_len
  
      # length of the maximum word. the prefix it is just a precaution.
      # for example <mask> -> _<mask> which is not in the vocabulary.
      max_len += len(self.model.SUBWORD_PREFIX)
  
      # length of the maximum text
      max_sent_len = (
          len(self.head_tokens) + len(self.tail_tokens)
      ) * max_len
  
      # define the types to be used
      self.dtype_token = "<U" + str(max_len)
      self.dtype_sent = "<U" + str(max_sent_len)
  
imports: import string
  from functools import partial
  from typing import Dict, List, Optional, Tuple
  import numpy
  import tensorflow
  from alibi.utils.lang_model import LanguageModel
  from alibi.explainers.anchors.text_samplers import AnchorTextSampler
label_desc: Use image node_id 13 for calling the LanguageModelSampler obj's underlying member method code with example usage: obj.set_data_type() without return types