"""Parse source TEI specifications and save as a pickle. You can use this script to create a new pickle file to replace the one stored at ../conversion_utils/resources/jos_specifications.pickle. The input file is expected to be a version of https://github.com/clarinsi/mte-msd/blob/master/xml/msd-sl.spc.xml. However, the specifications are not expected to change, and if they do, the package pickle there should be updated upstream, so you probably should not have to use this script. """ import pickle import argparse from conversion_utils.jos_msds_and_properties import SpecificationsParser arg_parser = argparse.ArgumentParser(description='Parse source TEI specifications file and save as pickle.') arg_parser.add_argument('-xml', type=str, help='input XML file', required=True) arg_parser.add_argument('-pickle', type=str, help='output pickle file', required=True) arguments = arg_parser.parse_args() parser = SpecificationsParser() specifications = parser.parse(arguments.xml) with open(arguments.pickle, 'wb') as pickle_file: pickle.dump(specifications, pickle_file)