Research Article
Multigranularity Pruning Model for Subject Recognition Task under Knowledge Base Question Answering When General Models Fail
Algorithm 1
The core algorithm of MGPM.
| | Input: Question , Entity set , Relation set , Domain set , Fact set | | | Output: Recognized subject | | (1) | Initialize | | (2) | forindo | | (3) | Calculate by Pruning Model I | | (4) | ifthen | | (5) | end for | | (6) | forindo | | (7) | ifinthen | | (8) | end for | | (9) | forindo | | (10) | Calculate by Pruning Model II | | (11) | ifthen | | (12) | end for | | (13) | forindo | | (14) | ifinandnot inthen | | (15) | end for | | (16) | forindo | | (17) | Calculate by Pruning Model III | | (18) | ifthen | | (19) | end for | | (20) | forindo | | (21) | Calculate by Pruning Model IV | | (22) | | | (23) | end for | | (24) | | | (25) | return |
|