From 44000f5e311794e82ee1858fd6250abc3b002d2d Mon Sep 17 00:00:00 2001 From: saist1993 Date: Tue, 2 Jul 2019 13:19:46 +0200 Subject: [PATCH] file location checker to check if all the files have been downloaded correctly --- README.md | 10 ++++------ file_location_check.py | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 file_location_check.py diff --git a/README.md b/README.md index 16fc2cb..da6478a 100644 --- a/README.md +++ b/README.md @@ -64,13 +64,11 @@ change embedding in configs to 300d #### Once the dataset is prepared -Check for the following files -1. in /resources check for vectors_gl.npy and vocab_gl.npy -2. in /data/data/common check for rdf_type_lookup.json and relations.pickle -3. in /data/data/lcquad check for id_big_data.json (To reproduce experiments related to lcquad) -4. in /data/data/qald check for id_big_data.json (To reproduce experiments related to qald) +To check if all the files are in correct palce run the following command -@TODO: Write a script to automate the above task. +``` +python file_location_check.py +``` Once the data is at appropriate place run the following command. diff --git a/file_location_check.py b/file_location_check.py new file mode 100644 index 0000000..9b37081 --- /dev/null +++ b/file_location_check.py @@ -0,0 +1,36 @@ +import os.path + +# Check for /resources check for vectors_gl.npy and vocab_gl.npy + +catch_exception = False +if not os.path.isfile('resources/vectors_gl.npy'): + print("vectors_gl.npy file not found in resources. Please download the file and add it to the resources folder.") + catch_exception = True + + +if not os.path.isfile('resources/vocab_gl.pickle'): + print("vocab_gl.pickle file not found in resources. Please download the file and add it to the resources folder.") + catch_exception = True + +if not os.path.isfile('data/data/common/rdf_type_lookup.json'): + print("rdf_type_lookup.json not found in data/data/common. Please download the file and add it to the " + "data/data/common folder.") + catch_exception = True + +if not os.path.isfile('data/data/common/relations.pickle'): + print("relations.pickle not found in data/data/common. Please download the file and add it to the " + "data/data/common folder.") + catch_exception = True + +if not os.path.isfile('data/data/lcquad/id_big_data.json'): + print("id_big_data.json file not found in data/data/lcquad. Please download the file and " + "add it to the data/data/lcquad folder to perform experiments on lcquad.") + catch_exception = True + +if not os.path.isfile('data/data/qald/id_big_data.json'): + print("id_big_data.json file not found in data/data/qald. Please download the file and " + "add it to the data/data/lcquad folder to perform experiments on qald.") + catch_exception = True + +if not catch_exception: + print("Found all required files") \ No newline at end of file