Files

10 lines
478 B
Python
Raw Normal View History

# Lists the labels of a JSONL file touching [FROM, TO): id, start, end, family, description (truncated to N chars).
import json, sys
path, a, b = sys.argv[1], sys.argv[2], sys.argv[3]
n = int(sys.argv[4]) if len(sys.argv) > 4 else 300
for line in open(path, encoding="utf-8"):
if not line.strip():
continue
e = json.loads(line)
if e["start"] < b and e["end"] >= a:
print(e["id"], e["start"], e["end"], e["family"], "|", e.get("description", "")[:n])