Skip to content

Commit

Permalink
Add dist script
Browse files Browse the repository at this point in the history
  • Loading branch information
simonepri committed Jun 23, 2019
1 parent da15d8b commit b7b5c9e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions dist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import os
import tarfile


def compress_dataset(dir, name, files):
tgz_file = os.path.join(dir, name + '.tgz')
with tarfile.open(tgz_file, "w:gz") as tar:
for file in files:
path = os.path.realpath(file)
name = os.path.basename(path)
tar.add(path, arcname=name)


def main():
os.makedirs('dist', exist_ok=True)

compress_dataset('dist', 'WN16S-ID', [
'dataset/edges_as_id_all.tsv',
'dataset/map_entity_id_to_text.tsv',
'dataset/map_relation_id_to_text.tsv'
])
compress_dataset('dist', 'WN16S', [
'dataset/edges_as_text_all.tsv',
])


if __name__ == '__main__':
main()

0 comments on commit b7b5c9e

Please sign in to comment.