将用于标记 NER 的 Prodigy 的 JSONL 格式转换为 spaCy 的训练格式?
Convert from Prodigy's JSONL format for labeled NER to spaCy's training format?
我是 Prodigy 和 spaCy 以及 CLI 编码的新手。我想使用 Prodigy 为 NER 模型标记我的数据,然后使用 python 中的 spaCy 来创建模型。
Prodigy 以 SQLite 格式输出。 SpaCy 采用另一种格式,不确定如何称呼它:
TRAIN_DATA = [
(
"Horses are too tall and they pretend to care about your feelings",
{"entities": [(0, 6, LABEL)]},
),
("Do they bite?", {"entities": []}),
(
"horses are too tall and they pretend to care about your feelings",
{"entities": [(0, 6, LABEL)]},
),
("horses pretend to care about your feelings", {"entities": [(0, 6, LABEL)]}),
(
"they pretend to care about your feelings, those horses",
{"entities": [(48, 54, LABEL)]},
),
("horses?", {"entities": [(0, 6, LABEL)]}),
]
如何从一种转换为另一种?看起来这应该很容易,但我无法在任何地方找到它。
我在数据集中加载没有问题,只是转换。
从 1.9 版开始,Prodigy 应使用 data-to-spacy
导出此训练格式:https://prodi.gy/docs/recipes#data-to-spacy
我是 Prodigy 和 spaCy 以及 CLI 编码的新手。我想使用 Prodigy 为 NER 模型标记我的数据,然后使用 python 中的 spaCy 来创建模型。
Prodigy 以 SQLite 格式输出。 SpaCy 采用另一种格式,不确定如何称呼它:
TRAIN_DATA = [
(
"Horses are too tall and they pretend to care about your feelings",
{"entities": [(0, 6, LABEL)]},
),
("Do they bite?", {"entities": []}),
(
"horses are too tall and they pretend to care about your feelings",
{"entities": [(0, 6, LABEL)]},
),
("horses pretend to care about your feelings", {"entities": [(0, 6, LABEL)]}),
(
"they pretend to care about your feelings, those horses",
{"entities": [(48, 54, LABEL)]},
),
("horses?", {"entities": [(0, 6, LABEL)]}),
]
如何从一种转换为另一种?看起来这应该很容易,但我无法在任何地方找到它。
我在数据集中加载没有问题,只是转换。
从 1.9 版开始,Prodigy 应使用 data-to-spacy
导出此训练格式:https://prodi.gy/docs/recipes#data-to-spacy