in calculate_pr.py [0:0]
def get_rec_intent(rec, predictions_):
rec_intents = []
pred_intents = []
for qa in rec['qas']:
if qa['id'].startswith("intent_"):
if qa['answers'][0]['text'] == "yes":
rec_intents.append(qa['intent'])
if predictions_[qa['id']] == "yes":
pred_intents.append(qa['intent'])
first_ind = 1000
for intent in rec_intents:
if intents.index(intent) < first_ind:
first_ind = intents.index(intent)
first_ind_pred = 1000
for intent in pred_intents:
if intents.index(intent) < first_ind_pred:
first_ind_pred = intents.index(intent)
return first_ind, first_ind_pred