Skip to content

Commit 2e727f5

Browse files
committed
Updates for January 25, 2022 Course
Includes changes to the NLP content. TextBlob has deprecated its language translation feature so I added some new snippets using the deep_translator open source module.
1 parent fc639f7 commit 2e727f5

File tree

7 files changed

+285
-190
lines changed

7 files changed

+285
-190
lines changed

StartHere.ipynb

+65-26
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,45 @@
4141
"metadata": {
4242
"slideshow": {
4343
"slide_type": "slide"
44-
}
44+
},
45+
"tags": []
4546
},
4647
"source": [
4748
"# My Upcoming O'Reilly Live Training Courses\n",
4849
"https://deitel.com/LearnWithDeitel\n",
4950
"\n",
50-
"* **January 18**—Python Full Throttle \n",
51-
"* **January 25**—Python Data Science Full Throttle \n",
5251
"* **February 8**—Java Full Throttle \n",
5352
"* **February 15**—Python Full Throttle \n",
5453
"* **February 28**—Python Data Science Full Throttle \n",
55-
"* March schedule coming soon\n",
56-
"\n",
57-
"My Python courses run every 4-5 weeks and my Java course runs every 7-9 weeks. \n",
54+
"* **March 15**—Python Full Throttle \n",
55+
"* **March 22**—Python Data Science Full Throttle \n",
56+
"* April schedule coming soon\n",
5857
"\n",
58+
"My Python courses run every 4-5 weeks and my Java course runs every 7-9 weeks. "
59+
]
60+
},
61+
{
62+
"cell_type": "markdown",
63+
"metadata": {},
64+
"source": [
65+
"<hr style=\"height:2px; border:none; color:#000; background-color:#000;\">"
66+
]
67+
},
68+
{
69+
"cell_type": "markdown",
70+
"metadata": {
71+
"slideshow": {
72+
"slide_type": "slide"
73+
}
74+
},
75+
"source": [
5976
"# Other Courses and Content Under Development\n",
60-
"* **C++20 Full Throttle** (at least one course, maybe two)\n",
61-
"* **Java How to Program, 12/e** and **Java for Programmers** based on **Java 17** (LTS)\n",
62-
"* **Java Fundamentals LiveLessons** based on **Java 17** (LTS)\n",
63-
"* **C Fundamentals LiveLessons** \n",
64-
"* **C Full Throttle** webinar"
77+
"* **C++20 Full Throttle: Core Language** (Q2)\n",
78+
"* **C++20 Full Throttle: Standard Library** (Q3)\n",
79+
"* **Updated Java books, LiveLessons videos and Full Throttles** based on **Java 17** (LTS) and higher\n",
80+
"* **Updated Python books, LiveLessons videos and Full Throttles** based on **Python 3.10+** and latest library versions\n",
81+
"* (If time) **C Fundamentals LiveLessons** \n",
82+
"* (If time) **C Full Throttle** webinar"
6583
]
6684
},
6785
{
@@ -79,7 +97,9 @@
7997
}
8098
},
8199
"source": [
82-
"# Early Access on O'Reilly:<br/>**C++20 LiveLessons** Sneak Peek and<br/>**C++20 for Programmers** Rough Cut E-Book<br/>https://deitel.com/LearnWithDeitel\n",
100+
"# Going to Publication Next Week: **C++20 for Programmers** \n",
101+
"Early Access on O'Reilly to our **C++20 LiveLessons** Sneak Peek and E-Book: https://deitel.com/LearnWithDeitel\n",
102+
"\n",
83103
"<a href=\"https://learning.oreilly.com/videos/c20-fundamentals/9780136875185\"><img alt=\"C++ Fundamentals LiveLessons cover\" src=\"./images/cpp20ll.jpg\" width=\"200px\" border=\"1\"/></a>&nbsp;&nbsp;&nbsp;<a href=\"https://learning.oreilly.com/library/view/c20-for-programmers/9780136905776/\"><img alt=\"C++20 for Programmers cover\" src=\"./images/c-plus-plus-20-for-programmers.jpg\" width=\"184px\" border=\"1\"/></a>\n"
84104
]
85105
},
@@ -94,8 +114,8 @@
94114
"cell_type": "markdown",
95115
"metadata": {},
96116
"source": [
97-
"# C How to Program, 9/e:< with Application Programming and Systems Programming Case Studies\n",
98-
"**E-mail **paul@deitel.com** with questions.\n",
117+
"# C How to Program, 9/e: with Application Programming and Systems Programming Case Studies\n",
118+
"**E-mail paul@deitel.com** with questions.\n",
99119
"\n",
100120
"<a style=\"float: left; padding-right:30px\" href=\"https://deitel.com/c-how-to-program-9-e/\"><img alt=\"C How to Program, 9/e\" src=\"https://deitel.com/wp-content/uploads/2021/02/c-how-to-program-9-e.jpg\" width=\"200px\" border=\"1\"/></a>\n",
101121
"\n",
@@ -394,27 +414,45 @@
394414
"metadata": {
395415
"slideshow": {
396416
"slide_type": "slide"
397-
}
417+
},
418+
"tags": []
398419
},
399420
"source": [
400421
"# My Upcoming O'Reilly Live Training Courses\n",
401422
"https://deitel.com/LearnWithDeitel\n",
402423
"\n",
403-
"* **January 18**&mdash;Python Full Throttle \n",
404-
"* **January 25**&mdash;Python Data Science Full Throttle \n",
405424
"* **February 8**&mdash;Java Full Throttle \n",
406425
"* **February 15**&mdash;Python Full Throttle \n",
407426
"* **February 28**&mdash;Python Data Science Full Throttle \n",
408-
"* March schedule coming soon\n",
409-
"\n",
410-
"My Python courses run every 4-5 weeks and my Java course runs every 7-9 weeks. \n",
427+
"* **March 15**&mdash;Python Full Throttle \n",
428+
"* **March 22**&mdash;Python Data Science Full Throttle \n",
429+
"* April schedule coming soon\n",
411430
"\n",
431+
"My Python courses run every 4-5 weeks and my Java course runs every 7-9 weeks. "
432+
]
433+
},
434+
{
435+
"cell_type": "markdown",
436+
"metadata": {},
437+
"source": [
438+
"<hr style=\"height:2px; border:none; color:#000; background-color:#000;\">"
439+
]
440+
},
441+
{
442+
"cell_type": "markdown",
443+
"metadata": {
444+
"slideshow": {
445+
"slide_type": "slide"
446+
}
447+
},
448+
"source": [
412449
"# Other Courses and Content Under Development\n",
413-
"* **C++20 Full Throttle** (at least one course, maybe two)\n",
414-
"* **Java How to Program, 12/e** and **Java for Programmers** based on **Java 17** (LTS)\n",
415-
"* **Java Fundamentals LiveLessons** based on **Java 17** (LTS)\n",
416-
"* **C Fundamentals LiveLessons** \n",
417-
"* **C Full Throttle** webinar"
450+
"* **C++20 Full Throttle: Core Language** (Q2)\n",
451+
"* **C++20 Full Throttle: Standard Library** (Q3)\n",
452+
"* **Updated Java books, LiveLessons videos and Full Throttles** based on **Java 17** (LTS) and higher\n",
453+
"* **Updated Python books, LiveLessons videos and Full Throttles** based on **Python 3.10+** and latest library versions\n",
454+
"* (If time) **C Fundamentals LiveLessons** \n",
455+
"* (If time) **C Full Throttle** webinar"
418456
]
419457
},
420458
{
@@ -453,7 +491,8 @@
453491
}
454492
},
455493
"source": [
456-
"# Early Access on O'Reilly:<br/>**C++20 LiveLessons** Sneak Peek and<br/>**C++20 for Programmers** Rough Cut E-Book<br/>https://deitel.com/LearnWithDeitel\n",
494+
"# **C++20 for Programmers** and **C++20 Fundamentals LiveLessons videos** https://deitel.com/LearnWithDeitel\n",
495+
"\n",
457496
"<a style=\"float:left; padding-right:10px; width: 200px;\" href=\"https://learning.oreilly.com/videos/c20-fundamentals/9780136875185\"><img alt=\"C++ Fundamentals LiveLessons cover\" src=\"./images/cpp20ll.jpg\" border=\"1\"/></a>\n",
458497
"\n",
459498
"<a style=\"float:left; padding-right:10px; width:184px;\" href=\"https://learning.oreilly.com/library/view/c20-for-programmers/9780136905776/\"><img alt=\"C++20 for Programmers cover\" src=\"./images/c-plus-plus-20-for-programmers.jpg\" border=\"1\"/></a>\n"

ch11/Ch11.ipynb

+43-20
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@
188188
"metadata": {},
189189
"source": [
190190
"## 11.2.3 Parts-of-Speech (POS) Tagging\n",
191-
"* `TextBlob` uses [**pattern library**](https://github.com/clips/pattern) to determine **parts-of-speech**\n",
192-
" * Pattern's [63 parts-of-speech tags](https://www.clips.uantwerpen.be/pages/MBSP-tags)"
191+
"* `nltk` [**parts-of-speech** tags](https://www.guru99.com/pos-tagging-chunking-nltk.html)"
193192
]
194193
},
195194
{
@@ -366,12 +365,12 @@
366365
]
367366
},
368367
{
369-
"cell_type": "code",
370-
"execution_count": null,
368+
"cell_type": "markdown",
371369
"metadata": {},
372-
"outputs": [],
373370
"source": [
374-
"spanish = blob.translate(to='es') # translate to target language Spanish ('es') "
371+
"**NOTE:** TextBlob translate method is now deprecated. Instead, you can install https://deep-translator.readthedocs.io/en/latest/\n",
372+
"\n",
373+
"> `pip install -U deep_translator`\n"
375374
]
376375
},
377376
{
@@ -380,7 +379,7 @@
380379
"metadata": {},
381380
"outputs": [],
382381
"source": [
383-
"spanish"
382+
"from deep_translator import GoogleTranslator"
384383
]
385384
},
386385
{
@@ -389,7 +388,7 @@
389388
"metadata": {},
390389
"outputs": [],
391390
"source": [
392-
"chinese = blob.translate(to='zh') # translate to Simplified Chinese ('zh') "
391+
"GoogleTranslator.get_supported_languages(as_dict=True) # dictionary of supported languages"
393392
]
394393
},
395394
{
@@ -398,22 +397,26 @@
398397
"metadata": {},
399398
"outputs": [],
400399
"source": [
401-
"chinese "
400+
"# autodetect source language and translate to Spanish\n",
401+
"spanish = GoogleTranslator(source='auto', target='es').translate(blob.string) "
402402
]
403403
},
404404
{
405-
"cell_type": "markdown",
405+
"cell_type": "code",
406+
"execution_count": null,
406407
"metadata": {},
408+
"outputs": [],
407409
"source": [
408-
"<hr style=\"height:2px; border:none; color:#000; background-color:#000;\">"
410+
"# spanish = blob.translate(to='es') # translate to target language Spanish ('es') "
409411
]
410412
},
411413
{
412-
"cell_type": "markdown",
414+
"cell_type": "code",
415+
"execution_count": null,
413416
"metadata": {},
417+
"outputs": [],
414418
"source": [
415-
"## 11.2.7 Language Detection and Translation (3 of 3)\n",
416-
"* Notice **differences** in the **text translated back to English** from Spanish and Chinese "
419+
"spanish"
417420
]
418421
},
419422
{
@@ -422,7 +425,8 @@
422425
"metadata": {},
423426
"outputs": [],
424427
"source": [
425-
"blob"
428+
"# autodetect source language and translate to Spanish\n",
429+
"chinese = GoogleTranslator(source='auto', target='zh-CN').translate(blob.string)"
426430
]
427431
},
428432
{
@@ -431,16 +435,33 @@
431435
"metadata": {},
432436
"outputs": [],
433437
"source": [
434-
"spanish = TextBlob('Ayer fue un hermoso día. Mañana parece mal tiempo.')"
438+
"chinese "
439+
]
440+
},
441+
{
442+
"cell_type": "markdown",
443+
"metadata": {},
444+
"source": [
445+
"<hr style=\"height:2px; border:none; color:#000; background-color:#000;\">"
446+
]
447+
},
448+
{
449+
"cell_type": "markdown",
450+
"metadata": {},
451+
"source": [
452+
"## 11.2.7 Language Detection and Translation (3 of 3)\n",
453+
"* Notice **differences** in the **text translated back to English** from Spanish and Chinese "
435454
]
436455
},
437456
{
438457
"cell_type": "code",
439458
"execution_count": null,
440-
"metadata": {},
459+
"metadata": {
460+
"tags": []
461+
},
441462
"outputs": [],
442463
"source": [
443-
"spanish.translate() # autodetect source language; translates to English by default"
464+
"blob"
444465
]
445466
},
446467
{
@@ -449,7 +470,8 @@
449470
"metadata": {},
450471
"outputs": [],
451472
"source": [
452-
"chinese = TextBlob('昨天是美好的一天。明天看起来天气不好。')"
473+
"# autodetect source language and translate to English\n",
474+
"GoogleTranslator(source='auto', target='en').translate(spanish) "
453475
]
454476
},
455477
{
@@ -460,7 +482,8 @@
460482
},
461483
"outputs": [],
462484
"source": [
463-
"chinese.translate()"
485+
"# autodetect source language and translate to English\n",
486+
"GoogleTranslator(source='auto', target='en').translate(chinese) "
464487
]
465488
},
466489
{

ch12/Ch12.ipynb

+1-2
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@
709709
"### Automatic Paging\n",
710710
"* To **get up to 200 followers at a time**, create the `Cursor` with the **`count`** keyword argument\n",
711711
">```python\n",
712-
"cursor = tweepy.Cursor(api.followers, screen_name='nasa', count=200)\n",
712+
"cursor = tweepy.Cursor(api.get_followers, screen_name='nasa', count=200)\n",
713713
"```\n",
714714
"* Calling `Cursor` method **`items`** with no argument attempts to get **all followers**\n",
715715
" * Could **take significant time** due to **rate limits**"
@@ -1249,7 +1249,6 @@
12491249
{
12501250
"cell_type": "markdown",
12511251
"metadata": {
1252-
"jp-MarkdownHeadingCollapsed": true,
12531252
"tags": []
12541253
},
12551254
"source": [

ch13/Ch13.ipynb

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
},
1010
{
1111
"cell_type": "markdown",
12-
"metadata": {},
12+
"metadata": {
13+
"jp-MarkdownHeadingCollapsed": true,
14+
"tags": []
15+
},
1316
"source": [
1417
"# 13. IBM Watson and Cognitive Computing"
1518
]
@@ -130,6 +133,12 @@
130133
"pip install pydub \n",
131134
"```\n",
132135
"\n",
136+
"These are also installable now with conda, which will auto install `portaudio` if necessary:\n",
137+
"```\n",
138+
"conda install pyaudio \n",
139+
"conda install pydub \n",
140+
"```\n",
141+
"\n",
133142
"**Mac users** might first need to execute\n",
134143
">`conda install -c conda-forge portaudio`\n"
135144
]

ch14/Ch14.ipynb

+15-5
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@
10081008
"source": [
10091009
"estimators = {\n",
10101010
" 'KNeighborsClassifier': knn, \n",
1011-
" 'SVC': SVC(gamma='scale'),\n",
1011+
" 'SVC': SVC(),\n",
10121012
" 'GaussianNB': GaussianNB()}"
10131013
]
10141014
},
@@ -1112,7 +1112,8 @@
11121112
"metadata": {},
11131113
"source": [
11141114
"# 14.4 Case Study: Time Series and Simple Linear Regression \n",
1115-
"\\[**Note:** I no longer cover this case study in this webinar due to lack of time. See the full presentation in my [**Python Fundamentals** videos (8 videos in this case study)](https://learning.oreilly.com/videos/python-fundamentals/9780135917411/9780135917411-PFLL_Lesson14_23)\\]\n",
1115+
"**Note:** I no longer cover this case study in this webinar due to lack of time. See the full presentation in my [**Python Fundamentals** videos (8 videos in this case study)](https://learning.oreilly.com/videos/python-fundamentals/9780135917411/9780135917411-PFLL_Lesson14_23)\n",
1116+
"\n",
11161117
"* **Simple linear regression** is the **simplest** regression algorithm\n",
11171118
"* Given a collection of numeric values representing an **independent variable** and a **dependent variable**, simple linear regression **describes the relationship between these variables with a straight line**, known as the **regression line**\n",
11181119
"* Using a **time series** of average New York City January high-temperature data for 1895 through 2018, we'll\n",
@@ -1134,7 +1135,8 @@
11341135
"metadata": {},
11351136
"source": [
11361137
"# 14.5 Case Study: Multiple Linear Regression with the California Housing Dataset\n",
1137-
"\\[**Note:** I no longer cover this case study in this webinar due to lack of time. See the full presentation in my [**Python Fundamentals** videos (10 videos in this case study)](https://learning.oreilly.com/videos/python-fundamentals/9780135917411/9780135917411-PFLL_Lesson14_31)\\]\n",
1138+
"**Note:** I no longer cover this case study in this webinar due to lack of time. See the full presentation in my [**Python Fundamentals** videos (10 videos in this case study)](https://learning.oreilly.com/videos/python-fundamentals/9780135917411/9780135917411-PFLL_Lesson14_31)\n",
1139+
"\n",
11381140
"* [**California Housing dataset**](http://lib.stat.cmu.edu/datasets) bundled with scikit-learn \n",
11391141
"* **Larger real-world dataset** \n",
11401142
" **20,640 samples**, each with **eight numerical features**\n",
@@ -1280,7 +1282,7 @@
12801282
"metadata": {},
12811283
"outputs": [],
12821284
"source": [
1283-
"tsne = TSNE(n_components=2, random_state=11)"
1285+
"tsne = TSNE(n_components=2, random_state=11) "
12841286
]
12851287
},
12861288
{
@@ -1464,7 +1466,6 @@
14641466
{
14651467
"cell_type": "markdown",
14661468
"metadata": {
1467-
"jp-MarkdownHeadingCollapsed": true,
14681469
"tags": []
14691470
},
14701471
"source": [
@@ -1911,6 +1912,15 @@
19111912
"print(kmeans.labels_[100:150])"
19121913
]
19131914
},
1915+
{
1916+
"cell_type": "code",
1917+
"execution_count": null,
1918+
"metadata": {},
1919+
"outputs": [],
1920+
"source": [
1921+
"kmeans.cluster_centers_"
1922+
]
1923+
},
19141924
{
19151925
"cell_type": "markdown",
19161926
"metadata": {},

ch15/Ch15.ipynb

+63-60
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)