Ejemplo n.º 1
0
def main(args):
    """
    Entry point of the evaluation sysem.
    :param args: list: command line args
    """

    if args["gen-id-store"]:
        logger.info("Generating id stores at %s ", args["<output-path>"])
        _ = generate_title_id_map(args["<redirects-path>"], args["<page-ids-path>"], args["<output-path>"])
        sys.exit(0)

    from annotators.spotlight import get_entities, format_data
    ent_linker_name = args["<entity-linker>"].lower()

    # generate report
    if args["gen-report"]:
        infile = path.realpath(args["<gs-file-path>"])
        outfile = path.realpath(args["<output-file>"])
        gen_report(infile, outfile, ent_linker_name)
        logger.info("Finished generating report at %s", args["<output-file>"])
        sys.exit(0)

    if args["with-dexter-eval"]:
        infile = path.realpath(args["<gs-file-path>"])
        outfile = path.realpath(args["<output-file>"])
        with_dexter_eval(infile, outfile, ent_linker_name)

    if args["all-with-dexter-eval"]:
        timestamp = datetime.utcnow().strftime('%Y:%H:%M:%S')
        for data_path in ["resources/AQUAINT-dataset.json",
                          "resources/MSNBC-dataset.json",
                          "resources/iitb-sorted.json"]:
            out_file_name = "output/{}_{}_{}.tsv".format(
                ent_linker_name,
                data_path.split("/")[1].split("-")[0].lower(),
                timestamp)
            with_dexter_eval(
                path.realpath(data_path),
                path.realpath(out_file_name),
                ent_linker_name)
Ejemplo n.º 2
0
 def test_generate_title_id_map(self):
     resolved_title_id_map = io.generate_title_id_map(REDIRECTS, PAGE_IDS)
     self.assertEqual(resolved_title_id_map["Computer_accessibility"], "411964")
     # To review the test case below
     self.assertTrue("AccessibleComputing" not in resolved_title_id_map)