Skip to content

Commit

Permalink
Add downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
woodthom2 committed Sep 15, 2023
1 parent 7110412 commit 173889f
Show file tree
Hide file tree
Showing 3 changed files with 260 additions and 71 deletions.
316 changes: 252 additions & 64 deletions Burrows Delta Walkthrough.ipynb

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/faststylometry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@

__version__ = "1.0.3"

from faststylometry.burrows_delta import calculate_burrows_delta

from faststylometry.corpus import Corpus
from faststylometry.util import load_corpus_from_folder
from faststylometry.en import tokenise_remove_pronouns_en
from faststylometry.examples import download_examples
from faststylometry.burrows_delta import calculate_burrows_delta
from faststylometry.probability import predict_proba, calibrate, get_calibration_curve
from faststylometry.util import load_corpus_from_folder
from faststylometry.examples import download_examples
8 changes: 4 additions & 4 deletions src/faststylometry/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def download_examples():
data_path = "data"
is_folder_exists = os.path.exists(data_path)
if not is_folder_exists:
print(f"Creating folder {data_path}.")
print(f"Creating folder {data_path} in current working directory.")
# Create a new directory because it does not exist
os.makedirs(data_path)

Expand All @@ -65,13 +65,13 @@ def download_examples():
url = 'https://raw.githubusercontent.com/fastdatascience/faststylometry/main/data/train_test.zip'

local_file = "data/train_test.zip"
print(f"Downloading {url} to {local_file}...")
print(f"Downloading {url} to {local_file} in current working directory...")

wget.download(url, out=local_file, bar=bar_custom)

print(f"Downloaded {url} to {local_file}.\nExtracting...")
print(f"Downloaded {url} to {local_file}.\nExtracting to {data_path}...")

with zipfile.ZipFile(local_file, 'r') as zip_ref:
zip_ref.extractall(data_path)

print(f"Extracted contents of zip file to {data_path}")
print(f"Extracted contents of zip file to {data_path}.")

0 comments on commit 173889f

Please sign in to comment.