--- license: mit task_categories: - question-answering language: - en tags: - agent --- # Mathematics Stack Exchange Q&A Dataset A curated dataset of question-and-answer pairs harvested from Mathematics Stack Exchange (math.stackexchange.com). Each entry contains the question, the top answer (if available), metadata (scores, tags, URL), and a combined Q/A text useful for training and evaluation of question-answering and tutoring models. ## Dataset summary - Source: Mathematics Stack Exchange (via the official Stack Exchange API) - Content: High-quality Q&A pairs (question title + body, top answer body) - Formats: CSV and JSON - Typical fields: - `question_id` (int) - `question_title` (string) - `question_body` (string, cleaned of HTML) - `question_score` (int) - `question_tags` (string, comma-separated) - `question_url` (string) - `answer_body` (string, cleaned of HTML; empty if no answer) - `answer_score` (int) - `answer_accepted` (bool) - `combined_text` (string, "Q: \n\n<body>\n\nA: <answer or placeholder>") - `scraped_at` (ISO 8601 timestamp) Example CSV header: ``` question_id,question_title,question_body,question_score,question_tags,question_url,answer_body,answer_score,answer_accepted,combined_text,scraped_at ``` ## How the dataset was generated The dataset was produced by a script that uses the official Stack Exchange API: - Requests top-voted mathematics questions (configurable count) - For each question, fetches the top answer (if any) - Cleans HTML from bodies (HTML entities unescaped and tags removed), collapses whitespace - Produces both CSV and JSON exports - Respects rate limits and inserts polite delays Notes: - The generator script is not included in this repository. If you want to include it, add the script file (for example `scripts/generate_math_se_dataset.py`) and reference it here. - For reproducibility, include the script, the exact arguments used, and the timestamp of generation. ## Data quality & known limitations - Bodies are cleaned of HTML but some formatting (math markup, code blocks, LaTeX) may be simplified or lost; consider preserving LaTeX if you need formula fidelity. - Only the top answer (by score) is captured — accepted vs. highest-scored may differ; both are recorded if available. - Potential biases: - Questions with higher votes and English-language questions are overrepresented if using a top-voted query. - Highly specialized or duplicate content may appear. - Empty `answer_body` means no answer was available at scraping time. - Some fields may contain non-ASCII characters; files are exported with UTF-8 encoding.