Datasets:

Modalities:
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
Dask
License:
File size: 8,888 Bytes
845d1b4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7f76548
845d1b4
d870c3a
d8026b3
d870c3a
 
 
 
 
 
 
 
 
d8026b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d870c3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
---
dataset_info:
  features:
  - name: project
    dtype: string
  - name: source
    dtype: string
  - name: language
    dtype: string
  - name: content
    dtype: string
  splits:
  - name: train
    num_bytes: 5421472234
    num_examples: 59733
  download_size: 1850870873
  dataset_size: 5421472234
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train-*
license: apache-2.0
---

# Dataset Card

This dataset is the code documenation dataset used in [StarCoder2](https://huggingface.co/papers/2402.19173) pre-training, and it is also part of the-stack-v2-train-extras descried in the paper.

## Dataset Details

### Overview

This dataset comprises a comprehensive collection of crawled documentation and code-related resources sourced from various package manager platforms and programming language documentation sites. It focuses on popular libraries, free programming books, and other relevant materials, facilitating research in software development, programming language trends, and documentation analysis.

### How to Use it

```python
from datasets import load_dataset

ds = load_dataset("SivilTaram/starcoder2-documentation")
```

### Data Fields

- **`project`** (`string`): The name or identifier of the project on each platform.
- **`source`** (`string`): The platform from which the documentation data is sourced.
- **`language`** (`string`): The identified programming language associated with the project.
- **`content`** (`string`): The text content of each document, formatted in Markdown.

### Related Resources

For additional tools and methods related to converting HTML to Markdown, refer to the GitHub repository: [code-html-to-markdown](https://github.com/SivilTaram/code-html-to-markdown).

### Data Sources

1. **Package Managers:**
   - **npm:** Node.js package manager.
   - **PyPI:** Python Package Index.
   - **Go Packages:** Go programming language packages.
   - **Packagist:** PHP package repository.
   - **Rubygems:** Ruby package manager.
   - **Cargo:** Rust package manager.
   - **CocoaPods:** Dependency manager for Swift and Objective-C Cocoa projects.
   - **Bower:** Front-end package manager.
   - **CPAN:** Comprehensive Perl Archive Network.
   - **Clojars:** Clojure library repository.
   - **Conda:** Package manager for data science and scientific computing.
   - **Hex:** Package manager for the Elixir programming language.
   - **Julia:** Package manager for the Julia programming language.

2. **Documentation Websites:**
   - A carefully curated list of programming-related websites, including Read the Docs and other well-known resources.

3. **Free Programming Books:**
   - Sources from the **Free Programming Books** project, which promotes the availability of free programming e-books across various languages.


### Data Collection Process

1. **Library Retrieval:**
   - The process begins by identifying the most popular libraries across the aforementioned platforms using [libraries.io](libraries.io).
   - These library names serve as search queries to obtain their respective homepages.

2. **Documentation Extraction:**
   - **Homepage Links:** Documentation files are crawled from the retrieved homepage links. If no dedicated documentation is found, README or equivalent files on the package manager platforms are utilized.
   - **Processing Strategy:** For documents obtained through homepage links, the same processing strategy is applied as outlined for website crawls, ensuring consistent formatting and extraction quality.
   - **Prioritization:** For libraries hosted on PyPI and Conda, documentation on [Read the Docs](https://about.readthedocs.com/) is prioritized due to its comprehensive nature.

3. **PDF Extraction:**
   - For R language documentation, text is extracted from all PDFs hosted on **CRAN** using the **pdftotext** library, which effectively preserves formatting.
   - For LaTeX packages, documentation, tutorials, and usage guide PDFs from **CTAN** are filtered, excluding image-heavy PDFs, and converted to markdown using the **Nougat** neural OCR tool.

4. **Web Crawling:**
   - Code documentation is collected from a curated list of websites by exploring from an initial URL, and the full list of all URLs can be found in the StarCoder2 paper.
   - A dynamic queue is employed to store URLs within the same domain, expanding as new links are discovered during the crawl.
   - The process focuses on (1) **content extraction** and (2) **content concatenation**:
     - **Content Extraction:** HTML pages are converted to XML using the **trafilatura** library, which eliminates redundant navigation elements.
     - **Content Concatenation:** Extracted content from different HTML pages is subjected to near-duplication checks using the **minhash locality-sensitive hashing** technique, applying a threshold of 0.7 to ensure unique content is retained.

5. **Free Textbooks:**
   - The dataset includes free programming books collected from the [Free Programming Books Project](https://github.com/EbookFoundation/free-programming-books). Links with a PDF extension are extracted, and all available PDFs are downloaded and processed for text extraction using the **pdf2text** library.

6. **Language Identification:**
   - A dual approach is utilized to identify the primary programming language of each document:
     - **Predefined Rules:** Applied when the document's source explicitly corresponds to a specific programming language.
     - **Guesslang Library:** Used in cases where the correspondence is not clear.

### Dataset Characteristics

- **Languages Covered:** English, Chinese, Japanese, Spanish, and others.
- **Document Types:** 
  - Code documentation files
  - PDF documents
  - HTML pages
  - E-books
- **Programming Languages Included:** 
  - Python
  - JavaScript
  - Rust
  - R
  - Go
  - PHP
  - Ruby
  - Haskell
  - Objective-C
  - SQL
  - YAML
  - TeX
  - Markdown
  - And more...

### Use Cases
- Analyzing trends in programming language documentation.
- Researching software development resources across multiple platforms.
- Training large language models on documentation datasets to better understand programming languages.
- Understanding the structure and accessibility of programming documentation.


## Citation

```bibtex
@article{DBLP:journals/corr/abs-2402-19173,
  author       = {Anton Lozhkov and
                  Raymond Li and
                  Loubna Ben Allal and
                  Federico Cassano and
                  Joel Lamy{-}Poirier and
                  Nouamane Tazi and
                  Ao Tang and
                  Dmytro Pykhtar and
                  Jiawei Liu and
                  Yuxiang Wei and
                  Tianyang Liu and
                  Max Tian and
                  Denis Kocetkov and
                  Arthur Zucker and
                  Younes Belkada and
                  Zijian Wang and
                  Qian Liu and
                  Dmitry Abulkhanov and
                  Indraneil Paul and
                  Zhuang Li and
                  Wen{-}Ding Li and
                  Megan Risdal and
                  Jia Li and
                  Jian Zhu and
                  Terry Yue Zhuo and
                  Evgenii Zheltonozhskii and
                  Nii Osae Osae Dade and
                  Wenhao Yu and
                  Lucas Krau{\ss} and
                  Naman Jain and
                  Yixuan Su and
                  Xuanli He and
                  Manan Dey and
                  Edoardo Abati and
                  Yekun Chai and
                  Niklas Muennighoff and
                  Xiangru Tang and
                  Muhtasham Oblokulov and
                  Christopher Akiki and
                  Marc Marone and
                  Chenghao Mou and
                  Mayank Mishra and
                  Alex Gu and
                  Binyuan Hui and
                  Tri Dao and
                  Armel Zebaze and
                  Olivier Dehaene and
                  Nicolas Patry and
                  Canwen Xu and
                  Julian J. McAuley and
                  Han Hu and
                  Torsten Scholak and
                  S{\'{e}}bastien Paquet and
                  Jennifer Robinson and
                  Carolyn Jane Anderson and
                  Nicolas Chapados and
                  et al.},
  title        = {StarCoder 2 and The Stack v2: The Next Generation},
  journal      = {CoRR},
  volume       = {abs/2402.19173},
  year         = {2024},
  url          = {https://doi.org/10.48550/arXiv.2402.19173},
  doi          = {10.48550/ARXIV.2402.19173},
  eprinttype    = {arXiv},
  eprint       = {2402.19173},
  timestamp    = {Tue, 06 Aug 2024 08:17:53 +0200},
  biburl       = {https://dblp.org/rec/journals/corr/abs-2402-19173.bib},
  bibsource    = {dblp computer science bibliography, https://dblp.org}
}
```