Spacy 2.0 神经网络训练

Spacy 2.0 NER Training

在 SpacyV1 中,可以通过提供 BILOU 格式的文档和实体注释列表来训练 NER 模型。

然而,似乎只有通过提供像这样的实体注释(7、13、'LOC')才能在 V2 中进行训练,因此具有实体偏移量和实体标签。

BILOU格式的代币列表和实体标签列表的旧方法是否仍然有效?

根据我从文档中收集到的信息,nlp.update 方法似乎接受了一个 GoldParse 对象列表,因此我可以为每个文档创建一个 GoldParse 对象并将 BILOU 标记传递给它的实体属性。但是,我会通过忽略 GoldParse class 的其他属性(例如头部或标签 https://spacy.io/api/goldparse )来丢失重要信息,还是训练 NER 不需要其他属性?

谢谢!

是的,您仍然可以使用 BILUO 标签创建 GoldParse 个对象。用法示例显示 "simpler" 偏移量格式的主要原因是它使它们更容易阅读和理解。

如果您只想训练 NER,现在也可以使用 nlp.disable_pipes() context manager and disable all other pipeline components (e.g. the 'tagger' and 'parser') during training. After the block, the components will be restored, so when you save out the model, it will include the whole pipeline. You can see this in action in the NER training examples

如何使用 GoldParse 对象进行训练?我已经尝试了一段时间我无法弄清楚。