Skip to content

Commit 599635a

Browse files
committed
NLP: Update Notebook 05 with windows compatibility
1 parent bff6a21 commit 599635a

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

Ch7/05_MachineTranslation.ipynb

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,33 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 2,
12+
"execution_count": 1,
1313
"metadata": {},
1414
"outputs": [
1515
{
1616
"name": "stdout",
1717
"output_type": "stream",
1818
"text": [
19-
"Collecting requests\n",
20-
" Using cached https://files.pythonhosted.org/packages/1a/70/1935c770cb3be6e3a8b78ced23d7e0f3b187f5cbfab4749523ed65d7c9b1/requests-2.23.0-py2.py3-none-any.whl\n",
21-
"Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests)\n",
22-
" Using cached https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl\n",
23-
"Collecting chardet<4,>=3.0.2 (from requests)\n",
24-
" Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl\n",
25-
"Requirement already satisfied: certifi>=2017.4.17 in /home/etherealenvy/miniconda3/envs/practicalnlp/lib/python3.5/site-packages (from requests) (2018.8.24)\n",
26-
"Collecting idna<3,>=2.5 (from requests)\n",
27-
" Using cached https://files.pythonhosted.org/packages/89/e3/afebe61c546d18fb1709a61bee788254b40e736cff7271c7de5de2dc4128/idna-2.9-py2.py3-none-any.whl\n",
28-
"\u001b[31mjupyterlab-server 1.0.0 has requirement jsonschema>=3.0.1, but you'll have jsonschema 2.6.0 which is incompatible.\u001b[0m\n",
29-
"\u001b[31mjupyterlab 2.1.0 has requirement jupyterlab_server>=1.1.0, but you'll have jupyterlab-server 1.0.0 which is incompatible.\u001b[0m\n",
30-
"Installing collected packages: urllib3, chardet, idna, requests\n",
31-
"Successfully installed chardet-3.0.4 idna-2.9 requests-2.23.0 urllib3-1.25.9\n",
32-
"\u001b[33mYou are using pip version 10.0.1, however version 20.1 is available.\n",
33-
"You should consider upgrading via the 'pip install --upgrade pip' command.\u001b[0m\n"
19+
"Requirement already satisfied: requests in c:\\users\\sukee\\appdata\\local\\programs\\python\\python37\\lib\\site-packages (2.25.1)"
20+
]
21+
},
22+
{
23+
"name": "stderr",
24+
"output_type": "stream",
25+
"text": [
26+
"WARNING: You are using pip version 20.1.1; however, version 21.1.1 is available.\n",
27+
"You should consider upgrading via the 'c:\\users\\sukee\\appdata\\local\\programs\\python\\python37\\python.exe -m pip install --upgrade pip' command.\n"
28+
]
29+
},
30+
{
31+
"name": "stdout",
32+
"output_type": "stream",
33+
"text": [
34+
"\n",
35+
"Requirement already satisfied: chardet<5,>=3.0.2 in c:\\users\\sukee\\appdata\\local\\programs\\python\\python37\\lib\\site-packages (from requests) (4.0.0)\n",
36+
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\sukee\\appdata\\local\\programs\\python\\python37\\lib\\site-packages (from requests) (1.25.9)\n",
37+
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\sukee\\appdata\\local\\programs\\python\\python37\\lib\\site-packages (from requests) (2020.12.5)\n",
38+
"Requirement already satisfied: idna<3,>=2.5 in c:\\users\\sukee\\appdata\\local\\programs\\python\\python37\\lib\\site-packages (from requests) (2.10)\n"
3439
]
3540
}
3641
],
@@ -53,12 +58,14 @@
5358
"metadata": {},
5459
"outputs": [],
5560
"source": [
56-
"#You will need a subscription key - you can use trial version\n",
61+
"# You will need a subscription key - you can use trial version\n",
62+
"# This will be user based\n",
63+
"\n",
5764
"subscription_key = \"XXXX\"\n",
5865
"endpoint = \"https://api-nam.cognitive.microsofttranslator.com\"\n",
5966
"path = '/translate?api-version=3.0'\n",
6067
"params = '&to=de' #From English to German (de)\n",
61-
"constructed_url = endpoint + path + params\n"
68+
"constructed_url = endpoint + path + params"
6269
]
6370
},
6471
{
@@ -80,28 +87,15 @@
8087
"print(json.dumps(response, sort_keys=True, indent=4, separators=(',', ': ')))\n"
8188
]
8289
},
83-
{
84-
"cell_type": "markdown",
85-
"metadata": {},
86-
"source": [
87-
"Google Cloud also has a translate service, which can be explored as an additional exercise."
88-
]
89-
},
9090
{
9191
"cell_type": "code",
9292
"execution_count": null,
9393
"metadata": {},
9494
"outputs": [],
9595
"source": [
96+
"Google Cloud also has a translate service, which can be explored as an additional exercise.\n",
9697
"#todo: get a trial subscription key and show output for this, and perhaps add google example code from: https://cloud.google.com/translate/docs"
9798
]
98-
},
99-
{
100-
"cell_type": "code",
101-
"execution_count": null,
102-
"metadata": {},
103-
"outputs": [],
104-
"source": []
10599
}
106100
],
107101
"metadata": {
@@ -120,9 +114,9 @@
120114
"name": "python",
121115
"nbconvert_exporter": "python",
122116
"pygments_lexer": "ipython3",
123-
"version": "3.5.6"
117+
"version": "3.7.9"
124118
}
125119
},
126120
"nbformat": 4,
127-
"nbformat_minor": 2
121+
"nbformat_minor": 4
128122
}

0 commit comments

Comments
 (0)