3be1154314111df8cd327a321fe3d68e7b661c68,tensorflow_datasets/text/pg19.py,Pg19,_generate_examples,#Pg19#Any#Any#,105

Before Change


  def _generate_examples(self, filepaths, metadata):
    Yields examples.

    metadata_dict = collections.defaultdict(list)
    for row in metadata:
      features = row.split(",")
      metadata_dict["book_id"].append(int(features[0]))
      metadata_dict["book_title"].append(str(features[1]))
      metadata_dict["publication_date"].append(str(features[2]))
      metadata_dict["book_link"].append(str(features[3]))

    with tf.io.gfile.GFile(filepaths, "r") as f:
      text = f.read().strip()

      yield metadata_dict, {"book_data": text}

After Change



      with tf.io.gfile.GFile(file, "r") as f:
        text = f.read().strip()
        yield index, {
            "book_text": text,
            "book_id": book_id,
            "book_title": book_data[0],
            "publication_date": book_data[1],
            "book_link": book_data[2]
            }
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: tensorflow/datasets
Commit Name: 3be1154314111df8cd327a321fe3d68e7b661c68
Time: 2020-05-29
Author: charlespatel07@gmail.com
File Name: tensorflow_datasets/text/pg19.py
Class Name: Pg19
Method Name: _generate_examples


Project Name: pantsbuild/pants
Commit Name: 34c1c7c1b671156c177c16824a47c2afad124751
Time: 2018-10-18
Author: clivingston45@gmail.com
File Name: src/python/pants/backend/python/interpreter_cache.py
Class Name: PythonInterpreterCache
Method Name: select_interpreter_for_targets


Project Name: snorkel-team/snorkel
Commit Name: 920c93b035fa35ab75443076745cda82ea092926
Time: 2016-07-27
Author: ajratner@gmail.com
File Name: snorkel/features.py
Class Name: Featurizer
Method Name: apply