-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathsetup.py
40 lines (30 loc) · 1.41 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
print('Installing requirements...')
os.system('pip install -r requirements.txt')
import requests
import zipfile
from clint.textui import progress
def download_data(url, zipped_path, extract):
# Open the url and download the data with progress bars.
data_stream = requests.get(url, stream=True)
with open(zipped_path, 'wb') as file:
total_length = int(data_stream.headers.get('content-length'))
for chunk in progress.bar(data_stream.iter_content(chunk_size=1024),
expected_size=total_length / 1024 + 1):
if chunk:
file.write(chunk)
file.flush()
# Extract file.
zip_file = zipfile.ZipFile(zipped_path, 'r')
zip_file.extractall(extract)
zip_file.close()
print('Do you want to download all datasets used in the paper (116 MB)? (y/n)')
if input() == 'y':
if not os.path.exists('data'):
os.mkdir('data')
download_data('https://ricsinaruto.github.io/website/docs/Twitter.zip', 'data/Twitter.zip', 'data')
download_data('https://ricsinaruto.github.io/website/docs/Cornell.zip', 'data/Cornell.zip', 'data')
download_data('https://ricsinaruto.github.io/website/docs/DailyDialog.zip', 'data/DailyDialog.zip', 'data')
print('Do you want to download all generated responses on the test set by the different models (7 MB)? (y/n)')
if input() == 'y':
download_data('https://ricsinaruto.github.io/website/docs/responses.zip', 'responses.zip', '')