class_docstr: Base class for bAbi question answering problems.
class_docstr_tok: ["Base","class","for","bAbi","question","answering","problems","."]
code: def generate_samples(self, data_dir, tmp_dir, dataset_split):
      tmp_dir = _prepare_babi_data(tmp_dir, data_dir)
      _build_vocab(
          self.generate_text_for_vocab(data_dir, tmp_dir),
          data_dir,
          self.vocab_filename,
      )
      examples = _babi_parser(
          tmp_dir,
          self.babi_task_id,
          self.babi_subset,
          dataset_split,
          self.joint_training,
      )
  
      def _generate_samples():
          """sample generator.
  
          Yields:
            A dict.
  
          """
          for example in examples:
              context = " ".join(example[FeatureNames.STORY])
              yield {
                  "context": " ".join(context.split()),
                  "inputs": " ".join(
                      example[FeatureNames.QUESTION].split()
                  ),
                  "targets": example[FeatureNames.ANSWER],
              }
  
      return _generate_samples()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import os
  import shutil
  import tarfile
  import requests
  import six
  from tensor2tensor.data_generators import problem
  from tensor2tensor.data_generators import text_encoder
  from tensor2tensor.data_generators import text_problems
  from tensor2tensor.data_generators import tokenizer
  from tensor2tensor.layers import modalities
  from tensor2tensor.utils import metrics
  from tensor2tensor.utils import registry
  import tensorflow.compat.v1
label_desc: Use image node_id 11 for calling the BabiQa obj's underlying member method code with example usage: obj.generate_samples(data_dir, tmp_dir, dataset_split) and returns: _generate_samples