Datasets:
Upload folder using huggingface_hub
Browse files- .DS_Store +0 -0
- README.md +174 -3
- data/test.jsonl +32 -0
- data/train.jsonl +0 -0
- data/validation.jsonl +32 -0
- scripts/download_arxiv_pdfs.py +178 -0
- scripts/download_arxiv_sources.py +196 -0
- scripts/validate_ids.py +238 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
README.md
CHANGED
|
@@ -1,3 +1,174 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pretty_name: Paper2Thesis
|
| 3 |
+
license: cc-by-4.0
|
| 4 |
+
task_categories:
|
| 5 |
+
- text-generation
|
| 6 |
+
language:
|
| 7 |
+
- en
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
# Paper2Thesis
|
| 11 |
+
|
| 12 |
+
> **Anonymized release for NeurIPS 2026 Datasets and Benchmarks Track review.**
|
| 13 |
+
> The non-anonymous version, including author information and a permanent DOI, will be released upon acceptance.
|
| 14 |
+
|
| 15 |
+
## Overview
|
| 16 |
+
|
| 17 |
+
Paper2Thesis is a benchmark for **extreme-length multi-document synthesis**. Each instance maps a set of input arXiv research papers to a target arXiv PhD thesis. The task requires generating a thesis-scale document that integrates multiple papers into a coherent, structured narrative.
|
| 18 |
+
|
| 19 |
+
This benchmark targets a regime beyond standard text generation, involving **long-context reasoning**, **cross-document integration**, and **structured generation**.
|
| 20 |
+
|
| 21 |
+
---
|
| 22 |
+
|
| 23 |
+
## Task
|
| 24 |
+
|
| 25 |
+
Each example is defined as:
|
| 26 |
+
|
| 27 |
+
[input_paper_ids] → target_thesis_id
|
| 28 |
+
|
| 29 |
+
The objective is to synthesize the input papers into a unified thesis-level document. Unlike summarization, the task requires **expansion**, **restructuring**, and **integration** across multiple sources.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## Dataset Structure
|
| 34 |
+
|
| 35 |
+
The dataset is provided in JSONL format:
|
| 36 |
+
|
| 37 |
+
paper2thesis/
|
| 38 |
+
data/
|
| 39 |
+
train.jsonl
|
| 40 |
+
validation.jsonl
|
| 41 |
+
test.jsonl
|
| 42 |
+
|
| 43 |
+
Each line in a JSONL file corresponds to one example.
|
| 44 |
+
|
| 45 |
+
Example:
|
| 46 |
+
|
| 47 |
+
{
|
| 48 |
+
"example_id": "p2t_000033",
|
| 49 |
+
"input_paper_ids": ["2208.09377", "2503.22525", "2405.08703"],
|
| 50 |
+
"target_thesis_id": "2508.07998",
|
| 51 |
+
"field": "astro-ph.SR",
|
| 52 |
+
"target_year": 2025,
|
| 53 |
+
"num_input_papers": 3,
|
| 54 |
+
"input_total_words": 85000,
|
| 55 |
+
"target_total_words": 100000,
|
| 56 |
+
"target_page_count": 180,
|
| 57 |
+
"input_versions": ["v1", "v1", "v1"],
|
| 58 |
+
"target_version": "v1",
|
| 59 |
+
"input_licenses": ["...", "...", "..."],
|
| 60 |
+
"target_license": "..."
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
---
|
| 64 |
+
|
| 65 |
+
## Construction
|
| 66 |
+
|
| 67 |
+
Data is derived from arXiv.
|
| 68 |
+
|
| 69 |
+
Pipeline:
|
| 70 |
+
|
| 71 |
+
1. Scan arXiv submission comments for explicit terms like "PhD thesis" or "dissertation"
|
| 72 |
+
2. Enforce single-author constraint and 100-page threshold
|
| 73 |
+
3. Verify source availability (LaTeX or Word)
|
| 74 |
+
4. Identify self-authored publications within each thesis's bibliography (author surname match)
|
| 75 |
+
5. Map candidate chapter-forming papers to their arXiv records (extract explicit arXiv IDs from the citation strings → fallback title-match search)
|
| 76 |
+
6. Manually select chapter-forming papers from the candidates
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## Splits
|
| 81 |
+
|
| 82 |
+
The dataset is split at the **thesis level**:
|
| 83 |
+
|
| 84 |
+
- Each target thesis appears in exactly one split
|
| 85 |
+
- All associated input papers remain within the same split
|
| 86 |
+
- No input paper identifier appears in more than one split
|
| 87 |
+
|
| 88 |
+
This design prevents document-level leakage.
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
|
| 92 |
+
## Statistics
|
| 93 |
+
|
| 94 |
+
Typical characteristics:
|
| 95 |
+
|
| 96 |
+
- Input papers per example: ~4.73
|
| 97 |
+
- Input length: ~60k words
|
| 98 |
+
- Thesis length: ~70k words (~100k tokens)
|
| 99 |
+
|
| 100 |
+
The scale exceeds the context window of most current models.
|
| 101 |
+
|
| 102 |
+
---
|
| 103 |
+
|
| 104 |
+
## Usage
|
| 105 |
+
|
| 106 |
+
This dataset is intended for:
|
| 107 |
+
|
| 108 |
+
- Long-context language modeling
|
| 109 |
+
- Multi-document synthesis
|
| 110 |
+
- Scientific writing generation
|
| 111 |
+
- Structure and discourse modeling at document scale
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## Validation
|
| 116 |
+
|
| 117 |
+
A validation script is provided to ensure dataset integrity.
|
| 118 |
+
|
| 119 |
+
It checks:
|
| 120 |
+
|
| 121 |
+
- JSON format validity
|
| 122 |
+
- Required fields
|
| 123 |
+
- arXiv ID format
|
| 124 |
+
- Duplicate examples
|
| 125 |
+
- Duplicate target theses
|
| 126 |
+
- Input-paper overlap across splits
|
| 127 |
+
- Consistency of num_input_papers
|
| 128 |
+
- Presence of license fields
|
| 129 |
+
|
| 130 |
+
Run:
|
| 131 |
+
|
| 132 |
+
python scripts/validate_ids.py --data_dir data/
|
| 133 |
+
|
| 134 |
+
---
|
| 135 |
+
|
| 136 |
+
## Data Access
|
| 137 |
+
|
| 138 |
+
This dataset does **not** include full text of papers or theses.
|
| 139 |
+
|
| 140 |
+
The release contains only:
|
| 141 |
+
|
| 142 |
+
- arXiv identifiers
|
| 143 |
+
- metadata
|
| 144 |
+
- dataset splits
|
| 145 |
+
|
| 146 |
+
To retrieve PDFs:
|
| 147 |
+
|
| 148 |
+
python scripts/download_arxiv_pdfs.py --input data/test.jsonl --out_dir local_pdfs/
|
| 149 |
+
|
| 150 |
+
To retrieve LaTeX/source files:
|
| 151 |
+
|
| 152 |
+
python scripts/download_arxiv_sources.py --input data/test.jsonl --out_dir local_sources/
|
| 153 |
+
|
| 154 |
+
---
|
| 155 |
+
|
| 156 |
+
## Licensing
|
| 157 |
+
|
| 158 |
+
This dataset (metadata and scripts) is released under
|
| 159 |
+
Creative Commons Attribution 4.0 International (CC BY 4.0).
|
| 160 |
+
|
| 161 |
+
The dataset does not redistribute arXiv PDFs, source files, or extracted text.
|
| 162 |
+
|
| 163 |
+
All referenced arXiv documents remain subject to their original licenses, including:
|
| 164 |
+
|
| 165 |
+
- arXiv Non-Exclusive Distribution License
|
| 166 |
+
- Creative Commons licenses (e.g., CC BY, CC BY-SA)
|
| 167 |
+
|
| 168 |
+
Users are responsible for complying with the license terms of each document.
|
| 169 |
+
|
| 170 |
+
---
|
| 171 |
+
|
| 172 |
+
## Citation
|
| 173 |
+
|
| 174 |
+
Author and citation information have been redacted to preserve anonymity during peer review. A complete citation will be provided upon acceptance.
|
data/test.jsonl
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"example_id": "p2t_000003", "input_paper_ids": ["2301.11867", "2205.07664"], "target_thesis_id": "2404.06192", "split": "test", "field": "math.CT", "target_year": 2024, "num_input_papers": 2, "input_total_words": 33803, "target_total_words": 59946, "target_page_count": 158, "input_versions": ["v1", "v4"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-sa/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 2 |
+
{"example_id": "p2t_000014", "input_paper_ids": ["2211.01728", "2305.03491", "2305.13382", "2306.17149", "2308.08546", "2402.11033", "2405.05732", "2406.20089", "2412.14049"], "target_thesis_id": "2501.03065", "split": "test", "field": "astro-ph.CO", "target_year": 2025, "num_input_papers": 9, "input_total_words": 134663, "target_total_words": 119246, "target_page_count": 283, "input_versions": ["v2", "v2", "v2", "v3", "v2", "v2", "v2", "v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/publicdomain/zero/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/publicdomain/zero/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/publicdomain/zero/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 3 |
+
{"example_id": "p2t_000015", "input_paper_ids": ["2004.00639", "2101.04124", "2108.08855", "2108.11397", "2203.12623", "2209.06215"], "target_thesis_id": "2401.13292", "split": "test", "field": "quant-ph", "target_year": 2024, "num_input_papers": 6, "input_total_words": 47142, "target_total_words": 46645, "target_page_count": 150, "input_versions": ["v2", "v2", "v2", "v2", "v2", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 4 |
+
{"example_id": "p2t_000028", "input_paper_ids": ["2108.07258", "2206.07682", "2211.13972", "2211.09110", "2212.11670", "2503.16861", "2310.12941", "2407.12929", "2403.07918"], "target_thesis_id": "2506.23123", "split": "test", "field": "cs.AI", "target_year": 2025, "num_input_papers": 9, "input_total_words": 377567, "target_total_words": 115706, "target_page_count": 358, "input_versions": ["v3", "v2", "v1", "v2", "v1", "v2", "v1", "v2", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-nc-sa/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by-sa/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 5 |
+
{"example_id": "p2t_000034", "input_paper_ids": ["2404.11004", "2507.02262"], "target_thesis_id": "2508.04978", "split": "test", "field": "eess.SP", "target_year": 2025, "num_input_papers": 2, "input_total_words": 21474, "target_total_words": 23875, "target_page_count": 104, "input_versions": ["v3", "v4"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by-nc-nd/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 6 |
+
{"example_id": "p2t_000042", "input_paper_ids": ["1903.04956", "1905.00678", "2008.01582", "2010.02090", "2105.02886", "2106.02644"], "target_thesis_id": "2204.08555", "split": "test", "field": "astro-ph.HE", "target_year": 2022, "num_input_papers": 6, "input_total_words": 39201, "target_total_words": 52270, "target_page_count": 180, "input_versions": ["v1", "v1", "v2", "v3", "v3", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 7 |
+
{"example_id": "p2t_000045", "input_paper_ids": ["2212.10934", "2501.13618"], "target_thesis_id": "2512.18372", "split": "test", "field": "hep-th", "target_year": 2025, "num_input_papers": 2, "input_total_words": 19752, "target_total_words": 48024, "target_page_count": 155, "input_versions": ["v3", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/publicdomain/zero/1.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/publicdomain/zero/1.0/"]}
|
| 8 |
+
{"example_id": "p2t_000046", "input_paper_ids": ["2103.14976", "1911.12199", "2102.03322", "1908.00085", "2111.00826"], "target_thesis_id": "2209.05084", "split": "test", "field": "cs.LG", "target_year": 2022, "num_input_papers": 5, "input_total_words": 33492, "target_total_words": 37764, "target_page_count": 112, "input_versions": ["v2", "v4", "v4", "v2", "v4"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 9 |
+
{"example_id": "p2t_000048", "input_paper_ids": ["2002.09198", "2004.05627", "2110.15478", "2308.13312"], "target_thesis_id": "2308.13580", "split": "test", "field": "astro-ph.GA", "target_year": 2023, "num_input_papers": 4, "input_total_words": 55486, "target_total_words": 64133, "target_page_count": 217, "input_versions": ["v4", "v2", "v1", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 10 |
+
{"example_id": "p2t_000053", "input_paper_ids": ["2404.11039", "2404.11038", "2407.14998"], "target_thesis_id": "2405.15091", "split": "test", "field": "math.RA", "target_year": 2024, "num_input_papers": 3, "input_total_words": 31183, "target_total_words": 36815, "target_page_count": 125, "input_versions": ["v2", "v2", "v1"], "target_version": "v2", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 11 |
+
{"example_id": "p2t_000058", "input_paper_ids": ["2409.14539", "2503.06160", "2112.05703", "2108.13711", "2312.05035"], "target_thesis_id": "2602.00706", "split": "test", "field": "cond-mat.mes-hall", "target_year": 2026, "num_input_papers": 5, "input_total_words": 52468, "target_total_words": 56039, "target_page_count": 202, "input_versions": ["v2", "v3", "v2", "v2", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 12 |
+
{"example_id": "p2t_000064", "input_paper_ids": ["2107.03945", "2205.04477", "2304.03298", "2306.13127", "2310.09325", "2312.12307", "2203.02427", "2405.17545"], "target_thesis_id": "2412.20759", "split": "test", "field": "hep-ph", "target_year": 2024, "num_input_papers": 8, "input_total_words": 154435, "target_total_words": 165387, "target_page_count": 377, "input_versions": ["v3", "v2", "v2", "v3", "v2", "v1", "v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-nc-nd/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 13 |
+
{"example_id": "p2t_000068", "input_paper_ids": ["2306.04209", "2201.05789", "2402.08949"], "target_thesis_id": "2409.10182", "split": "test", "field": "quant-ph", "target_year": 2024, "num_input_papers": 3, "input_total_words": 48266, "target_total_words": 67478, "target_page_count": 163, "input_versions": ["v3", "v4", "v3"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 14 |
+
{"example_id": "p2t_000077", "input_paper_ids": ["1812.09703", "2012.12576", "2008.03495"], "target_thesis_id": "2310.05613", "split": "test", "field": "math.QA", "target_year": 2023, "num_input_papers": 3, "input_total_words": 44594, "target_total_words": 95720, "target_page_count": 221, "input_versions": ["v2", "v1", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-nc-sa/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 15 |
+
{"example_id": "p2t_000080", "input_paper_ids": ["2004.07420", "2012.05347", "2308.00114", "2411.16050"], "target_thesis_id": "2511.12902", "split": "test", "field": "gr-qc", "target_year": 2025, "num_input_papers": 4, "input_total_words": 38443, "target_total_words": 44533, "target_page_count": 173, "input_versions": ["v2", "v1", "v3", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 16 |
+
{"example_id": "p2t_000112", "input_paper_ids": ["2009.09241", "2105.07452", "2202.12246"], "target_thesis_id": "2207.09643", "split": "test", "field": "cs.CL", "target_year": 2022, "num_input_papers": 3, "input_total_words": 22720, "target_total_words": 37360, "target_page_count": 104, "input_versions": ["v1", "v1", "v1"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 17 |
+
{"example_id": "p2t_000128", "input_paper_ids": ["2202.00032", "2311.11150", "2207.05162", "2103.05339", "2008.10825", "1912.01393"], "target_thesis_id": "2403.13753", "split": "test", "field": "gr-qc", "target_year": 2024, "num_input_papers": 6, "input_total_words": 54050, "target_total_words": 70110, "target_page_count": 220, "input_versions": ["v2", "v1", "v2", "v2", "v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 18 |
+
{"example_id": "p2t_000129", "input_paper_ids": ["2110.05651", "2105.04019", "2203.09630", "2206.07290", "2204.13845", "2210.08277", "2410.19055"], "target_thesis_id": "2209.00616", "split": "test", "field": "cs.LG", "target_year": 2022, "num_input_papers": 7, "input_total_words": 71103, "target_total_words": 68094, "target_page_count": 162, "input_versions": ["v2", "v2", "v1", "v1", "v1", "v1", "v1"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 19 |
+
{"example_id": "p2t_000133", "input_paper_ids": ["2003.05455", "2012.11029", "1810.11035", "1811.05581", "1906.03174"], "target_thesis_id": "2206.12310", "split": "test", "field": "hep-th", "target_year": 2022, "num_input_papers": 5, "input_total_words": 117458, "target_total_words": 107683, "target_page_count": 364, "input_versions": ["v4", "v2", "v3", "v2", "v1"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 20 |
+
{"example_id": "p2t_000137", "input_paper_ids": ["2002.06212", "2105.03468", "2207.05652", "2207.05660"], "target_thesis_id": "2303.16134", "split": "test", "field": "astro-ph.IM", "target_year": 2023, "num_input_papers": 4, "input_total_words": 32069, "target_total_words": 75308, "target_page_count": 284, "input_versions": ["v3", "v2", "v1", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 21 |
+
{"example_id": "p2t_000155", "input_paper_ids": ["2104.10128", "2204.11324", "2004.01202", "2011.11720", "2111.08700", "2309.03889", "2305.03841"], "target_thesis_id": "2401.00043", "split": "test", "field": "hep-ph", "target_year": 2023, "num_input_papers": 7, "input_total_words": 72069, "target_total_words": 49646, "target_page_count": 203, "input_versions": ["v1", "v1", "v2", "v1", "v2", "v3", "v1"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 22 |
+
{"example_id": "p2t_000157", "input_paper_ids": ["2106.14059", "1907.02085", "2011.13934", "2102.04032", "1912.01618"], "target_thesis_id": "2112.15175", "split": "test", "field": "quant-ph", "target_year": 2021, "num_input_papers": 5, "input_total_words": 61527, "target_total_words": 78838, "target_page_count": 225, "input_versions": ["v3", "v3", "v2", "v2", "v4"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-nc-sa/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 23 |
+
{"example_id": "p2t_000161", "input_paper_ids": ["2010.03848", "2103.03991", "2011.00440", "2101.09391"], "target_thesis_id": "2303.01634", "split": "test", "field": "cs.RO", "target_year": 2023, "num_input_papers": 4, "input_total_words": 26873, "target_total_words": 47819, "target_page_count": 126, "input_versions": ["v2", "v2", "v2", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 24 |
+
{"example_id": "p2t_000166", "input_paper_ids": ["1909.10869", "2104.04758"], "target_thesis_id": "2208.01298", "split": "test", "field": "cs.LO", "target_year": 2022, "num_input_papers": 2, "input_total_words": 41534, "target_total_words": 75550, "target_page_count": 200, "input_versions": ["v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 25 |
+
{"example_id": "p2t_000174", "input_paper_ids": ["2106.08619", "2208.01003", "2402.16991", "2410.13770", "2502.12089", "2505.16959", "2305.12827"], "target_thesis_id": "2510.06106", "split": "test", "field": "cs.LG", "target_year": 2025, "num_input_papers": 7, "input_total_words": 101688, "target_total_words": 108700, "target_page_count": 333, "input_versions": ["v3", "v5", "v3", "v2", "v3", "v2", "v3"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 26 |
+
{"example_id": "p2t_000240", "input_paper_ids": ["2204.00458", "2210.12540", "2301.10799", "2305.14293", "2305.14288"], "target_thesis_id": "2403.15364", "split": "test", "field": "cs.CL", "target_year": 2024, "num_input_papers": 5, "input_total_words": 53524, "target_total_words": 71791, "target_page_count": 230, "input_versions": ["v2", "v2", "v2", "v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 27 |
+
{"example_id": "p2t_000250", "input_paper_ids": ["2008.00945", "2107.01083", "2202.01576", "2304.13486", "2108.08732"], "target_thesis_id": "2307.06042", "split": "test", "field": "astro-ph.HE", "target_year": 2023, "num_input_papers": 5, "input_total_words": 71856, "target_total_words": 85638, "target_page_count": 239, "input_versions": ["v2", "v2", "v2", "v2", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by-nc-nd/4.0/", "http://creativecommons.org/licenses/by-nc-nd/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 28 |
+
{"example_id": "p2t_000261", "input_paper_ids": ["2102.00690", "2103.09422", "2304.10719", "2310.00920"], "target_thesis_id": "2403.02037", "split": "test", "field": "cs.CV", "target_year": 2024, "num_input_papers": 4, "input_total_words": 25578, "target_total_words": 30229, "target_page_count": 107, "input_versions": ["v1", "v1", "v1", "v4"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 29 |
+
{"example_id": "p2t_000272", "input_paper_ids": ["1907.03606", "2005.13923", "2106.08631", "2203.13634"], "target_thesis_id": "2207.03296", "split": "test", "field": "gr-qc", "target_year": 2022, "num_input_papers": 4, "input_total_words": 39355, "target_total_words": 73697, "target_page_count": 205, "input_versions": ["v1", "v3", "v2", "v3"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 30 |
+
{"example_id": "p2t_000284", "input_paper_ids": ["2305.16501", "2402.19303", "2103.03228", "2311.16459", "2311.00260", "2311.07754", "2302.03805", "2010.14670", "2103.00671", "2202.07552"], "target_thesis_id": "2408.01596", "split": "test", "field": "cs.LG", "target_year": 2024, "num_input_papers": 10, "input_total_words": 175914, "target_total_words": 148621, "target_page_count": 376, "input_versions": ["v2", "v1", "v1", "v1", "v1", "v1", "v2", "v1", "v4", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-nc-sa/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by-nc-sa/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 31 |
+
{"example_id": "p2t_000288", "input_paper_ids": ["2010.06632", "2208.05038", "2303.00034", "2103.05004", "2112.06944"], "target_thesis_id": "2402.08766", "split": "test", "field": "astro-ph.GA", "target_year": 2024, "num_input_papers": 5, "input_total_words": 81887, "target_total_words": 121609, "target_page_count": 354, "input_versions": ["v2", "v1", "v1", "v1", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 32 |
+
{"example_id": "p2t_000301", "input_paper_ids": ["1811.01895", "1906.00467", "1910.01599", "1912.12389"], "target_thesis_id": "2112.14647", "split": "test", "field": "hep-th", "target_year": 2022, "num_input_papers": 4, "input_total_words": 44823, "target_total_words": 58949, "target_page_count": 189, "input_versions": ["v2", "v3", "v1", "v2"], "target_version": "v2", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
data/train.jsonl
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/validation.jsonl
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"example_id": "p2t_000002", "input_paper_ids": ["1909.01400", "2004.09979", "2012.09291", "2107.07600", "2106.11136", "2112.00052", "2007.13907", "2105.12692", "2110.14840"], "target_thesis_id": "2204.06118", "split": "validation", "field": "astro-ph.CO", "target_year": 2022, "num_input_papers": 9, "input_total_words": 155480, "target_total_words": 153456, "target_page_count": 377, "input_versions": ["v3", "v3", "v2", "v2", "v2", "v4", "v2", "v3", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/publicdomain/zero/1.0/", "http://creativecommons.org/publicdomain/zero/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/publicdomain/zero/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 2 |
+
{"example_id": "p2t_000024", "input_paper_ids": ["1912.07029", "2009.05450"], "target_thesis_id": "2601.13279", "split": "validation", "field": "math.GR", "target_year": 2026, "num_input_papers": 2, "input_total_words": 46664, "target_total_words": 70400, "target_page_count": 133, "input_versions": ["v6", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 3 |
+
{"example_id": "p2t_000029", "input_paper_ids": ["2201.04056", "2304.14680", "2207.11465"], "target_thesis_id": "2309.00498", "split": "validation", "field": "cs.LG", "target_year": 2023, "num_input_papers": 3, "input_total_words": 19552, "target_total_words": 41675, "target_page_count": 138, "input_versions": ["v2", "v1", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 4 |
+
{"example_id": "p2t_000030", "input_paper_ids": ["2505.08441", "2412.07967", "2601.11123"], "target_thesis_id": "2601.13076", "split": "validation", "field": "hep-ph", "target_year": 2026, "num_input_papers": 3, "input_total_words": 32377, "target_total_words": 60193, "target_page_count": 169, "input_versions": ["v3", "v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 5 |
+
{"example_id": "p2t_000031", "input_paper_ids": ["2106.02097", "2310.00229", "2410.07096"], "target_thesis_id": "2511.06470", "split": "validation", "field": "cs.AI", "target_year": 2025, "num_input_papers": 3, "input_total_words": 58049, "target_total_words": 88048, "target_page_count": 186, "input_versions": ["v3", "v4", "v9"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 6 |
+
{"example_id": "p2t_000055", "input_paper_ids": ["1909.05508", "2102.03140"], "target_thesis_id": "2203.01027", "split": "validation", "field": "cs.LG", "target_year": 2022, "num_input_papers": 2, "input_total_words": 13821, "target_total_words": 52857, "target_page_count": 154, "input_versions": ["v4", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 7 |
+
{"example_id": "p2t_000082", "input_paper_ids": ["2005.01284", "2102.04846"], "target_thesis_id": "2210.09040", "split": "validation", "field": "cond-mat.stat-mech", "target_year": 2023, "num_input_papers": 2, "input_total_words": 27416, "target_total_words": 38523, "target_page_count": 120, "input_versions": ["v2", "v2"], "target_version": "v3", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 8 |
+
{"example_id": "p2t_000089", "input_paper_ids": ["2312.01457", "2206.04405", "2301.07210"], "target_thesis_id": "2502.06011", "split": "validation", "field": "stat.ML", "target_year": 2025, "num_input_papers": 3, "input_total_words": 60899, "target_total_words": 70998, "target_page_count": 216, "input_versions": ["v1", "v2", "v4"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 9 |
+
{"example_id": "p2t_000096", "input_paper_ids": ["2506.15085", "2205.04952", "2406.05515"], "target_thesis_id": "2506.15107", "split": "validation", "field": "cs.RO", "target_year": 2025, "num_input_papers": 3, "input_total_words": 19230, "target_total_words": 43126, "target_page_count": 128, "input_versions": ["v2", "v3", "v2"], "target_version": "v2", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 10 |
+
{"example_id": "p2t_000098", "input_paper_ids": ["2202.03676", "2304.13272", "2412.00628", "2404.16338"], "target_thesis_id": "2506.21950", "split": "validation", "field": "math.OA", "target_year": 2025, "num_input_papers": 4, "input_total_words": 60573, "target_total_words": 69837, "target_page_count": 251, "input_versions": ["v2", "v2", "v2", "v1"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by-sa/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 11 |
+
{"example_id": "p2t_000106", "input_paper_ids": ["2504.18539", "2502.10447", "2510.13281"], "target_thesis_id": "2512.14083", "split": "validation", "field": "eess.AS", "target_year": 2025, "num_input_papers": 3, "input_total_words": 40756, "target_total_words": 54559, "target_page_count": 123, "input_versions": ["v2", "v2", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 12 |
+
{"example_id": "p2t_000111", "input_paper_ids": ["2108.03603", "2206.04928"], "target_thesis_id": "2306.14650", "split": "validation", "field": "cs.AI", "target_year": 2023, "num_input_papers": 2, "input_total_words": 24788, "target_total_words": 42199, "target_page_count": 152, "input_versions": ["v2", "v5"], "target_version": "v2", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by-nc-sa/4.0/"]}
|
| 13 |
+
{"example_id": "p2t_000138", "input_paper_ids": ["2206.04798", "2106.06935", "2310.04562", "2205.10128", "2404.07198", "2210.08008", "2310.07064", "2202.08320", "1903.00757"], "target_thesis_id": "2410.13018", "split": "validation", "field": "cs.AI", "target_year": 2024, "num_input_papers": 9, "input_total_words": 126907, "target_total_words": 73739, "target_page_count": 206, "input_versions": ["v5", "v4", "v2", "v2", "v2", "v2", "v3", "v1", "v1"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 14 |
+
{"example_id": "p2t_000143", "input_paper_ids": ["2203.01948", "2301.00218", "2401.10985"], "target_thesis_id": "2403.20267", "split": "validation", "field": "quant-ph", "target_year": 2024, "num_input_papers": 3, "input_total_words": 37942, "target_total_words": 52406, "target_page_count": 181, "input_versions": ["v2", "v1", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 15 |
+
{"example_id": "p2t_000149", "input_paper_ids": ["1711.09419", "1908.09587", "1909.05876", "1910.11886", "2103.05002", "2103.06281"], "target_thesis_id": "2109.08394", "split": "validation", "field": "hep-ph", "target_year": 2022, "num_input_papers": 6, "input_total_words": 88063, "target_total_words": 110885, "target_page_count": 252, "input_versions": ["v1", "v2", "v2", "v2", "v2", "v3"], "target_version": "v3", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 16 |
+
{"example_id": "p2t_000154", "input_paper_ids": ["2204.02007", "2009.08205", "2004.05773", "2112.06924", "2009.06401", "2009.13295", "2109.03756"], "target_thesis_id": "2211.04946", "split": "validation", "field": "cs.LG", "target_year": 2022, "num_input_papers": 7, "input_total_words": 66148, "target_total_words": 83778, "target_page_count": 226, "input_versions": ["v1", "v1", "v1", "v1", "v3", "v1", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 17 |
+
{"example_id": "p2t_000164", "input_paper_ids": ["2103.17202", "2207.10758", "2403.20318", "2508.11185"], "target_thesis_id": "2508.19593", "split": "validation", "field": "cs.CV", "target_year": 2025, "num_input_papers": 4, "input_total_words": 56071, "target_total_words": 54696, "target_page_count": 176, "input_versions": ["v1", "v1", "v1", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 18 |
+
{"example_id": "p2t_000171", "input_paper_ids": ["2311.11921", "2409.12123", "2509.05495", "2510.20704"], "target_thesis_id": "2602.07675", "split": "validation", "field": "hep-ph", "target_year": 2026, "num_input_papers": 4, "input_total_words": 49730, "target_total_words": 58167, "target_page_count": 163, "input_versions": ["v1", "v2", "v1", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 19 |
+
{"example_id": "p2t_000176", "input_paper_ids": ["2010.11762", "2305.03606"], "target_thesis_id": "2403.00934", "split": "validation", "field": "cs.LO", "target_year": 2024, "num_input_papers": 2, "input_total_words": 32863, "target_total_words": 73276, "target_page_count": 230, "input_versions": ["v2", "v1"], "target_version": "v2", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 20 |
+
{"example_id": "p2t_000178", "input_paper_ids": ["2403.14331", "2310.16563", "2211.11283", "2203.07748"], "target_thesis_id": "2507.16605", "split": "validation", "field": "hep-ph", "target_year": 2025, "num_input_papers": 4, "input_total_words": 43089, "target_total_words": 71582, "target_page_count": 251, "input_versions": ["v2", "v2", "v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 21 |
+
{"example_id": "p2t_000189", "input_paper_ids": ["2107.13341", "2101.06760", "2208.11146"], "target_thesis_id": "2307.02580", "split": "validation", "field": "gr-qc", "target_year": 2023, "num_input_papers": 3, "input_total_words": 26304, "target_total_words": 29792, "target_page_count": 112, "input_versions": ["v1", "v2", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 22 |
+
{"example_id": "p2t_000191", "input_paper_ids": ["2202.02291", "2501.19115", "2303.13206", "2401.14293", "2212.10623", "2308.08456", "2408.02364"], "target_thesis_id": "2410.20996", "split": "validation", "field": "hep-lat", "target_year": 2024, "num_input_papers": 7, "input_total_words": 89726, "target_total_words": 115013, "target_page_count": 346, "input_versions": ["v2", "v1", "v2", "v1", "v1", "v2", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 23 |
+
{"example_id": "p2t_000193", "input_paper_ids": ["2201.00032", "2302.13417", "2311.09418"], "target_thesis_id": "2403.02537", "split": "validation", "field": "cond-mat.dis-nn", "target_year": 2024, "num_input_papers": 3, "input_total_words": 32695, "target_total_words": 46199, "target_page_count": 131, "input_versions": ["v2", "v6", "v3"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-nc-nd/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by-nc-nd/4.0/", "http://creativecommons.org/licenses/by-nc-nd/4.0/", "http://creativecommons.org/licenses/by-nc-nd/4.0/"]}
|
| 24 |
+
{"example_id": "p2t_000195", "input_paper_ids": ["2112.14777", "2206.01212", "2305.15460", "2403.03147", "2407.12908"], "target_thesis_id": "2412.12526", "split": "validation", "field": "gr-qc", "target_year": 2024, "num_input_papers": 5, "input_total_words": 72113, "target_total_words": 64877, "target_page_count": 187, "input_versions": ["v2", "v1", "v4", "v4", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 25 |
+
{"example_id": "p2t_000202", "input_paper_ids": ["2102.00760", "2205.10055", "2003.00920", "2102.02789", "2009.04324", "2205.13255"], "target_thesis_id": "2209.11629", "split": "validation", "field": "cs.LG", "target_year": 2022, "num_input_papers": 6, "input_total_words": 95346, "target_total_words": 106948, "target_page_count": 242, "input_versions": ["v3", "v2", "v2", "v3", "v4", "v3"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by-nc-sa/4.0/"]}
|
| 26 |
+
{"example_id": "p2t_000215", "input_paper_ids": ["1810.11438", "1908.10546", "2104.01291", "2203.13291", "2205.12870"], "target_thesis_id": "2308.12419", "split": "validation", "field": "cs.CV", "target_year": 2023, "num_input_papers": 5, "input_total_words": 40215, "target_total_words": 52429, "target_page_count": 206, "input_versions": ["v3", "v1", "v1", "v1", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 27 |
+
{"example_id": "p2t_000223", "input_paper_ids": ["2102.02611", "2206.03398", "2301.10540", "2307.14354", "2110.08059", "2302.05400", "1911.07849", "2002.03830", "2010.00977", "2006.05259", "2110.10211"], "target_thesis_id": "2411.09827", "split": "validation", "field": "cs.LG", "target_year": 2024, "num_input_papers": 11, "input_total_words": 125399, "target_total_words": 133841, "target_page_count": 368, "input_versions": ["v3", "v2", "v2", "v1", "v3", "v2", "v2", "v3", "v2", "v2", "v3"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 28 |
+
{"example_id": "p2t_000226", "input_paper_ids": ["2112.03740", "2306.00817", "2306.17670", "2309.13972"], "target_thesis_id": "2408.06383", "split": "validation", "field": "cs.LG", "target_year": 2024, "num_input_papers": 4, "input_total_words": 28030, "target_total_words": 53960, "target_page_count": 181, "input_versions": ["v4", "v2", "v3", "v2"], "target_version": "v1", "target_license": "http://creativecommons.org/licenses/by-nc-nd/4.0/", "input_licenses": ["http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/"]}
|
| 29 |
+
{"example_id": "p2t_000228", "input_paper_ids": ["2306.16447", "2406.17016", "2405.05315", "2409.05950", "2403.03147", "2407.12908", "2501.09806", "2504.08033"], "target_thesis_id": "2509.18313", "split": "validation", "field": "gr-qc", "target_year": 2025, "num_input_papers": 8, "input_total_words": 95561, "target_total_words": 133252, "target_page_count": 372, "input_versions": ["v2", "v2", "v2", "v2", "v4", "v2", "v1", "v2"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 30 |
+
{"example_id": "p2t_000231", "input_paper_ids": ["2008.02693", "1908.11782", "2008.08189", "2008.11882", "2107.14178", "2109.02865", "1906.04376", "2006.06145", "1911.08065", "2007.02388"], "target_thesis_id": "2302.08901", "split": "validation", "field": "cs.CV", "target_year": 2023, "num_input_papers": 10, "input_total_words": 77799, "target_total_words": 38851, "target_page_count": 167, "input_versions": ["v2", "v1", "v1", "v1", "v2", "v2", "v6", "v3", "v1", "v1"], "target_version": "v1", "target_license": "http://creativecommons.org/publicdomain/zero/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/publicdomain/zero/1.0/", "http://creativecommons.org/publicdomain/zero/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by/4.0/", "http://creativecommons.org/licenses/by/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 31 |
+
{"example_id": "p2t_000275", "input_paper_ids": ["2211.06252", "2206.11702", "2101.09036", "2110.14431", "2109.13802", "2208.07436", "2212.14848", "2202.08588", "2208.02033", "2312.12152", "2302.12061", "2112.02573"], "target_thesis_id": "2409.11947", "split": "validation", "field": "math-ph", "target_year": 2024, "num_input_papers": 12, "input_total_words": 124421, "target_total_words": 99627, "target_page_count": 319, "input_versions": ["v2", "v3", "v2", "v3", "v2", "v3", "v2", "v2", "v2", "v1", "v4", "v4"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
| 32 |
+
{"example_id": "p2t_000282", "input_paper_ids": ["2002.07224", "2006.03179", "2109.08958", "2301.05785"], "target_thesis_id": "2304.03374", "split": "validation", "field": "cs.LG", "target_year": 2023, "num_input_papers": 4, "input_total_words": 62263, "target_total_words": 56842, "target_page_count": 233, "input_versions": ["v2", "v5", "v2", "v6"], "target_version": "v1", "target_license": "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "input_licenses": ["http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://creativecommons.org/licenses/by-nc-nd/4.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/", "http://arxiv.org/licenses/nonexclusive-distrib/1.0/"]}
|
scripts/download_arxiv_pdfs.py
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download arXiv PDFs referenced by a Paper2Thesis JSONL file.
|
| 3 |
+
|
| 4 |
+
This script is standalone and only uses the Python standard library. It reads
|
| 5 |
+
one JSONL file, collects every input_paper_ids value plus every
|
| 6 |
+
target_thesis_id, and downloads PDFs from https://arxiv.org/pdf/<id>.pdf.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import argparse
|
| 10 |
+
import json
|
| 11 |
+
import re
|
| 12 |
+
import sys
|
| 13 |
+
import time
|
| 14 |
+
import urllib.error
|
| 15 |
+
import urllib.parse
|
| 16 |
+
import urllib.request
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
ARXIV_PDF_URLS = ("https://arxiv.org/pdf/{arxiv_id}.pdf", "https://export.arxiv.org/pdf/{arxiv_id}.pdf")
|
| 21 |
+
VERSION_RE = re.compile(r"v\d+$")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def normalize_arxiv_id(value):
|
| 25 |
+
arxiv_id = str(value or "").strip()
|
| 26 |
+
arxiv_id = arxiv_id.rsplit("/abs/", 1)[-1]
|
| 27 |
+
arxiv_id = arxiv_id.rsplit("/pdf/", 1)[-1]
|
| 28 |
+
arxiv_id = arxiv_id.rsplit("/", 1)[-1] if arxiv_id.startswith("http") else arxiv_id
|
| 29 |
+
arxiv_id = arxiv_id.split("?", 1)[0].split("#", 1)[0]
|
| 30 |
+
if arxiv_id.endswith(".pdf"):
|
| 31 |
+
arxiv_id = arxiv_id[:-4]
|
| 32 |
+
return VERSION_RE.sub("", arxiv_id)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def read_jsonl(path):
|
| 36 |
+
rows = []
|
| 37 |
+
with path.open("r", encoding="utf-8") as handle:
|
| 38 |
+
for line_number, line in enumerate(handle, start=1):
|
| 39 |
+
stripped = line.strip()
|
| 40 |
+
if not stripped:
|
| 41 |
+
continue
|
| 42 |
+
try:
|
| 43 |
+
row = json.loads(stripped)
|
| 44 |
+
except json.JSONDecodeError as exc:
|
| 45 |
+
raise ValueError(f"Invalid JSON in {path} line {line_number}: {exc}") from exc
|
| 46 |
+
if not isinstance(row, dict):
|
| 47 |
+
raise ValueError(f"{path} line {line_number} is not a JSON object")
|
| 48 |
+
rows.append(row)
|
| 49 |
+
return rows
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def collect_arxiv_ids(rows):
|
| 53 |
+
arxiv_ids = set()
|
| 54 |
+
for row in rows:
|
| 55 |
+
target_id = normalize_arxiv_id(row.get("target_thesis_id"))
|
| 56 |
+
if target_id:
|
| 57 |
+
arxiv_ids.add(target_id)
|
| 58 |
+
|
| 59 |
+
input_paper_ids = row.get("input_paper_ids", [])
|
| 60 |
+
if not isinstance(input_paper_ids, list):
|
| 61 |
+
raise ValueError(f"input_paper_ids must be a list for example_id={row.get('example_id')!r}")
|
| 62 |
+
for paper_id in input_paper_ids:
|
| 63 |
+
normalized_paper_id = normalize_arxiv_id(paper_id)
|
| 64 |
+
if normalized_paper_id:
|
| 65 |
+
arxiv_ids.add(normalized_paper_id)
|
| 66 |
+
|
| 67 |
+
return sorted(arxiv_ids)
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def fetch_pdf(arxiv_id, timeout, retries):
|
| 71 |
+
quoted_id = urllib.parse.quote(arxiv_id)
|
| 72 |
+
headers = {"User-Agent": "Paper2Thesis PDF downloader (mailto:example@example.com)"}
|
| 73 |
+
last_error = None
|
| 74 |
+
|
| 75 |
+
for url_template in ARXIV_PDF_URLS:
|
| 76 |
+
url = url_template.format(arxiv_id=quoted_id)
|
| 77 |
+
request = urllib.request.Request(url, headers=headers)
|
| 78 |
+
for attempt in range(1, retries + 1):
|
| 79 |
+
try:
|
| 80 |
+
with urllib.request.urlopen(request, timeout=timeout) as response:
|
| 81 |
+
content_type = response.headers.get("Content-Type", "")
|
| 82 |
+
data = response.read()
|
| 83 |
+
if b"%PDF" not in data[:2048] and "pdf" not in content_type.lower():
|
| 84 |
+
raise RuntimeError(f"{url} did not return PDF content")
|
| 85 |
+
return data
|
| 86 |
+
except urllib.error.HTTPError as exc:
|
| 87 |
+
last_error = exc
|
| 88 |
+
if exc.code in {400, 403, 404, 406}:
|
| 89 |
+
break
|
| 90 |
+
if attempt < retries:
|
| 91 |
+
time.sleep(min(30, 2**attempt))
|
| 92 |
+
except (urllib.error.URLError, TimeoutError, RuntimeError) as exc:
|
| 93 |
+
last_error = exc
|
| 94 |
+
if attempt < retries:
|
| 95 |
+
time.sleep(min(30, 2**attempt))
|
| 96 |
+
|
| 97 |
+
raise RuntimeError(f"Failed to download PDF for {arxiv_id}: {last_error}")
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def write_pdf_atomic(path, data):
|
| 101 |
+
temp_path = path.with_suffix(path.suffix + ".tmp")
|
| 102 |
+
with temp_path.open("wb") as handle:
|
| 103 |
+
handle.write(data)
|
| 104 |
+
temp_path.replace(path)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def download_pdfs(arxiv_ids, out_dir, delay_seconds, timeout, retries, overwrite):
|
| 108 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 109 |
+
downloaded = 0
|
| 110 |
+
skipped = 0
|
| 111 |
+
failed = []
|
| 112 |
+
|
| 113 |
+
for index, arxiv_id in enumerate(arxiv_ids, start=1):
|
| 114 |
+
output_path = out_dir / f"{arxiv_id}.pdf"
|
| 115 |
+
if output_path.exists() and not overwrite:
|
| 116 |
+
skipped += 1
|
| 117 |
+
print(f"[{index}/{len(arxiv_ids)}] skip existing {output_path}")
|
| 118 |
+
continue
|
| 119 |
+
|
| 120 |
+
if index > 1 and delay_seconds > 0:
|
| 121 |
+
time.sleep(delay_seconds)
|
| 122 |
+
|
| 123 |
+
try:
|
| 124 |
+
pdf_bytes = fetch_pdf(arxiv_id, timeout=timeout, retries=retries)
|
| 125 |
+
write_pdf_atomic(output_path, pdf_bytes)
|
| 126 |
+
downloaded += 1
|
| 127 |
+
print(f"[{index}/{len(arxiv_ids)}] downloaded {output_path}")
|
| 128 |
+
except Exception as exc:
|
| 129 |
+
failed.append((arxiv_id, str(exc)))
|
| 130 |
+
print(f"[{index}/{len(arxiv_ids)}] failed {arxiv_id}: {exc}")
|
| 131 |
+
|
| 132 |
+
return downloaded, skipped, failed
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
def parse_args():
|
| 136 |
+
parser = argparse.ArgumentParser(description="Download all arXiv PDFs referenced by a JSONL file.")
|
| 137 |
+
parser.add_argument("--input", required=True, help="Input JSONL file, e.g. data/test.jsonl")
|
| 138 |
+
parser.add_argument("--out_dir", required=True, help="Directory where PDFs will be written")
|
| 139 |
+
parser.add_argument("--delay-seconds", type=float, default=1.0, help="Delay between downloads. Default: 1.0")
|
| 140 |
+
parser.add_argument("--timeout", type=float, default=60.0, help="Download timeout in seconds. Default: 60")
|
| 141 |
+
parser.add_argument("--retries", type=int, default=3, help="Retries per PDF URL. Default: 3")
|
| 142 |
+
parser.add_argument("--overwrite", action="store_true", help="Redownload PDFs even if files already exist")
|
| 143 |
+
return parser.parse_args()
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
def main():
|
| 147 |
+
args = parse_args()
|
| 148 |
+
if args.retries <= 0:
|
| 149 |
+
raise ValueError("--retries must be positive")
|
| 150 |
+
|
| 151 |
+
rows = read_jsonl(Path(args.input))
|
| 152 |
+
arxiv_ids = collect_arxiv_ids(rows)
|
| 153 |
+
print(f"Loaded {len(rows)} examples.")
|
| 154 |
+
print(f"Found {len(arxiv_ids)} unique arXiv IDs.")
|
| 155 |
+
|
| 156 |
+
downloaded, skipped, failed = download_pdfs(
|
| 157 |
+
arxiv_ids,
|
| 158 |
+
out_dir=Path(args.out_dir),
|
| 159 |
+
delay_seconds=args.delay_seconds,
|
| 160 |
+
timeout=args.timeout,
|
| 161 |
+
retries=args.retries,
|
| 162 |
+
overwrite=args.overwrite,
|
| 163 |
+
)
|
| 164 |
+
|
| 165 |
+
print(f"Downloaded {downloaded} PDFs.")
|
| 166 |
+
print(f"Skipped {skipped} existing PDFs.")
|
| 167 |
+
if failed:
|
| 168 |
+
print(f"Failed {len(failed)} downloads:")
|
| 169 |
+
for arxiv_id, error in failed:
|
| 170 |
+
print(f"- {arxiv_id}: {error}")
|
| 171 |
+
return 1
|
| 172 |
+
|
| 173 |
+
print("All PDFs downloaded successfully.")
|
| 174 |
+
return 0
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
if __name__ == "__main__":
|
| 178 |
+
sys.exit(main())
|
scripts/download_arxiv_sources.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Download arXiv source packages referenced by a Paper2Thesis JSONL file.
|
| 3 |
+
|
| 4 |
+
This script is standalone and only uses the Python standard library. It reads
|
| 5 |
+
one JSONL file, collects every input_paper_ids value plus every
|
| 6 |
+
target_thesis_id, and downloads source packages from
|
| 7 |
+
https://arxiv.org/e-print/<id>. Files are saved as <id>.tar.gz because arXiv
|
| 8 |
+
source packages are usually gzipped tarballs.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import json
|
| 13 |
+
import re
|
| 14 |
+
import sys
|
| 15 |
+
import time
|
| 16 |
+
import urllib.error
|
| 17 |
+
import urllib.parse
|
| 18 |
+
import urllib.request
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
ARXIV_SOURCE_URLS = ("https://arxiv.org/e-print/{arxiv_id}", "https://export.arxiv.org/e-print/{arxiv_id}")
|
| 23 |
+
VERSION_RE = re.compile(r"v\d+$")
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def normalize_arxiv_id(value):
|
| 27 |
+
arxiv_id = str(value or "").strip()
|
| 28 |
+
arxiv_id = arxiv_id.rsplit("/abs/", 1)[-1]
|
| 29 |
+
arxiv_id = arxiv_id.rsplit("/pdf/", 1)[-1]
|
| 30 |
+
arxiv_id = arxiv_id.rsplit("/e-print/", 1)[-1]
|
| 31 |
+
arxiv_id = arxiv_id.rsplit("/", 1)[-1] if arxiv_id.startswith("http") else arxiv_id
|
| 32 |
+
arxiv_id = arxiv_id.split("?", 1)[0].split("#", 1)[0]
|
| 33 |
+
for suffix in (".tar.gz", ".tgz", ".gz", ".pdf"):
|
| 34 |
+
if arxiv_id.endswith(suffix):
|
| 35 |
+
arxiv_id = arxiv_id[: -len(suffix)]
|
| 36 |
+
break
|
| 37 |
+
return VERSION_RE.sub("", arxiv_id)
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def read_jsonl(path):
|
| 41 |
+
rows = []
|
| 42 |
+
with path.open("r", encoding="utf-8") as handle:
|
| 43 |
+
for line_number, line in enumerate(handle, start=1):
|
| 44 |
+
stripped = line.strip()
|
| 45 |
+
if not stripped:
|
| 46 |
+
continue
|
| 47 |
+
try:
|
| 48 |
+
row = json.loads(stripped)
|
| 49 |
+
except json.JSONDecodeError as exc:
|
| 50 |
+
raise ValueError(f"Invalid JSON in {path} line {line_number}: {exc}") from exc
|
| 51 |
+
if not isinstance(row, dict):
|
| 52 |
+
raise ValueError(f"{path} line {line_number} is not a JSON object")
|
| 53 |
+
rows.append(row)
|
| 54 |
+
return rows
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def collect_arxiv_ids(rows):
|
| 58 |
+
arxiv_ids = set()
|
| 59 |
+
for row in rows:
|
| 60 |
+
target_id = normalize_arxiv_id(row.get("target_thesis_id"))
|
| 61 |
+
if target_id:
|
| 62 |
+
arxiv_ids.add(target_id)
|
| 63 |
+
|
| 64 |
+
input_paper_ids = row.get("input_paper_ids", [])
|
| 65 |
+
if not isinstance(input_paper_ids, list):
|
| 66 |
+
raise ValueError(f"input_paper_ids must be a list for example_id={row.get('example_id')!r}")
|
| 67 |
+
for paper_id in input_paper_ids:
|
| 68 |
+
normalized_paper_id = normalize_arxiv_id(paper_id)
|
| 69 |
+
if normalized_paper_id:
|
| 70 |
+
arxiv_ids.add(normalized_paper_id)
|
| 71 |
+
|
| 72 |
+
return sorted(arxiv_ids)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def looks_like_source_package(data, content_type):
|
| 76 |
+
content_type = content_type.lower()
|
| 77 |
+
if data.startswith(b"\x1f\x8b"):
|
| 78 |
+
return True
|
| 79 |
+
if data.startswith(b"PK\x03\x04"):
|
| 80 |
+
return True
|
| 81 |
+
if b"tar" in content_type or b"gzip" in content_type or b"octet-stream" in content_type:
|
| 82 |
+
return True
|
| 83 |
+
if data[:64].lstrip().startswith((b"\\", b"%", b"@", b"\\documentclass")):
|
| 84 |
+
return True
|
| 85 |
+
return False
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
def fetch_source(arxiv_id, timeout, retries):
|
| 89 |
+
quoted_id = urllib.parse.quote(arxiv_id)
|
| 90 |
+
headers = {"User-Agent": "Paper2Thesis source downloader (mailto:example@example.com)"}
|
| 91 |
+
last_error = None
|
| 92 |
+
|
| 93 |
+
for url_template in ARXIV_SOURCE_URLS:
|
| 94 |
+
url = url_template.format(arxiv_id=quoted_id)
|
| 95 |
+
request = urllib.request.Request(url, headers=headers)
|
| 96 |
+
for attempt in range(1, retries + 1):
|
| 97 |
+
try:
|
| 98 |
+
with urllib.request.urlopen(request, timeout=timeout) as response:
|
| 99 |
+
content_type = response.headers.get("Content-Type", "")
|
| 100 |
+
data = response.read()
|
| 101 |
+
if not looks_like_source_package(data, content_type):
|
| 102 |
+
raise RuntimeError(f"{url} did not return a recognizable source package")
|
| 103 |
+
return data
|
| 104 |
+
except urllib.error.HTTPError as exc:
|
| 105 |
+
last_error = exc
|
| 106 |
+
if exc.code in {400, 403, 404, 406}:
|
| 107 |
+
break
|
| 108 |
+
if attempt < retries:
|
| 109 |
+
time.sleep(min(30, 2**attempt))
|
| 110 |
+
except (urllib.error.URLError, TimeoutError, RuntimeError) as exc:
|
| 111 |
+
last_error = exc
|
| 112 |
+
if attempt < retries:
|
| 113 |
+
time.sleep(min(30, 2**attempt))
|
| 114 |
+
|
| 115 |
+
raise RuntimeError(f"Failed to download source for {arxiv_id}: {last_error}")
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
def write_source_atomic(path, data):
|
| 119 |
+
temp_path = path.with_suffix(path.suffix + ".tmp")
|
| 120 |
+
with temp_path.open("wb") as handle:
|
| 121 |
+
handle.write(data)
|
| 122 |
+
temp_path.replace(path)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def download_sources(arxiv_ids, out_dir, delay_seconds, timeout, retries, overwrite):
|
| 126 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 127 |
+
downloaded = 0
|
| 128 |
+
skipped = 0
|
| 129 |
+
failed = []
|
| 130 |
+
|
| 131 |
+
for index, arxiv_id in enumerate(arxiv_ids, start=1):
|
| 132 |
+
output_path = out_dir / f"{arxiv_id}.tar.gz"
|
| 133 |
+
if output_path.exists() and not overwrite:
|
| 134 |
+
skipped += 1
|
| 135 |
+
print(f"[{index}/{len(arxiv_ids)}] skip existing {output_path}")
|
| 136 |
+
continue
|
| 137 |
+
|
| 138 |
+
if index > 1 and delay_seconds > 0:
|
| 139 |
+
time.sleep(delay_seconds)
|
| 140 |
+
|
| 141 |
+
try:
|
| 142 |
+
source_bytes = fetch_source(arxiv_id, timeout=timeout, retries=retries)
|
| 143 |
+
write_source_atomic(output_path, source_bytes)
|
| 144 |
+
downloaded += 1
|
| 145 |
+
print(f"[{index}/{len(arxiv_ids)}] downloaded {output_path}")
|
| 146 |
+
except Exception as exc:
|
| 147 |
+
failed.append((arxiv_id, str(exc)))
|
| 148 |
+
print(f"[{index}/{len(arxiv_ids)}] failed {arxiv_id}: {exc}")
|
| 149 |
+
|
| 150 |
+
return downloaded, skipped, failed
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def parse_args():
|
| 154 |
+
parser = argparse.ArgumentParser(description="Download all arXiv source packages referenced by a JSONL file.")
|
| 155 |
+
parser.add_argument("--input", required=True, help="Input JSONL file, e.g. data/test.jsonl")
|
| 156 |
+
parser.add_argument("--out_dir", required=True, help="Directory where source packages will be written")
|
| 157 |
+
parser.add_argument("--delay-seconds", type=float, default=1.0, help="Delay between downloads. Default: 1.0")
|
| 158 |
+
parser.add_argument("--timeout", type=float, default=60.0, help="Download timeout in seconds. Default: 60")
|
| 159 |
+
parser.add_argument("--retries", type=int, default=3, help="Retries per source URL. Default: 3")
|
| 160 |
+
parser.add_argument("--overwrite", action="store_true", help="Redownload sources even if files already exist")
|
| 161 |
+
return parser.parse_args()
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def main():
|
| 165 |
+
args = parse_args()
|
| 166 |
+
if args.retries <= 0:
|
| 167 |
+
raise ValueError("--retries must be positive")
|
| 168 |
+
|
| 169 |
+
rows = read_jsonl(Path(args.input))
|
| 170 |
+
arxiv_ids = collect_arxiv_ids(rows)
|
| 171 |
+
print(f"Loaded {len(rows)} examples.")
|
| 172 |
+
print(f"Found {len(arxiv_ids)} unique arXiv IDs.")
|
| 173 |
+
|
| 174 |
+
downloaded, skipped, failed = download_sources(
|
| 175 |
+
arxiv_ids,
|
| 176 |
+
out_dir=Path(args.out_dir),
|
| 177 |
+
delay_seconds=args.delay_seconds,
|
| 178 |
+
timeout=args.timeout,
|
| 179 |
+
retries=args.retries,
|
| 180 |
+
overwrite=args.overwrite,
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
print(f"Downloaded {downloaded} source packages.")
|
| 184 |
+
print(f"Skipped {skipped} existing source packages.")
|
| 185 |
+
if failed:
|
| 186 |
+
print(f"Failed {len(failed)} downloads:")
|
| 187 |
+
for arxiv_id, error in failed:
|
| 188 |
+
print(f"- {arxiv_id}: {error}")
|
| 189 |
+
return 1
|
| 190 |
+
|
| 191 |
+
print("All source packages downloaded successfully.")
|
| 192 |
+
return 0
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
if __name__ == "__main__":
|
| 196 |
+
sys.exit(main())
|
scripts/validate_ids.py
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Validate released Paper2Thesis JSONL split files.
|
| 3 |
+
|
| 4 |
+
This script is standalone and only uses the Python standard library.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import argparse
|
| 8 |
+
import json
|
| 9 |
+
import re
|
| 10 |
+
import sys
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
SPLITS = ("train", "validation", "test")
|
| 15 |
+
REQUIRED_FIELDS = {
|
| 16 |
+
"example_id",
|
| 17 |
+
"input_paper_ids",
|
| 18 |
+
"target_thesis_id",
|
| 19 |
+
"split",
|
| 20 |
+
"field",
|
| 21 |
+
"target_year",
|
| 22 |
+
"num_input_papers",
|
| 23 |
+
"input_total_words",
|
| 24 |
+
"target_total_words",
|
| 25 |
+
"target_page_count",
|
| 26 |
+
"input_versions",
|
| 27 |
+
"target_version",
|
| 28 |
+
"target_license",
|
| 29 |
+
"input_licenses",
|
| 30 |
+
}
|
| 31 |
+
ARXIV_ID_RE = re.compile(r"^(?:[a-z-]+(?:\.[A-Z]{2})?/\d{7}|\d{4}\.\d{4,5})(?:v\d+)?$")
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def is_valid_arxiv_id(value):
|
| 35 |
+
return isinstance(value, str) and ARXIV_ID_RE.fullmatch(value.strip()) is not None
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def add_error(errors, path, line_number, message):
|
| 39 |
+
errors.append(f"{path}:{line_number}: {message}")
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def read_jsonl(path, errors):
|
| 43 |
+
rows = []
|
| 44 |
+
if not path.exists():
|
| 45 |
+
errors.append(f"{path}: file does not exist")
|
| 46 |
+
return rows
|
| 47 |
+
|
| 48 |
+
with path.open("r", encoding="utf-8") as handle:
|
| 49 |
+
for line_number, line in enumerate(handle, start=1):
|
| 50 |
+
stripped = line.strip()
|
| 51 |
+
if not stripped:
|
| 52 |
+
add_error(errors, path, line_number, "blank line")
|
| 53 |
+
continue
|
| 54 |
+
|
| 55 |
+
try:
|
| 56 |
+
row = json.loads(stripped)
|
| 57 |
+
except json.JSONDecodeError as exc:
|
| 58 |
+
add_error(errors, path, line_number, f"invalid JSON: {exc}")
|
| 59 |
+
continue
|
| 60 |
+
|
| 61 |
+
if not isinstance(row, dict):
|
| 62 |
+
add_error(errors, path, line_number, "row is not a JSON object")
|
| 63 |
+
continue
|
| 64 |
+
|
| 65 |
+
rows.append((path, line_number, row))
|
| 66 |
+
|
| 67 |
+
return rows
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
def validate_required_fields(path, line_number, row, errors):
|
| 71 |
+
missing = sorted(REQUIRED_FIELDS - set(row))
|
| 72 |
+
if missing:
|
| 73 |
+
add_error(errors, path, line_number, f"missing required fields: {missing}")
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def validate_arxiv_ids(path, line_number, row, errors):
|
| 77 |
+
target_thesis_id = row.get("target_thesis_id")
|
| 78 |
+
if not is_valid_arxiv_id(target_thesis_id):
|
| 79 |
+
add_error(errors, path, line_number, f"invalid target_thesis_id: {target_thesis_id!r}")
|
| 80 |
+
|
| 81 |
+
input_paper_ids = row.get("input_paper_ids")
|
| 82 |
+
if not isinstance(input_paper_ids, list):
|
| 83 |
+
add_error(errors, path, line_number, "input_paper_ids is not a list")
|
| 84 |
+
return
|
| 85 |
+
|
| 86 |
+
for index, paper_id in enumerate(input_paper_ids):
|
| 87 |
+
if not is_valid_arxiv_id(paper_id):
|
| 88 |
+
add_error(errors, path, line_number, f"invalid input_paper_ids[{index}]: {paper_id!r}")
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
def validate_split(path, line_number, row, expected_split, errors):
|
| 92 |
+
split = row.get("split")
|
| 93 |
+
if split != expected_split:
|
| 94 |
+
add_error(errors, path, line_number, f"split is {split!r}, expected {expected_split!r}")
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
def validate_num_input_papers(path, line_number, row, errors):
|
| 98 |
+
input_paper_ids = row.get("input_paper_ids")
|
| 99 |
+
num_input_papers = row.get("num_input_papers")
|
| 100 |
+
|
| 101 |
+
if not isinstance(input_paper_ids, list):
|
| 102 |
+
return
|
| 103 |
+
if not isinstance(num_input_papers, int):
|
| 104 |
+
add_error(errors, path, line_number, f"num_input_papers is not an integer: {num_input_papers!r}")
|
| 105 |
+
return
|
| 106 |
+
if num_input_papers != len(input_paper_ids):
|
| 107 |
+
add_error(
|
| 108 |
+
errors,
|
| 109 |
+
path,
|
| 110 |
+
line_number,
|
| 111 |
+
f"num_input_papers={num_input_papers} but len(input_paper_ids)={len(input_paper_ids)}",
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
def validate_license_fields(path, line_number, row, errors):
|
| 116 |
+
target_license = row.get("target_license")
|
| 117 |
+
if not isinstance(target_license, str) or not target_license.strip():
|
| 118 |
+
add_error(errors, path, line_number, f"target_license missing or empty: {target_license!r}")
|
| 119 |
+
|
| 120 |
+
input_licenses = row.get("input_licenses")
|
| 121 |
+
input_paper_ids = row.get("input_paper_ids")
|
| 122 |
+
if not isinstance(input_licenses, list):
|
| 123 |
+
add_error(errors, path, line_number, "input_licenses is not a list")
|
| 124 |
+
return
|
| 125 |
+
|
| 126 |
+
if isinstance(input_paper_ids, list) and len(input_licenses) != len(input_paper_ids):
|
| 127 |
+
add_error(
|
| 128 |
+
errors,
|
| 129 |
+
path,
|
| 130 |
+
line_number,
|
| 131 |
+
f"len(input_licenses)={len(input_licenses)} but len(input_paper_ids)={len(input_paper_ids)}",
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
for index, license_value in enumerate(input_licenses):
|
| 135 |
+
if not isinstance(license_value, str) or not license_value.strip():
|
| 136 |
+
add_error(errors, path, line_number, f"input_licenses[{index}] missing or empty: {license_value!r}")
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def validate_duplicates_and_overlap(rows, errors):
|
| 140 |
+
example_locations = {}
|
| 141 |
+
target_locations = {}
|
| 142 |
+
input_paper_splits = {}
|
| 143 |
+
|
| 144 |
+
for path, line_number, row in rows:
|
| 145 |
+
example_id = row.get("example_id")
|
| 146 |
+
if example_id in example_locations:
|
| 147 |
+
previous_path, previous_line = example_locations[example_id]
|
| 148 |
+
add_error(
|
| 149 |
+
errors,
|
| 150 |
+
path,
|
| 151 |
+
line_number,
|
| 152 |
+
f"duplicate example_id {example_id!r}; first seen at {previous_path}:{previous_line}",
|
| 153 |
+
)
|
| 154 |
+
else:
|
| 155 |
+
example_locations[example_id] = (path, line_number)
|
| 156 |
+
|
| 157 |
+
target_thesis_id = row.get("target_thesis_id")
|
| 158 |
+
if target_thesis_id in target_locations:
|
| 159 |
+
previous_path, previous_line = target_locations[target_thesis_id]
|
| 160 |
+
add_error(
|
| 161 |
+
errors,
|
| 162 |
+
path,
|
| 163 |
+
line_number,
|
| 164 |
+
f"duplicate target_thesis_id {target_thesis_id!r}; first seen at {previous_path}:{previous_line}",
|
| 165 |
+
)
|
| 166 |
+
else:
|
| 167 |
+
target_locations[target_thesis_id] = (path, line_number)
|
| 168 |
+
|
| 169 |
+
split = row.get("split")
|
| 170 |
+
input_paper_ids = row.get("input_paper_ids")
|
| 171 |
+
if not isinstance(input_paper_ids, list):
|
| 172 |
+
continue
|
| 173 |
+
|
| 174 |
+
for paper_id in input_paper_ids:
|
| 175 |
+
if paper_id not in input_paper_splits:
|
| 176 |
+
input_paper_splits[paper_id] = (split, path, line_number)
|
| 177 |
+
continue
|
| 178 |
+
|
| 179 |
+
previous_split, previous_path, previous_line = input_paper_splits[paper_id]
|
| 180 |
+
if split != previous_split:
|
| 181 |
+
add_error(
|
| 182 |
+
errors,
|
| 183 |
+
path,
|
| 184 |
+
line_number,
|
| 185 |
+
"input_paper_id "
|
| 186 |
+
f"{paper_id!r} appears in split {split!r} and split {previous_split!r}; "
|
| 187 |
+
f"first seen at {previous_path}:{previous_line}",
|
| 188 |
+
)
|
| 189 |
+
|
| 190 |
+
return len(example_locations), len(target_locations)
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def parse_args():
|
| 194 |
+
parser = argparse.ArgumentParser(description="Validate Paper2Thesis released JSONL split files.")
|
| 195 |
+
parser.add_argument(
|
| 196 |
+
"--data_dir",
|
| 197 |
+
default="data",
|
| 198 |
+
help="Directory containing train.jsonl, validation.jsonl, and test.jsonl. Default: data",
|
| 199 |
+
)
|
| 200 |
+
return parser.parse_args()
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
def main():
|
| 204 |
+
args = parse_args()
|
| 205 |
+
data_dir = Path(args.data_dir)
|
| 206 |
+
errors = []
|
| 207 |
+
all_rows = []
|
| 208 |
+
|
| 209 |
+
for split in SPLITS:
|
| 210 |
+
path = data_dir / f"{split}.jsonl"
|
| 211 |
+
split_rows = read_jsonl(path, errors)
|
| 212 |
+
for row_path, line_number, row in split_rows:
|
| 213 |
+
validate_required_fields(row_path, line_number, row, errors)
|
| 214 |
+
validate_split(row_path, line_number, row, split, errors)
|
| 215 |
+
validate_arxiv_ids(row_path, line_number, row, errors)
|
| 216 |
+
validate_num_input_papers(row_path, line_number, row, errors)
|
| 217 |
+
validate_license_fields(row_path, line_number, row, errors)
|
| 218 |
+
all_rows.extend(split_rows)
|
| 219 |
+
|
| 220 |
+
_example_count, target_count = validate_duplicates_and_overlap(all_rows, errors)
|
| 221 |
+
|
| 222 |
+
print(f"Loaded {len(all_rows)} examples.")
|
| 223 |
+
if errors:
|
| 224 |
+
print(f"Validation failed with {len(errors)} error(s):")
|
| 225 |
+
for error in errors:
|
| 226 |
+
print(f"- {error}")
|
| 227 |
+
return 1
|
| 228 |
+
|
| 229 |
+
print("No duplicate example_id.")
|
| 230 |
+
print("No duplicate target_thesis_id.")
|
| 231 |
+
print("No input paper overlap across splits.")
|
| 232 |
+
print(f"Validated {target_count} unique target_thesis_id values.")
|
| 233 |
+
print("Validation passed.")
|
| 234 |
+
return 0
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
if __name__ == "__main__":
|
| 238 |
+
sys.exit(main())
|