mirror of https://github.com/explosion/spaCy.git
* Upd train script
This commit is contained in:
parent
08ca5c8970
commit
df749f257d
|
@ -9,7 +9,6 @@ import codecs
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
import gzip
|
import gzip
|
||||||
import nltk
|
|
||||||
|
|
||||||
import plac
|
import plac
|
||||||
import cProfile
|
import cProfile
|
||||||
|
@ -219,10 +218,12 @@ def train(Language, paragraphs, model_dir, n_iter=15, feat_set=u'basic', seed=0,
|
||||||
|
|
||||||
|
|
||||||
def evaluate(Language, dev_loc, model_dir, gold_preproc=False):
|
def evaluate(Language, dev_loc, model_dir, gold_preproc=False):
|
||||||
|
global loss
|
||||||
nlp = Language()
|
nlp = Language()
|
||||||
n_corr = 0
|
n_corr = 0
|
||||||
total = 0
|
total = 0
|
||||||
skipped = 0
|
skipped = 0
|
||||||
|
loss = 0
|
||||||
with codecs.open(dev_loc, 'r', 'utf8') as file_:
|
with codecs.open(dev_loc, 'r', 'utf8') as file_:
|
||||||
paragraphs = read_docparse_gold(file_)
|
paragraphs = read_docparse_gold(file_)
|
||||||
for tokens, tag_strs, heads, labels in iter_data(paragraphs, nlp.tokenizer,
|
for tokens, tag_strs, heads, labels in iter_data(paragraphs, nlp.tokenizer,
|
||||||
|
|
Loading…
Reference in New Issue