Loading statistics/statistics.py +7 −7 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ import psycopg2 from psycopg2 import sql # http://initd.org/psycopg/docs/sql.html#module-psycopg2.sql def store_result(table_name, values_dict): def store_result(service, table_name, values_dict): # Connect to database. db = psycopg2.connect("service=ted-join") db = psycopg2.connect("service=" + service) # Open a cursor to perform database operations cur = db.cursor() attributes = values_dict.keys() Loading @@ -41,14 +41,14 @@ def store_result(table_name, values_dict): # parse input argurments parser = argparse.ArgumentParser() parser.add_argument("--inputfile", type=str, parser.add_argument("--inputfile", type=str, required=True, help="path to input files containing line seperated trees in bracket notation") parser.add_argument("--shortdesc", type=str, default="no description", help="short description about the dataset") parser.add_argument("--printlabels", action='store_true', dest='printlabels', help="print label distribution") parser.add_argument("--storeindb", action='store_true', dest='storeindb', help="store the information about the dataset in a database") parser.add_argument('--service', type=str, help="Service name for db connection. Specify this parameter to store the results in a database.") args = parser.parse_args() Loading Loading @@ -99,8 +99,8 @@ dataset_info += "}" print(dataset_info) # store dataset in db if args.storeindb: store_result(db_table_name, json.loads(dataset_info)) if args.service: store_result(args.service, db_table_name, json.loads(dataset_info)) # print label distribution if args.printlabels: Loading Loading
statistics/statistics.py +7 −7 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ import psycopg2 from psycopg2 import sql # http://initd.org/psycopg/docs/sql.html#module-psycopg2.sql def store_result(table_name, values_dict): def store_result(service, table_name, values_dict): # Connect to database. db = psycopg2.connect("service=ted-join") db = psycopg2.connect("service=" + service) # Open a cursor to perform database operations cur = db.cursor() attributes = values_dict.keys() Loading @@ -41,14 +41,14 @@ def store_result(table_name, values_dict): # parse input argurments parser = argparse.ArgumentParser() parser.add_argument("--inputfile", type=str, parser.add_argument("--inputfile", type=str, required=True, help="path to input files containing line seperated trees in bracket notation") parser.add_argument("--shortdesc", type=str, default="no description", help="short description about the dataset") parser.add_argument("--printlabels", action='store_true', dest='printlabels', help="print label distribution") parser.add_argument("--storeindb", action='store_true', dest='storeindb', help="store the information about the dataset in a database") parser.add_argument('--service', type=str, help="Service name for db connection. Specify this parameter to store the results in a database.") args = parser.parse_args() Loading Loading @@ -99,8 +99,8 @@ dataset_info += "}" print(dataset_info) # store dataset in db if args.storeindb: store_result(db_table_name, json.loads(dataset_info)) if args.service: store_result(args.service, db_table_name, json.loads(dataset_info)) # print label distribution if args.printlabels: Loading