-
Notifications
You must be signed in to change notification settings - Fork 1
Create a .gz file
Benjamin Schnabel edited this page Mar 13, 2024
·
1 revision
This function is necessary if you want to compress the data.
Usually we compress the ttl file. But if you want to debug the file it is not zipped.
! In any case make sure to put the right file extension in the markdown file in the dataset folder in judaicalink-site.
See gist: gist
`def compress_ttl(file_name):
"""
Compress the ttl file.
returns: compressed ttl file.
"""
# compress the ttl file
try:
with open(file_name, 'rb') as f_in:
with gzip.open(file_name + '.gz', 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
except Exception as e:
print("Could not compress file. Error: ", e)
`