Skip to content

Commit 28c9f2d

Browse files
committed
refactor: correcting notebook examples
BREAKING CHANGE: This is a breaking change. BREAKING CHANGE: This is a breaking change.
1 parent 3945ff6 commit 28c9f2d

2 files changed

Lines changed: 50 additions & 52 deletions

File tree

examples/notebooks/assistant_v1.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"import sys\n",
1818
"import os\n",
1919
"sys.path.append(os.path.join(os.getcwd(),'..','..'))\n",
20-
"import watson_developer_cloud"
20+
"import ibm_watson"
2121
]
2222
},
2323
{
@@ -35,7 +35,7 @@
3535
"metadata": {},
3636
"outputs": [],
3737
"source": [
38-
"assistant = watson_developer_cloud.AssistantV1(iam_apikey=API_KEY,\n",
38+
"assistant = ibm_watson.AssistantV1(iam_apikey=API_KEY,\n",
3939
" version='2018-07-10')"
4040
]
4141
},

examples/notebooks/natural_language_understanding_v1.ipynb

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,105 +2,103 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 4,
6-
"metadata": {
7-
"collapsed": true,
8-
"deletable": true,
9-
"editable": true
10-
},
5+
"execution_count": 1,
6+
"metadata": {},
117
"outputs": [],
128
"source": [
139
"import sys\n",
1410
"import os\n",
1511
"sys.path.append(os.path.join(os.getcwd(),'..'))\n",
16-
"import watson_developer_cloud\n",
17-
"from watson_developer_cloud.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions"
12+
"import ibm_watson\n",
13+
"from ibm_watson.natural_language_understanding_v1 import Features, EntitiesOptions, KeywordsOptions"
1814
]
1915
},
2016
{
2117
"cell_type": "code",
22-
"execution_count": 3,
23-
"metadata": {
24-
"collapsed": false,
25-
"deletable": true,
26-
"editable": true
27-
},
18+
"execution_count": 2,
19+
"metadata": {},
2820
"outputs": [],
2921
"source": [
30-
"nlu = watson_developer_cloud.NaturalLanguageUnderstandingV1(version='2017-02-27',\n",
31-
" username='USERNAME',\n",
32-
" password='PASSWORD')"
22+
"nlu = ibm_watson.NaturalLanguageUnderstandingV1(version='2018-03-16',\n",
23+
" iam_apikey='YOUR API KEY')"
3324
]
3425
},
3526
{
3627
"cell_type": "code",
37-
"execution_count": 6,
38-
"metadata": {
39-
"collapsed": false,
40-
"deletable": true,
41-
"editable": true
42-
},
28+
"execution_count": 3,
29+
"metadata": {},
4330
"outputs": [
4431
{
4532
"data": {
4633
"text/plain": [
47-
"{'entities': [{'count': 3,\n",
48-
" 'relevance': 0.915411,\n",
49-
" 'text': 'Bruce Banner',\n",
50-
" 'type': 'Person'},\n",
51-
" {'count': 1, 'relevance': 0.296395, 'text': 'Wayne', 'type': 'Person'}],\n",
52-
" 'keywords': [{'relevance': 0.984789, 'text': 'Bruce Banner'},\n",
53-
" {'relevance': 0.958833, 'text': 'Bruce Wayne'},\n",
54-
" {'relevance': 0.853322, 'text': 'experimental text'},\n",
55-
" {'relevance': 0.627454, 'text': 'Hulk'},\n",
56-
" {'relevance': 0.619956, 'text': 'Superman'},\n",
57-
" {'relevance': 0.583188, 'text': 'BATMAN'}],\n",
58-
" 'language': 'en'}"
34+
"{u'entities': [{u'count': 2,\n",
35+
" u'relevance': 0.919052,\n",
36+
" u'text': u'Bruce Banner',\n",
37+
" u'type': u'Person'},\n",
38+
" {u'count': 2,\n",
39+
" u'relevance': 0.861216,\n",
40+
" u'text': u'Bruce Wayne',\n",
41+
" u'type': u'Person'}],\n",
42+
" u'keywords': [{u'count': 1,\n",
43+
" u'relevance': 0.997922,\n",
44+
" u'text': u'Bruce Banner iis'},\n",
45+
" {u'count': 1, u'relevance': 0.968563, u'text': u'Bruce Wayne'},\n",
46+
" {u'count': 1, u'relevance': 0.939485, u'text': u'Superman fears'},\n",
47+
" {u'count': 1, u'relevance': 0.633474, u'text': u'Hulk'},\n",
48+
" {u'count': 1, u'relevance': 0.620977, u'text': u'Banner'},\n",
49+
" {u'count': 1, u'relevance': 0.550403, u'text': u'BATMAN'},\n",
50+
" {u'count': 1, u'relevance': 0.530623, u'text': u'Wayne'},\n",
51+
" {u'count': 1, u'relevance': 0.374627, u'text': u'experimental text'}],\n",
52+
" u'language': u'en',\n",
53+
" u'usage': {u'features': 2, u'text_characters': 121, u'text_units': 1}}"
5954
]
6055
},
61-
"execution_count": 6,
56+
"execution_count": 3,
6257
"metadata": {},
6358
"output_type": "execute_result"
6459
}
6560
],
6661
"source": [
67-
"nlu.analyze(text='this is my experimental text. Bruce Banner is the Hulk and Bruce Wayne is BATMAN! Superman fears not Banner, but Wayne.',\n",
68-
" features=Features(entities=EntitiesOptions(), keywords=KeywordsOptions()))"
62+
"nlu.analyze(text='this is my experimental text. Bruce Banner iis the Hulk and Bruce Wayne is BATMAN! Superman fears not Banner, but Wayne.',\n",
63+
" features=Features(entities=EntitiesOptions(), keywords=KeywordsOptions())).get_result()"
6964
]
7065
},
7166
{
7267
"cell_type": "code",
7368
"execution_count": null,
7469
"metadata": {
75-
"collapsed": true,
76-
"deletable": true,
77-
"editable": true
70+
"collapsed": true
7871
},
7972
"outputs": [],
80-
"source": [
81-
""
82-
]
73+
"source": []
74+
},
75+
{
76+
"cell_type": "code",
77+
"execution_count": null,
78+
"metadata": {},
79+
"outputs": [],
80+
"source": []
8381
}
8482
],
8583
"metadata": {
8684
"kernelspec": {
87-
"display_name": "Python 3",
85+
"display_name": "Python with Pixiedust (Spark 2.2)",
8886
"language": "python",
89-
"name": "python3"
87+
"name": "pythonwithpixiedustspark22"
9088
},
9189
"language_info": {
9290
"codemirror_mode": {
9391
"name": "ipython",
94-
"version": 3.0
92+
"version": 2
9593
},
9694
"file_extension": ".py",
9795
"mimetype": "text/x-python",
9896
"name": "python",
9997
"nbconvert_exporter": "python",
100-
"pygments_lexer": "ipython3",
101-
"version": "3.6.0"
98+
"pygments_lexer": "ipython2",
99+
"version": "2.7.10"
102100
}
103101
},
104102
"nbformat": 4,
105-
"nbformat_minor": 0
103+
"nbformat_minor": 1
106104
}

0 commit comments

Comments
 (0)