# only_in_packages=False # ) classifiers=[ "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Programming Language :: Python", ], ) # test installation import time from RPISlotFilling.slot_filling.ChineseSlotFilling import ChineseSlotFilling print('Running Chinese Slot Filling installation test...') time.sleep(2) try: root_path = os.environ['CN_SF_PATH'] except KeyError: raise KeyError('Environment variable CN_SF_PATH not set.') cn_sf = ChineseSlotFilling() cn_sf.get_answer(os.path.join(root_path, 'data/queries_sample.xml')) cn_sf.export_answer(os.path.join(root_path, 'cn_sf_result.tab')) cn_sf.visualize(os.path.join(root_path, 'cn_sf_result.html')) print('Installation test passed.') print('Chinese Slot Filling installation completed.')
import sys import os from RPISlotFilling.slot_filling.ChineseSlotFilling import ChineseSlotFilling if len(sys.argv) != 3: print('Incorrect number of arguments.') print('ChineseSlotFilling requires 2 arguments:') print('\t1) KBP format slot filling queries.') print('\t2) Path to output result and visualization result.') exit() path = os.path.dirname(os.path.realpath(__file__)) query_path = os.path.join(path, sys.argv[1]) if not os.path.exists(query_path): print(sys.argv[1]+' not exist') output_path = os.path.join(path, sys.argv[2]) if not os.path.exists(output_path): print(sys.argv[2]+' not exist') cn_sf = ChineseSlotFilling() cn_sf.get_answer(query_path) cn_sf.export_answer(os.path.join(output_path, 'cn_sf_result.tab')) cn_sf.visualize(os.path.join(output_path, 'cn_sf_result.html'))