Military knowledge question and answer generation method and computer system based on knowledge graph

Through the military field knowledge Q&A generation method based on knowledge graphs, using big models and natural language processing technology, the problem that non-professionals find it difficult to effectively explore military knowledge is solved, and efficient and accurate information acquisition and concise Q&A presentation are achieved, which improves the The efficiency and accuracy of information query and analysis in the military field.

CN118798366BActive Publication Date: 2024-12-31XIAMEN YUANTING INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411259649.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-10
Publication Date
2024-12-31
Estimated Expiration
2044-09-10

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively promote non-professionals to use knowledge graphs to explore military knowledge in the military field, and the lack of concise and clear Q&A generation methods, resulting in insufficient information acquisition efficiency and accuracy.

Method used

Using the military field knowledge question-and-answer generation method based on the knowledge graph, the generation of preliminary graph search statements, keyword extraction and processing, node score calculation and filtering, template construction and intelligent question-and-answer generation are concise and clear. answer.

Benefits of technology

Reduce manual intervention, improve the accuracy and efficiency of knowledge graphs, enhance the understanding and retrieval ability of complex data in the military field, simplify information acquisition, and meet the needs of knowledge acquisition and application in the military field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798366B_ABST
    Figure CN118798366B_ABST
Patent Text Reader

Abstract

The present invention provides a method for generating knowledge questions and answers in the military field based on a knowledge graph, comprising: a knowledge graph forming step; a preliminary graph retrieval statement generating step, using a large model to perform natural language processing on user questions to generate preliminary knowledge graph retrieval statements; a knowledge graph retrieval step, constructing a result document according to each result relationship; a keyword extraction and processing step, using important nodes as keywords; a node score calculation and filtering step, calculating the matching score of each result document and keyword, retaining the result documents and nodes with high correlation; a template construction and data assembly step, constructing an answer template based on the result documents and nodes with high correlation; an intelligent question and answer generating step, inputting the data in the answer template into a generation model to generate an answer. The method improves the efficiency and accuracy of information query and analysis in the military field.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method for generating military knowledge questions and answers based on a knowledge graph, a computer system, a readable storage medium, and a program product. Background Art

[0002] As a comprehensive knowledge system of structured human knowledge, the knowledge graph encompasses basic facts, universal rules and related information, and is widely used in advanced technology fields such as information retrieval, intelligent reasoning and decision-making. Its initial success was to significantly improve the performance of search engines, and then gradually expanded to diversified application scenarios such as assisted question-answering, deep understanding of natural language, and personalized recommendations, showing strong value potential.

[0003] Recently, people's demand for efficient acquisition and application of military knowledge has increased dramatically. With its unique advantages in knowledge organization and management, knowledge graphs have been put into practical application in this field. For example, the Chinese patent application with publication number CN113806513A discloses a method and system for constructing a question-answering system based on military knowledge graphs, demonstrating the positive role of knowledge graphs in knowledge dissemination in the military field.

[0004] Nevertheless, faced with the challenge of the growing demand for knowledge in the military field, how to further promote non-professionals to effectively use knowledge graphs to explore military knowledge remains a pressing issue that needs to be addressed. Summary of the invention

[0005] Based on the shortcomings of the existing military field knowledge question and answer generation method based on knowledge graph, the present invention proposes a new military field knowledge question and answer generation method based on knowledge graph, including: a knowledge graph forming step, forming a military field knowledge graph; a preliminary graph retrieval statement generating step, using a large model to perform natural language processing on user questions to generate preliminary knowledge graph retrieval statements; a knowledge graph retrieval step, according to the preliminary knowledge graph retrieval statement, performing data retrieval in the military field knowledge graph to obtain result relations, and constructing a result document according to each result relation; a keyword extraction and processing step, performing keyword extraction processing on the user question, including constructing a graph model, creating nodes, and taking the first M nodes arranged in front of the weight as keywords; a node score calculation and filtering step, vectorizing the result document and the keyword, calculating the matching score of each result document and the keyword, and retaining the result document and the node with high correlation; a template construction and data assembly step, constructing an answer template based on the result document and the node with high correlation; an intelligent question and answer generation step, inputting the data in the answer template into the generation model to generate an answer.

[0006] Furthermore, the keyword extraction and processing step of the method also includes: segmenting, filtering and standardizing the user questions, and when constructing the graph model, creating edges, constructing graph formulas, and adjusting the weights of military domain vocabulary in the graph model.

