我正在研究这样的数据格式
data = [{"content":'''Hello I am Aniyya. I enjoy playing Football.
I love eating grapes''',"annotations":[{"id":1,"start":11,"end":17,"tag":"name"},
{"id":2,"start":59,"end":65,"tag":"fruit"}]}]
我确实想要这样的数据格式。没有实体的句子必须删除。并根据删除的句子更新其他实体的开始和结束
result_data = data = [{"content":'''Hello I am Aniyya. I love eating grapes''',"annotations":[{"id":1,"start":11,"end":17,"tag":"name"},
{"id":2,"start":33,"end":39,"tag":"fruit"}]}]
我没有得到任何特别的逻辑。我知道这就像要求为我编码一样,但如果你们有时间帮助我,我会非常感激。我有点执着于此。我以前问过一个类似的问题,但我也没有解决。所以想到了描述更多的细节。此解决方案将有助于所有准备NLP任务相关数据集的人员。提前谢谢
可视化是用空间显示完成的,代码在visualizing NER training data and entity using displacy
输出:
从我在问题中看到的是,有一个分隔符来分隔一个名为“.”(点)的句子。这样,你可以把句子分成不同的单元,然后对每个句子,你可以试着检查它是否是一个有注释的有效句子,或者从字符串中删除或拼接该句子
我已经为同样的问题写了一份解决方案草案,这就是完成工作。请随时提出任何更改。此外,你可能需要调整它,以满足你的确切需求
相关问题 更多 >
编程相关推荐