小编Tan*_*ans的帖子

我如何使用 spacy3.0 的 nlp.update 问题示例

我正在尝试使用 spacy v3.0 训练我的数据,显然 nlp.update 不接受任何元组。这是一段代码:

import spacy
import random
import json
nlp = spacy.blank("en")
ner = nlp.create_pipe("ner")
nlp.add_pipe('ner')
ner.add_label("label")
# Start the training
nlp.begin_training()
# Loop for 40 iterations
for itn in range(40):
    # Shuffle the training data
    random.shuffle(TRAINING_DATA)
    losses = {}
# Batch the examples and iterate over them
    for batch in spacy.util.minibatch(TRAINING_DATA, size=2):
        texts = [text for text, entities in batch]
        annotations = [entities for text, entities in batch]
# Update the model
        nlp.update(texts, annotations, losses=losses, drop=0.3) …
Run Code Online (Sandbox Code Playgroud)

nlp named-entity-recognition spacy ner

10
推荐指数
3
解决办法
3290
查看次数

标签 统计

named-entity-recognition ×1

ner ×1

nlp ×1

spacy ×1