Skip to content

Commit a1e72c1

Browse files
committed
Update documentation
1 parent f77d5c2 commit a1e72c1

File tree

9 files changed

+176
-184
lines changed

9 files changed

+176
-184
lines changed

_sources/chap11.ipynb

Lines changed: 164 additions & 172 deletions
Large diffs are not rendered by default.

_sources/chap12.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"source": [
4646
"# Text Analysis and Generation\n",
4747
"\n",
48-
"At this point we have covered Python's core data structures -- lists, dictionaries, and tuples -- and and some algorithms that use them.\n",
48+
"At this point we have covered Python's core data structures -- lists, dictionaries, and tuples -- and some algorithms that use them.\n",
4949
"In this chapter, we'll use them to explore text analysis and Markov generation:\n",
5050
"\n",
5151
"* Text analysis is a way to describe the statistical relationships between the words in a document, like the probability that one word is followed by another, and\n",

_sources/chap13.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
"id": "f652aaac",
478478
"metadata": {},
479479
"source": [
480-
"To write this data to a file, you can use the `write` method, which we saw in [Chapter 8](section_writing_files).\n",
480+
"To write this data to a file, you can use the `write` method, which we saw in Chapter 8.\n",
481481
"The argument of `write` has to be a string, so if we want to put other values in a file, we have to convert them to strings.\n",
482482
"The easiest way to do that is with the built-in function `str`.\n",
483483
"\n",

_sources/chap18.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,7 @@
24702470
"metadata": {},
24712471
"source": [
24722472
"`run_unittest` does not take `TestExample` as an argument -- instead, it searches for classes that inherit from `TestCase`.\n",
2473-
"Then is searches for methods that begin with `test` and runs them.\n",
2473+
"Then it searches for methods that begin with `test` and runs them.\n",
24742474
"This process is called **test discovery**.\n",
24752475
"\n",
24762476
"Here's what happens when we call `run_unittest`."

chap11.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ <h2><span class="section-number">11.1. </span>Tuples are like lists<a class="hea
572572
</div>
573573
</div>
574574
<div class="cell_output docutils container">
575-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;reversed at 0x7f114c1217b0&gt;
575+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;reversed at 0x7f23a9a32b60&gt;
576576
</pre></div>
577577
</div>
578578
</div>
@@ -999,7 +999,7 @@ <h2><span class="section-number">11.6. </span>Zip<a class="headerlink" href="#zi
999999
</div>
10001000
</div>
10011001
<div class="cell_output docutils container">
1002-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;zip at 0x7f1136705b80&gt;
1002+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;zip at 0x7f23a9a7bdc0&gt;
10031003
</pre></div>
10041004
</div>
10051005
</div>
@@ -1104,7 +1104,7 @@ <h2><span class="section-number">11.6. </span>Zip<a class="headerlink" href="#zi
11041104
</div>
11051105
</div>
11061106
<div class="cell_output docutils container">
1107-
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;enumerate at 0x7f114c127640&gt;
1107+
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>&lt;enumerate at 0x7f23a808afc0&gt;
11081108
</pre></div>
11091109
</div>
11101110
</div>
@@ -1333,7 +1333,7 @@ <h2><span class="section-number">11.8. </span>Inverting a dictionary<a class="he
13331333
<p>Lists, dictionaries and tuples are <strong>data structures</strong>.
13341334
In this chapter we are starting to see compound data structures, like lists of tuples, or dictionaries that contain tuples as keys and lists as values.
13351335
Compound data structures are useful, but they are prone to errors caused when a data structure has the wrong type, size, or structure.
1336-
For example, if a function expects a list if integers and you give it a plain old integer
1336+
For example, if a function expects a list of integers and you give it a plain old integer
13371337
(not in a list), it probably won’t work.</p>
13381338
<p>To help debug these kinds of errors, I wrote a module called <code class="docutils literal notranslate"><span class="pre">structshape</span></code> that provides a function, also called <code class="docutils literal notranslate"><span class="pre">structshape</span></code>, that takes any kind of data structure as an argument and returns a string that summarizes its structure.
13391339
You can download it from
@@ -1495,7 +1495,7 @@ <h3><span class="section-number">11.11.2. </span>Exercise<a class="headerlink" h
14951495
<div class="cell_output docutils container">
14961496
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
14971497
<span class="ne">TypeError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
1498-
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">76</span><span class="p">],</span> <span class="n">line</span> <span class="mi">1</span>
1498+
<span class="n">Cell</span> <span class="n">In</span><span class="p">[</span><span class="mi">77</span><span class="p">],</span> <span class="n">line</span> <span class="mi">1</span>
14991499
<span class="ne">----&gt; </span><span class="mi">1</span> <span class="n">d</span> <span class="o">=</span> <span class="p">{</span><span class="n">t</span><span class="p">:</span> <span class="s1">&#39;this tuple contains two lists&#39;</span><span class="p">}</span>
15001500
<span class="n">d</span> <span class="o">=</span> <span class="p">{</span><span class="mi">1</span><span class="p">:</span> <span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="mi">2</span><span class="p">:</span> <span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="mi">3</span><span class="p">:</span> <span class="s1">&#39;c&#39;</span><span class="p">}</span>
15011501
<span class="n">t</span> <span class="o">=</span> <span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">])</span>

chap12.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ <h2> Contents </h2>
399399
<a class="reference external" href="https://www.amazon.com/_/dp/1098155432?smid=ATVPDKIKX0DER&amp;amp;_encoding=UTF8&amp;amp;tag=oreilly20-20&amp;amp;_encoding=UTF8&amp;amp;tag=greenteapre01-20&amp;amp;linkCode=ur2&amp;amp;linkId=e2a529f94920295d27ec8a06e757dc7c&amp;amp;camp=1789&amp;amp;creative=9325">Amazon</a>.</p>
400400
<section id="text-analysis-and-generation">
401401
<h1><span class="section-number">12. </span>Text Analysis and Generation<a class="headerlink" href="#text-analysis-and-generation" title="Link to this heading">#</a></h1>
402-
<p>At this point we have covered Python’s core data structures – lists, dictionaries, and tuples – and and some algorithms that use them.
402+
<p>At this point we have covered Python’s core data structures – lists, dictionaries, and tuples – and some algorithms that use them.
403403
In this chapter, we’ll use them to explore text analysis and Markov generation:</p>
404404
<ul class="simple">
405405
<li><p>Text analysis is a way to describe the statistical relationships between the words in a document, like the probability that one word is followed by another, and</p></li>

chap13.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ <h2><span class="section-number">13.2. </span>f-strings<a class="headerlink" hre
564564
</div>
565565
</div>
566566
</div>
567-
<p>To write this data to a file, you can use the <code class="docutils literal notranslate"><span class="pre">write</span></code> method, which we saw in <a class="reference internal" href="chap08.html#section-writing-files"><span class="std std-ref">Chapter 8</span></a>.
567+
<p>To write this data to a file, you can use the <code class="docutils literal notranslate"><span class="pre">write</span></code> method, which we saw in Chapter 8.
568568
The argument of <code class="docutils literal notranslate"><span class="pre">write</span></code> has to be a string, so if we want to put other values in a file, we have to convert them to strings.
569569
The easiest way to do that is with the built-in function <code class="docutils literal notranslate"><span class="pre">str</span></code>.</p>
570570
<p>Here’s what that looks like:</p>

chap18.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ <h2><span class="section-number">18.9. </span>Debugging<a class="headerlink" hre
14021402
</div>
14031403
</div>
14041404
<p><code class="docutils literal notranslate"><span class="pre">run_unittest</span></code> does not take <code class="docutils literal notranslate"><span class="pre">TestExample</span></code> as an argument – instead, it searches for classes that inherit from <code class="docutils literal notranslate"><span class="pre">TestCase</span></code>.
1405-
Then is searches for methods that begin with <code class="docutils literal notranslate"><span class="pre">test</span></code> and runs them.
1405+
Then it searches for methods that begin with <code class="docutils literal notranslate"><span class="pre">test</span></code> and runs them.
14061406
This process is called <strong>test discovery</strong>.</p>
14071407
<p>Here’s what happens when we call <code class="docutils literal notranslate"><span class="pre">run_unittest</span></code>.</p>
14081408
<div class="cell docutils container">

searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)