我有这个JSON
{
"journal.pbio.0050304.xml": {
"sentence": [
[
{"entity_group": "literal", "score": 0.9961686, "word": "The anterior\u2013posterior (A\u2013P) axis ", "start": 0, "end": 299}
],
[
{"entity_group": "literal", "score": 0.9932352, "word": "RA, Fgfs, and Wnts are all produced at the posterior of the embryo, and might therefore be expected to form posterior-", "start": 0, "end": 118},
{"entity_group": "metaphoric", "score": 0.874372, "word": "to", "start": 118, "end": 120},
{"entity_group": "literal", "score": 0.99049604, "word": "-anterior gradients (for Fgf8", "start": 120, "end": 149},
{"entity_group": "metaphoric", "score": 0.9993481, "word": "this", "start": 150, "end": 154}
]
]
},
"journal.pbio.0050093.xml": {
"sentence": [
[
{"entity_group": "literal", "score": 0.9961686, "word": "The anterior\u2013posterior (A\u2013P) axis ", "start": 0, "end": 299}
]
]
}
}
我想只取实体组,开始和结束,并将它们转换成元组,如下所示:[(0, 299, 'literal'),(186, 194, 'literal'), ('metaphoric', 196, 199)]
等等,我该怎么做呢?
2条答案
按热度按时间j7dteeu81#
像这样?
结果:
dtcbnfnu2#
您只需要首先迭代字典值,然后迭代列表和子列表,如下所示: