//if not gold.ner[i].endswith("ANIMAL"):
// gold.ner[i] = "-"
doc = nlp.make_doc(raw_text)
nlp.tagger(doc)
// As of 1.9, spaCy"s parser now lets you supply a dropout probability
// This might help the model generalize better from only a few
// examples.
loss += nlp.entity.update(doc, gold, drop=0.9)
After Change
optimizer = nlp.begin_training(lambda: [])
nlp.meta["name"] = "en_ent_animal"
for itn in range(50):
losses = {}
for batch in minibatch(get_gold_parses(nlp.make_doc, train_data), size=3):
docs, golds = zip(*batch)
nlp.update(docs, golds, losses=losses, sgd=optimizer, update_shared=True,
drop=0.35)
print(losses)
if not output_dir:
return
elif not output_dir.exists():
output_dir.mkdir()