Skip to content

Commit

Permalink
Revisions
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDowney committed Nov 16, 2024
1 parent 16883ef commit 79e3f95
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions examples/zipf.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"source": [
"This post is based on *Think Bayes 2e*, which is available from\n",
"[Bookshop.org](https://bookshop.org/a/98697/9781492089469) and\n",
"[Amazon](https://amzn.to/334eqGo)."
"[Amazon](https://amzn.to/334eqGo).\n",
"\n",
"[Click here to run this notebook on Colab](https://colab.research.google.com/github/AllenDowney/ThinkBayes2/blob/master/examples/zipf.ipynb)."
]
},
{
Expand Down Expand Up @@ -155,10 +157,9 @@
"import re\n",
"from collections import Counter\n",
"\n",
"counter = Counter()\n",
"\n",
"pattern = r\"[ /\\n]+|--\"\n",
"\n",
"counter = Counter()\n",
"for line in generate_lines():\n",
" words = re.split(pattern, line)[1:]\n",
" counter.update(word.lower() for word in words if word)"
Expand Down Expand Up @@ -1257,7 +1258,11 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"tags": [
"remove-cell"
]
},
"source": [
"Copyright 2024 Allen B. Downey\n",
"\n",
Expand Down

0 comments on commit 79e3f95

Please sign in to comment.