The invention discloses a template-based
software defect automatic question and answer method, and belongs to the field of
software maintenance, and the method comprises the steps: firstly, extractingan entity relationship triple from a bug corpus, and obtaining a
natural language mode; Then determining an entity relationship in the triple; Acquiring a query template corresponding to the naturallanguage mode; Replacing an entity in the question q proposed by the user with an
entity type to obtain a question q '; Comparing and searching the
entity type in the q'with the
entity type in the
natural language mode, and calculating the similarity; Obtaining an
SPARQL query mode of the question q according to the similarity and the entity in the question q; And finally, searching and executingthe
SPARQL query mode of the question q on the entity
relation graph constructed by the bug report, thereby obtaining the answer of the question q. According to the method,
natural language semantic understanding is carried out through the template, the understanding effect is good,
template matching is carried out based on the entity type, the search space is greatly reduced, and the efficiency of
software defect automatic
question answering is improved.