Skip to content

Commit

Permalink
rename download_and_unzip to make it more specific
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed May 12, 2024
1 parent 58c591c commit 55c3a91
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions appendix-E/01_main-chapter-code/appendix-E.ipynb
Expand Up @@ -170,7 +170,7 @@
"from pathlib import Path\n",
"import pandas as pd\n",
"from previous_chapters import (\n",
" download_and_unzip,\n",
" download_and_unzip_spam_data,\n",
" create_balanced_dataset,\n",
" random_split\n",
")\n",
Expand All @@ -181,7 +181,7 @@
"extracted_path = \"sms_spam_collection\"\n",
"data_file_path = Path(extracted_path) / \"SMSSpamCollection.tsv\"\n",
"\n",
"download_and_unzip(url, zip_path, extracted_path, data_file_path)\n",
"download_and_unzip_spam_data(url, zip_path, extracted_path, data_file_path)\n",
"\n",
"df = pd.read_csv(data_file_path, sep=\"\\t\", header=None, names=[\"Label\", \"Text\"])\n",
"balanced_df = create_balanced_dataset(df)\n",
Expand Down Expand Up @@ -1415,7 +1415,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion appendix-E/01_main-chapter-code/previous_chapters.py
Expand Up @@ -362,7 +362,7 @@ def evaluate_model(model, train_loader, val_loader, device, eval_iter):
#####################################


def download_and_unzip(url, zip_path, extracted_path, data_file_path):
def download_and_unzip_spam_data(url, zip_path, extracted_path, data_file_path):
if data_file_path.exists():
print(f"{data_file_path} already exists. Skipping download and extraction.")
return
Expand Down
6 changes: 3 additions & 3 deletions ch06/01_main-chapter-code/ch06.ipynb
Expand Up @@ -187,7 +187,7 @@
"extracted_path = \"sms_spam_collection\"\n",
"data_file_path = Path(extracted_path) / \"SMSSpamCollection.tsv\"\n",
"\n",
"def download_and_unzip(url, zip_path, extracted_path, data_file_path):\n",
"def download_and_unzip_spam_data(url, zip_path, extracted_path, data_file_path):\n",
" if data_file_path.exists():\n",
" print(f\"{data_file_path} already exists. Skipping download and extraction.\")\n",
" return\n",
Expand All @@ -206,7 +206,7 @@
" os.rename(original_file_path, data_file_path)\n",
" print(f\"File downloaded and saved as {data_file_path}\")\n",
"\n",
"download_and_unzip(url, zip_path, extracted_path, data_file_path)"
"download_and_unzip_spam_data(url, zip_path, extracted_path, data_file_path)"
]
},
{
Expand Down Expand Up @@ -2347,7 +2347,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions ch06/03_bonus_imdb-classification/sklearn-baseline.ipynb
Expand Up @@ -46,7 +46,7 @@
" print(f\"File download and saved as {new_file_path}\")\n",
"\n",
"# Execute the function\n",
"download_and_unzip(url, zip_path, extract_to, new_file_path)"
"download_and_unzip_spam_data(url, zip_path, extract_to, new_file_path)"
]
},
{
Expand Down Expand Up @@ -510,7 +510,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 55c3a91

Please sign in to comment.