14 lines
403 B
Python
14 lines
403 B
Python
import json
|
|
|
|
with open("dataset/dataset_ner_srl.json", encoding="utf-8") as f:
|
|
data = json.load(f)
|
|
|
|
|
|
with open("dataset/dataset_ner_srl.tsv", "w", encoding="utf-8") as f:
|
|
for entry in data:
|
|
for tok, ner, srl in zip(
|
|
entry["tokens"], entry["labels_ner"], entry["labels_srl"]
|
|
):
|
|
f.write(f"{tok}\t{ner}\t{srl}\n")
|
|
f.write("\n") # Separate sentences
|