[0007] Furthermore, the keyword extraction and processing step of the method further includes calculating the weight of the node using the following formula:

[0008]

[0009] in Is a node The importance score of , d is the damping coefficient, N is the total number of all the nodes of the corresponding graph in the graph model, Is a node The source node set of all incoming edges of Is a node and nodes The weight between Is a node The number of outgoing links is calculated, and the first M nodes with the highest weights are extracted as the keywords, where M is greater than or equal to 1 and less than or equal to 10.

[0010] Furthermore, the node score calculation and filtering step of the method also includes vectorizing the result documents and keywords through a BGE vector model, calculating the similarity score of each result document and keyword using a cosine similarity algorithm, and retaining the result documents and keywords with a similarity score above 0.55.

[0011] Furthermore, the method also includes a sub-node association expansion step, performing an extended query retrieval on the result document in the military field knowledge graph, and merging the retrieval results into the result document for constructing the answer template.

[0012] Furthermore, the method also includes a matching rearrangement and confidence elimination step, calculating the matching degree of the result document and keywords with the user question, and eliminating the confidence according to the calculation result, retaining the result document with high confidence as the final output document for constructing the answer template.

[0013] Furthermore, the method uses the BM25 algorithm to perform the matching rearrangement, and calculates the BM25 score of each result document for the query of the user question:

[0014]

[0015] Wherein, Q represents the query, D represents the result document, Is a specific word The frequency of occurrence in document D, is the length of the result document D, represents the average length of all the result documents, and b are parameters, with default values = 1.5 and b = 0.75, Indicates the calculation of specific words The inverse document frequency of a specific word The discriminative power in the entire set of result documents is calculated as follows:

[0016]

[0017] Where N is the total number of documents, Contains specific words The number of result documents.

[0018] Furthermore, the method sets the confidence threshold as a BM25 algorithm score threshold of 0.75, and the result documents with scores below 0.75 are eliminated.

[0019] Furthermore, the keyword extraction and processing steps of the method also include expansion and synonym replacement of the keywords.

[0020] Furthermore, the method also includes a feedback step, accepting user evaluation of the answer, and optimizing the generation model and the military field knowledge graph based on the evaluation.

[0021] To solve the above problem, the present invention further provides a computer system, including a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the above method.

[0022] To solve the above problem, the present invention further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above method are implemented.

[0023] To solve the above problem, the present invention also provides a computer program product, including a computer program, which implements the steps of the above method when executed by a processor.

[0024] The present invention conceives a method for generating knowledge questions and answers in the military field based on a knowledge graph. Compared with the prior art, the technical solution of the present invention: 1) reduces manual intervention and improves the accuracy and efficiency of the knowledge graph; 2) improves the ability to understand and retrieve complex data in the military field; 3) through an intelligent question-and-answer system, extracts relevant information from the constructed knowledge graph according to the user's questions, and presents it to the user in a concise and clear manner.

[0025] The technical solution of the present invention effectively combines related technologies to help users (people) better understand a large amount of military information. This meets the needs of the military field for knowledge acquisition and application. By integrating the powerful organization and association data capabilities of the knowledge graph with advanced natural language processing technology, the efficiency and accuracy of information query and analysis in the military field are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] Figure 1 This is a schematic diagram of the steps for constructing a Neo4j military database according to an embodiment of the present invention;

[0027] Figure 2 It is a flowchart of the steps of a method for generating military knowledge questions and answers based on a knowledge graph in one embodiment of the present invention. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0029] An embodiment of the present invention provides a method for generating military knowledge questions and answers based on a knowledge graph, comprising the following steps.

[0030] Steps to form a knowledge graph

[0031] First, the knowledge graph formation step is carried out to form a knowledge graph in the military field.

[0032] This step is a preliminary preparation step, which may specifically include the steps of constructing a military terminology library and a military field knowledge graph. The military terminology library may be created and maintained by intelligence personnel, professionals or expert groups to form a special military terminology library, which may include various commonly used military abbreviations, codes and code names, etc. The construction of the military field knowledge graph may include data collection and data extraction. Data collection may specifically be obtaining relevant public data in the military field from reliable sources.

[0033] Data extraction can also be further implemented by extracting graph nodes from data through the Qwen (large) model. The Qwen model is a large-scale visual language model (LVLM) developed by Alibaba Cloud. The parameter scales of the Qwen series models are 1.8 billion (1.8B), 7 billion (7B), 14 billion (14B), and 72 billion (72B), including the basic model Qwen and the dialogue model Qwen-Chat.

