class_docstr: Math Dataset.
docstr: Yields examples based on directory, module file..
code: def _generate_examples(self, directory, config, categories):
      """Yields examples based on directory, module file.."""
  
      lines = self._read_data_from_all_categories(
          directory, config, categories
      )
      logging.info(
          "%s: %s contains total: %d", categories, config, len(lines)
      )
      questions = lines[::2]
      answers = lines[1::2]
  
      assert len(answers) == len(
          questions
      ), "answers: %d do not match questions: %d" % (
          len(answers),
          len(questions),
      )
  
      for idx, (q, a) in enumerate(zip(questions, answers)):
          result = {_QUESTION: q, _ANSWER: a}
          if all(result.values()):
              yield idx, result
  
file_path: datasets/tensorflow_datasets/datasets/math_dataset/math_dataset_dataset_builder.py
imports: import os
  from absl import logging
  from etils import epath
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
  import tensorflow_datasets.public_api
label_desc: Use image node_id 4 for calling the Builder obj's underlying member method code with example usage: obj._generate_examples(directory, config, categories) without return types