Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Sub-tasks:
open-domain-qa
Languages:
English
Size:
10K - 100K
License:
Update files from the datasets library (from 1.6.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.6.0
- natural_questions.py +2 -12
natural_questions.py
CHANGED
@@ -16,26 +16,16 @@
|
|
16 |
# Lint as: python3
|
17 |
"""Natural Questions: A Benchmark for Question Answering Research."""
|
18 |
|
19 |
-
from __future__ import absolute_import, division, print_function
|
20 |
|
|
|
21 |
import json
|
22 |
import re
|
23 |
|
24 |
import apache_beam as beam
|
25 |
-
import six
|
26 |
|
27 |
import datasets
|
28 |
|
29 |
|
30 |
-
if six.PY2:
|
31 |
-
import HTMLParser as html_parser # pylint:disable=g-import-not-at-top
|
32 |
-
|
33 |
-
html_unescape = html_parser.HTMLParser().unescape
|
34 |
-
else:
|
35 |
-
import html # pylint:disable=g-import-not-at-top
|
36 |
-
|
37 |
-
html_unescape = html.unescape
|
38 |
-
|
39 |
_CITATION = """
|
40 |
@article{47761,
|
41 |
title = {Natural Questions: a Benchmark for Question Answering Research},
|
@@ -149,7 +139,7 @@ class NaturalQuestions(datasets.BeamBasedBuilder):
|
|
149 |
ans_bytes = ans_bytes.replace(b"\xc2\xa0", b" ")
|
150 |
text = ans_bytes.decode("utf-8")
|
151 |
# Remove HTML markup.
|
152 |
-
text = re.sub("<([^>]*)>", "",
|
153 |
# Replace \xa0 characters with spaces.
|
154 |
return {
|
155 |
"start_token": short_ans["start_token"],
|
|
|
16 |
# Lint as: python3
|
17 |
"""Natural Questions: A Benchmark for Question Answering Research."""
|
18 |
|
|
|
19 |
|
20 |
+
import html
|
21 |
import json
|
22 |
import re
|
23 |
|
24 |
import apache_beam as beam
|
|
|
25 |
|
26 |
import datasets
|
27 |
|
28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
_CITATION = """
|
30 |
@article{47761,
|
31 |
title = {Natural Questions: a Benchmark for Question Answering Research},
|
|
|
139 |
ans_bytes = ans_bytes.replace(b"\xc2\xa0", b" ")
|
140 |
text = ans_bytes.decode("utf-8")
|
141 |
# Remove HTML markup.
|
142 |
+
text = re.sub("<([^>]*)>", "", html.unescape(text))
|
143 |
# Replace \xa0 characters with spaces.
|
144 |
return {
|
145 |
"start_token": short_ans["start_token"],
|