- json文件格式为
[
{
"context": "BEGALA Well , we ' ll debate that later on in the show .",
"end_position": [],
"entity_label": "GPE",
"impossible": true,
"qas_id": "0.1",
"query": "geographical political entities are geographical regions defined by political and or social groups such as countries, nations, regions, cities, states, government and its people.",
"span_position": [],
"start_position": []
},
{
"context": "BEGALA Well , we ' ll debate that later on in the show .",
"end_position": [
3
],
"entity_label": "ORG",
"impossible": false,
"qas_id": "0.2",
"query": "organization entities are limited to companies, corporations, agencies, institutions and other groups of people.",
"span_position": [
"3;3"
],
"start_position": [
3
]
}
]
python代码
with open(data_dir, "r") as reader:
input_data = json.load(reader)
for entry in input_data:
if entry["entity_label"] == "FAC":