{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "7fb27b941602401d91542211134fc71a",
   "metadata": {},
   "source": [
    "# Reproduce a FiveLetterWords data download\n",
    "Organisation author: FiveLetterWords. Derived data: CC BY 4.0.\n",
    "This example pins the September 2026 release and verifies its SHA-256 before parsing.\n",
    "These are completed-answer aggregates, not human playing outcomes. The excluded upstream answer-pool file retains separate source terms.\n",
    "[Methods and citation](https://www.fiveletterwords.io/data/releases/v2026-09-01)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "acae54e37e7d407bbb7b55eff062a284",
   "metadata": {},
   "outputs": [],
   "source": [
    "from urllib.request import Request, urlopen\n",
    "import csv\n",
    "import hashlib\n",
    "import io\n",
    "import json\n",
    "\n",
    "# Pin a release so re-running the notebook reads the same data.\n",
    "base = \"https://www.fiveletterwords.io/data/releases/v2026-09-01/\"\n",
    "with urlopen(\n",
    "    Request(base + \"manifest.json\", headers={\"User-Agent\": \"FiveLetterWordsResearchExample/1.0\"}),\n",
    "    timeout=30,\n",
    ") as response:\n",
    "    manifest = json.load(response)\n",
    "filename = \"answer-repeats.csv\"\n",
    "with urlopen(\n",
    "    Request(base + filename, headers={\"User-Agent\": \"FiveLetterWordsResearchExample/1.0\"}),\n",
    "    timeout=30,\n",
    ") as response:\n",
    "    raw = response.read()\n",
    "assert hashlib.sha256(raw).hexdigest() == manifest[\"files\"][filename][\"sha256\"]\n",
    "rows = list(csv.DictReader(io.StringIO(raw.decode(\"utf-8\"))))\n",
    "print(\"FiveLetterWords\", manifest[\"release\"], \"through\", manifest[\"answer_history_data_through\"])\n",
    "rows[:10]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9a63283cbaf04dbcab1f6479b197f3a8",
   "metadata": {},
   "source": [
    "Cite: FiveLetterWords (2026). *FiveLetterWords research release v2026-09-01* [Data set]. https://www.fiveletterwords.io/data/releases/v2026-09-01\n",
    "To analyse another release, change the pinned base URL and cite that exact release. A mutable /data/current/ download is useful for monitoring, but will not reproduce a fixed citation."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
