fix data bug - empty prep slot; replacing with underscore
Browse files- qa_srl2018.py +3 -3
qa_srl2018.py
CHANGED
@@ -54,7 +54,7 @@ SpanFeatureType = datasets.Sequence(datasets.Value("int32"), length=2)
|
|
54 |
class QaSrl2018(datasets.GeneratorBasedBuilder):
|
55 |
"""QA-SRL2018: Large-Scale Question-Answer Driven Semantic Role Labeling corpus"""
|
56 |
|
57 |
-
VERSION = datasets.Version("1.0.
|
58 |
|
59 |
BUILDER_CONFIGS = [
|
60 |
datasets.BuilderConfig(
|
@@ -138,7 +138,7 @@ class QaSrl2018(datasets.GeneratorBasedBuilder):
|
|
138 |
def _generate_examples(self, filepath):
|
139 |
|
140 |
""" Yields examples from a '.jsonl.gz' file ."""
|
141 |
-
|
142 |
with gzip.open(filepath, "rt") as f:
|
143 |
qa_counter = 0
|
144 |
for line in f:
|
@@ -158,7 +158,7 @@ class QaSrl2018(datasets.GeneratorBasedBuilder):
|
|
158 |
question_slots["subj"],
|
159 |
verb_surface,
|
160 |
question_slots["obj"],
|
161 |
-
question_slots["prep"],
|
162 |
question_slots["obj2"],
|
163 |
'?'
|
164 |
]
|
|
|
54 |
class QaSrl2018(datasets.GeneratorBasedBuilder):
|
55 |
"""QA-SRL2018: Large-Scale Question-Answer Driven Semantic Role Labeling corpus"""
|
56 |
|
57 |
+
VERSION = datasets.Version("1.0.3")
|
58 |
|
59 |
BUILDER_CONFIGS = [
|
60 |
datasets.BuilderConfig(
|
|
|
138 |
def _generate_examples(self, filepath):
|
139 |
|
140 |
""" Yields examples from a '.jsonl.gz' file ."""
|
141 |
+
empty_to_underscore = lambda s: "_" if s=="" else s
|
142 |
with gzip.open(filepath, "rt") as f:
|
143 |
qa_counter = 0
|
144 |
for line in f:
|
|
|
158 |
question_slots["subj"],
|
159 |
verb_surface,
|
160 |
question_slots["obj"],
|
161 |
+
empty_to_underscore(question_slots["prep"]), # fix bug in data
|
162 |
question_slots["obj2"],
|
163 |
'?'
|
164 |
]
|