File size: 462 Bytes
bac72f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import csv
import json
import sys
from scorer import score

def load(path):
    with open(path, encoding="utf-8", newline="") as f:
        return list(csv.DictReader(f))

if __name__ == "__main__":
    if len(sys.argv) != 3:
        raise SystemExit("Usage: python cli.py predictions.csv references.csv")

    predictions = load(sys.argv[1])
    references = load(sys.argv[2])

    result = score(predictions, references)
    print(json.dumps(result, indent=2))