code: def text2class_txt_iterator(source_txt_path, label_txt_path, class_strs=None):
    
    if class_strs:
      class_strs = dict([(s, i) for i, s in enumerate(class_strs)])
    for inputs, label in zip(
        txt_line_iterator(source_txt_path), txt_line_iterator(label_txt_path)):
      label = label.strip()
      if class_strs:
        label = class_strs[label]
      else:
        label = int(label)
      yield {"inputs": inputs, "label": label}
docs: Yield dicts for Text2ClassProblem.generate_samples from lines of files.
  
    Args:
      source_txt_path: txt file with record per line.
      label_txt_path: txt file with label per line, either as int or str. If
        string, must provide class_strs.
      class_strs: list<str> of class label names. Must be in correct order (i.e.
        ["a", "b", "c"] means that "a" will get class ID 0, "b" ID 1, etc.).
  
    Yields:
      {"inputs": inputs, "label": label}