* Add warning for models not found in parser

This commit is contained in:
Matthew Honnibal 2015-07-08 20:04:55 +02:00
parent 05b28ec9eb
commit adb868bdad

View File

@ -72,9 +72,7 @@ cdef class Parser:
def __init__(self, StringStore strings, model_dir, transition_system):
if not os.path.exists(model_dir):
print >> sys.stderr, "Warning: No model found at", model_dir
self.cfg = Config(labels={}, features=[])
elif not os.path.isdir(model_dir):
self.cfg = Config(labels={}, features=[])
print >> sys.stderr, "Warning: model path:", model_dir, "is not a directory"
else:
self.cfg = Config.read(model_dir, 'config')
@ -83,6 +81,7 @@ cdef class Parser:
self.model = Model(self.moves.n_moves, templates, model_dir)
def __call__(self, Doc tokens):
if self.model is not None:
if self.cfg.get('beam_width', 0) < 1:
self._greedy_parse(tokens)
else: