herumb-stanford's picture
Update README.md
5a39d56 verified
metadata
license: cc
task_categories:
  - text-generation
language:
  - en

Marin Markdownified StackExchange

Markdownified Stack Exchange transforms the Stack Exchange's question-answer pairs into Markdown format consisting of 20.4B tokens. This dataset preserves the content contained in technical discussions while organizing it into a thread format for language model training.

Value
Tokens 20 413 785 853
Primary source https://archive.org/details/stackexchange
File format JSONL
License CC (mirrors upstream SE licenses)

Processing and Cleaning Pipeline

Our conversion pipeline combines several sophisticated techniques to transform raw Wikipedia HTML into high-quality Markdown:

  1. HTML Preprocessing: We start with the Stack Exachange Dump which provides XML representations of Posts

  2. Structured Q&A Format Each thread is formatted with clear section headings:

    • "# Question" with title and body
    • "# Answer" for each response
    • Vote counts are preserved next to each answer
    • Tags are appended at the bottom with a separator
  3. Template Variations

    • Answer templates are randomly varied
    • Vote counts may appear either before or after answer content
    • This randomization is seeded deterministically based on the question ID
  4. DOM Simplification: We employ a custom-enhanced version of Resiliparse that preserves semantic HTML structure. Rather than flattening to plain text, we retain important elements like headings, paragraphs, lists while removing scripts, tracking code, and boilerplate.

  5. Markdown Conversion: Our custom Markdownify implementation transforms the simplified DOM into clean Markdown. The final output stores each article as a JSON object containing the Markdown text and essential metadata.

Template Structure

Each entry in the dataset contains a complete question-answer thread with: - Original question title - Question body in full Markdown - Multiple answers (when available) with vote counts - Original tags - Creation date - URL reference

Example template:

# Question
Title: What is the h-index exactly and how does it work?
What is the h-index, and how does it work ?

# Answer
The h-index is a measure of the impact of someone's publication list. An h-index of 10 for example means that the person has published 10 papers with at least 10 citations. The total number of papers published may be higher, but only 10 will have 10 or more citations.

Critics argue that this measure disadvantages young researchers who did not have time to publish a lot and whose work has not been published for long and thus may not have attracted many citations. Other criticisms include that it makes a researcher focus on how to increase the citation count for a paper that may be not that good but would increase the h-index.

For more explanation, see for example the Wikipedia article.
> 35 votes

---
Tags: bibliometrics, methodology, ranking
---

Usage Example

from datasets import load_dataset

ds = load_dataset(
    "marin-community/stackexchange-markdown",
    split="train",
    streaming=True
)

for article in ds.take(3):
    print(article["text"])

Citation

If you use this dataset in your research, please cite both the original Wikipedia contributors and our work:

@misc{markdownified_ar5iv_2024,
  title        = {Markdownified StackExchange},
  author       = {The Marin Community},
  year         = {2024},
  url          = {https://huggingface.co/datasets/marin-community/stackexchange-markdown}
}

License

All content inherits StackExachange's licensing: CC. Our conversion tools and pipeline are released under Apache 2.0.

Acknowledgement

We extend our gratitude to: