【发布时间】:2018-02-21 22:41:44
【问题描述】:
我在 spaCy 文档的 "Training an additional entity type" 部分中有新 NER 类型的训练数据。
TRAIN_DATA = [
("Horses are too tall and they pretend to care about your feelings", {
'entities': [(0, 6, 'ANIMAL')]
}),
("Do they bite?", {
'entities': []
}),
("horses are too tall and they pretend to care about your feelings", {
'entities': [(0, 6, 'ANIMAL')]
}),
("horses pretend to care about your feelings", {
'entities': [(0, 6, 'ANIMAL')]
}),
("they pretend to care about your feelings, those horses", {
'entities': [(48, 54, 'ANIMAL')]
}),
("horses?", {
'entities': [(0, 6, 'ANIMAL')]
})
]
我想使用 spacy command line application 在此数据上训练 NER 模型。这需要 spaCy 的 JSON format 中的数据。如何以这种 JSON 格式编写上述数据(即带有标记的字符偏移跨度的文本)?
查看该格式的文档后,我不清楚如何以这种格式手动写入数据。 (例如,我是否已将所有内容划分为段落?)还有一个convert 命令行实用程序,可将非spaCy 数据格式转换为spaCy 格式,但它不采用上述spaCy 格式作为输入.
我了解使用“简单训练样式”的 NER 训练代码示例,但我希望能够使用命令行实用程序进行训练。 (尽管从我的previous spaCy question 中可以看出,我不清楚你什么时候应该使用那种风格,什么时候应该使用命令行。)
谁能给我看一个“spaCy 的 JSON 格式”的上述数据的例子,或者指向解释如何进行这种转换的文档。
【问题讨论】:
标签: spacy