Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollopy-tulane committed Apr 27, 2024
1 parent fec8c47 commit a30b0f3
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions nlp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
# such as where data will be downloaded from.
# here is an example.
def write_default_config(path):
with open(path, 'wt') as w:
w.write('[data]\n')
w.write('url1 = https://raw.githubusercontent.com/tulane-cmps6730/project-reddit/main/data/train.csv\n')
w.write('file1 = %s%s%s\n' % (nlp_path, os.path.sep, 'train.csv'))
w.write('url2 = https://raw.githubusercontent.com/tulane-cmps6730/project-reddit/main/data/test.csv\n')
w.write('file2 = %s%s%s\n' % (nlp_path, os.path.sep, 'test.csv'))
w.write('url3 = https://raw.githubusercontent.com/tulane-cmps6730/project-reddit/main/data/validation.csv\n')
w.write('file3 = %s%s%s\n' % (nlp_path, os.path.sep, 'validation.csv'))
for i in range(1, 4): # Iterate over url1, url2, url3
data_url = config.get('data', f'url{i}', fallback=None) # Fetch the 'url{i}' option
if data_url is not None:
data_file = config.get('data', f'file{i}')
print('downloading from %s to %s' % (data_url, data_file))
r = requests.get(data_url)
with open(data_file, 'wt') as f:
f.write(r.text)
else:
print(f"No URL found for 'url{i}' in configuration.")

# Find NLP_HOME path
if 'NLP_HOME' in os.environ:
Expand Down

0 comments on commit a30b0f3

Please sign in to comment.