Datasets:

Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
pandas
License:
File size: 1,970 Bytes
3a47afc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import datasets
import json
import os

citation='''
@article{han2022folio,
  title={FOLIO: Natural Language Reasoning with First-Order Logic},
  author = {Han, Simeng and Schoelkopf, Hailey and Zhao, Yilun and Qi, Zhenting and Riddell, Martin and Benson, Luke and Sun, Lucy and Zubova, Ekaterina and Qiao, Yujie and Burtell, Matthew and Peng, David and Fan, Jonathan and Liu, Yixin and Wong, Brian and Sailor, Malcolm and Ni, Ansong and Nan, Linyong and Kasai, Jungo and Yu, Tao and Zhang, Rui and Joty, Shafiq and Fabbri, Alexander R. and Kryscinski, Wojciech and Lin, Xi Victoria and Xiong, Caiming and Radev, Dragomir},
  journal={arXiv preprint arXiv:2209.00840},
  url = {https://arxiv.org/abs/2209.00840},
  year={2022}
}
'''

class FolioConfig(datasets.BuilderConfig):
    citation=citation

files = ["folio-validation.jsonl"]

_URLs = {f:f"https://huggingface.co./datasets/benlipkin/folio/resolve/main/{f}" for f in files}

class Folio(datasets.GeneratorBasedBuilder):
    BUILDER_CONFIGS = [
            FolioConfig(
                name='.'.join(n.split('.')[:-1]),
                data_dir=n
            ) for n in files
    ]
    

    def _split_generators(self, dl_manager: datasets.DownloadManager):
        data_file = dl_manager.download(_URLs)
        path=data_file[self.config.data_dir]
        pval=os.path.join(path,"folio-validation.jsonl")

        return [
            datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": pval}),
        ]

    def _info(self):
        return datasets.DatasetInfo()
    
    def _generate_examples(self, filepath):
        cols=["premises", "premises-FOL", "conclusion", "conclusion-FOL", "label"]
        """Yields examples."""
        with open(filepath, "r", encoding="utf-8") as f:
            for id_, line in enumerate(f):
                line_dict = json.loads(line)
                line_dict={k:v for k,v in line_dict.items() if k in cols}
                yield id_, line_dict