Ejemplo n.º 1
0
def main():
    judgment_path = sys.argv[1]
    save_path = sys.argv[2]
    # print
    qrels = load_qrels_with_subtopic(judgment_path)

    new_d = {}
    for query_id, docs in qrels.items():
        if query_id not in new_d:
            new_d[query_id] = {}

        for doc_id, subtopic, raw_score in docs:
            if raw_score > 0:
                score = raw_score
                if doc_id in new_d[query_id]:
                    # other sub-topic is judged, which should be relevant.
                    assert new_d[query_id][doc_id] > 0

                new_d[query_id][doc_id] = raw_score
            else:
                # If not relevant, no sub-topic is relevant
                assert doc_id not in new_d[query_id]
                score = 0
                new_d[query_id][doc_id] = score

    def iter():
        for query_id, doc_score_d in new_d.items():
            for doc_id in doc_score_d:
                score = doc_score_d[doc_id]
                yield TrecRelevanceJudgementEntry(query_id, doc_id, score)

    write_trec_relevance_judgement(iter(), save_path)
Ejemplo n.º 2
0
def main():
    print("using second score as judgments")
    input_path = at_data_dir("clueweb", "2009.prels.1-50")

    raw_entries = []
    for line in open(input_path, "r"):
        query_id, doc_id, s1, s2, s3 = line.split()
        maybe_relevance = int(s1)
        maybe_relevance2 = int(s2)
        some_float = float(s3)
        e = TrecRelevanceJudgementEntry(query_id, doc_id, maybe_relevance2)
        raw_entries.append(e)

    save_path = at_data_dir("clueweb", "2009.qrel_test.2.txt")
    write_trec_relevance_judgement(raw_entries, save_path)
Ejemplo n.º 3
0
def main():
    judgment_path = sys.argv[1]
    save_path = sys.argv[2]
    # print
    qrels = load_qrels_flat(judgment_path)

    def iter():
        for query_id, docs in qrels.items():
            for doc_id, raw_score in docs:
                if raw_score > 0:
                    score = raw_score
                else:
                    score = 0
                yield TrecRelevanceJudgementEntry(query_id, doc_id, score)

    write_trec_relevance_judgement(iter(), save_path)
Ejemplo n.º 4
0
def main(info_path, input_type, label_dict_path, save_path):
    f_handler = get_format_handler(input_type)
    info: Dict[str, Dict] = load_combine_info_jsons(info_path, f_handler.get_mapping(), f_handler.drop_kdp())
    label_dict: Dict[Tuple[str, str], bool] = load_pickle_from(label_dict_path)

    l = []
    for entry in info.values():
        key = f_handler.get_pair_id(entry)
        query_id, candidate_id = key
        if key in label_dict:
            correctness = label_dict[key]
        else:
            correctness = False
        e = TrecRelevanceJudgementEntry(query_id, candidate_id, int(correctness))
        l.append(e)

    write_trec_relevance_judgement(l, save_path)
Ejemplo n.º 5
0
def main():
    label_itr = get_labels()
    l = get_trec_relevance_judgement(label_itr)
    save_path = os.path.join(output_path, "counter_arg", "qrel.txt")
    write_trec_relevance_judgement(l, save_path)
Ejemplo n.º 6
0
def save_only_from_candidate():
    l = get_relevance_judgement_only_from_candidate()
    save_path = os.path.join(data_path, "perspective", "qrel_sub.txt")
    write_trec_relevance_judgement(l, save_path)
Ejemplo n.º 7
0
def main():
    l = get_trec_relevance_judgement()
    save_path = os.path.join(data_path, "perspective", "qrel.txt")
    write_trec_relevance_judgement(l, save_path)
Ejemplo n.º 8
0
def main():
    label_itr = list(get_labels())
    l = get_trec_relevance_judgement(label_itr)
    save_path = os.path.join(data_path, "perspective",
                             "claim_evidence_qrel.txt")
    write_trec_relevance_judgement(l, save_path)