instruction stringlengths 0 1k | input stringlengths 1 1k | output stringlengths 10 6.51k |
|---|---|---|
entity_label,
}
)
current_entity_text = segment["text"]
current_entity_label = segment["label_name"]
else:
current_entity_text += segment["text"]
if current_entity_label and current_entity_text:
output_data.append(
{
"text": current_entity_text,
"label": current_entity_label,
}
)
elif not current_entity_label and current_entity_text:
output_data.append({"text": current_entity_text, "label": None})
final_output = []
temp_text = ""
for item in output_data:
if item["label"] is None:
temp_text += item["text"]
else:
if temp_text:
final_output.append({"text": temp_text, "label": None})
temp_text = ""
final_output.append(item)
|
return json.dumps(
{
"annotations": final_output,
"labels": self.entities,
},
indent=2,
)
| if temp_text:
final_output.append({"text": temp_text, "label": None}) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.