[0034] The specific data extraction and construction process is shown in Table 1 below:

[0035] Table 1 Data extraction example table

[0036]

[0037] In the knowledge graph formation step of this embodiment, the military terminology library constructed in the above steps can be further supplemented and replaced accordingly for the entity names in the data extraction results, for example, replacing "Type 055 destroyer" with "Type 055 guided missile destroyer" to make the data more accurate.

[0038] In the knowledge graph formation step of this embodiment, the data extraction results can also be written into a large model, such as a Neo4j model, to form a military knowledge graph based on Neo4j. The Neo4j model is an open source graph database management system model that uses a graph data model to store, manage and query data, and uses nodes, edges and properties to represent data.

[0039] The above process of forming a knowledge graph in the military field can also be directly referenced Figure 1 , including: "start" step, start the formation step of the knowledge graph (military knowledge graph); "crawler collection" step, use legal crawler collection method to collect and obtain relevant public data in the military field; then perform "parse and extract node relationship" step, for example, extract graph nodes from data through Qwen big model, so as to realize the relationship between parsed extracted nodes (construction); after that, perform "replace synonyms based on military vocabulary, etc." step, expand nodes (result documents) and keywords; thereafter, realize the "Neo4j military library" construction step, including writing data extraction results into Neo4j model, so as to form a military knowledge graph based on Neo4j; finally, "end" step, end the corresponding program.

[0040] Steps for generating preliminary graph search statements

[0041] Next, the preliminary graph retrieval statement generation step is carried out, and the large model is used to perform natural language processing on user questions to generate preliminary knowledge graph retrieval statements.

[0042] In the initial graph search statement generation step, the context of the user's question and the user's historical interaction can be combined, and the question can be reorganized and the entity name can be extracted through the corresponding big model. Specifically, the corresponding user question can be reorganized through the Qwen big model, and the corresponding entity name can be extracted.

[0043] An example of a specific reorganization process is shown in Table 2 below:

[0044] Table 2 Example of problem restructuring process

[0045]

[0046] Furthermore, the extraction results can be cleaned and processed based on the military terminology library.

[0047] An example of cleaning is shown in Table 3:

[0048] Table 3 Cleaning treatment example

[0049]

[0050] The cleaned extraction results can be further assembled into corresponding query statements, specifically, Cypher query statements. At this time, a query statement for assembling a one-dimensional subgraph based on the entity name is implemented. A specific example is shown in Table 4 below:

[0051] Table 4 Query statement assembly example table

[0052]

[0053] The knowledge graph retrieval step is to perform data retrieval in the military field knowledge graph based on the preliminary knowledge graph retrieval statement. The retrieval results are the nodes in the military field knowledge graph and the relationships between the nodes, which are called result relationships. A result document is constructed based on each result relationship.

[0054] Specifically, when performing data retrieval, data retrieval can be performed in the military field knowledge graph constructed in the aforementioned steps based on the Cypher query statement assembled in the aforementioned steps, and when assembling documents, a corresponding result document is constructed for each result relationship.

[0055] Keyword extraction and processing steps

[0056] In the keyword extraction and processing step, keyword extraction is performed on the user question, including building a graph model, creating nodes, and taking the M nodes ranked first in weight as keywords.

[0057] In an embodiment of the present invention, the keyword extraction and processing step may also include: segmenting, filtering and standardizing user questions, and when constructing a graph model, creating edges, constructing a graph formula, and adjusting the weights of military field vocabulary in the graph model.

[0058] When segmenting words, you can use the Jieba library to segment user questions and process stop words. Jieba is a Python third-party Chinese word segmentation library that supports three word segmentation modes: precise mode, full mode, and search engine mode.

[0059] This embodiment can identify and replace the segmented words in the words after word segmentation during the filtering and standardization process based on the military terminology library (domain vocabulary) of the knowledge graph retrieval step to ensure the standardization of the words.

[0060] When constructing a graph model, this embodiment may include processes such as creating nodes, creating edges, and constructing graph formulas.

[0061] When creating a node, each word (including domain words) after the above segmentation, filtering and standardization processing can be used as a node. When creating an edge, the edge between words can be established based on the co-occurrence relationship or other semantic relationship to achieve the establishment of the edge. In addition, the weight of the edge can be set according to the co-occurrence frequency of the word in the text.

