from nltk.corpus import framenet from sftp.utils.common import VIRTUAL_ROOT import os import sys output_path = sys.argv[1] rules = [[VIRTUAL_ROOT]] for fr in framenet.frames(): rules[0].append(fr.name) new_rule = [fr.name] for fe in fr.FE: new_rule.append(fe) rules.append(new_rule) os.makedirs(os.path.dirname(output_path), exist_ok=True) with open(output_path, 'w') as fp: fp.write('\n'.join(['\t'.join(r) for r in rules]))