def right_subgraph_relation_generation(current_uid: int, question_template: Dict[str, Any], generated_questions: List[Dict[str, Any]],
old_properties_ids: List[str] = None, old_properties: List[str] = None) -> Dict[str, Any]:
    generated_template = deepcopy(question_template)
    sparql_query = generated_template['sparql_wikidata']
    if old_properties_ids is None:
        old_properties_ids = questions_generator.get_elements_from_query(sparql_query, [0, 1], True)
    questions_generator.relation_generation_common_part(current_uid, generated_template, generated_questions, old_properties_ids, old_properties)
    right_subgraph_nnqt_question_construction(generated_template)
    return generated_template
Ejemplo n.º 2
0
def unknown_relation_generation(current_uid: int, question_template: Dict[str, Any], generated_questions: List[Dict[str, Any]],
old_properties_ids: List[str] = None, old_properties: List[str] = None) -> Dict[str, Any]:
    generated_template = deepcopy(question_template)
    if old_properties_ids is None:
        sparql_query = generated_template['sparql_wikidata']
        old_properties_ids = questions_generator.get_specific_elements_from_query(sparql_query, [0], "p", "P")
        old_properties_ids += questions_generator.get_specific_elements_from_query(sparql_query, [0], "pq", "P")
    questions_generator.relation_generation_common_part(current_uid, generated_template, generated_questions, old_properties_ids, old_properties)
    unknown_nnqt_question_construction(generated_template)
    return generated_template
def string_matching_type_relation_contains_word_relation_generation(
        current_uid: int,
        question_template: Dict[str, Any],
        generated_questions: List[Dict[str, Any]],
        old_properties_ids: List[str] = None,
        old_properties: List[str] = None) -> Dict[str, Any]:
    generated_template = deepcopy(question_template)
    if old_properties_ids is None:
        sparql_query = generated_template['sparql_wikidata']
        old_properties_ids = questions_generator.get_elements_from_query(
            sparql_query, [1], True)
    questions_generator.relation_generation_common_part(
        current_uid, generated_template, generated_questions,
        old_properties_ids, old_properties)
    string_matching_type_relation_contains_word_nnqt_question_construction(
        generated_template)
    return generated_template