[0062] When constructing the graph formula, we can do it based on co-occurrence relationships. For example, in a text, if two words appear together (such as in a window), an edge is established in the graph. The weight of the edge can be determined by the number of co-occurrences of the words, with the following formula:

[0063]

[0064] In the formula, and Represents two different words respectively.

[0065] In this step, the weight of the domain vocabulary can also be adjusted, that is, in order to ensure that the domain vocabulary obtains a higher weight in the graph, the weight of the military domain vocabulary can be adjusted. The corresponding weight adjustment formula can be:

[0066]

[0067] In this embodiment, Representing the weight of domain vocabulary, the keyword extraction and processing step can also include calculating the weight of (each) node using the following formula (the core formula of the TextRank algorithm):

[0068]

[0069] in Is a node The importance score of the node, d is the damping coefficient, which is used to control the probability of random jumps. It determines the probability of a random walker jumping to any node when visiting a node. The final score of a node is mainly calculated by the scores of adjacent nodes, and d determines the score weight of this part. In this embodiment, d can be set to 0.85. N is the total number of all nodes in the corresponding graph in the graph model, Is a node The source node set of all incoming edges of Is a node and nodes The weight between Is a node The number of outgoing links is used to extract the top M nodes with the highest weight as keywords, where M is greater than or equal to 1 and less than or equal to 10. The value of M is related to the number of keywords that are usually suitable for extraction in a user question. Usually, the number of keywords mentioned in a user question is limited.

[0070] The TextRank algorithm is a graph-based sorting algorithm for text. It can construct a node connection graph by dividing the text into several components (sentences), and the similarity between sentences can be used as the weight of the edge.

[0071] For example, the nodes are sorted according to the calculated node weights, and the nodes with the highest weights are extracted as corresponding keywords, as shown in the following Table 5 (Table 5 corresponds to the case where M is equal to 2):

[0072] Table 5 Node extraction example table

[0073]

[0074] The keyword extraction and processing step may also include keyword expansion and synonym replacement processing, which may be specifically performed on the extraction results based on the military terminology library.

[0075] Node score calculation and filtering steps

[0076] In the node score calculation and filtering step, the result documents and keywords are vectorized, the matching scores of each result document and keyword are calculated, and the result documents and nodes with high correlation are retained. The correlation is controlled by the score. In this embodiment, the correlation score above 0.55 is defined as high correlation.

[0077] In an embodiment of the present invention, the node score calculation and filtering step may also include vectorizing the result documents and keywords through a BGE (BAAI General Embedding) vector model, calculating the similarity score of each result document and keyword using a cosine similarity algorithm, and retaining the result documents and keywords with a similarity score above 0.55, that is, those with a score greater than or equal to 0.55 calculated according to the formula are considered to have high correlation.

[0078] The BGE vector model is a general embedding model developed by the Beijing Zhiyuan Artificial Intelligence Research Institute (BAAI). It can map any text to a low-dimensional dense vector, is Chinese-friendly, and has been widely used in text vectorization tasks. Therefore, this embodiment uses this vector model to vectorize the result documents assembled in the above steps and the extracted keywords to achieve document and keyword vectorization. In this process, the result document refers to a one-dimensional relationship, each set of relationships is regarded as a document, and then the keyword is regarded as a question document, the correlation between the two is calculated, and the similarity score is calculated.

[0079] In the embodiment of the present invention, when the cosine similarity algorithm is used to calculate the similarity score between each document and the keyword, it can be implemented by calculating the dot product of the vectors.

[0080] For two vectors A and B (A and B represent the result document and question document retrieved above, i.e., the vectors obtained by their vectorization), the dot product formula is:

[0081]

[0082] in, and is the first The value of the dimension, n represents the number of dimensions.

[0083] Then, calculate the magnitude (or norm) of the vector using the formula:

[0084]

[0085] The parameters of the above formula are the same as above.

[0086] After that, calculate the cosine similarity ( ), the formula is:

[0087]

[0088] Among them, ||A|| and ||B|| represent the modulus of the vectors corresponding to A and B respectively. The calculation result is between [-1,1], and the closer the value is to 1, the higher the similarity. As mentioned above, the threshold is set to filter out the nodes with lower scores and only retain the nodes with high correlation. This embodiment has found through a large number of tests that when the score is above 0.55, the result documents (and question documents) with higher correlation can be retained.

