kleinay commited on
Commit
eff1610
1 Parent(s): d33adc5

Include dataset versions - support both "v2" and "v2_1" (default)

Browse files
Files changed (1) hide show
  1. qa_srl2018.py +14 -14
qa_srl2018.py CHANGED
@@ -12,7 +12,7 @@
12
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
  # See the License for the specific language governing permissions and
14
  # limitations under the License.
15
- """TODO: Add a description here."""
16
 
17
 
18
  import datasets
@@ -44,26 +44,29 @@ _LICENSE = ""
44
 
45
 
46
  _URLs = {
47
- "qasrl_v2.0": "http://qasrl.org/data/qasrl-v2.tar",
48
- "qasrl_v2.1": "https://qasrl.org/data/qasrl-v2_1.tar"
49
  }
50
 
51
  SpanFeatureType = datasets.Sequence(datasets.Value("int32"), length=2)
52
 
53
- # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
54
  class QaSrl2018(datasets.GeneratorBasedBuilder):
55
  """QA-SRL2018: Large-Scale Question-Answer Driven Semantic Role Labeling corpus"""
56
 
57
- VERSION = datasets.Version("1.0.1")
58
 
59
  BUILDER_CONFIGS = [
60
  datasets.BuilderConfig(
61
- name="plain_text", version=VERSION, description="This provides WIKIPEDIA dataset for qa_srl corpus"
 
 
 
62
  ),
63
  ]
64
 
65
  DEFAULT_CONFIG_NAME = (
66
- "plain_text" # It's not mandatory to have a default configuration. Just use one if it make sense.
67
  )
68
 
69
  def _info(self):
@@ -101,13 +104,10 @@ class QaSrl2018(datasets.GeneratorBasedBuilder):
101
  """Returns SplitGenerators."""
102
 
103
  # iterate the tar file of the corpus
104
-
105
- # Older version of the corpus (has some format errors):
106
- # corpus_base_path = Path(dl_manager.download_and_extract(_URLs["qasrl_v2.0"]))
107
- # corpus_orig = corpus_base_path / "qasrl-v2" / "orig"
108
-
109
- corpus_base_path = Path(dl_manager.download_and_extract(_URLs["qasrl_v2.1"]))
110
- corpus_orig = corpus_base_path / "qasrl-v2_1" / "orig"
111
 
112
 
113
  # TODO add optional kwarg for genre (wikinews)
 
12
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
  # See the License for the specific language governing permissions and
14
  # limitations under the License.
15
+ """ QA-SRL Bank v2 Dataset"""
16
 
17
 
18
  import datasets
 
44
 
45
 
46
  _URLs = {
47
+ "qasrl_v2": "http://qasrl.org/data/qasrl-v2.tar",
48
+ "qasrl_v2_1": "https://qasrl.org/data/qasrl-v2_1.tar"
49
  }
50
 
51
  SpanFeatureType = datasets.Sequence(datasets.Value("int32"), length=2)
52
 
53
+ # Name of the dataset usually match the script name with CamelCase instead of snake_case
54
  class QaSrl2018(datasets.GeneratorBasedBuilder):
55
  """QA-SRL2018: Large-Scale Question-Answer Driven Semantic Role Labeling corpus"""
56
 
57
+ VERSION = datasets.Version("1.0.2")
58
 
59
  BUILDER_CONFIGS = [
60
  datasets.BuilderConfig(
61
+ name="v2", version=VERSION, description="This provides WIKIPEDIA dataset for qa_srl corpus (original version from Fitzgerald et. al., 2018)"
62
+ ),
63
+ datasets.BuilderConfig(
64
+ name="v2_1", version=VERSION, description="This provides WIKIPEDIA dataset for qa_srl corpus (version 2.1)"
65
  ),
66
  ]
67
 
68
  DEFAULT_CONFIG_NAME = (
69
+ "v2_1"
70
  )
71
 
72
  def _info(self):
 
104
  """Returns SplitGenerators."""
105
 
106
  # iterate the tar file of the corpus
107
+
108
+ qasrl_dataset_version = self.config_id
109
+ corpus_base_path = Path(dl_manager.download_and_extract(_URLs[f"qasrl_{qasrl_dataset_version}"]))
110
+ corpus_orig = corpus_base_path / f"qasrl-{qasrl_dataset_version}" / "orig"
 
 
 
111
 
112
 
113
  # TODO add optional kwarg for genre (wikinews)