Commit
·
b4095b0
1
Parent(s):
2c572a1
Update demo2.py
Browse files
demo2.py
CHANGED
@@ -25,8 +25,7 @@ from datasets import TextClassification
|
|
25 |
logger = datasets.logging.get_logger(__name__)
|
26 |
|
27 |
|
28 |
-
_CITATION = """\
|
29 |
-
@article{2016arXiv160605250R,
|
30 |
author = {{Rajpurkar}, Pranav and {Zhang}, Jian and {Lopyrev},
|
31 |
Konstantin and {Liang}, Percy},
|
32 |
title = "{SQuAD: 100,000+ Questions for Machine Comprehension of Text}",
|
@@ -39,11 +38,7 @@ archivePrefix = {arXiv},
|
|
39 |
}
|
40 |
"""
|
41 |
|
42 |
-
_DESCRIPTION = """\
|
43 |
-
Stanford Question Answering Dataset (SQuAD) is a reading comprehension \
|
44 |
-
dataset, consisting of questions posed by crowdworkers on a set of Wikipedia \
|
45 |
-
articles, where the answer to every question is a segment of text, or span, \
|
46 |
-
from the corresponding reading passage, or the question might be unanswerable.
|
47 |
"""
|
48 |
|
49 |
train_url = "https://raw.githubusercontent.com/Sampson2016/test/master/train.csv?token=GHSAT0AAAAAABR4XKTHOQNDJLYATOR3QTUKYVQLKGQ"
|
@@ -100,12 +95,11 @@ class Demo2(datasets.GeneratorBasedBuilder):
|
|
100 |
]
|
101 |
|
102 |
def _generate_examples(self, filepath):
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
}
|
|
|
25 |
logger = datasets.logging.get_logger(__name__)
|
26 |
|
27 |
|
28 |
+
_CITATION = """\n@article{2016arXiv160605250R,
|
|
|
29 |
author = {{Rajpurkar}, Pranav and {Zhang}, Jian and {Lopyrev},
|
30 |
Konstantin and {Liang}, Percy},
|
31 |
title = "{SQuAD: 100,000+ Questions for Machine Comprehension of Text}",
|
|
|
38 |
}
|
39 |
"""
|
40 |
|
41 |
+
_DESCRIPTION = """\nStanford Question Answering Dataset (SQuAD) is a reading comprehension \ndataset, consisting of questions posed by crowdworkers on a set of Wikipedia \narticles, where the answer to every question is a segment of text, or span, \nfrom the corresponding reading passage, or the question might be unanswerable.
|
|
|
|
|
|
|
|
|
42 |
"""
|
43 |
|
44 |
train_url = "https://raw.githubusercontent.com/Sampson2016/test/master/train.csv?token=GHSAT0AAAAAABR4XKTHOQNDJLYATOR3QTUKYVQLKGQ"
|
|
|
95 |
]
|
96 |
|
97 |
def _generate_examples(self, filepath):
|
98 |
+
logger.info("generating examples from = %s", filepath)
|
99 |
+
with open(filepath, encoding="utf-8") as f:
|
100 |
+
demo2 = csv.DictReader(f)
|
101 |
+
for key, row in enumerate(demo2):
|
102 |
+
yield key, {
|
103 |
+
"text": row['text'],
|
104 |
+
"label": row['label'],
|
105 |
+
}
|
|