def load_trec_labels_dict(in_name):
    """
    input: trec format qrel
    :param in_name:  qrel
    :return: h_qrel = {qid:{doc:score} }
    """
    h_qrel = {}
    l_lines = open(in_name).read().splitlines()
    for line in l_lines:
        cols = line.split()
        qid = cols[0].strip()
        docno = cols[2].strip()
        label = int(cols[3])
        if qid not in h_qrel:
            h_qrel[qid] = {}
        h_qrel[qid][docno] = label

    return h_qrel