dicee.query_generator
Classes
Module Contents
- class dicee.query_generator.QueryGenerator(train_path, val_path: str, test_path: str, ent2id: Dict = None, rel2id: Dict = None, seed: int = 1, gen_valid: bool = False, gen_test: bool = True)[source]
- train_path
- val_path
- test_path
- gen_valid = False
- gen_test = True
- seed = 1
- max_ans_num = 1000000.0
- mode
- ent2id = None
- rel2id: Dict = None
- ent_in: Dict
- ent_out: Dict
- query_name_to_struct
- construct_graph(paths: List[str]) Tuple[Dict, Dict] [source]
Construct graph from triples Returns dicts with incoming and outgoing edges
- fill_query(query_structure: List[str | List], ent_in: Dict, ent_out: Dict, answer: int) bool [source]
Private method for fill_query logic.
- achieve_answer(query: List[str | List], ent_in: Dict, ent_out: Dict) set [source]
Private method for achieve_answer logic. @TODO: Document the code
- ground_queries(query_structure: List[str | List], ent_in: Dict, ent_out: Dict, small_ent_in: Dict, small_ent_out: Dict, gen_num: int, query_name: str)[source]
Generating queries and achieving answers
- generate_queries(query_struct: List, gen_num: int, query_type: str)[source]
Passing incoming and outgoing edges to ground queries depending on mode [train valid or text] and getting queries and answers in return @ TODO: create a class for each single query struct