14 lines
680 B
Python
14 lines
680 B
Python
"""Ajoute à labeling/auto/JUNGFRAU.jsonl les étiquettes d'un fichier TSV (debut, fin, categorie, description)."""
|
|||
|
|
import json, sys
|
||
|
|
FAM = {"Visibility", "Obstruction", "Thermal displacement", "Displacement", "Target issue", "No data"}
|
||
|
|
lignes = []
|
||
|
|
for l in open(sys.argv[1], encoding="utf-8"):
|
||
|
|
if not l.strip():
|
||
|
|
continue
|
||
|
|
d, f, c, t = l.rstrip("\n").split("\t")
|
||
|
|
assert c in FAM and d < f, l
|
||
|
|
lignes.append(json.dumps({"debut": d, "fin": f, "categorie": c, "description": t}, ensure_ascii=False))
|
||
|
|
with open("labeling/auto/JUNGFRAU.jsonl", "a", encoding="utf-8") as o:
|
||
|
|
for x in lignes:
|
||
|
|
o.write(x + "\n")
|
||
|
|
print(len(lignes), "étiquettes ajoutées")
|