Files
T

8 lines
417 B
Python
Raw Normal View History

# Lists the labels of a JSONL file touching a range: id, start, end, family, description (cut). Args: labels.jsonl FROM TO [width]
import json, sys
path, fr, to = sys.argv[1:4]
w = int(sys.argv[4]) if len(sys.argv) > 4 else 160
for line in open(path):
d = json.loads(line)
if d['start'] < to and d['end'] >= fr:
print(f"{d['id']:<14} {d['start']} {d['end']} {d['family']:<22} {d['description'][:w]}")