Datasets:

Modalities:
Text
Size:
< 1K
ArXiv:
Libraries:
Datasets
License:
proofnet / proofnet.py
zhangir-azerbayev
fixed a few errors
83dc2ba
# 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.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