--- 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} } ```