File size: 1,958 Bytes
640ee7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
beca52c
 
 
640ee7f
 
 
 
beca52c
 
640ee7f
 
2004ae6
640ee7f
beca52c
 
 
 
640ee7f
 
beca52c
 
640ee7f
beca52c
 
 
 
640ee7f
 
beca52c
 
 
 
640ee7f
beca52c
640ee7f
 
 
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
52
53
54
55
56
57
58
59
60
61
62
63
64
# coding=utf-8

# Lint as: python3
"""mindgames datasets"""

from __future__ import absolute_import, division, print_function

import json
import os
import textwrap
import six
import datasets


CITATION = r"""
@article{sileo2023mindgames,
  title={MindGames: Targeting Theory of Mind in Large Language Models with Dynamic Epistemic Modal Logic},
  author={Sileo, Damien and Lernould, Antoine},
  journal={arXiv preprint arXiv:2305.03353},
  year={2023}
}
"""

DESCRIPTION = """\
mindgames json tasks
"""

CONFIGS=['forehead','forehead_mirror','explicit','internal','all']
_URLs = {(x,y):f'https://huggingface.co/datasets/sileod/mindgames/resolve/main/data/{x}-{y}.jsonl' for x in ['train','validation','test'] for y in CONFIGS}
files = ['-'.join(x) for x in _URLs]




class mindgamesConfig(datasets.BuilderConfig):
    citation=CITATION

class mindgames(datasets.GeneratorBasedBuilder):
    DEFAULT_CONFIG_NAME = "all"
    BUILDER_CONFIGS = [
            mindgamesConfig(
                name=n,
                data_dir=n
            ) for n in CONFIGS
    ]

    def _split_generators(self, dl_manager: datasets.DownloadManager):
        data_file = dl_manager.download(_URLs)
        return [
            datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_file['train',self.config.data_dir]}),
            datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_file['validation',self.config.data_dir]}),
            datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_file['test',self.config.data_dir]}),
            
        ]

    def _info(self):
        return datasets.DatasetInfo()
    def _generate_examples(self, filepath):
        print(filepath)
        """Yields examples."""
        with open(filepath, "r", encoding="utf-8") as f:
            for id_, line in enumerate(f):
                line_dict = json.loads(line)
                yield id_, line_dict