forked from hugochan/KATE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nvdm_doccodes_converter.py
38 lines (26 loc) · 978 Bytes
/
nvdm_doccodes_converter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'''
Created on Jan, 2017
@author: hugo
'''
from __future__ import absolute_import
import os
import sys
import argparse
import numpy as np
from autoencoder.utils.io_utils import load_json, dump_json
def main():
parser = argparse.ArgumentParser()
parser.add_argument('train_doc_codes', type=str, help='path to the train doc code file')
parser.add_argument('val_doc_codes', type=str, help='path to the valid doc code file')
parser.add_argument('out_dir', type=str, help='path to the output dir')
args = parser.parse_args()
train_doc_codes_path = args.train_doc_codes
train_doc_codes = load_json(train_doc_codes_path)
val_doc_codes = load_json(args.val_doc_codes)
# import pdb;pdb.set_trace()
train_doc_codes.update(val_doc_codes)
out_dir = args.out_dir
dump_json(train_doc_codes, os.path.join(out_dir, 'new_' + os.path.basename(train_doc_codes_path)))
import pdb;pdb.set_trace()
if __name__ == "__main__":
main()