Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenDowney committed Nov 16, 2024
1 parent 0f3f562 commit 154de0e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
1 change: 0 additions & 1 deletion _sources/bookstore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"cells": [
{
"cell_type": "markdown",
"id": "1331faa1",
"metadata": {},
"source": [
"You can order print and ebook versions of *Think Bayes 2e* from\n",
Expand Down
13 changes: 9 additions & 4 deletions _sources/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
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions zipf.html
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ <h1>What’s a chartist?<a class="headerlink" href="#whats-a-chartist" title="Pe
<p>This post is based on <em>Think Bayes 2e</em>, which is available from
<a class="reference external" href="https://bookshop.org/a/98697/9781492089469">Bookshop.org</a> and
<a class="reference external" href="https://amzn.to/334eqGo">Amazon</a>.</p>
<p><a class="reference external" href="https://colab.research.google.com/github/AllenDowney/ThinkBayes2/blob/master/examples/zipf.ipynb">Click here to run this notebook on Colab</a>.</p>
<div class="cell tag_hide-cell docutils container">
<details class="hide above-input">
<summary aria-label="Toggle hidden content">
Expand Down Expand Up @@ -499,10 +500,9 @@ <h2>Word Frequencies<a class="headerlink" href="#word-frequencies" title="Permal
<div class="highlight-ipython3 notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">re</span>
<span class="kn">from</span> <span class="nn">collections</span> <span class="kn">import</span> <span class="n">Counter</span>

<span class="n">counter</span> <span class="o">=</span> <span class="n">Counter</span><span class="p">()</span>

<span class="n">pattern</span> <span class="o">=</span> <span class="sa">r</span><span class="s2">&quot;[ /\n]+|--&quot;</span>

<span class="n">counter</span> <span class="o">=</span> <span class="n">Counter</span><span class="p">()</span>
<span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">generate_lines</span><span class="p">():</span>
<span class="n">words</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="n">pattern</span><span class="p">,</span> <span class="n">line</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span>
<span class="n">counter</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">word</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="k">for</span> <span class="n">word</span> <span class="ow">in</span> <span class="n">words</span> <span class="k">if</span> <span class="n">word</span><span class="p">)</span>
Expand Down Expand Up @@ -1107,8 +1107,6 @@ <h2>The Update<a class="headerlink" href="#the-update" title="Permalink to this
And as I mentioned at the beginning, we should probably not take this conclusion to seriously.
If you hear a word for the first time after 50 years, there’s a good chance the word is “having a moment”, which greatly increases the chance you’ll hear it again.
I can’t think of why chartism might be in the news at the moment, but maybe this post will go viral and make it happen.</p>
<p>Copyright 2024 Allen B. Downey</p>
<p>License: <a class="reference external" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)</a></p>
</section>
</section>

Expand Down

0 comments on commit 154de0e

Please sign in to comment.