Skip to content

Commit 7246c49

Browse files
committed
fixed word_to_ix bug
1 parent 4302d2e commit 7246c49

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Deep Learning for Natural Language Processing with Pytorch.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@
14451445
"things called data. The evolution of a process is directed by a pattern of rules\n",
14461446
"called a program. People create programs to direct processes. In effect,\n",
14471447
"we conjure the spirits of the computer with our spells.\"\"\".split()\n",
1448-
"word_to_ix = { word: i for i, word in enumerate(raw_text) }\n",
1448+
"word_to_ix = { word: i for i, word in enumerate(set(raw_text)) }\n",
14491449
"data = []\n",
14501450
"for i in xrange(2, len(raw_text) - 2):\n",
14511451
" context = [ raw_text[i-2], raw_text[i-1], raw_text[i+1], raw_text[i+2] ]\n",
@@ -2247,7 +2247,7 @@
22472247
"metadata": {
22482248
"kernelspec": {
22492249
"display_name": "Python 2",
2250-
"language": "python2",
2250+
"language": "python",
22512251
"name": "python2"
22522252
},
22532253
"language_info": {

0 commit comments

Comments
 (0)