Datasets:

Modalities:
Text
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
File size: 2,955 Bytes
47834db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ef64e3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47834db
 
 
 
 
 
 
 
 
 
ef64e3a
47834db
 
 
 
 
 
 
b479b19
47834db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8d206a5
47834db
b479b19
 
47834db
 
 
 
 
8d206a5
b479b19
8d206a5
47834db
 
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Lint as: python3

import json
import datasets

# TODO: Add description of the dataset here
# You can copy an official description
_DESCRIPTION = """\
A dataset that evaluates formally proving and autoformalizing undergraduate mathematics.
"""

# TODO: Add a link to an official homepage for the dataset here
_HOMEPAGE = ""

# TODO: Add the licence for the dataset here if you can find it
_LICENSE = "MIT"

# TODO: Add link to the official dataset URLs here
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
_URLS = {
}


class ProofNetConfig(datasets.BuilderConfig):
    """BuilderConfig"""

    def __init__(self, **kwargs):
        """BuilderConfig 
        Args:
          **kwargs: keyword arguments forwarded to super.
        """
        super(ProofNetConfig, self).__init__(**kwargs)


class ProofNet(datasets.GeneratorBasedBuilder):

    BUILDER_CONFIGS = [
        ProofNetConfig(
            name="plain_text",
            version=datasets.Version("2.0.0", ""),
            description="Plain text",
        ),
    ]

    def _info(self):
        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=datasets.Features(
                {
                    "id": datasets.Value("string"),
                    "nl_statement": datasets.Value("string"),
                    "nl_proof": datasets.Value("string"),
                    "formal_statement": datasets.Value("string"),
                    "src_header": datasets.Value("string"), 
                }
            ),
        )

    def _split_generators(self, dl_manager):
        return [
            datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": dl_manager.download("test.jsonl")}),
            datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath":dl_manager.download("valid.jsonl")})
        ]

    def _generate_examples(self, filepath):
        """This function returns the examples in the raw (text) form."""
        key = 0
        with open(filepath) as f:
            for line in f.readlines():
                instance = json.loads(line)
                yield key, instance
                key += 1