system HF staff commited on
Commit
4325ab8
1 Parent(s): 51787ad

Update files from the datasets library (from 1.7.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.7.0

Files changed (2) hide show
  1. README.md +4 -3
  2. go_emotions.py +3 -3
README.md CHANGED
@@ -22,6 +22,7 @@ task_ids:
22
  - multi-class-classification
23
  - multi-label-classification
24
  - text-classification-other-emotion
 
25
  ---
26
 
27
  # Dataset Card for GoEmotions
@@ -29,12 +30,12 @@ task_ids:
29
  ## Table of Contents
30
  - [Dataset Description](#dataset-description)
31
  - [Dataset Summary](#dataset-summary)
32
- - [Supported Tasks](#supported-tasks-and-leaderboards)
33
  - [Languages](#languages)
34
  - [Dataset Structure](#dataset-structure)
35
  - [Data Instances](#data-instances)
36
- - [Data Fields](#data-instances)
37
- - [Data Splits](#data-instances)
38
  - [Dataset Creation](#dataset-creation)
39
  - [Curation Rationale](#curation-rationale)
40
  - [Source Data](#source-data)
 
22
  - multi-class-classification
23
  - multi-label-classification
24
  - text-classification-other-emotion
25
+ paperswithcode_id: goemotions
26
  ---
27
 
28
  # Dataset Card for GoEmotions
 
30
  ## Table of Contents
31
  - [Dataset Description](#dataset-description)
32
  - [Dataset Summary](#dataset-summary)
33
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
34
  - [Languages](#languages)
35
  - [Dataset Structure](#dataset-structure)
36
  - [Data Instances](#data-instances)
37
+ - [Data Fields](#data-fields)
38
+ - [Data Splits](#data-splits)
39
  - [Dataset Creation](#dataset-creation)
40
  - [Curation Rationale](#curation-rationale)
41
  - [Source Data](#source-data)
go_emotions.py CHANGED
@@ -142,17 +142,17 @@ class GoEmotions(datasets.GeneratorBasedBuilder):
142
 
143
  def _generate_examples(self, filepaths, raw=False):
144
  """Generate AG News examples."""
145
- for filepath in filepaths:
146
  with open(filepath, "r", encoding="utf-8") as f:
147
  if raw:
148
  reader = csv.DictReader(f)
149
  else:
150
  reader = csv.DictReader(f, delimiter="\t", fieldnames=list(self.config.features.keys()))
151
 
152
- for irow, row in enumerate(reader):
153
  if raw:
154
  row["example_very_unclear"] = row["example_very_unclear"] == "TRUE"
155
  else:
156
  row["labels"] = [int(ind) for ind in row["labels"].split(",")]
157
 
158
- yield irow, row
 
142
 
143
  def _generate_examples(self, filepaths, raw=False):
144
  """Generate AG News examples."""
145
+ for file_idx, filepath in enumerate(filepaths):
146
  with open(filepath, "r", encoding="utf-8") as f:
147
  if raw:
148
  reader = csv.DictReader(f)
149
  else:
150
  reader = csv.DictReader(f, delimiter="\t", fieldnames=list(self.config.features.keys()))
151
 
152
+ for row_idx, row in enumerate(reader):
153
  if raw:
154
  row["example_very_unclear"] = row["example_very_unclear"] == "TRUE"
155
  else:
156
  row["labels"] = [int(ind) for ind in row["labels"].split(",")]
157
 
158
+ yield f"{file_idx}_{row_idx}", row