如何解决以下问题:NameError: name 'nlp' is not defined?

问题描述 投票:0回答:0

我打算开始为自定义 NER 模型创建数据集。

我正在尝试使用以下库:

import spacy
from spacy.tokens import Doc
from spacy.training import Example

我不太清楚为什么会出现这个错误。

NameError                                 Traceback (most recent call last)
/tmp/ipykernel_510787/1444480736.py in <module>
     23 train_data = []
     24 for text in texts:
---> 25     doc = nlp(text)
     26     entities = []
     27     for label in LABELS:

NameError: name 'nlp' is not defined

有人可以在这里指导我吗?

python csv nlp spacy nameerror
© www.soinside.com 2019 - 2024. All rights reserved.