Skip to content

Commit 0fbf312

Browse files
committed
Fixed notebook
1 parent 246a026 commit 0fbf312

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/reference/notebooks/fake_real_news_classification.ipynb

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
"source": [
6767
"import os\n",
6868
"import string\n",
69+
"import tarfile\n",
6970
"from pathlib import Path\n",
7071
"from typing import Tuple, Callable\n",
7172
"from urllib.request import urlretrieve\n",
@@ -380,7 +381,7 @@
380381
"def get_embeddings_matrix() -> np.ndarray:\n",
381382
" \"\"\"Create matrix, where each row is an embedding of a specific word.\"\"\"\n",
382383
" # Load glove embeddings.\n",
383-
" embeddings_dict = dict(parse_line(*line.rstrip().rsplit(' ')) for line in open(DATA_PATH / \"glove_100d.txt.tar.gz\"))\n",
384+
" embeddings_dict = dict(parse_line(*line.rstrip().rsplit(' ')) for line in tarfile.open(DATA_PATH / \"glove_100d.txt.tar.gz\", \"r:gz\").extractfile(\"fake_real_news_dataset-glove_100d.txt\").read().decode())\n",
384385
"\n",
385386
" # Create embeddings matrix with glove word vectors.\n",
386387
" embeddings_matrix = init_embeddings_matrix(embeddings_dict)\n",

0 commit comments

Comments
 (0)