Skip to content

Commit

Permalink
combine download and extract_archive
Browse files Browse the repository at this point in the history
  • Loading branch information
Guanheng Zhang committed Jul 22, 2019
1 parent 58e3bac commit 81e5a31
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions torchtext/datasets/text_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from tqdm import tqdm


def download(url, raw_folder, dataset_name):
def download_extract_archive(url, raw_folder, dataset_name):
"""Download the dataset if it doesn't exist in processed_folder already."""

train_csv_path = os.path.join(raw_folder,
Expand Down Expand Up @@ -149,7 +149,7 @@ def __init__(self, url, root='.data',
'processed')
filepath = os.path.join(self.processed_folder, self.dataset_name + '.train')
if not os.path.isfile(filepath):
download(self.url, self.raw_folder, self.dataset_name)
download_extract_archive(self.url, self.raw_folder, self.dataset_name)
_preprocess(self.raw_folder, self.processed_folder, self.dataset_name)
with open(filepath) as src_data:
self.train_examples = _load_text_classification_data(src_data, self.fields, ngrams)
Expand Down

0 comments on commit 81e5a31

Please sign in to comment.