[0089] Subnode association expansion steps

[0090] In this embodiment, a sub-node association expansion step may also be included to perform an extended query retrieval on the result document in the military field knowledge graph, and merge the retrieval results into the result document for constructing an answer template.

[0091] For the result documents retained by the above process (at this time, the document set after one-dimensional data retrieval and score filtering), a two-dimensional subgraph query is performed in the graph to achieve two-dimensional subnode association to expand the data range. And further secondary assembly of the document is performed, that is, the data retrieved by the two-dimensional subgraph is split, and finally the current one-dimensional subgraph and the single node of the two-dimensional subgraph are regarded as an updated result document.

[0092] The extension of this step is to extend the original one-dimensional document into a two-dimensional document: for example, in the graph, node a is associated with node b, and node b is considered as the one-dimensional of node a. However, node b is also associated with node c and node d, so node c and node d are considered as the two-dimensional of node a. Therefore, the extended document is a two-dimensional document consisting of nodes a, b and c, and a two-dimensional document consisting of nodes a, b and d (of course, the relationship names between nodes should also be included in the document, such as the content between the two symbols "--" and "-->" in the aforementioned tables represents the relationship name, such as the word "own" in Table 1).

[0093] Matching rearrangement and confidence elimination steps

[0094] In this embodiment, matching rearrangement and confidence elimination steps may also be included to calculate the matching degree of the result document and keywords with the user question, and to eliminate the confidence according to the calculation result, retaining the result document with high confidence as the final output document for constructing the answer template.

[0095] The matching rearrangement and confidence elimination steps may also include document input to input data. The input data may be the document set assembled in the above steps (a single node of the one-dimensional subgraph and the two-dimensional subgraph is regarded as a collection of updated result documents) and the keywords determined in the above steps.

[0096] In this embodiment, the BM25 algorithm may be used for matching rearrangement (including parameter initialization and configuration of BM25 algorithm parameters). The BM25 algorithm is a commonly used information retrieval algorithm. This embodiment uses it to calculate the BM25 score of each result document for the user's query ( ):

[0097]

