class_docstr: WordSparseTensorGenerator generates string tf.SparseTensor with string
  length similar to a word.
class_docstr_tok: ["WordSparseTensorGenerator","generates","string","tf.SparseTensor","with","string","length","similar","to","a","word","."]
code: def generate(self):
      # Use Poisson distribution to sample the length of byte strings.
      # The avg_length equals to the lambda in Poisson distribution.
      shape = self._get_shape()
      num_values = self._get_num_values(shape)
      lengths = np.random.poisson(self._avg_length, size=num_values)
  
      to_string = lambda length: np.random.bytes(length)
      vfunc = np.vectorize(to_string)
      vals = vfunc(lengths)
      coords = self._generate_random_coords(num_values, shape)
      return tf.SparseTensor(
          indices=coords, values=vals, dense_shape=shape
      )
  
imports: import enum
  import random
  import hashlib
  import numpy
  import tensorflow
  from tests.test_atds_avro.utils.generator.generator_base import Generator
  from tests.test_atds_avro.utils.hash_util import int_to_bytes
label_desc: Use image node_id 2 for calling the WordSparseTensorGenerator obj's underlying member method code with example usage: obj.generate() and returns: tf