mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
* Ensure tagger and NER are trained, even if non-projective problem
This commit is contained in:
parent
f69fe6a635
commit
895060e774
|
@ -84,15 +84,13 @@ def train(Language, gold_tuples, model_dir, n_iter=15, feat_set=u'basic', seed=0
|
||||||
loss += nlp.parser.train(tokens, gold)
|
loss += nlp.parser.train(tokens, gold)
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
# TODO: Do something about non-projective sentences
|
# TODO: Do something about non-projective sentences
|
||||||
continue
|
pass
|
||||||
if gold.ents:
|
nlp.entity.train(tokens, gold)
|
||||||
nlp.entity.train(tokens, gold)
|
|
||||||
nlp.tagger.train(tokens, gold.tags)
|
nlp.tagger.train(tokens, gold.tags)
|
||||||
|
random.shuffle(gold_tuples)
|
||||||
print '%d:\t%d\t%.3f\t%.3f\t%.3f\t%.3f' % (itn, loss, scorer.uas, scorer.ents_f,
|
print '%d:\t%d\t%.3f\t%.3f\t%.3f\t%.3f' % (itn, loss, scorer.uas, scorer.ents_f,
|
||||||
scorer.tags_acc,
|
scorer.tags_acc,
|
||||||
scorer.token_acc)
|
scorer.token_acc)
|
||||||
random.shuffle(gold_tuples)
|
|
||||||
nlp.parser.model.end_training()
|
nlp.parser.model.end_training()
|
||||||
nlp.entity.model.end_training()
|
nlp.entity.model.end_training()
|
||||||
nlp.tagger.model.end_training()
|
nlp.tagger.model.end_training()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user