import os

datadir = '/afs/inf.ed.ac.uk/group/project/prosody/prosody_nlp/data/input_features/turn_opensmile/'

gold = os.path.join(datadir,'turn_dev.lbl.final_one')
pred = os.path.join(datadir,'turn_sp_parse_72240_dummy_penalty.5_dev=86.36.pt_dev_predicted.txt.lbl')

golds = [[int(tok) for tok in line.strip().split()] for line in open(gold,'r').readlines()]
preds = [[int(tok) for tok in line.strip().split()] for line in open(pred,'r').readlines()]

unpredicted_golds = 0
predicted_golds = 0

for g_line,p_line in zip(golds,preds):
    for gg,pp in zip(g_line,p_line):
        if pp == 1 and gg == 0:
            unpredicted_golds += 1
        elif pp == 1 and gg== 1:
            predicted_golds += 1

print(f'unpredicted golds: {unpredicted_golds}')
print(f'predicted golds: {predicted_golds}')
import pdb;pdb.set_trace()
