Xueguang Ma commited on
Commit
f6d89d3
·
1 Parent(s): 0f9fa28
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. corpus.jsonl.gz +3 -0
  3. scifact-corpus.py +84 -0
.gitattributes CHANGED
@@ -25,3 +25,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
  *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ corpus.jsonl.gz filter=lfs diff=lfs merge=lfs -text
corpus.jsonl.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b7529ffde338c3a921289678edbc6022beef3d505985edb346bfa78e0137c75
3
+ size 2756565
scifact-corpus.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
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
+
16
+ # Lint as: python3
17
+ """SciFact Dataset (Retrieval Only)"""
18
+
19
+ import json
20
+
21
+ import datasets
22
+
23
+ _CITATION = """
24
+ @inproceedings{Wadden2020FactOF,
25
+ title={Fact or Fiction: Verifying Scientific Claims},
26
+ author={David Wadden and Shanchuan Lin and Kyle Lo and Lucy Lu Wang and Madeleine van Zuylen and Arman Cohan and Hannaneh Hajishirzi},
27
+ booktitle={EMNLP},
28
+ year={2020},
29
+ }
30
+ """
31
+
32
+ _DESCRIPTION = "dataset load script for SciFact"
33
+
34
+ _DATASET_URLS = {
35
+ 'train': "https://huggingface.co/datasets/tevatron/scifact/resolve/main/corpus.jsonl.gz",
36
+ }
37
+
38
+
39
+ class ScifactCorpus(datasets.GeneratorBasedBuilder):
40
+ VERSION = datasets.Version("0.0.1")
41
+
42
+ BUILDER_CONFIGS = [
43
+ datasets.BuilderConfig(version=VERSION,
44
+ description="SciFact Corpus"),
45
+ ]
46
+
47
+ def _info(self):
48
+ features = datasets.Features(
49
+ {'docid': datasets.Value('string'), 'text': datasets.Value('string'),
50
+ 'title': datasets.Value('string')},
51
+ )
52
+
53
+ return datasets.DatasetInfo(
54
+ # This is the description that will appear on the datasets page.
55
+ description=_DESCRIPTION,
56
+ # This defines the different columns of the dataset and their types
57
+ features=features, # Here we define them above because they are different between the two configurations
58
+ supervised_keys=None,
59
+ # Homepage of the dataset for documentation
60
+ homepage="",
61
+ # License for the dataset if available
62
+ license="",
63
+ # Citation for the dataset
64
+ citation=_CITATION,
65
+ )
66
+
67
+ def _split_generators(self, dl_manager):
68
+ downloaded_files = dl_manager.download_and_extract(_DATASET_URLS)
69
+ splits = [
70
+ datasets.SplitGenerator(
71
+ name="train",
72
+ gen_kwargs={
73
+ "filepath": downloaded_files["train"],
74
+ },
75
+ ),
76
+ ]
77
+ return splits
78
+
79
+ def _generate_examples(self, filepath):
80
+ """Yields examples."""
81
+ with open(filepath, encoding="utf-8") as f:
82
+ for line in f:
83
+ data = json.loads(line)
84
+ yield data['docid'], data