Esempio n. 1
0
    args.hidden_dim = 50
    args.num_classes = 2
    args.input_dim = 300
    args.sparse = ""
    args.lr = 0.01
    args.wd = 1e-4
    args.data = os.path.join(base_path, "data/lc_quad/")
    args.cuda = False

    parser = LC_QaudParser()
    kb = parser.kb

    base_dir = "./output"
    question_type_classifier_path = os.path.join(base_dir,
                                                 "question_type_classifier")
    utility.makedirs(question_type_classifier_path)
    question_type_classifier = SVMClassifier(
        os.path.join(question_type_classifier_path, "svm.model"))

    o = Orchestrator(None, question_type_classifier, None, parser, True)
    raw_entities = [{
        "surface":
        "",
        "uris": [{
            "confidence": 1,
            "uri": "http://dbpedia.org/resource/Bill_Finger"
        }]
    }]
    entities = []
    for item in raw_entities:
        uris = [
Esempio n. 2
0
    ds = LC_Qaud_Linked(path="./data/LC-QUAD/linked_test.json")
    ds.load()
    ds.parse()

    if not ds.parser.kb.server_available:
        logger.error("Server is not available. Please check the endpoint at: {}".format(ds.parser.kb.endpoint))
        sys.exit(0)

    output_file = 'lcquadtestanswer_output'
    linker = Earl(path="data/LC-QUAD/entity_lcquad_test.json")

    base_dir = "./output"
    question_type_classifier_path = os.path.join(base_dir, "question_type_classifier")
    double_relation_classifier_path = os.path.join(base_dir, "double_relation_classifier")
    utility.makedirs(question_type_classifier_path)
    utility.makedirs(double_relation_classifier_path)
    question_type_classifier = SVMClassifier(os.path.join(question_type_classifier_path, "svm.model"))
    double_relation_classifier = SVMClassifier(os.path.join(double_relation_classifier_path, "svm.model"))

    stats = Stats()

    parser = LC_QaudParser()
    kb = parser.kb

    o = Orchestrator(logger, question_type_classifier, double_relation_classifier, parser, question_type_classifier_path, True)

    tmp = []
    output = []
    na_list = []