Skip to content

Instantly share code, notes, and snippets.

@nikkisharma536
Last active November 30, 2019 08:28
Show Gist options
  • Save nikkisharma536/8c675c8e0677854f73ea5c05c3b48820 to your computer and use it in GitHub Desktop.
Save nikkisharma536/8c675c8e0677854f73ea5c05c3b48820 to your computer and use it in GitHub Desktop.
create or load model
if model is not None:
nlp = spacy.load(model) # load existing spaCy model
print("Loaded model '%s'" % model)
else:
nlp = spacy.blank("en") # create blank Language class
print("Created blank 'en' model")
if 'ner' not in nlp.pipe_names :
ner = nlp.create_pipe('ner')
nlp.add_pipe(ner, last=True)
else :
ner = nlp.get_pipe("ner")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment