{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "374f4531-19cd-4686-aeeb-1fd74864b075",
   "metadata": {},
   "source": [
    "# Lecture 9 - Exercise"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "36fb41f0-6e55-47bf-a460-785c402c7c9d",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import seaborn as sns\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import nltk\n",
    "import spacy"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0e4e4cf1-581e-40d3-bae4-6da334f3c68e",
   "metadata": {},
   "source": [
    "Run this - it may take a minute:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2ce82a9a-c40a-4526-af82-fd809cd818e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "nlp = spacy.load('en_core_web_sm')\n",
    "nltk.download('inaugural')\n",
    "speeches = [nlp(nltk.corpus.inaugural.raw(f)) for f in nltk.corpus.inaugural.fileids()]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2e61c6a1-cf9e-4838-92c8-7a94af80414a",
   "metadata": {},
   "source": [
    "`speeches` is now a list of 60 spacy NLP objects (i.e., they've been analyzed by spacy)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e5d4c8ce-b544-4d82-8d6b-0f4a68f49edf",
   "metadata": {},
   "source": [
    "**Task 1**: Plot the number of tokens in a speech over time."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cd7f0410-a03e-4386-acf7-281359ae26bf",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "30a99f7b-6c12-49c0-bfba-a96273a287ed",
   "metadata": {},
   "source": [
    "**Task 2:** Make a plot showing the fraction of tokens in a speech that are adverbs (`pos_` is `ADV`) as a function of time."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "33d0cd06-bf34-4a7a-bb2f-ff71940de622",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "38eadf64-22c2-460d-abfc-20ff924c5098",
   "metadata": {},
   "source": [
    "**Task 3**: Do something else interesting!"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0e29ccef-51be-414f-b11f-1342e0e8ee48",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
