赞
踩
nlp.begin_training
方法;nlp.update
方法for i in range(10):
random.shuffle(TRAINING_DATA)
for batch in spacy.util.minibatch(TRAINING_DATA):
texts = [text for text, annoation in batch]
annotations = [annotation for text, annotation in batch]
nlp.update(texts, annotations)
nlp.to_disk(path_to_model)
训练一个新的模型:
nlp = spacy.blank("zh")
ner = nlp.create_pipe("ner")
nlp.add_pipe(ner)
ner.add_label("GADGET")
nlp.begin_training()
for itn in range(10):
random.shuffle(examples)
for batch in spacy.util.minibatch(examples, size=2):
texts = [text for text, annoation in batch]
annotations = [annotation for text, annotatio
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。