ebrigham commited on
Commit
b34f145
·
1 Parent(s): 5097fe1

Update labels.py

Browse files
Files changed (1) hide show
  1. labels.py +4 -4
labels.py CHANGED
@@ -103,11 +103,11 @@ class YahooAnswersTopics(datasets.GeneratorBasedBuilder):
103
 
104
  def _generate_examples(self, filepath):
105
  """Generate AG News examples."""
106
- with open(filepath, encoding="utf-8") as csv_file:
107
- csv_reader = csv.reader(
108
- csv_file, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
109
  )
110
- for id_, row in enumerate(csv_reader):
111
  label, title, description = row
112
  # Original labels are [1, 2, 3, 4] ->
113
  # ['World', 'Sports', 'Business', 'Sci/Tech']
 
103
 
104
  def _generate_examples(self, filepath):
105
  """Generate AG News examples."""
106
+ with open(filepath, encoding="utf-8") as f:
107
+ rows = csv.reader(
108
+ f, quotechar='"', delimiter=",", quoting=csv.QUOTE_ALL, skipinitialspace=True
109
  )
110
+ for id_, row in enumerate(rows):
111
  label, title, description = row
112
  # Original labels are [1, 2, 3, 4] ->
113
  # ['World', 'Sports', 'Business', 'Sci/Tech']