コード例 #1
0
ファイル: wikify.py プロジェクト: sucre111/cdata
        description = jsonData[2][idx]
        url = jsonData[3][idx]

        item = {
            "name": label,
            "description":description,
            "url": url,
        }
        items.append(item)

    return ret

if __name__ == "__main__":
    logging.basicConfig(format='[%(levelname)s][%(asctime)s][%(module)s][%(funcName)s][%(lineno)s] %(message)s', level=logging.INFO)
    logging.getLogger("requests").setLevel(logging.WARNING)

    optional_params = {
        '--query': 'query'
    }
    main_subtask(__name__, optional_params=optional_params)

"""
    python cdata/wikify.py task_wikipedia_test --query="birth place"
    python cdata/wikify.py task_wikidata_test --query="birth place"
    python cdata/wikify.py task_wikidata_test --query="birthplace"
    python cdata/wikify.py task_wikidata_test --query=居里夫人

    python cdata/wikify.py task_compare

"""
コード例 #2
0
        if result:
            if item["province"] != result["province"]:
                match_errors.append("province")

            if item["type"] in ["city", "district"]:
                if item["city"] != result.get("city", ""):
                    match_errors.append("city")

            if item["type"] in ["district"]:
                if item["district"] != result.get("district", ""):
                    match_errors.append("district")

        one_result["match_error_count"] = len(match_errors)
        one_result["result_type"] = result_type

    logging.info("accuracy = {} match_error_count_0/all".format(
        1.0 * len([x for x in test_results if x["match_error_count"] == 0])/len(test_results)))
    stat(test_results, [], ["match_error_count", "type_diff", "result_type"])


if __name__ == "__main__":
    logging.basicConfig(format='[%(levelname)s][%(asctime)s][%(module)s][%(funcName)s][%(lineno)s] %(message)s', level=logging.INFO)  # noqa

    main_subtask(__name__)

"""
    python cdata/region.py task_guess_all_batch

    python cdata/region.py task_guess_all
"""