|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import json |
|
import datasets |
|
|
|
|
|
|
|
_DESCRIPTION = """\ |
|
A dataset that evaluates formally proving and autoformalizing undergraduate mathematics. |
|
""" |
|
|
|
|
|
_HOMEPAGE = "" |
|
|
|
|
|
_LICENSE = "MIT" |
|
|
|
|
|
|
|
|
|
_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.1.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 |
|
|