[0098] Among them, Q represents the query, D is the result document, Is a specific word The frequency of occurrence in document D. A specific word qi refers to the i-th word in the query q (i.e., the letter "q" represents the user's question). Specifically, the BM25 model calculates the contribution of each word in the query to the relevance of the document, and adds up these contributions to get the relevance score of the entire query to the document.

[0099] is the length of the result document D, It represents the average length of all result documents. and b are parameters, Controls the saturation of word frequency. When calculating the word frequency contribution in a document, Controls the growth rate of word frequency, b controls the impact of document length on the score. When calculating the document length normalization, b adjusts the impact of document length on the score. In this embodiment, the default value is =1.5 and b=0.75.

[0100] Indicates the calculation of specific words The inverse document frequency of a specific word The discriminative power in the entire result document set is calculated as follows:

[0101]

[0102] Where N is the total number of documents, Contains specific words The number of result documents.

[0103] Set the BM25 algorithm score with a confidence threshold of 0.75 ( ), and the result documents with scores below 0.75 are eliminated. The calculation process of the above document set can include traversing each document to calculate the BM25 score of the document and the question, and then sorting them in descending order according to the scores, placing the most relevant documents at the front to remove irrelevant data. This embodiment sets a confidence threshold, that is, sets a minimum BM25 score threshold, and data below this score is directly eliminated. Through a large number of test statistics, as mentioned above, this embodiment concludes that 0.75 is the most appropriate threshold.

[0104] According to the above calculation process, an example of the final output document set is shown in Table 6 below:

[0105] Table 6 Output document result example table

[0106]

[0107] Among them, the BM25 algorithm can normalize the document length, better balance the influence of word frequency and document length, provide stable and explanatory ranking results, and it is an algorithm with widely verified and optimized results. It can be used to effectively measure the relevance between documents and queries. This embodiment uses this algorithm to provide efficient and correct document sorting in complex military field knowledge retrieval, which helps to improve the overall performance and experience of the question-answering system.

[0108] It should be noted that, in other embodiments of the present invention, the reranking can also be performed using the bge-reranker-large open source reranking model to output a reranked document set.

[0109] Template construction and data assembly steps

[0110] In the template construction and data assembly steps, answer templates are constructed based on highly relevant result documents and nodes.

[0111] An assembly example is shown below:

[0112] Table 7 Data assembly example table

[0113]

[0114] In the example shown in Table 7, the contents of question and context can be replaced, where question corresponds to the input user question and context represents the final result document. Therefore, the generation of the corresponding answer template is relatively certain.

[0115] Smart Question and Answer Generation Steps

[0116] The intelligent question and answer generation step of the embodiment of the present invention may include inputting the data in the answer template into the generation model to generate the answer. Specifically, the assembly result based on the template construction and data assembly steps may be brought into the Qwen large model (generation model) to generate a natural, fluent and professional answer.

[0117] Feedback Steps

[0118] In the embodiment of the present invention, a feedback step may also be included to accept the user's evaluation of the answer, and optimize the generated model and military field knowledge map according to the evaluation. For example, the personalization and pertinence of the answer are optimized by combining the user's interaction history and context information. Accordingly, a feedback mechanism may be set up, and the user may evaluate the answer, and the system continuously optimizes the model and knowledge map according to the evaluation.

[0119] A specific question-answering production process can be referred to Figure 2, including: "start" step, i.e. start the question and answer generation method; then perform the "user question" step, i.e. input the user question; after that, perform the "determine whether there is a history record of the conversation", if there is (history record), i.e. "yes", then enter the "reorganize question" step, i.e. reorganize the question according to the history record; then enter the "question Jieba word segmentation" step; if the result of "determine whether there is a history record of the conversation" is no (history record), i.e. "no", then directly enter the "question Jieba word segmentation" step; after the aforementioned word segmentation step, you can perform the "TextRank keyword extraction step", then enter the "word replacement based on vocabulary" step, and continue to perform the "keyword assembly Cypher statement" step, the statement of this step is used to search in the neo4j military knowledge base (knowledge graph) constructed in the aforementioned step; thereafter, perform the "assemble question + retrieve document into Qwen large model for question and answer" step to assemble the question, and substitute the retrieved document (result document) into the Qwen large model for question and answer, and finally perform the "output" step to output the corresponding question and answer data (question reply).

[0120] The technical solution provided by the embodiment of the present invention can improve the efficiency of organizing and managing knowledge information in the military field. The huge military information resources can be effectively managed and utilized through the knowledge graph, thereby improving the efficiency and accuracy of information retrieval. Moreover, the technical solution provided by the embodiment of the present invention can improve the processing capability of military information. Through natural language processing technology and information retrieval technology, useful information can be effectively extracted from a large amount of unstructured data, thereby improving the processing efficiency and accuracy of information. Finally, the technical solution of the present invention can improve the efficiency and convenience of obtaining military information. Through the intelligent question-and-answer system, relevant information can be extracted from the constructed knowledge graph according to the user's questions, and presented to the user in a concise and clear manner, thereby improving the efficiency and convenience of information acquisition.

[0121] The embodiment of the present invention also provides a computer system, including a memory, a processor, and a computer program stored in the memory. The computer system may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, etc., and the computer system is taken as an example of a mobile phone: at this time, the memory may be used to store software programs and modules, and the processor executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application for a sound playback function, an application for an image playback function, etc.); the data storage area may store data created according to the use of the mobile phone (such as audio data, address book, etc.). In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The processor of the mobile phone executes the computer program to implement the steps of the method for generating military knowledge questions and answers based on the knowledge graph of the present invention, and the corresponding contents of the aforementioned embodiment may be referred to.

[0122] The embodiment of the present invention further provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the corresponding steps of the aforementioned method embodiment are implemented.

[0123] The embodiment of the present invention also provides a computer program product, including a computer program. The computer program product includes a computer-readable code, which can be directly loaded into the memory of a programmable computing unit, and the computer program product has a program code medium, so that when the computer program product is executed in the computing unit, the method according to the embodiment of the present invention is executed. The computer program product can be a computer program or include a computer program. It is thus possible to quickly, repeatably and robustly execute the method according to the present invention. The computer program product can be configured so that the method steps according to the present invention can be executed by means of a computing unit. The computer program product is, for example, stored on a computer-readable medium or stored in a computer network or server, from which the computer program product can be loaded into the processor of the computing unit. In addition, the control information of the computer program product can be stored on an electronically readable data carrier. The control information of the electronically readable data carrier can be designed so that when the data carrier is applied in the computing unit, the control information executes the method according to the present invention. Therefore, the computer program product can also be an electronically readable data carrier. Examples of electronically readable data carriers are DVDs, tapes, hard disks or USB flash drives, on which electronically readable control information is stored, and the control information particularly corresponds to a program coding medium. When the control information is read from the data carrier and stored in the computing unit, all embodiments of the method described above according to the present invention can be executed. The computer program product can implement the steps of the method described in the above embodiment when executed by a processor or the like.

