sociolome / scripts /gen_fn_constraints.py
Gosse Minnema
Initial commit
05922fb
raw
history blame
458 Bytes
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]))