lautel commited on
Commit
036be0d
1 Parent(s): ddcf132

Upload fair_rationales.py

Browse files
Files changed (1) hide show
  1. fair_rationales.py +7 -5
fair_rationales.py CHANGED
@@ -58,6 +58,7 @@ class FairRationalesConfig(datasets.BuilderConfig):
58
 
59
  def __init__(
60
  self,
 
61
  url,
62
  data_url,
63
  citation,
@@ -86,6 +87,7 @@ class FairRationalesConfig(datasets.BuilderConfig):
86
  **kwargs: keyword arguments forwarded to super.
87
  """
88
  super(FairRationalesConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
 
89
  self.label_classes = label_classes
90
  self.label_classes_original = label_classes_original
91
  # self.attentioncheck = attentioncheck
@@ -103,7 +105,7 @@ class FairRationales(datasets.GeneratorBasedBuilder):
103
 
104
  BUILDER_CONFIGS = [
105
  FairRationalesConfig(
106
- name="sst2",
107
  description=textwrap.dedent(
108
  """\
109
  The Stanford Sentiment Treebank is a corpus with fully labeled parse trees that allows for a complete analysis of the compositional effects of sentiment in language.
@@ -150,7 +152,7 @@ class FairRationales(datasets.GeneratorBasedBuilder):
150
  ),
151
  ),
152
  FairRationalesConfig(
153
- name="dynasent",
154
  description=textwrap.dedent(
155
  """\
156
  DynaSent is an English-language benchmark task for ternary (positive/negative/neutral) sentiment analysis.
@@ -183,7 +185,7 @@ class FairRationales(datasets.GeneratorBasedBuilder):
183
  ),
184
  ),
185
  FairRationalesConfig(
186
- name="cose",
187
  description=textwrap.dedent(
188
  """\
189
  Common Sense Explanations (CoS-E) allows for training language models to automatically
@@ -236,7 +238,7 @@ class FairRationales(datasets.GeneratorBasedBuilder):
236
  "originaldata_id": datasets.Value("string"),
237
  "annotator_ID": datasets.Value("int64")
238
  }
239
- if self.config.name == "cose":
240
  features["label"] = datasets.Value("string")
241
  else:
242
  features["label"] = datasets.ClassLabel(names=self.config.label_classes)
@@ -288,7 +290,7 @@ class FairRationales(datasets.GeneratorBasedBuilder):
288
  }
289
  for attribute_name, _ in self.config.attributes:
290
  example[attribute_name] = data[attribute_name]
291
- if self.config.name == "sst2":
292
  example["sst2_id"] = data["sst2_id"]
293
  example["sst2_split"] = data["sst2_split"]
294
  yield id_, example
 
58
 
59
  def __init__(
60
  self,
61
+ dataname,
62
  url,
63
  data_url,
64
  citation,
 
87
  **kwargs: keyword arguments forwarded to super.
88
  """
89
  super(FairRationalesConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
90
+ self.dataname = dataname
91
  self.label_classes = label_classes
92
  self.label_classes_original = label_classes_original
93
  # self.attentioncheck = attentioncheck
 
105
 
106
  BUILDER_CONFIGS = [
107
  FairRationalesConfig(
108
+ dataname="sst2",
109
  description=textwrap.dedent(
110
  """\
111
  The Stanford Sentiment Treebank is a corpus with fully labeled parse trees that allows for a complete analysis of the compositional effects of sentiment in language.
 
152
  ),
153
  ),
154
  FairRationalesConfig(
155
+ dataname="dynasent",
156
  description=textwrap.dedent(
157
  """\
158
  DynaSent is an English-language benchmark task for ternary (positive/negative/neutral) sentiment analysis.
 
185
  ),
186
  ),
187
  FairRationalesConfig(
188
+ dataname="cose",
189
  description=textwrap.dedent(
190
  """\
191
  Common Sense Explanations (CoS-E) allows for training language models to automatically
 
238
  "originaldata_id": datasets.Value("string"),
239
  "annotator_ID": datasets.Value("int64")
240
  }
241
+ if self.config.dataname == "cose":
242
  features["label"] = datasets.Value("string")
243
  else:
244
  features["label"] = datasets.ClassLabel(names=self.config.label_classes)
 
290
  }
291
  for attribute_name, _ in self.config.attributes:
292
  example[attribute_name] = data[attribute_name]
293
+ if self.config.dataname == "sst2":
294
  example["sst2_id"] = data["sst2_id"]
295
  example["sst2_split"] = data["sst2_split"]
296
  yield id_, example