[0124] The contents of the parts that are not expanded in detail in the various embodiments of this specification can be referenced to each other. For example, the contents of the method embodiment part of the specification can be referenced to the embodiments corresponding to the computer system, computer-readable storage medium and computer program product, and the embodiments of the computer system, computer-readable storage medium and computer program product can also be referenced to each other.

[0125] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for generating military knowledge questions and answers based on knowledge graph, characterized in that: include: The steps of forming a knowledge graph are to form a knowledge graph in the military field; The preliminary graph search statement generation step uses a large model to perform natural language processing on user questions and generate preliminary knowledge graph search statements; A knowledge graph retrieval step, performing data retrieval in the military field knowledge graph according to the preliminary knowledge graph retrieval statement, obtaining result relationships, and constructing a result document according to each result relationship; A keyword extraction and processing step is to extract keywords from the user question, including constructing a graph model, creating nodes, and taking the first M nodes ranked in the front by weight as keywords, where M is greater than or equal to 1 and less than or equal to 10; the result relationship is the relationship between nodes in the retrieved knowledge graph; The node score calculation and filtering step is to vectorize the result documents and keywords, calculate the matching score of each result document and keyword, and retain the result documents and nodes with high correlation; A template construction and data assembly step, constructing an answer template based on the result documents and nodes with high correlation; The intelligent question and answer generation step is to input the data in the answer template into the generation model to generate an answer; It also includes a sub-node association expansion step, performing an extended query retrieval on the result document in the military field knowledge graph, merging the retrieval results into the result document to form an expanded result document for constructing the answer template; the expanded result document is a document composed of the nodes in the result document and the sub-nodes associated with the nodes in the result document, and the expanded result document includes the relationship between the nodes and the sub-nodes.

2. The method for generating military knowledge questions and answers based on knowledge graph according to claim 1, characterized in that: The keyword extraction and processing step also includes: segmenting, filtering and standardizing the user questions, and when constructing the graph model, adjusting the weights of military domain vocabulary in the graph model.

3. The method for generating military knowledge questions and answers based on knowledge graph as claimed in claim 2, characterized in that: The keyword extraction and processing step also includes calculating the weight of the node using the following formula: in Is a node The importance score of , d is the damping coefficient, N is the total number of all the nodes of the corresponding graph in the graph model, Is a node The source node set of all incoming edges of Is a node and nodes The weight between Is a node The number of outgoing links is calculated, and the first M nodes with the highest weights are extracted as the keywords.

4. The method for generating military knowledge questions and answers based on knowledge graph as claimed in claim 3, characterized in that: The node score calculation and filtering step also includes vectorizing the result documents and keywords through a BGE vector model, calculating the similarity score of each result document and keyword using a cosine similarity algorithm, and retaining the result documents and keywords with a similarity score above 0.

55.

5. The method for generating military knowledge questions and answers based on knowledge graph according to claim 4, characterized in that: It also includes matching rearrangement and confidence elimination steps, calculating the matching degree of the result document and keywords with the user question, and eliminating the confidence according to the calculation result, retaining the result document with high confidence as the final output document for constructing the answer template.

6. The method for generating military knowledge questions and answers based on knowledge graph according to claim 5, characterized in that: The matching is rearranged using the BM25 algorithm, and the BM25 score of each result document for the query of the user question is calculated. The score calculation formula is: Wherein, Q represents the query, D represents the result document, Is a specific word The frequency of occurrence in document D, is the length of the result document D, represents the average length of all the result documents, and b are parameters, set = 1.5 and b = 0.75, Indicates the calculation of specific words The inverse document frequency of a specific word The ability to distinguish among the entire set of result documents, The calculation is as follows: Where N is the total number of documents, Contains specific words The number of result documents.

7. A computer system comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method for generating military domain knowledge questions and answers based on knowledge graphs as described in any one of claims 1 to 6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for generating military field knowledge questions and answers based on knowledge graphs as described in any one of claims 1 to 6 are implemented.

9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method for generating military field knowledge questions and answers based on knowledge graphs as described in any one of claims 1 to 6 are implemented.