able to load pickled structures

This commit is contained in:
2019-06-16 01:00:22 +02:00
parent f0109771aa
commit 37acabc076
2 changed files with 12 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
from xml.etree import ElementTree
import logging
import pickle
from component import Component, ComponentType
from lemma_features import get_lemma_features
@@ -92,7 +93,12 @@ class SyntacticStructure:
return [] if matches is None else matches
def build_structures(filename):
def build_structures(args):
filename = args.structures
if args.pickled_structures:
with open(filename, 'rb') as fp:
return pickle.load(fp)
max_num_components = -1
with open(filename, 'r') as fp:
et = ElementTree.XML(fp.read())