Commit
·
a245956
1
Parent(s):
c434d86
Track important_citations.csv with Git LFS
Browse files- .gitattributes +1 -0
- README.md +5 -4
- important_citations.csv +3 -0
- lotus_deep_research.py +397 -0
- papers.csv +0 -0
- papers_with_related_works.csv +0 -0
- usage_example.py +175 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
important_citations.csv filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -23,7 +23,7 @@ A comprehensive dataset of academic papers with extracted related works sections
|
|
| 23 |
|
| 24 |
## 📊 Dataset Overview
|
| 25 |
|
| 26 |
-
This dataset contains **
|
| 27 |
|
| 28 |
### 🎯 Use Cases
|
| 29 |
|
|
@@ -35,10 +35,9 @@ This dataset contains **67 academic papers** from ArXiv with their related works
|
|
| 35 |
|
| 36 |
## 📁 Dataset Structure
|
| 37 |
|
| 38 |
-
### 1. `papers_with_related_works.csv` (
|
| 39 |
|
| 40 |
Contains academic papers with extracted related works sections in multiple formats:
|
| 41 |
-
|
| 42 |
| Column | Description |
|
| 43 |
|--------|-------------|
|
| 44 |
| `arxiv_id` | ArXiv identifier (e.g., "2506.02838v1") |
|
|
@@ -50,11 +49,12 @@ Contains academic papers with extracted related works sections in multiple forma
|
|
| 50 |
| `updated_date` | Last update date |
|
| 51 |
| `abs_url` | ArXiv abstract URL |
|
| 52 |
| `arxiv_link` | Full ArXiv link |
|
|
|
|
| 53 |
| `raw_latex_related_works` | Raw LaTeX related works section |
|
| 54 |
| `clean_latex_related_works` | Cleaned LaTeX related works section |
|
| 55 |
| `pdf_related_works` | Related works extracted from PDF |
|
| 56 |
|
| 57 |
-
### 2. `
|
| 58 |
|
| 59 |
Contains individual citations with recovered metadata:
|
| 60 |
|
|
@@ -75,6 +75,7 @@ Contains individual citations with recovered metadata:
|
|
| 75 |
| `bib_paper_url` | URL of the cited paper |
|
| 76 |
| `bib_paper_doi` | DOI of the cited paper |
|
| 77 |
| `bib_paper_journal` | Journal name |
|
|
|
|
| 78 |
| `search_res_title` | Title from search results |
|
| 79 |
| `search_res_url` | URL from search results |
|
| 80 |
| `search_res_content` | Content snippet from search results |
|
|
|
|
| 23 |
|
| 24 |
## 📊 Dataset Overview
|
| 25 |
|
| 26 |
+
This dataset contains **63 academic papers** from ArXiv with their related works sections and **1630 recovered citations**, providing a rich resource for research generation and citation analysis tasks.
|
| 27 |
|
| 28 |
### 🎯 Use Cases
|
| 29 |
|
|
|
|
| 35 |
|
| 36 |
## 📁 Dataset Structure
|
| 37 |
|
| 38 |
+
### 1. `papers_with_related_works.csv` (63 papers)
|
| 39 |
|
| 40 |
Contains academic papers with extracted related works sections in multiple formats:
|
|
|
|
| 41 |
| Column | Description |
|
| 42 |
|--------|-------------|
|
| 43 |
| `arxiv_id` | ArXiv identifier (e.g., "2506.02838v1") |
|
|
|
|
| 49 |
| `updated_date` | Last update date |
|
| 50 |
| `abs_url` | ArXiv abstract URL |
|
| 51 |
| `arxiv_link` | Full ArXiv link |
|
| 52 |
+
| `publication_date` | Publication date |
|
| 53 |
| `raw_latex_related_works` | Raw LaTeX related works section |
|
| 54 |
| `clean_latex_related_works` | Cleaned LaTeX related works section |
|
| 55 |
| `pdf_related_works` | Related works extracted from PDF |
|
| 56 |
|
| 57 |
+
### 2. `recovered_citations.csv` (1630 citations)
|
| 58 |
|
| 59 |
Contains individual citations with recovered metadata:
|
| 60 |
|
|
|
|
| 75 |
| `bib_paper_url` | URL of the cited paper |
|
| 76 |
| `bib_paper_doi` | DOI of the cited paper |
|
| 77 |
| `bib_paper_journal` | Journal name |
|
| 78 |
+
| `original_title` | Original title from citation metadata |
|
| 79 |
| `search_res_title` | Title from search results |
|
| 80 |
| `search_res_url` | URL from search results |
|
| 81 |
| `search_res_content` | Content snippet from search results |
|
important_citations.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5cb48008cdaa202abc4ed2e6689357f1858791b5fe0d586b33f9b447797114cf
|
| 3 |
+
size 16641640
|
lotus_deep_research.py
ADDED
|
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Lotus Deep Research Dataset: Academic papers with extracted related works sections and recovered citations.
|
| 3 |
+
|
| 4 |
+
This dataset contains academic papers from ArXiv with their related works sections and recovered citations,
|
| 5 |
+
providing a rich resource for research generation and citation analysis tasks.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
import csv
|
| 9 |
+
import datasets
|
| 10 |
+
from typing import Dict, List, Any, Optional
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
# Dataset URLs - these would typically point to hosted files
|
| 14 |
+
_DESCRIPTION = """\
|
| 15 |
+
A comprehensive dataset of academic papers with extracted related works sections and recovered citations,
|
| 16 |
+
designed for training and evaluating research generation systems.
|
| 17 |
+
|
| 18 |
+
This dataset contains 63 academic papers from ArXiv with their related works sections and 1630 recovered citations,
|
| 19 |
+
providing a rich resource for research generation and citation analysis tasks.
|
| 20 |
+
"""
|
| 21 |
+
|
| 22 |
+
_CITATION = """\
|
| 23 |
+
@misc{patel2025deepscholarbenchlivebenchmarkautomated,
|
| 24 |
+
title={DeepScholar-Bench: A Live Benchmark and Automated Evaluation for Generative Research Synthesis},
|
| 25 |
+
author={Liana Patel and Negar Arabzadeh and Harshit Gupta and Ankita Sundar and Ion Stoica and Matei Zaharia and Carlos Guestrin},
|
| 26 |
+
year={2025},
|
| 27 |
+
eprint={2508.20033},
|
| 28 |
+
archivePrefix={arXiv},
|
| 29 |
+
primaryClass={cs.CL},
|
| 30 |
+
url={https://arxiv.org/abs/2508.20033},
|
| 31 |
+
}
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
_HOMEPAGE = "https://github.com/guestrin-lab/deepscholar-bench"
|
| 35 |
+
_LICENSE = "MIT"
|
| 36 |
+
|
| 37 |
+
# URLs to the dataset files
|
| 38 |
+
_URLS = {
|
| 39 |
+
"papers": "papers_with_related_works.csv",
|
| 40 |
+
"citations": "recovered_citations.csv",
|
| 41 |
+
"important_citations": "important_citations.csv",
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class LotusDeepResearchConfig(datasets.BuilderConfig):
|
| 46 |
+
"""BuilderConfig for LotusDeepResearch dataset."""
|
| 47 |
+
|
| 48 |
+
def __init__(self, name: str, description: str, **kwargs):
|
| 49 |
+
"""BuilderConfig for LotusDeepResearch.
|
| 50 |
+
|
| 51 |
+
Args:
|
| 52 |
+
name: Configuration name
|
| 53 |
+
description: Description of this configuration
|
| 54 |
+
**kwargs: Additional keyword arguments
|
| 55 |
+
"""
|
| 56 |
+
super(LotusDeepResearchConfig, self).__init__(
|
| 57 |
+
name=name,
|
| 58 |
+
description=description,
|
| 59 |
+
version=datasets.Version("1.0.0"),
|
| 60 |
+
**kwargs
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class LotusDeepResearch(datasets.GeneratorBasedBuilder):
|
| 65 |
+
"""Lotus Deep Research dataset."""
|
| 66 |
+
|
| 67 |
+
VERSION = datasets.Version("1.0.0")
|
| 68 |
+
|
| 69 |
+
BUILDER_CONFIGS = [
|
| 70 |
+
LotusDeepResearchConfig(
|
| 71 |
+
name="papers",
|
| 72 |
+
description="Academic papers with extracted related works sections (63 papers)",
|
| 73 |
+
),
|
| 74 |
+
LotusDeepResearchConfig(
|
| 75 |
+
name="citations",
|
| 76 |
+
description="Recovered citations with metadata (1630 citations)",
|
| 77 |
+
),
|
| 78 |
+
LotusDeepResearchConfig(
|
| 79 |
+
name="important_citations",
|
| 80 |
+
description="Important citations with metadata (1050 citations)",
|
| 81 |
+
),
|
| 82 |
+
LotusDeepResearchConfig(
|
| 83 |
+
name="full",
|
| 84 |
+
description="Complete dataset with both papers and citations",
|
| 85 |
+
),
|
| 86 |
+
]
|
| 87 |
+
|
| 88 |
+
DEFAULT_CONFIG_NAME = "full"
|
| 89 |
+
|
| 90 |
+
def _info(self) -> datasets.DatasetInfo:
|
| 91 |
+
"""Return the dataset info."""
|
| 92 |
+
|
| 93 |
+
if self.config.name == "papers":
|
| 94 |
+
features = datasets.Features({
|
| 95 |
+
"arxiv_id": datasets.Value("string"),
|
| 96 |
+
"title": datasets.Value("string"),
|
| 97 |
+
"authors": datasets.Value("string"),
|
| 98 |
+
"abstract": datasets.Value("string"),
|
| 99 |
+
"categories": datasets.Value("string"),
|
| 100 |
+
"published_date": datasets.Value("string"),
|
| 101 |
+
"updated_date": datasets.Value("string"),
|
| 102 |
+
"abs_url": datasets.Value("string"),
|
| 103 |
+
"arxiv_link": datasets.Value("string"),
|
| 104 |
+
"publication_date": datasets.Value("string"),
|
| 105 |
+
"raw_latex_related_works": datasets.Value("string"),
|
| 106 |
+
"clean_latex_related_works": datasets.Value("string"),
|
| 107 |
+
"pdf_related_works": datasets.Value("string"),
|
| 108 |
+
})
|
| 109 |
+
elif self.config.name == "citations":
|
| 110 |
+
features = datasets.Features({
|
| 111 |
+
"parent_paper_title": datasets.Value("string"),
|
| 112 |
+
"parent_paper_arxiv_id": datasets.Value("string"),
|
| 113 |
+
"citation_shorthand": datasets.Value("string"),
|
| 114 |
+
"raw_citation_text": datasets.Value("string"),
|
| 115 |
+
"cited_paper_title": datasets.Value("string"),
|
| 116 |
+
"cited_paper_arxiv_link": datasets.Value("string"),
|
| 117 |
+
"cited_paper_abstract": datasets.Value("string"),
|
| 118 |
+
"has_metadata": datasets.Value("bool"),
|
| 119 |
+
"is_arxiv_paper": datasets.Value("bool"),
|
| 120 |
+
"bib_paper_authors": datasets.Value("string"),
|
| 121 |
+
"bib_paper_year": datasets.Value("float32"),
|
| 122 |
+
"bib_paper_month": datasets.Value("string"),
|
| 123 |
+
"bib_paper_url": datasets.Value("string"),
|
| 124 |
+
"bib_paper_doi": datasets.Value("string"),
|
| 125 |
+
"bib_paper_journal": datasets.Value("string"),
|
| 126 |
+
"original_title": datasets.Value("string"),
|
| 127 |
+
"search_res_title": datasets.Value("string"),
|
| 128 |
+
"search_res_url": datasets.Value("string"),
|
| 129 |
+
"search_res_content": datasets.Value("string"),
|
| 130 |
+
})
|
| 131 |
+
elif self.config.name == "important_citations":
|
| 132 |
+
features = datasets.Features({
|
| 133 |
+
"parent_paper_title": datasets.Value("string"),
|
| 134 |
+
"parent_paper_arxiv_id": datasets.Value("string"),
|
| 135 |
+
"citation_shorthand": datasets.Value("string"),
|
| 136 |
+
"raw_citation_text": datasets.Value("string"),
|
| 137 |
+
"cited_paper_title": datasets.Value("string"),
|
| 138 |
+
"cited_paper_arxiv_link": datasets.Value("string"),
|
| 139 |
+
"cited_paper_abstract": datasets.Value("string"),
|
| 140 |
+
"has_metadata": datasets.Value("bool"),
|
| 141 |
+
"is_arxiv_paper": datasets.Value("bool"),
|
| 142 |
+
"cited_paper_authors": datasets.Value("string"),
|
| 143 |
+
"bib_paper_year": datasets.Value("float32"),
|
| 144 |
+
"bib_paper_month": datasets.Value("string"),
|
| 145 |
+
"bib_paper_url": datasets.Value("string"),
|
| 146 |
+
"bib_paper_doi": datasets.Value("string"),
|
| 147 |
+
"bib_paper_journal": datasets.Value("string"),
|
| 148 |
+
"original_title": datasets.Value("string"),
|
| 149 |
+
"search_res_title": datasets.Value("string"),
|
| 150 |
+
"search_res_url": datasets.Value("string"),
|
| 151 |
+
"search_res_content": datasets.Value("string"),
|
| 152 |
+
"arxiv_id": datasets.Value("string"),
|
| 153 |
+
"arxiv_link": datasets.Value("string"),
|
| 154 |
+
"publication_date": datasets.Value("string"),
|
| 155 |
+
"title": datasets.Value("string"),
|
| 156 |
+
"abstract": datasets.Value("string"),
|
| 157 |
+
"raw_latex_related_works": datasets.Value("string"),
|
| 158 |
+
"related_work_section": datasets.Value("string"),
|
| 159 |
+
"pdf_related_works": datasets.Value("string"),
|
| 160 |
+
"cited_paper_content": datasets.Value("string"),
|
| 161 |
+
})
|
| 162 |
+
else: # full config
|
| 163 |
+
features = datasets.Features({
|
| 164 |
+
# Papers features
|
| 165 |
+
"papers": datasets.Sequence({
|
| 166 |
+
"arxiv_id": datasets.Value("string"),
|
| 167 |
+
"title": datasets.Value("string"),
|
| 168 |
+
"authors": datasets.Value("string"),
|
| 169 |
+
"abstract": datasets.Value("string"),
|
| 170 |
+
"categories": datasets.Value("string"),
|
| 171 |
+
"published_date": datasets.Value("string"),
|
| 172 |
+
"updated_date": datasets.Value("string"),
|
| 173 |
+
"abs_url": datasets.Value("string"),
|
| 174 |
+
"arxiv_link": datasets.Value("string"),
|
| 175 |
+
"publication_date": datasets.Value("string"),
|
| 176 |
+
"raw_latex_related_works": datasets.Value("string"),
|
| 177 |
+
"clean_latex_related_works": datasets.Value("string"),
|
| 178 |
+
"pdf_related_works": datasets.Value("string"),
|
| 179 |
+
}),
|
| 180 |
+
# Citations features
|
| 181 |
+
"citations": datasets.Sequence({
|
| 182 |
+
"parent_paper_title": datasets.Value("string"),
|
| 183 |
+
"parent_paper_arxiv_id": datasets.Value("string"),
|
| 184 |
+
"citation_shorthand": datasets.Value("string"),
|
| 185 |
+
"raw_citation_text": datasets.Value("string"),
|
| 186 |
+
"cited_paper_title": datasets.Value("string"),
|
| 187 |
+
"cited_paper_arxiv_link": datasets.Value("string"),
|
| 188 |
+
"cited_paper_abstract": datasets.Value("string"),
|
| 189 |
+
"has_metadata": datasets.Value("bool"),
|
| 190 |
+
"is_arxiv_paper": datasets.Value("bool"),
|
| 191 |
+
"bib_paper_authors": datasets.Value("string"),
|
| 192 |
+
"bib_paper_year": datasets.Value("float32"),
|
| 193 |
+
"bib_paper_month": datasets.Value("string"),
|
| 194 |
+
"bib_paper_url": datasets.Value("string"),
|
| 195 |
+
"bib_paper_doi": datasets.Value("string"),
|
| 196 |
+
"bib_paper_journal": datasets.Value("string"),
|
| 197 |
+
"original_title": datasets.Value("string"),
|
| 198 |
+
"search_res_title": datasets.Value("string"),
|
| 199 |
+
"search_res_url": datasets.Value("string"),
|
| 200 |
+
"search_res_content": datasets.Value("string"),
|
| 201 |
+
}),
|
| 202 |
+
"important_citations": datasets.Sequence({
|
| 203 |
+
"parent_paper_title": datasets.Value("string"),
|
| 204 |
+
"parent_paper_arxiv_id": datasets.Value("string"),
|
| 205 |
+
"citation_shorthand": datasets.Value("string"),
|
| 206 |
+
"raw_citation_text": datasets.Value("string"),
|
| 207 |
+
"cited_paper_title": datasets.Value("string"),
|
| 208 |
+
"cited_paper_arxiv_link": datasets.Value("string"),
|
| 209 |
+
"cited_paper_abstract": datasets.Value("string"),
|
| 210 |
+
"has_metadata": datasets.Value("bool"),
|
| 211 |
+
"is_arxiv_paper": datasets.Value("bool"),
|
| 212 |
+
"cited_paper_authors": datasets.Value("string"),
|
| 213 |
+
"bib_paper_year": datasets.Value("float32"),
|
| 214 |
+
"bib_paper_month": datasets.Value("string"),
|
| 215 |
+
"bib_paper_url": datasets.Value("string"),
|
| 216 |
+
"bib_paper_doi": datasets.Value("string"),
|
| 217 |
+
"bib_paper_journal": datasets.Value("string"),
|
| 218 |
+
"original_title": datasets.Value("string"),
|
| 219 |
+
"search_res_title": datasets.Value("string"),
|
| 220 |
+
"search_res_url": datasets.Value("string"),
|
| 221 |
+
"search_res_content": datasets.Value("string"),
|
| 222 |
+
"arxiv_id": datasets.Value("string"),
|
| 223 |
+
"arxiv_link": datasets.Value("string"),
|
| 224 |
+
"publication_date": datasets.Value("string"),
|
| 225 |
+
"title": datasets.Value("string"),
|
| 226 |
+
"abstract": datasets.Value("string"),
|
| 227 |
+
"raw_latex_related_works": datasets.Value("string"),
|
| 228 |
+
"related_work_section": datasets.Value("string"),
|
| 229 |
+
"pdf_related_works": datasets.Value("string"),
|
| 230 |
+
"cited_paper_content": datasets.Value("string"),
|
| 231 |
+
})
|
| 232 |
+
})
|
| 233 |
+
|
| 234 |
+
return datasets.DatasetInfo(
|
| 235 |
+
description=_DESCRIPTION,
|
| 236 |
+
features=features,
|
| 237 |
+
homepage=_HOMEPAGE,
|
| 238 |
+
license=_LICENSE,
|
| 239 |
+
citation=_CITATION,
|
| 240 |
+
)
|
| 241 |
+
|
| 242 |
+
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
| 243 |
+
"""Return the dataset splits."""
|
| 244 |
+
|
| 245 |
+
# For local files, use the actual file paths
|
| 246 |
+
import os
|
| 247 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 248 |
+
|
| 249 |
+
if self.config.name == "papers":
|
| 250 |
+
data_file = os.path.join(current_dir, "papers_with_related_works.csv")
|
| 251 |
+
return [
|
| 252 |
+
datasets.SplitGenerator(
|
| 253 |
+
name=datasets.Split.TRAIN,
|
| 254 |
+
gen_kwargs={
|
| 255 |
+
"filepath": data_file,
|
| 256 |
+
"split": "papers"
|
| 257 |
+
},
|
| 258 |
+
),
|
| 259 |
+
]
|
| 260 |
+
elif self.config.name == "citations":
|
| 261 |
+
data_file = os.path.join(current_dir, "recovered_citations.csv")
|
| 262 |
+
return [
|
| 263 |
+
datasets.SplitGenerator(
|
| 264 |
+
name=datasets.Split.TRAIN,
|
| 265 |
+
gen_kwargs={
|
| 266 |
+
"filepath": data_file,
|
| 267 |
+
"split": "citations"
|
| 268 |
+
},
|
| 269 |
+
),
|
| 270 |
+
]
|
| 271 |
+
elif self.config.name == "important_citations":
|
| 272 |
+
data_file = os.path.join(current_dir, "important_citations.csv")
|
| 273 |
+
return [
|
| 274 |
+
datasets.SplitGenerator(
|
| 275 |
+
name=datasets.Split.TRAIN,
|
| 276 |
+
gen_kwargs={
|
| 277 |
+
"filepath": data_file,
|
| 278 |
+
"split": "important_citations"
|
| 279 |
+
},
|
| 280 |
+
),
|
| 281 |
+
]
|
| 282 |
+
else: # full config
|
| 283 |
+
papers_file = os.path.join(current_dir, "papers_with_related_works.csv")
|
| 284 |
+
citations_file = os.path.join(current_dir, "recovered_citations.csv")
|
| 285 |
+
important_citations_file = os.path.join(current_dir, "important_citations.csv")
|
| 286 |
+
return [
|
| 287 |
+
datasets.SplitGenerator(
|
| 288 |
+
name="papers",
|
| 289 |
+
gen_kwargs={
|
| 290 |
+
"filepath": papers_file,
|
| 291 |
+
"split": "papers"
|
| 292 |
+
},
|
| 293 |
+
),
|
| 294 |
+
datasets.SplitGenerator(
|
| 295 |
+
name="citations",
|
| 296 |
+
gen_kwargs={
|
| 297 |
+
"filepath": citations_file,
|
| 298 |
+
"split": "citations"
|
| 299 |
+
},
|
| 300 |
+
),
|
| 301 |
+
datasets.SplitGenerator(
|
| 302 |
+
name="important_citations",
|
| 303 |
+
gen_kwargs={
|
| 304 |
+
"filepath": important_citations_file,
|
| 305 |
+
"split": "important_citations"
|
| 306 |
+
},
|
| 307 |
+
),
|
| 308 |
+
]
|
| 309 |
+
|
| 310 |
+
def _generate_examples(self, filepath: str, split: str):
|
| 311 |
+
"""Generate examples from the dataset."""
|
| 312 |
+
|
| 313 |
+
def _safe_bool_convert(value: str) -> bool:
|
| 314 |
+
"""Safely convert string to boolean."""
|
| 315 |
+
if isinstance(value, str):
|
| 316 |
+
return value.lower() in ('true', 'yes', '1')
|
| 317 |
+
return bool(value)
|
| 318 |
+
|
| 319 |
+
def _safe_float_convert(value: str) -> Optional[float]:
|
| 320 |
+
"""Safely convert string to float."""
|
| 321 |
+
if not value or value.strip() == '' or value.lower() == 'nan':
|
| 322 |
+
return None
|
| 323 |
+
try:
|
| 324 |
+
return float(value)
|
| 325 |
+
except (ValueError, TypeError):
|
| 326 |
+
return None
|
| 327 |
+
|
| 328 |
+
if split == "papers":
|
| 329 |
+
with open(filepath, encoding="utf-8") as f:
|
| 330 |
+
reader = csv.DictReader(f)
|
| 331 |
+
for key, row in enumerate(reader):
|
| 332 |
+
yield key, {
|
| 333 |
+
"arxiv_id": row.get("arxiv_id", ""),
|
| 334 |
+
"title": row.get("title", ""),
|
| 335 |
+
"authors": row.get("authors", ""),
|
| 336 |
+
"abstract": row.get("abstract", ""),
|
| 337 |
+
"categories": row.get("categories", ""),
|
| 338 |
+
"published_date": row.get("published_date", ""),
|
| 339 |
+
"updated_date": row.get("updated_date", ""),
|
| 340 |
+
"abs_url": row.get("abs_url", ""),
|
| 341 |
+
"arxiv_link": row.get("arxiv_link", ""),
|
| 342 |
+
"publication_date": row.get("publication_date", ""),
|
| 343 |
+
"raw_latex_related_works": row.get("raw_latex_related_works", ""),
|
| 344 |
+
"clean_latex_related_works": row.get("clean_latex_related_works", ""),
|
| 345 |
+
"pdf_related_works": row.get("pdf_related_works", ""),
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
elif split == "citations":
|
| 349 |
+
with open(filepath, encoding="utf-8") as f:
|
| 350 |
+
reader = csv.DictReader(f)
|
| 351 |
+
for key, row in enumerate(reader):
|
| 352 |
+
yield key, {
|
| 353 |
+
"parent_paper_title": row.get("parent_paper_title", ""),
|
| 354 |
+
"parent_paper_arxiv_id": row.get("parent_paper_arxiv_id", ""),
|
| 355 |
+
"citation_shorthand": row.get("citation_shorthand", ""),
|
| 356 |
+
"raw_citation_text": row.get("raw_citation_text", ""),
|
| 357 |
+
"cited_paper_title": row.get("cited_paper_title", ""),
|
| 358 |
+
"cited_paper_arxiv_link": row.get("cited_paper_arxiv_link", ""),
|
| 359 |
+
"cited_paper_abstract": row.get("cited_paper_abstract", ""),
|
| 360 |
+
"has_metadata": _safe_bool_convert(row.get("has_metadata", "False")),
|
| 361 |
+
"is_arxiv_paper": _safe_bool_convert(row.get("is_arxiv_paper", "False")),
|
| 362 |
+
"bib_paper_authors": row.get("bib_paper_authors", ""),
|
| 363 |
+
"bib_paper_year": _safe_float_convert(row.get("bib_paper_year", "")),
|
| 364 |
+
"bib_paper_month": row.get("bib_paper_month", ""),
|
| 365 |
+
"bib_paper_url": row.get("bib_paper_url", ""),
|
| 366 |
+
"bib_paper_doi": row.get("bib_paper_doi", ""),
|
| 367 |
+
"bib_paper_journal": row.get("bib_paper_journal", ""),
|
| 368 |
+
"original_title": row.get("original_title", ""),
|
| 369 |
+
"search_res_title": row.get("search_res_title", ""),
|
| 370 |
+
"search_res_url": row.get("search_res_url", ""),
|
| 371 |
+
"search_res_content": row.get("search_res_content", ""),
|
| 372 |
+
}
|
| 373 |
+
elif split == "important_citations":
|
| 374 |
+
with open(filepath, encoding="utf-8") as f:
|
| 375 |
+
reader = csv.DictReader(f)
|
| 376 |
+
for key, row in enumerate(reader):
|
| 377 |
+
yield key, {
|
| 378 |
+
"parent_paper_title": row.get("parent_paper_title", ""),
|
| 379 |
+
"parent_paper_arxiv_id": row.get("parent_paper_arxiv_id", ""),
|
| 380 |
+
"citation_shorthand": row.get("citation_shorthand", ""),
|
| 381 |
+
"raw_citation_text": row.get("raw_citation_text", ""),
|
| 382 |
+
"cited_paper_title": row.get("cited_paper_title", ""),
|
| 383 |
+
"cited_paper_arxiv_link": row.get("cited_paper_arxiv_link", ""),
|
| 384 |
+
"cited_paper_abstract": row.get("cited_paper_abstract", ""),
|
| 385 |
+
"has_metadata": _safe_bool_convert(row.get("has_metadata", "False")),
|
| 386 |
+
"is_arxiv_paper": _safe_bool_convert(row.get("is_arxiv_paper", "False")),
|
| 387 |
+
"bib_paper_authors": row.get("bib_paper_authors", ""),
|
| 388 |
+
"bib_paper_year": _safe_float_convert(row.get("bib_paper_year", "")),
|
| 389 |
+
"bib_paper_month": row.get("bib_paper_month", ""),
|
| 390 |
+
"bib_paper_url": row.get("bib_paper_url", ""),
|
| 391 |
+
"bib_paper_doi": row.get("bib_paper_doi", ""),
|
| 392 |
+
"bib_paper_journal": row.get("bib_paper_journal", ""),
|
| 393 |
+
"original_title": row.get("original_title", ""),
|
| 394 |
+
"search_res_title": row.get("search_res_title", ""),
|
| 395 |
+
"search_res_url": row.get("search_res_url", ""),
|
| 396 |
+
"search_res_content": row.get("search_res_content", ""),
|
| 397 |
+
}
|
papers.csv
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
papers_with_related_works.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
usage_example.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Usage example for the Lotus Deep Research dataset.
|
| 4 |
+
|
| 5 |
+
This shows how to use the dataset builder directly, which is the recommended approach
|
| 6 |
+
for local development and testing.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
import sys
|
| 10 |
+
import os
|
| 11 |
+
from pathlib import Path
|
| 12 |
+
|
| 13 |
+
# Add the current directory to Python path
|
| 14 |
+
sys.path.insert(0, str(Path(__file__).parent))
|
| 15 |
+
|
| 16 |
+
from lotus_deep_research import LotusDeepResearch
|
| 17 |
+
import pandas as pd
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def load_papers_dataset():
|
| 21 |
+
"""Load the papers dataset."""
|
| 22 |
+
print("Loading papers dataset...")
|
| 23 |
+
|
| 24 |
+
# Create dataset builder
|
| 25 |
+
builder = LotusDeepResearch(config_name="papers")
|
| 26 |
+
|
| 27 |
+
# Mock download manager for local files
|
| 28 |
+
class MockDownloadManager:
|
| 29 |
+
def download_and_extract(self, url_or_path):
|
| 30 |
+
return url_or_path
|
| 31 |
+
|
| 32 |
+
dl_manager = MockDownloadManager()
|
| 33 |
+
|
| 34 |
+
# Get split generators and load data
|
| 35 |
+
split_generators = builder._split_generators(dl_manager)
|
| 36 |
+
split_gen = split_generators[0] # Get train split
|
| 37 |
+
|
| 38 |
+
# Collect all examples
|
| 39 |
+
papers_data = []
|
| 40 |
+
for key, example in builder._generate_examples(
|
| 41 |
+
split_gen.gen_kwargs["filepath"],
|
| 42 |
+
split_gen.gen_kwargs["split"]
|
| 43 |
+
):
|
| 44 |
+
papers_data.append(example)
|
| 45 |
+
|
| 46 |
+
print(f"Loaded {len(papers_data)} papers")
|
| 47 |
+
return papers_data
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def load_citations_dataset():
|
| 51 |
+
"""Load the citations dataset."""
|
| 52 |
+
print("Loading citations dataset...")
|
| 53 |
+
|
| 54 |
+
# Create dataset builder
|
| 55 |
+
builder = LotusDeepResearch(config_name="citations")
|
| 56 |
+
|
| 57 |
+
# Mock download manager for local files
|
| 58 |
+
class MockDownloadManager:
|
| 59 |
+
def download_and_extract(self, url_or_path):
|
| 60 |
+
return url_or_path
|
| 61 |
+
|
| 62 |
+
dl_manager = MockDownloadManager()
|
| 63 |
+
|
| 64 |
+
# Get split generators and load data
|
| 65 |
+
split_generators = builder._split_generators(dl_manager)
|
| 66 |
+
split_gen = split_generators[0] # Get train split
|
| 67 |
+
|
| 68 |
+
# Collect all examples
|
| 69 |
+
citations_data = []
|
| 70 |
+
for key, example in builder._generate_examples(
|
| 71 |
+
split_gen.gen_kwargs["filepath"],
|
| 72 |
+
split_gen.gen_kwargs["split"]
|
| 73 |
+
):
|
| 74 |
+
citations_data.append(example)
|
| 75 |
+
|
| 76 |
+
print(f"Loaded {len(citations_data)} citations")
|
| 77 |
+
return citations_data
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
def load_important_citations_dataset():
|
| 81 |
+
"""Load the important citations dataset."""
|
| 82 |
+
print("Loading important citations dataset...")
|
| 83 |
+
|
| 84 |
+
# Create dataset builder
|
| 85 |
+
builder = LotusDeepResearch(config_name="important_citations")
|
| 86 |
+
|
| 87 |
+
# Mock download manager for local files
|
| 88 |
+
class MockDownloadManager:
|
| 89 |
+
def download_and_extract(self, url_or_path):
|
| 90 |
+
return url_or_path
|
| 91 |
+
|
| 92 |
+
dl_manager = MockDownloadManager()
|
| 93 |
+
|
| 94 |
+
# Get split generators and load data
|
| 95 |
+
split_generators = builder._split_generators(dl_manager)
|
| 96 |
+
split_gen = split_generators[0] # Get train split
|
| 97 |
+
|
| 98 |
+
# Collect all examples
|
| 99 |
+
important_citations_data = []
|
| 100 |
+
for key, example in builder._generate_examples(
|
| 101 |
+
split_gen.gen_kwargs["filepath"],
|
| 102 |
+
split_gen.gen_kwargs["split"]
|
| 103 |
+
):
|
| 104 |
+
important_citations_data.append(example)
|
| 105 |
+
|
| 106 |
+
print(f"Loaded {len(important_citations_data)} important citations")
|
| 107 |
+
return important_citations_data
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def main():
|
| 111 |
+
"""Main example function."""
|
| 112 |
+
print("Lotus Deep Research Dataset - Usage Example")
|
| 113 |
+
print("=" * 50)
|
| 114 |
+
|
| 115 |
+
# Load datasets
|
| 116 |
+
papers = load_papers_dataset()
|
| 117 |
+
citations = load_citations_dataset()
|
| 118 |
+
important_citations = load_important_citations_dataset()
|
| 119 |
+
|
| 120 |
+
print("\n📊 Dataset Statistics:")
|
| 121 |
+
print(f" - Papers: {len(papers)}")
|
| 122 |
+
print(f" - Citations: {len(citations)}")
|
| 123 |
+
print(f" - Important Citations: {len(important_citations)}")
|
| 124 |
+
|
| 125 |
+
# Show sample paper
|
| 126 |
+
if papers:
|
| 127 |
+
sample_paper = papers[0]
|
| 128 |
+
print(f"\n📄 Sample Paper:")
|
| 129 |
+
print(f" - Title: {sample_paper['title']}")
|
| 130 |
+
print(f" - ArXiv ID: {sample_paper['arxiv_id']}")
|
| 131 |
+
print(f" - Authors: {sample_paper['authors'][:100]}...")
|
| 132 |
+
print(f" - Abstract: {sample_paper['abstract'][:200]}...")
|
| 133 |
+
|
| 134 |
+
# Show sample citation
|
| 135 |
+
if citations:
|
| 136 |
+
sample_citation = citations[0]
|
| 137 |
+
print(f"\n📚 Sample Citation:")
|
| 138 |
+
print(f" - Parent Paper: {sample_citation['parent_paper_title']}")
|
| 139 |
+
print(f" - Cited Paper: {sample_citation['cited_paper_title']}")
|
| 140 |
+
print(f" - Has Metadata: {sample_citation['has_metadata']}")
|
| 141 |
+
print(f" - Is ArXiv Paper: {sample_citation['is_arxiv_paper']}")
|
| 142 |
+
|
| 143 |
+
# Show sample important citation
|
| 144 |
+
if important_citations:
|
| 145 |
+
sample_important_citation = important_citations[0]
|
| 146 |
+
print(f"\n⭐ Sample Important Citation:")
|
| 147 |
+
print(f" - Parent Paper: {sample_important_citation['parent_paper_title']}")
|
| 148 |
+
print(f" - Cited Paper: {sample_important_citation['cited_paper_title']}")
|
| 149 |
+
print(f" - Has Metadata: {sample_important_citation['has_metadata']}")
|
| 150 |
+
print(f" - Is ArXiv Paper: {sample_important_citation['is_arxiv_paper']}")
|
| 151 |
+
|
| 152 |
+
# Convert to pandas for easier analysis
|
| 153 |
+
print(f"\n🐼 Converting to Pandas DataFrames...")
|
| 154 |
+
papers_df = pd.DataFrame(papers)
|
| 155 |
+
citations_df = pd.DataFrame(citations)
|
| 156 |
+
important_citations_df = pd.DataFrame(important_citations)
|
| 157 |
+
|
| 158 |
+
print(f" - Papers DataFrame: {papers_df.shape}")
|
| 159 |
+
print(f" - Citations DataFrame: {citations_df.shape}")
|
| 160 |
+
print(f" - Important Citations DataFrame: {important_citations_df.shape}")
|
| 161 |
+
|
| 162 |
+
# Show some analysis
|
| 163 |
+
print(f"\n📈 Quick Analysis:")
|
| 164 |
+
print(f" - Unique parent papers in citations: {citations_df['parent_paper_arxiv_id'].nunique()}")
|
| 165 |
+
print(f" - Citations with metadata: {citations_df['has_metadata'].sum()}")
|
| 166 |
+
print(f" - ArXiv citations: {citations_df['is_arxiv_paper'].sum()}")
|
| 167 |
+
print(f" - Unique parent papers in important citations: {important_citations_df['parent_paper_arxiv_id'].nunique()}")
|
| 168 |
+
print(f" - Important citations with metadata: {important_citations_df['has_metadata'].sum()}")
|
| 169 |
+
print(f" - ArXiv important citations: {important_citations_df['is_arxiv_paper'].sum()}")
|
| 170 |
+
|
| 171 |
+
return papers_df, citations_df, important_citations_df
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
if __name__ == "__main__":
|
| 175 |
+
papers_df, citations_df, important_citations_df = main()
|