Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,128 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
task_categories:
|
| 4 |
+
- question-answering
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- agent
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Mathematics Stack Exchange Q&A Dataset
|
| 12 |
+
|
| 13 |
+
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.
|
| 14 |
+
|
| 15 |
+
## Dataset summary
|
| 16 |
+
|
| 17 |
+
- Source: Mathematics Stack Exchange (via the official Stack Exchange API)
|
| 18 |
+
- Content: High-quality Q&A pairs (question title + body, top answer body)
|
| 19 |
+
- Formats: CSV and JSON
|
| 20 |
+
- Typical fields:
|
| 21 |
+
- `question_id` (int)
|
| 22 |
+
- `question_title` (string)
|
| 23 |
+
- `question_body` (string, cleaned of HTML)
|
| 24 |
+
- `question_score` (int)
|
| 25 |
+
- `question_tags` (string, comma-separated)
|
| 26 |
+
- `question_url` (string)
|
| 27 |
+
- `answer_body` (string, cleaned of HTML; empty if no answer)
|
| 28 |
+
- `answer_score` (int)
|
| 29 |
+
- `answer_accepted` (bool)
|
| 30 |
+
- `combined_text` (string, "Q: <title>\n\n<body>\n\nA: <answer or placeholder>")
|
| 31 |
+
- `scraped_at` (ISO 8601 timestamp)
|
| 32 |
+
|
| 33 |
+
Example CSV header:
|
| 34 |
+
```
|
| 35 |
+
question_id,question_title,question_body,question_score,question_tags,question_url,answer_body,answer_score,answer_accepted,combined_text,scraped_at
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
## License and attribution
|
| 40 |
+
|
| 41 |
+
Content in this dataset is user-contributed content from Stack Exchange and is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.
|
| 42 |
+
|
| 43 |
+
When using or redistributing the dataset, include attribution. A suggested attribution statement:
|
| 44 |
+
|
| 45 |
+
"Data from Mathematics Stack Exchange (math.stackexchange.com). Licensed under CC BY-SA 4.0."
|
| 46 |
+
|
| 47 |
+
Also include a link to the original question pages (the `question_url` field) when practical.
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
## How the dataset was generated
|
| 51 |
+
|
| 52 |
+
The dataset was produced by a script that uses the official Stack Exchange API:
|
| 53 |
+
|
| 54 |
+
- Requests top-voted mathematics questions (configurable count)
|
| 55 |
+
- For each question, fetches the top answer (if any)
|
| 56 |
+
- Cleans HTML from bodies (HTML entities unescaped and tags removed), collapses whitespace
|
| 57 |
+
- Produces both CSV and JSON exports
|
| 58 |
+
- Respects rate limits and inserts polite delays
|
| 59 |
+
|
| 60 |
+
Notes:
|
| 61 |
+
- 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.
|
| 62 |
+
- For reproducibility, include the script, the exact arguments used, and the timestamp of generation.
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
## Regenerating the dataset
|
| 66 |
+
|
| 67 |
+
Prerequisites:
|
| 68 |
+
- Python 3.8+ (or compatible)
|
| 69 |
+
- `requests` (for API calls)
|
| 70 |
+
- Optional: a Stack Exchange API key (recommended for higher rate limits)
|
| 71 |
+
|
| 72 |
+
Important considerations:
|
| 73 |
+
- Respect Stack Exchange API rate limits; use an API key if you will fetch many pages.
|
| 74 |
+
- The script should include backoff/retry and delays between requests; do not parallelize requests without careful rate-limit handling.
|
| 75 |
+
- If exporting large datasets, consider paging and storing intermediate results.
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
## Data quality & known limitations
|
| 79 |
+
|
| 80 |
+
- 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.
|
| 81 |
+
- Only the top answer (by score) is captured — accepted vs. highest-scored may differ; both are recorded if available.
|
| 82 |
+
- Potential biases:
|
| 83 |
+
- Questions with higher votes and English-language questions are overrepresented if using a top-voted query.
|
| 84 |
+
- Highly specialized or duplicate content may appear.
|
| 85 |
+
- Empty `answer_body` means no answer was available at scraping time.
|
| 86 |
+
- Some fields may contain non-ASCII characters; files are exported with UTF-8 encoding.
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
## Suggested preprocessing for ML
|
| 90 |
+
|
| 91 |
+
- Deduplicate entries by `question_id`.
|
| 92 |
+
- Normalize or preserve LaTeX as needed (consider using a LaTeX-aware tokenizer when training models that must understand formulas).
|
| 93 |
+
- Truncate or chunk very long texts (both question and answer) when fitting into model context windows.
|
| 94 |
+
- Optionally filter by tags for domain-specific datasets (e.g., `algebra`, `calculus`, `probability`).
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
## Use cases
|
| 98 |
+
|
| 99 |
+
- Training and evaluating question-answering systems and math tutoring chatbots
|
| 100 |
+
- Fine-tuning language models on math Q&A patterns
|
| 101 |
+
- Research on problem-solving strategies and reasoning in mathematics
|
| 102 |
+
- Building retrieval-augmented systems with real Q&A examples
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
## Privacy, ethics, and policy
|
| 106 |
+
|
| 107 |
+
- The dataset contains user-contributed content under CC BY-SA; comply with the license and provide attribution.
|
| 108 |
+
- Do not claim the content as your own; include proper attribution and linkbacks where practical.
|
| 109 |
+
- Avoid publishing personally identifiable information beyond what is already publicly available on Stack Exchange.
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
## Citation
|
| 113 |
+
|
| 114 |
+
If you use this dataset in publications, we suggest citing it as:
|
| 115 |
+
|
| 116 |
+
Furkan Nar or https://github.com/TheOfficialFurkanNar/StackMathematics. (2026). Mathematics Stack Exchange Q&A Dataset. Retrieved from https://github.com/TheOfficialFurkanNar/StackMathematics (data originally from mathematics.stackexchange.com; licensed CC BY-SA 4.0)
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
## Contact
|
| 120 |
+
Contact via:
|
| 121 |
+
furkannar168@hotmail.com
|
| 122 |
+
For questions about this dataset or generation script, open an issue in this repository or contact the maintainer.
|
| 123 |
+
|
| 124 |
+
## Community & Support
|
| 125 |
+
|
| 126 |
+
Join the community to ask questions, discuss the dataset, and get help:
|
| 127 |
+
|
| 128 |
+
- Discord: https://discord.gg/dcjh8S5H
|