From f36fab39b0d678405cff9664013970dd42c4a7ca Mon Sep 17 00:00:00 2001 From: ines Date: Fri, 10 Nov 2017 23:35:38 +0100 Subject: [PATCH] Don't rename component in intent parser example (resolves #1551) Otherwise, the default saved model won't know that it's supposed to create spaCy's 'parser'. --- examples/training/train_intent_parser.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/training/train_intent_parser.py b/examples/training/train_intent_parser.py index 6d804c5d9..763c1471d 100644 --- a/examples/training/train_intent_parser.py +++ b/examples/training/train_intent_parser.py @@ -72,19 +72,18 @@ def main(model=None, output_dir=None, n_iter=5): nlp = spacy.blank('en') # create blank Language class print("Created blank 'en' model") - # We'll use the built-in dependency parser - # class, but we want to create a fresh instance, and give it a different - # name. + # We'll use the built-in dependency parser class, but we want to create a + # fresh instance – just in case. if 'parser' in nlp.pipe_names: nlp.remove_pipe('parser') parser = nlp.create_pipe('parser') - nlp.add_pipe(parser, name='intent-parser', first=True) + nlp.add_pipe(parser, first=True) for text, annotations in TRAIN_DATA: for dep in annotations.get('deps', []): parser.add_label(dep) - other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'intent-parser'] + other_pipes = [pipe for pipe in nlp.pipe_names if pipe != 'parser'] with nlp.disable_pipes(*other_pipes): # only train parser optimizer = nlp.begin_training() for itn in range(n_iter):