mathiascreutz commited on
Commit
f275cf8
1 Parent(s): 48f737e

More comments

Browse files
Files changed (1) hide show
  1. opusparcus.py +12 -7
opusparcus.py CHANGED
@@ -94,11 +94,12 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
94
  OpusparcusConfig(lang=lang, quality=quality, version=_VERSION) for lang in LANGS for quality in QUALITIES
95
  ]
96
 
97
- #DEFAULT_CONFIG_NAME = "test" # It's not mandatory to have a default configuration. Just use one if it make sense.
 
98
 
99
  def _info(self):
100
- # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
101
- #if self.config.name == "test": # This is the name of the configuration selected in BUILDER_CONFIGS above
102
  features = datasets.Features(
103
  {
104
  "lang": datasets.Value("string"),
@@ -113,11 +114,11 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
113
  # This is the description that will appear on the datasets page.
114
  description=_DESCRIPTION,
115
  # This defines the different columns of the dataset and their types
116
- features=features, # Here we define them above because they are different between the two configurations
117
  # If there's a common (input, target) tuple from the features,
118
  # specify them here. They'll be used if as_supervised=True in
119
- # builder.as_dataset.
120
- supervised_keys=None,
121
  # Homepage of the dataset for documentation
122
  homepage=_HOMEPAGE,
123
  # License for the dataset if available
@@ -137,6 +138,10 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
137
  # separated by a period, containing the values of
138
  # self.config.lang and self.config.quality.
139
 
 
 
 
 
140
  # Select which file of the training data contains the matching data:
141
  if self.config.quality < 70:
142
  # We need to retrieve the largest training set file
@@ -259,7 +264,7 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
259
  }
260
  else:
261
  # The validation and test sets are in jsonl files.
262
- # They contain the fields "lang" and "quality" that we filter on.
263
  # If we ask for the full sets, we will keep all data entries, also
264
  # the sentence pairs that were not considered paraphrases by the
265
  # annotators:
 
94
  OpusparcusConfig(lang=lang, quality=quality, version=_VERSION) for lang in LANGS for quality in QUALITIES
95
  ]
96
 
97
+ # There is no default configuration. User always needs to specify one:
98
+ #DEFAULT_CONFIG_NAME = None
99
 
100
  def _info(self):
101
+ # This method specifies the datasets.DatasetInfo object which
102
+ # contains informations and typings for the dataset
103
  features = datasets.Features(
104
  {
105
  "lang": datasets.Value("string"),
 
114
  # This is the description that will appear on the datasets page.
115
  description=_DESCRIPTION,
116
  # This defines the different columns of the dataset and their types
117
+ features=features,
118
  # If there's a common (input, target) tuple from the features,
119
  # specify them here. They'll be used if as_supervised=True in
120
+ # builder.as_dataset:
121
+ supervised_keys=(sent1, sent2), # is this correct?
122
  # Homepage of the dataset for documentation
123
  homepage=_HOMEPAGE,
124
  # License for the dataset if available
 
138
  # separated by a period, containing the values of
139
  # self.config.lang and self.config.quality.
140
 
141
+ if lang is None:
142
+ # This is an error, nothing to do here
143
+ return []
144
+
145
  # Select which file of the training data contains the matching data:
146
  if self.config.quality < 70:
147
  # We need to retrieve the largest training set file
 
264
  }
265
  else:
266
  # The validation and test sets are in jsonl files.
267
+ # They contain the fields "lang" and "annot_score" that we filter on.
268
  # If we ask for the full sets, we will keep all data entries, also
269
  # the sentence pairs that were not considered paraphrases by the
270
  # annotators: