Commit ·
dab9a44
0
Parent(s):
Duplicate from proofcheck/prooflang
Browse filesCo-authored-by: Christopher A. Stone <christopherastone@users.noreply.huggingface.co>
- .gitattributes +54 -0
- README.md +142 -0
- prooflang.py +176 -0
- proofs.zip +3 -0
- raw.zip +3 -0
- sentences.zip +3 -0
- tags.zip +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
# Audio files - uncompressed
|
| 37 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
# Audio files - compressed
|
| 41 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
# Image files - uncompressed
|
| 47 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
# Image files - compressed
|
| 52 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
size_categories:
|
| 8 |
+
- 1B<n<10B
|
| 9 |
+
pretty_name: ProofLang Corpus
|
| 10 |
+
dataset_info:
|
| 11 |
+
- config_name: proofs
|
| 12 |
+
num_bytes: 3197091800
|
| 13 |
+
num_examples: 3681901
|
| 14 |
+
features:
|
| 15 |
+
- name: fileID
|
| 16 |
+
dtype: string
|
| 17 |
+
- name: proof
|
| 18 |
+
dtype: string
|
| 19 |
+
|
| 20 |
+
- config_name: sentences
|
| 21 |
+
num_bytes: 3736579062
|
| 22 |
+
num_examples: 38899130
|
| 23 |
+
features:
|
| 24 |
+
- name: fileID
|
| 25 |
+
dtype: string
|
| 26 |
+
- name: sentence
|
| 27 |
+
dtype: string
|
| 28 |
+
|
| 29 |
+
download_size: 6933683563
|
| 30 |
+
dataset_size: 6933670862
|
| 31 |
+
---
|
| 32 |
+
# Dataset Card for the ProofLang Corpus
|
| 33 |
+
|
| 34 |
+
## Dataset Summary
|
| 35 |
+
|
| 36 |
+
The ProofLang Corpus includes 3.7M proofs (558 million words) mechanically extracted from papers that were posted on [arXiv.org](https://arXiv.org) between 1992 and 2020.
|
| 37 |
+
The focus of this corpus is proofs, rather than the explanatory text that surrounds them, and more specifically on the *language* used in such proofs.
|
| 38 |
+
Specific mathematical content is filtered out, resulting in sentences such as `Let MATH be the restriction of MATH to MATH.`
|
| 39 |
+
|
| 40 |
+
This dataset reflects how people prefer to write (non-formalized) proofs, and is also amenable to statistical analyses and experiments with Natural Language Processing (NLP) techniques.
|
| 41 |
+
We hope it can serve as an aid in the development of language-based proof assistants and proof checkers for professional and educational purposes.
|
| 42 |
+
|
| 43 |
+
## Dataset Structure
|
| 44 |
+
|
| 45 |
+
There are multiple TSV versions of the data. Primarily, `proofs` divides up the data proof-by-proof, and `sentences` further divides up the same data sentence-by-sentence.
|
| 46 |
+
The `raw` dataset is a less-cleaned-up version of `proofs`. More usefully, the `tags` dataset gives arXiv subject tags for each paper ID found in the other data files.
|
| 47 |
+
|
| 48 |
+
* The data in `proofs` (and `raw`) consists of a `paper` ID (identifying where the proof was extracted from), and the `proof` as a string.
|
| 49 |
+
|
| 50 |
+
* The data in `sentences` consists of a `paper` ID, and the `sentence` as a string.
|
| 51 |
+
|
| 52 |
+
* The data in `tags` consists of a `paper` ID, and the arXiv subject tags for that paper as a single comma-separated string.
|
| 53 |
+
|
| 54 |
+
Further metadata about papers can be queried from arXiv.org using the paper ID.
|
| 55 |
+
|
| 56 |
+
In particular, each paper `<id>` in the dataset can be accessed online at the url `https://arxiv.org/abs/<id>`
|
| 57 |
+
|
| 58 |
+
## Dataset Size
|
| 59 |
+
|
| 60 |
+
* `proofs` is 3,094,779,182 bytes (unzipped) and has 3,681,893 examples.
|
| 61 |
+
* `sentences` is 3,545,309,822 bytes (unzipped) and has 38,899,132 examples.
|
| 62 |
+
* `tags` is 7,967,839 bytes (unzipped) and has 328,642 rows.
|
| 63 |
+
* `raw` is 3,178,997,379 bytes (unzipped) and has 3,681,903 examples.
|
| 64 |
+
|
| 65 |
+
## Dataset Statistics
|
| 66 |
+
|
| 67 |
+
* The average length of `sentences` is 14.1 words.
|
| 68 |
+
|
| 69 |
+
* The average length of `proofs` is 10.5 sentences.
|
| 70 |
+
|
| 71 |
+
## Dataset Usage
|
| 72 |
+
|
| 73 |
+
Data can be downloaded as (zipped) TSV files.
|
| 74 |
+
|
| 75 |
+
Accessing the data programmatically from Python is also possible using the `Datasets` library.
|
| 76 |
+
For example, to print the first 10 proofs:
|
| 77 |
+
|
| 78 |
+
```python
|
| 79 |
+
from datasets import load_dataset
|
| 80 |
+
dataset = load_dataset('proofcheck/prooflang', 'proofs', split='train', streaming='True')
|
| 81 |
+
for d in dataset.take(10):
|
| 82 |
+
print(d['paper'], d['proof'])
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
To look at individual sentences from the proofs,
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
dataset = load_dataset('proofcheck/prooflang', 'proofs', split='train', streaming='True')
|
| 89 |
+
for d in dataset.take(10):
|
| 90 |
+
print(d['paper'], d['sentence'])
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
To get a comma-separated list of arXiv subject tags for each paper,
|
| 94 |
+
```python
|
| 95 |
+
from datasets import load_dataset
|
| 96 |
+
dataset = load_dataset('proofcheck/prooflang', 'tags', split='train', streaming='True')
|
| 97 |
+
for d in dataset.take(10):
|
| 98 |
+
print(d['paper'], d['tags'])
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
Finally, to look at a version of the proofs with less aggressive cleanup (straight from the LaTeX extraction),
|
| 102 |
+
|
| 103 |
+
```python
|
| 104 |
+
dataset = load_dataset('proofcheck/prooflang', 'raw', split='train', streaming='True')
|
| 105 |
+
for d in dataset.take(10):
|
| 106 |
+
print(d['paper'], d['proof'])
|
| 107 |
+
```
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
### Data Splits
|
| 111 |
+
|
| 112 |
+
There is currently no train/test split; all the data is in `train`.
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
## Dataset Creation
|
| 116 |
+
|
| 117 |
+
We started with the LaTeX source of 1.6M papers that were submitted to [arXiv.org](https://arXiv.org) between 1992 and April 2022.
|
| 118 |
+
|
| 119 |
+
The proofs were extracted using a Python script simulating parts of LaTeX (including defining and expanding macros).
|
| 120 |
+
It does no actual typesetting, throws away output not between `\begin{proof}...\end{proof}`, and skips math content. During extraction,
|
| 121 |
+
|
| 122 |
+
* Math-mode formulas (signalled by `$`, `\begin{equation}`, etc.) become `MATH`
|
| 123 |
+
* `\ref{...}` and variants (`autoref`, `\subref`, etc.) become `REF`
|
| 124 |
+
* `\cite{...}` and variants (`\Citet`, `\shortciteNP`, etc.) become `CITE`
|
| 125 |
+
* Words that appear to be proper names become `NAME`
|
| 126 |
+
* `\item` becomes `CASE:`
|
| 127 |
+
|
| 128 |
+
We then run a cleanup pass on the extracted proofs that includes
|
| 129 |
+
|
| 130 |
+
* Cleaning up common extraction errors (e.g., due to uninterpreted macros)
|
| 131 |
+
* Replacing more references by `REF`, e.g., `Theorem 2(a)` or `Postulate (*)`
|
| 132 |
+
* Replacing more citations with `CITE`, e.g., `Page 47 of CITE`
|
| 133 |
+
* Replacing more proof-case markers with `CASE:`, e.g., `Case (a).`
|
| 134 |
+
* Fixing a few common misspellings
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
## Additional Information
|
| 138 |
+
|
| 139 |
+
This dataset is released under the Creative Commons Attribution 4.0 licence.
|
| 140 |
+
|
| 141 |
+
Copyright for the actual proofs remains with the authors of the papers on [arXiv.org](https://arXiv.org), but these simplified snippets are fair use under US copyright law.
|
| 142 |
+
|
prooflang.py
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""The ProofLang Corpus of arXiv Proofs"""
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
import csv
|
| 18 |
+
import os
|
| 19 |
+
|
| 20 |
+
import datasets
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
_CITATION = """\
|
| 24 |
+
@inproceedings{prooflang:dataset,
|
| 25 |
+
title = "{ProofLang: the Language of arXiv Proofs}",
|
| 26 |
+
booktitle = "{Intelligent Computer Mathematics (CICM 2023)}",
|
| 27 |
+
author = "{Henry Hammer and Nanako Noda and Christopher A. Stone}",
|
| 28 |
+
year = {2023},
|
| 29 |
+
note = {To appear}
|
| 30 |
+
}
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
+
_DESCRIPTION = """\ The ProofLang Corpus includes over three million
|
| 34 |
+
English-language proofs—558 million words—mechanically extracted from the papers
|
| 35 |
+
(Math, CS, Physics, etc.) posted on arXiv.org between 1992 and 2020. The focus
|
| 36 |
+
of this corpus is written proofs, not the explanatory text that surrounds them,
|
| 37 |
+
and more specifically on the language used in such proofs; mathematical
|
| 38 |
+
content is filtered out, resulting in sentences such as ``Let MATH be
|
| 39 |
+
the restriction of MATH to MATH.'' This dataset reflects how people prefer to
|
| 40 |
+
write informal proofs. It is also amenable to statistical analyses and to
|
| 41 |
+
experiments with Natural Language Processing (NLP) techniques.
|
| 42 |
+
"""
|
| 43 |
+
|
| 44 |
+
_HOMEPAGE = "https://huggingface.co/datasets/proofcheck/prooflang"
|
| 45 |
+
|
| 46 |
+
_LICENSE = "CC-BY 4.0"
|
| 47 |
+
|
| 48 |
+
_URLS = {
|
| 49 |
+
"proofs": "proofs.zip",
|
| 50 |
+
"sentences": "sentences.zip",
|
| 51 |
+
"raw": "raw.zip",
|
| 52 |
+
"tags": "tags.zip",
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
class ArxivProofs(datasets.GeneratorBasedBuilder):
|
| 56 |
+
"""English text from proofs found in arXiv preprints."""
|
| 57 |
+
|
| 58 |
+
VERSION = datasets.Version("0.6.0")
|
| 59 |
+
|
| 60 |
+
# This is an example of a dataset with multiple configurations.
|
| 61 |
+
# If you don't want/need to define several sub-sets in your dataset,
|
| 62 |
+
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
| 63 |
+
|
| 64 |
+
# If you need to make complex sub-parts in the datasets with configurable options
|
| 65 |
+
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
| 66 |
+
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
| 67 |
+
|
| 68 |
+
# You will be able to load one or the other configurations in the following list with
|
| 69 |
+
# data = datasets.load_dataset('my_dataset', 'proofs')
|
| 70 |
+
# data = datasets.load_dataset('my_dataset', 'sentences')
|
| 71 |
+
BUILDER_CONFIGS = [
|
| 72 |
+
datasets.BuilderConfig(name="proofs", version=VERSION, description="One proof per line"),
|
| 73 |
+
datasets.BuilderConfig(name="sentences", version=VERSION, description="One sentence per line"),
|
| 74 |
+
datasets.BuilderConfig(name="raw", version=VERSION, description="One (less agressively cleaned) proof per line"),
|
| 75 |
+
datasets.BuilderConfig(name="tags", version=VERSION, description="arXiv subject tags for each paper"),
|
| 76 |
+
]
|
| 77 |
+
|
| 78 |
+
DEFAULT_CONFIG_NAME = "proofs" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 79 |
+
|
| 80 |
+
def _info(self):
|
| 81 |
+
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
| 82 |
+
if self.config.name in {"proofs", "raw"}: # This is the name of the configuration selected in BUILDER_CONFIGS above
|
| 83 |
+
features = datasets.Features(
|
| 84 |
+
{
|
| 85 |
+
"paper": datasets.Value("string"),
|
| 86 |
+
"proof": datasets.Value("string"),
|
| 87 |
+
}
|
| 88 |
+
)
|
| 89 |
+
elif self.config.name == "tags": # This is an example to show how to have different features for "proofs" and "sentences"
|
| 90 |
+
features = datasets.Features(
|
| 91 |
+
{
|
| 92 |
+
"paper": datasets.Value("string"),
|
| 93 |
+
"tags": datasets.Value("string"),
|
| 94 |
+
}
|
| 95 |
+
)
|
| 96 |
+
else: # This is an example to show how to have different features for "proofs" and "sentences"
|
| 97 |
+
features = datasets.Features(
|
| 98 |
+
{
|
| 99 |
+
"paper": datasets.Value("string"),
|
| 100 |
+
"sentence": datasets.Value("string"),
|
| 101 |
+
}
|
| 102 |
+
)
|
| 103 |
+
return datasets.DatasetInfo(
|
| 104 |
+
# This is the description that will appear on the datasets page.
|
| 105 |
+
description=_DESCRIPTION,
|
| 106 |
+
# This defines the different columns of the dataset and their types
|
| 107 |
+
features=features, # Here we define them above because they are different between the two configurations
|
| 108 |
+
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
| 109 |
+
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
| 110 |
+
# supervised_keys=("sentence", "label"),
|
| 111 |
+
# Homepage of the dataset for documentation
|
| 112 |
+
homepage=_HOMEPAGE,
|
| 113 |
+
# License for the dataset if available
|
| 114 |
+
license=_LICENSE,
|
| 115 |
+
# Citation for the dataset
|
| 116 |
+
citation=_CITATION,
|
| 117 |
+
)
|
| 118 |
+
|
| 119 |
+
def _split_generators(self, dl_manager):
|
| 120 |
+
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
| 121 |
+
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
| 122 |
+
|
| 123 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
| 124 |
+
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 125 |
+
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 126 |
+
urls = _URLS[self.config.name]
|
| 127 |
+
data_dir = dl_manager.download_and_extract(urls)
|
| 128 |
+
# data_file = dl_manager.download_and_extract(urls)
|
| 129 |
+
return [
|
| 130 |
+
datasets.SplitGenerator(
|
| 131 |
+
name=datasets.Split.TRAIN,
|
| 132 |
+
# These kwargs will be passed to _generate_examples
|
| 133 |
+
gen_kwargs={
|
| 134 |
+
"filepath": data_dir,
|
| 135 |
+
"split": "train", # Prooflang doesn't have a train/test split.
|
| 136 |
+
},
|
| 137 |
+
),
|
| 138 |
+
# datasets.SplitGenerator(
|
| 139 |
+
# name=datasets.Split.TEST,
|
| 140 |
+
# # These kwargs will be passed to _generate_examples
|
| 141 |
+
# gen_kwargs={
|
| 142 |
+
# "filepath": os.path.join(data_dir, "test.jsonl"),
|
| 143 |
+
# "split": "test"
|
| 144 |
+
# },
|
| 145 |
+
# ),
|
| 146 |
+
# datasets.SplitGenerator(
|
| 147 |
+
# name=datasets.Split.VALIDATION,
|
| 148 |
+
# # These kwargs will be passed to _generate_examples
|
| 149 |
+
# gen_kwargs={
|
| 150 |
+
# "filepath": os.path.join(data_dir, "dev.jsonl"),
|
| 151 |
+
# "split": "dev",
|
| 152 |
+
# },
|
| 153 |
+
# ),
|
| 154 |
+
]
|
| 155 |
+
|
| 156 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 157 |
+
def _generate_examples(self, filepath, split):
|
| 158 |
+
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 159 |
+
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 160 |
+
csv.field_size_limit(256000) # Some of the raw proofs are slightly longer than 131072 characters
|
| 161 |
+
with open(os.path.join(filepath, self.config.name + ".tsv"), encoding="utf-8") as f:
|
| 162 |
+
reader = csv.DictReader(f, delimiter='\t', quoting=csv.QUOTE_NONE)
|
| 163 |
+
for key, data in enumerate(reader):
|
| 164 |
+
yield key, data
|
| 165 |
+
# if self.config.name == "proofs":
|
| 166 |
+
# # Yields examples as (key, example) tuples
|
| 167 |
+
# # print(key, repr(data))
|
| 168 |
+
# yield key, {
|
| 169 |
+
# "fileID" : data[0],
|
| 170 |
+
# "proof": data[1],
|
| 171 |
+
# }
|
| 172 |
+
# else:
|
| 173 |
+
# yield key, {
|
| 174 |
+
# "fileID" : data[0],
|
| 175 |
+
# "sentence": data[1],
|
| 176 |
+
# }
|
proofs.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:834fc89ed12a1e2f4ac3137195dd4c181f7c7083df9703c5069ee224c5aebe73
|
| 3 |
+
size 722830298
|
raw.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:22564809efc16d396ea0470d848d9bc3f77ddcc6d2ddbc455cc2ed34c08fa51a
|
| 3 |
+
size 753908748
|
sentences.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cef9b89dbea688e2e7f7eb5f421f8ef5168e94c408a25701f2b4e22d8f70f205
|
| 3 |
+
size 747935508
|
tags.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7cb505f1b7cc9f24801f1e0601b4065c6aeec7bfa35d3bf20477e17a74b60ae8
|
| 3 |
+
size 1921707
|