From d425ede7e9e44e7fc003faf29524698a0531a1ff Mon Sep 17 00:00:00 2001 From: ines Date: Thu, 26 Oct 2017 15:15:08 +0200 Subject: [PATCH] Fix example --- examples/training/train_ner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/training/train_ner.py b/examples/training/train_ner.py index 5a3e23244..9427f452e 100644 --- a/examples/training/train_ner.py +++ b/examples/training/train_ner.py @@ -44,7 +44,7 @@ def main(model=None, output_dir=None, n_iter=100): print("Created blank 'en' model") # create the built-in pipeline components and add them to the pipeline - # ner.create_pipe works for built-ins that are registered with spaCy! + # nlp.create_pipe works for built-ins that are registered with spaCy if 'ner' not in nlp.pipe_names: ner = nlp.create_pipe('ner') nlp.add_pipe(ner, last=True) @@ -86,8 +86,9 @@ def main(model=None, output_dir=None, n_iter=100): # test the saved model print("Loading from", output_dir) + nlp2 = spacy.load(output_dir) for text, _ in TRAIN_DATA: - doc = nlp(text) + doc = nlp2(text) print('Entities', [(ent.text, ent.label_) for ent in doc.ents]) print('Tokens', [(t.text, t.ent_type_, t.ent_iob) for t in doc])