# Path: autoencoder/datasets/wiki10plus.py
# def extract_labels(docs, labels, output):
#     # it will be fast if docs is a dict instead of a list
#     doc_labels = {}
#     for name in docs:
#         doc_labels[name] = labels[name]
#     dump_json(doc_labels, output)
#     import pdb;pdb.set_trace()
#     return doc_labels
# 
# Path: autoencoder/utils/io_utils.py
# def load_json(file):
#     try:
#         with open(file, 'r') as datafile:
#             data = json.load(datafile)
#     except Exception as e:
#         raise e
# 
#     return data


import argparse
from autoencoder.datasets.wiki10plus import extract_labels
from autoencoder.utils.io_utils import load_json
'''
Created on Dec, 2016

@author: hugo

'''



def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-l', '--label', type=str, required=True, help='path to the input label file')
    parser.add_argument('-c', '--corpus', type=str, required=True, help='path to the constructed corpus file')
    parser.add_argument('-o', '--output', type=str, required=True, help='path to the output file')
    args = parser.parse_args()



# Path: autoencoder/datasets/wiki10plus.py
# def extract_labels(docs, labels, output):
#     # it will be fast if docs is a dict instead of a list
#     doc_labels = {}
#     for name in docs:
#         doc_labels[name] = labels[name]
#     dump_json(doc_labels, output)
#     import pdb;pdb.set_trace()
#     return doc_labels
# 
# Path: autoencoder/utils/io_utils.py
# def load_json(file):
#     try:
#         with open(file, 'r') as datafile:
#             data = json.load(datafile)
#     except Exception as e:
#         raise e
# 
#     return data


# Path: get_wiki10plus_labels.py
import argparse
from autoencoder.datasets.wiki10plus import extract_labels
from autoencoder.utils.io_utils import load_json

'''
Created on Dec, 2016

@author: hugo

'''



def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-l', '--label', type=str, required=True, help='path to the input label file')
    parser.add_argument('-c', '--corpus', type=str, required=True, help='path to the constructed corpus file')
    parser.add_argument('-o', '--output', type=str, required=True, help='path to the output file')
    args = parser.parse_args()



    extract_labels(load_json(args.corpus)['docs'], load_json(args.label), args.output)