Intelligent question-answering method, device, electronic device and storage medium for weapons and equipment
The intelligent question-answering method and device address inefficiencies in relational databases by using a weapon knowledge graph and question templates to quickly retrieve relevant weapon equipment data, enhancing query efficiency and user experience.
Patent Information
- Application Number
- CN202210497828.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-09
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-05-09
AI Technical Summary
Relational databases used for storing weapon equipment data face inefficiencies due to the wide variety of categories and complex relationships, leading to low storage efficiency and cumbersome queries, which affect user experience.
An intelligent question-answering method and device that pre-stores a weapon knowledge graph and multiple question types, including templates, to quickly determine the best matching question template and obtain answers from the graph, utilizing attribute tag and index libraries for different answer types.
Improves query efficiency and enhances user experience by rapidly identifying relevant information through a weapon knowledge graph, simplifying operations and accelerating answer retrieval.
Smart Images

Figure CN114996419B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to an intelligent question-answering method, device, electronic device and storage medium for weapon equipment. Background Art
[0002] Weapon equipment data is important data in the military field and has high military value. At present, relational databases are generally used to store weapon equipment data, but due to the wide variety of weapon equipment categories and complex relationships, this method has the problems of low storage efficiency and cumbersome query. Summary of the invention
[0003] In view of this, the object of the present invention is to provide an intelligent question-answering method, device, electronic device and storage medium for weapons and equipment.
[0004] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0005] In a first aspect, the present invention provides an intelligent question-answering method for weapons and equipment, which is applied to an electronic device, wherein the electronic device pre-stores a weapon knowledge graph and a plurality of question types, each of which includes a plurality of question templates; the method comprises:
[0006] Determine the target problem type to which the problem to be processed belongs according to the problem to be processed input by the user;
[0007] Acquire a target question template matching the question to be processed from all question templates of the target question type;
[0008] According to the target question template and the weapon knowledge graph, an answer corresponding to the problem to be processed is obtained.
[0009] The beneficial effect of the above implementation is that, based on multiple question types and their question templates, the question template that best suits the question input by the user can be quickly determined, and the corresponding answer can be obtained from the weapon knowledge graph based on the most suitable question template, thereby simplifying the operation, improving query efficiency and enhancing the user experience.
[0010] In an optional implementation manner, the electronic device also pre-stores an attribute tag library and an attribute index library; each of the question types has a corresponding answer type, and the answer type includes a definite value type and an indefinite value type;
[0011] After the step of acquiring a target question template matching the question to be processed from all question templates of the target question type, the method further includes:
[0012] Determine a target answer type corresponding to the target question type;
[0013] If the target answer type is the determined value type, then based on the target question template, an answer corresponding to the pending question is obtained from the weapon knowledge graph;
[0014] If the target answer type is the indeterminate value type, then based on the target question template, an answer corresponding to the question to be processed is obtained from the attribute tag library or the attribute index library.
[0015] The beneficial effect of the above implementation is that by setting the answer type corresponding to each question type, and for different answer types, obtaining the answer corresponding to the question to be processed from the weapon knowledge graph, or the attribute tag library, or the attribute index library, the speed of obtaining the answer is accelerated and the query efficiency is improved.
[0016] In an optional implementation manner, the step of acquiring a target question template matching the question to be processed from all question templates of the target question type includes:
[0017] Identify the name and attributes of the target weapon corresponding to the problem to be processed according to a preset algorithm;
[0018] The name and attributes of the target weapon are matched with all question templates of the target question type to obtain the target question template.
[0019] The beneficial effect of the above implementation is that the key information in the problem to be processed is identified through a preset algorithm, which facilitates rapid matching with the problem template, thereby saving time and improving efficiency.
[0020] In an optional implementation manner, the weapon knowledge graph is obtained in the following manner:
[0021] Extracting basic information and initial tags of multiple weapons from the original weapon information; the initial tags indicate the type of association between the weapon and each of its initially associated weapons;
[0022] Determine the weapon category of each weapon according to the basic information of each weapon, and obtain an ontology library including all weapon categories;
[0023] Performing knowledge fusion according to the basic information of each of the weapons to obtain an entity library of each of the weapons;
[0024] Performing knowledge reasoning based on the initial label of each weapon to obtain a target label of each weapon; the target label indicates the type of association between the weapon and each of its target-associated weapons;
[0025] The weapon knowledge graph is obtained according to the ontology library, the entity library of each weapon and the target label.
[0026] The beneficial effect of the above implementation is that by constructing a weapon knowledge graph, it is convenient to quickly query weapon information and apply it to intelligent question and answer of weapons and equipment, thereby improving query efficiency and enhancing user experience.
[0027] In an optional embodiment, each of the weapons has a weapon identification, and the basic information includes a plurality of names and a plurality of attribute names and attribute values thereof;
[0028] The step of performing knowledge fusion according to the basic information of each weapon to obtain the entity library of each weapon includes:
[0029] Take any weapon from all weapons as the first weapon;
[0030] Binding each name of the first weapon to a weapon identifier of the first weapon;
[0031] Binding each attribute name and attribute value of the first weapon to the weapon identifier of the first weapon to obtain an entity library of the first weapon;
[0032] Traverse each of the weapons to obtain the entity library of each of the weapons.
[0033] The beneficial effect of the above implementation is that by binding the identification of each weapon with its entire name and all attribute names and attribute values, the influence of different weapon names is eliminated, so that the weapon information can be quickly and accurately obtained through the weapon knowledge graph.
[0034] In an optional implementation, the step of performing knowledge reasoning based on the initial label of each weapon to obtain the target label of each weapon includes:
[0035] Take any weapon from all weapons as a second weapon;
[0036] Based on the initial tag of the second weapon, acquiring each initial associated weapon of the second weapon to obtain each weapon to be processed;
[0037] For each of the weapons to be processed, an indirectly associated weapon is obtained from all the initially associated weapons of the weapon to be processed, to obtain each indirectly associated weapon; wherein the type of association between the indirectly associated weapon and the weapon to be processed is the same as the type of association between the weapon to be processed and the second weapon;
[0038] Determine the type of association between the second weapon and each of the indirectly associated weapons according to a preset rule;
[0039] each initially associated weapon of the second weapon and each indirectly associated weapon as each target associated weapon of the second weapon;
[0040] Obtaining a target tag of the second weapon according to an association type between the second weapon and each of its target-associated weapons;
[0041] Traverse each of the weapons to obtain the target tag of each of the weapons.
[0042] The beneficial effect of the above implementation is that, through the initial associated weapons of a weapon, the weapons indirectly associated with it are obtained, and the relationship type is determined according to preset rules, so as to expand and improve the relationship between weapons, making the constructed weapon knowledge graph richer.
[0043] In an optional embodiment, the method further comprises:
[0044] Obtain each attribute value of each attribute name and its corresponding weapon ID;
[0045] Constructing an attribute tag library according to the maximum attribute value of each attribute name and its corresponding weapon identification, and the minimum attribute value of each attribute name and its corresponding weapon identification;
[0046] According to each intermediate attribute value of each attribute name and its corresponding weapon identification, an attribute index library is constructed; the intermediate attribute value represents the attribute value of all attribute values of the attribute name except the maximum attribute value and the minimum attribute value.
[0047] The above implementation has the beneficial effect that by constructing an attribute tag library of the maximum attributes of weapons and an attribute index library of the non-maximum attributes of weapons, it is convenient to quickly obtain weapon information, thereby improving query efficiency.
[0048] In a second aspect, the present invention provides an intelligent question-answering device for weapons and equipment, which is applied to an electronic device, wherein the electronic device pre-stores a weapon knowledge graph and a plurality of question types, each of which includes a plurality of question templates; the device comprises:
[0049] A determination module, used to determine the target problem type to which the problem to be processed belongs according to the problem to be processed input by the user;
[0050] A matching module, used for acquiring a target question template matching the question to be processed from all question templates of the target question type;
[0051] The reply module is used to obtain an answer corresponding to the problem to be processed according to the target question template and the weapon knowledge graph.
[0052] In a third aspect, the present invention provides an electronic device, including a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any one of the aforementioned embodiments is implemented.
[0053] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in any one of the aforementioned embodiments.
[0054] The intelligent question-answering method, device, electronic device and storage medium for weapons and equipment provided by the embodiment of the present invention are pre-stored with a weapon knowledge graph and multiple question types in the electronic device, each question type includes multiple question templates; the target question type to which the question to be processed belongs is determined according to the question to be processed input by the user; then the target question template matching the question to be processed is obtained from all question templates of the target question type; and then the answer corresponding to the question to be processed is obtained according to the target question template and the weapon knowledge graph. According to multiple question types and their question templates, the question template that best matches the question input by the user can be quickly determined, and the corresponding answer can be obtained from the weapon knowledge graph according to the most suitable question template, thereby simplifying the operation, improving the query efficiency and enhancing the user experience.
[0055] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0057] Figure 1 A block diagram of an electronic device provided by an embodiment of the present invention is shown;
[0058] Figure 2 A schematic diagram of a flow chart of an intelligent question-answering method for weapons and equipment provided by an embodiment of the present invention is shown;
[0059] Figure 3 Another schematic flow chart of the intelligent question-answering method for weapons and equipment provided by an embodiment of the present invention is shown;
[0060] Figure 4 Another schematic flow chart of the intelligent question-answering method for weapons and equipment provided by an embodiment of the present invention is shown;
[0061] Figure 5 Another schematic flow chart of the intelligent question-answering method for weapons and equipment provided by an embodiment of the present invention is shown;
[0062] Figure 6 A functional module diagram of an intelligent question-answering device for weapons and equipment provided by an embodiment of the present invention is shown.
[0063] Icons: 110 - bus; 120 - processor; 130 - memory; 150 - I / O module; 170 - communication interface; 300 - intelligent question-answering device for weapon equipment; 310 - determination module; 330 - matching module; 350 - reply module; 370 - construction module. DETAILED DESCRIPTION
[0064] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0065] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0066] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0067] Weapon equipment data is important data in the military field and has high military value. At present, relational databases are generally used to store weapon equipment data. However, due to the wide variety of weapon equipment categories and complex relationships, it takes a long time to find relevant data of weapon equipment, and there are problems such as low storage efficiency and cumbersome query, which also affects the user experience. Furthermore, an embodiment of the present invention provides an intelligent question-answering method for weapon equipment to solve the above problems.
[0068] Please refer to Figure 1 , is a block diagram of an electronic device provided by an embodiment of the present invention. The electronic device includes a bus 110 , a processor 120 , a memory 130 , an I / O module 150 , and a communication interface 170 .
[0069] The bus 110 may be a circuit that connects the above elements to each other and transfers communications (eg, control messages) between the above elements.
[0070] The processor 120 may receive commands from the other elements described above (eg, the memory 130 , the I / O module 150 , the communication interface 170 , etc.) through the bus 110 , may interpret the received commands, and may perform calculations or data processing according to the interpreted commands.
[0071] The processor 120 may be an integrated circuit chip with signal processing capabilities. The processor 120 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0072] The memory 130 may store commands or data received from the processor 120 or other elements (eg, the I / O module 150 , the communication interface 170 , etc.) or commands or data generated by the processor 120 or other elements.
[0073] The memory 130 can be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), or an electrically erasable programmable read-only memory (EEPROM).
[0074] The I / O module 150 may receive commands or data input from a user via input-output means (e.g., a sensor, a keyboard, a touch screen, etc.), and may transmit the received commands or data to the processor 120 or the memory 130 via the bus 110. It is also used to display various information (e.g., multimedia data, text data) received, stored, and processed from the above elements, and may display videos, images, data, etc. to the user.
[0075] The communication interface 170 may be used to communicate signaling or data with other node devices.
[0076] Understandably, Figure 1 The structure shown is only a schematic diagram of the structure of the electronic device. The electronic device may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0077] The electronic device provided in the embodiment of the present invention may be a smart phone, a personal computer, a tablet computer, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a server, etc. The embodiment of the present invention does not impose any limitation on this.
[0078] The above-mentioned electronic device will be used as an execution subject to execute each step in each method provided in the embodiment of the present invention and achieve corresponding technical effects.
[0079] See also Figure 2 , Figure 2 It is a flow chart of an intelligent question-answering method for weapons and equipment provided by an embodiment of the present invention.
[0080] It should be noted that the electronic device pre-stores a weapon knowledge graph and multiple question types, each of which includes multiple question templates. These multiple question types and their question templates can be understood as being pre-set based on the characteristics of the weapon equipment data.
[0081] Step S202, determining the target problem type to which the problem to be processed belongs according to the problem to be processed input by the user;
[0082] In this embodiment, the user can input the relevant issues of the weapon equipment, that is, the issues to be processed, through interactive operations. The interactive operations can be implemented through voice, interactive buttons, physical buttons, external devices, etc.
[0083] The problem to be processed can be input into a pre-built classifier, and the problem type to which the problem to be processed belongs, that is, the target problem type, can be determined based on the classifier. The classifier can be built based on a support vector machine (SVM).
[0084] Step S204, obtaining a target question template matching the question to be processed from all question templates of the target question type;
[0085] In this embodiment, based on the obtained target question type, all question templates of the target question type are obtained, and each question template therein is matched with the question to be processed.
[0086] The matching degree can be used to represent the matching degree between the question template and the problem to be processed, and the question template with the highest matching degree with the problem to be processed is obtained from all question templates of the target question type, that is, the target question template is obtained.
[0087] Step S206, obtaining an answer corresponding to the problem to be processed according to the target question template and the weapon knowledge graph;
[0088] In this embodiment, the weapon knowledge graph can be stored in a graph database, which includes information about multiple weapons and the relationships between the multiple weapons. The corresponding weapon can be determined from the target question template, and then the information about the weapon can be obtained from the weapon knowledge graph, that is, the answer to the problem to be processed can be obtained.
[0089] It can be seen that based on the above steps, the electronic device pre-stores a weapon knowledge graph and multiple question types, each of which includes multiple question templates; by determining the target question type to which the pending question belongs based on the pending question input by the user; then obtaining the target question template that matches the pending question from all the question templates of the target question type; and then obtaining the answer corresponding to the pending question based on the target question template and the weapon knowledge graph. Based on multiple question types and their question templates, the question template that best matches the question input by the user can be quickly determined, and the corresponding answer can be obtained from the weapon knowledge graph based on the most suitable question template, thereby simplifying the operation, improving the query efficiency and enhancing the user experience.
[0090] See also Figure 3 , the above step S204 may also include step S204-1 and step S204-3.
[0091] Step S204-1, identifying the name and attributes of the target weapon corresponding to the problem to be processed according to a preset algorithm;
[0092] In this embodiment, the preset algorithm may be an algorithm using a bidirectional long short-term memory network BiLSTM. The preset algorithm is used to identify and understand the problem to be processed, and obtain the name and attributes of the corresponding target weapon.
[0093] Optionally, the name and attributes of the target weapon corresponding to the problem to be processed can also be obtained based on a pre-built weapon word library. The weapon word library includes the names and attributes of some weapons with high search frequencies. Based on the weapon word library, the name and attributes of the weapon corresponding to the problem to be processed can be quickly identified.
[0094] Step S204-3, matching the name and attributes of the target weapon with all question templates of the target question type to obtain the target question template.
[0095] In this embodiment, for each question template in the target question type, a regular expression can be used to match each question template with the name and attributes of the target weapon corresponding to the question to be processed, and each matching degree is obtained, and the question template with the highest matching degree is used as the target question template.
[0096] It can be seen that the name and attribute of the target weapon corresponding to the problem to be processed are identified according to the preset algorithm, and the name and attribute of the target weapon are matched with all the problem templates of the target problem type to obtain the target problem template. The key information in the problem to be processed is identified by the preset algorithm, which is convenient for rapid matching with the problem template, thereby saving time and improving efficiency.
[0097] It is understandable that multiple question types can be preset based on the characteristics of weapon equipment data. Based on the fact that weapon equipment data usually includes the name of the weapon, the attributes of the weapon, and the relationship between the weapons, the embodiment of the present invention provides four types of questions: weapon attribute value type questions, weapon attribute maximum value type questions, weapon attribute value interval type questions, and weapon relationship attribute value type questions. It should be noted that the question type can also be set according to actual needs, and the embodiment of the present invention does not limit it.
[0098] Questions about weapon attribute values can be understood as questions related to the attributes of a certain weapon, for example, what is the length of ship A?
[0099] The maximum value of weapon attributes can be understood as a question related to the attributes of a certain type of weapon, for example, what is the missile with the longest range.
[0100] For weapon attribute value interval problems, it can be understood as problems related to the attribute range of a certain type of weapon. For example, what are the reconnaissance aircraft with a flight speed exceeding a kilometers per hour?
[0101] Weapon attribute value problems can be understood as problems related to the attributes of multiple weapons, for example, which of fighter B and fighter C has a faster flight speed.
[0102] The implementation of the present invention provides two types of answers based on the above four types of questions: a definite value type and an indefinite value type. The definite value type can be understood as the answer is a single definite value. The indefinite value type can be understood as the answer may be multiple values, the number of which is uncertain. It should be noted that the answer type can also be set according to actual needs, and the embodiment of the present invention does not limit it.
[0103] Different types of questions have different corresponding answer types. For ease of understanding, the present invention provides a corresponding relationship as shown in Table 1 based on the above four types of questions and two types of answers.
[0104] Table 1
[0105]
[0106] In Table 1, the answer type corresponding to the weapon attribute value type question is the definite value type; the answer type corresponding to the weapon attribute maximum value type question is the indefinite value type; the answer type corresponding to the weapon attribute value interval type question is the indefinite value type; the answer type corresponding to the weapon relational attribute value type question is the definite value type.
[0107] Optionally, based on the above question types and answer types, in order to further improve the query efficiency, the present invention provides a possible implementation method, please refer to Figure 4, after the above step S204, the following steps are also included:
[0108] It is understandable that the electronic device also pre-stores an attribute tag library and an attribute index library, both of which are constructed based on the weapon knowledge graph. The attribute tag library includes the maximum attribute value and its weapon identification and the minimum attribute value and its weapon identification for each attribute name. The attribute index library includes all intermediate attribute values and their weapon identifications except the maximum attribute value and the minimum attribute value for each attribute name.
[0109] Step S208, determining the target answer type corresponding to the target question type;
[0110] In this embodiment, based on the preset correspondence between question types and answer types, the answer type corresponding to the target question type is determined, that is, the target answer type is obtained.
[0111] Step S210-A: If the target answer type is a determined value type, then based on the target question template, the answer corresponding to the question to be processed is obtained from the weapon knowledge graph;
[0112] In this embodiment, if the target answer type is a definite value type, indicating that the answer is a single definite value, a corresponding query statement such as a CYPHER statement is generated according to the target question template, and the answer is obtained from the weapon knowledge graph through the query statement. For example, if the target question template is a question about the attribute value of a weapon, or a question about the relationship attribute value of a weapon, then a corresponding query statement can be generated based on the target question template to obtain the answer from the weapon knowledge graph.
[0113] Step S210-B: if the target answer type is an indeterminate value type, then based on the target question template, obtain the answer corresponding to the question to be processed from the attribute tag library or the attribute index library;
[0114] In this embodiment, if the target answer type is an indeterminate value type, indicating that the answer may be multiple values, the number of which is uncertain, then the answer is obtained from the attribute tag library or the attribute index library according to the target question template. For example, if the target question template is a question about the maximum value of a weapon's attribute, the answer can be obtained from the attribute tag library. If the target question template is a question about the interval of a weapon's attribute value, the answer can be obtained from the attribute index library.
[0115] It is understandable that for the answer type with non-determined value, there are usually multiple answers. By pre-building an attribute tag library for storing the maximum attribute values of weapons and an attribute index library for storing the non-maximum attribute values of weapons, the speed of obtaining answers can be accelerated, thereby improving query efficiency.
[0116] It can be seen that by presetting the answer type corresponding to each question type, and obtaining the answers corresponding to the questions to be processed from the weapon knowledge graph, or the attribute tag library, or the attribute index library for different answer types, the speed of obtaining answers is accelerated and the query efficiency is improved.
[0117] Optionally, for the above-mentioned weapon knowledge graph, the embodiment of the present invention provides a possible implementation method for obtaining the weapon knowledge graph, please refer to Figure 5 , which includes the following steps:
[0118] Step S220, extracting basic information and initial labels of multiple weapons from the original weapon information;
[0119] Among them, the initial tag represents the type of association between the weapon and each of its initially associated weapons.
[0120] In this embodiment, the original weapon information may be structured information, such as a document in a format such as json, xml, etc., or may be unstructured information, such as text, a picture containing text, etc.
[0121] For structured information, the basic information of the weapon and the initial associated weapons and relationship types of the weapon can be directly extracted, that is, the initial label is obtained; for unstructured information, OCR recognition, word segmentation, semantic retrieval and filtering technologies can be used to extract the basic information of the weapon, and based on the text paragraph where the basic information of the weapon is located, the initial associated weapons and relationship types of the weapon can be obtained, that is, the initial label is obtained, and the basic information and initial labels of multiple weapons are obtained.
[0122] Step S222, determining the weapon category of each weapon according to the basic information of each weapon, and obtaining an ontology library including all weapon categories;
[0123] In this embodiment, the basic information of a weapon may include the name and attributes of the weapon. Based on the basic information of each weapon obtained, all weapons may be classified, such as by function, purpose or standard category, to determine the weapon category to which each weapon belongs and obtain all weapon categories, that is, to obtain an ontology library including all weapon categories.
[0124] Step S224, performing knowledge fusion according to the basic information of each weapon to obtain an entity library of each weapon;
[0125] In this embodiment, knowledge fusion can be understood as establishing a co-referential relationship between the name and attribute of the weapon and the weapon, so that the name and attribute are used to describe the same weapon. By performing knowledge fusion on the basic information of each weapon, an entity library of each weapon can be obtained.
[0126] Step S226, performing knowledge reasoning based on the initial label of each weapon to obtain the target label of each weapon;
[0127] Among them, the target label represents the type of association between the weapon and each of its target-associated weapons.
[0128] In this embodiment, the initial tag represents the association type between a weapon and each of its initial associated weapons, which records the relationship between the weapons. All initial tags can be understood as existing weapon relationships. Knowledge reasoning can be understood as expansion based on existing weapon relationships.
[0129] By performing knowledge reasoning based on the initial label of each weapon, the target label of each weapon can be obtained. All target labels can be understood as the expanded weapon relationship. In other words, by expanding based on the initial label, the weapon relationship can be further improved and the relationship between weapons can be enriched.
[0130] Step S228, obtain the weapon knowledge graph based on the ontology library, the entity library of each weapon and the target label.
[0131] In this embodiment, based on the obtained ontology library, the entity library of each weapon and the target label, a weapon knowledge icon can be constructed, which includes multiple weapon categories, basic information of multiple weapons in each weapon category, and the association type of each weapon with all its target-associated weapons.
[0132] It can be seen that by extracting the basic information and initial labels of multiple weapons from the original weapon information; then determining the weapon category of each weapon based on the basic information of each weapon, and obtaining an ontology library including all weapon categories; then performing knowledge fusion based on the basic information of each weapon to obtain the entity library of each weapon, and performing knowledge reasoning based on the initial label of each weapon to obtain the target label of each weapon; finally, based on the ontology library, the entity library of each weapon and the target label, the weapon knowledge graph is obtained. By constructing a weapon knowledge graph, it is convenient to quickly query the information of the weapon, and it is applied to the intelligent question and answer of weapons and equipment, thereby improving the query efficiency and enhancing the user experience.
[0133] Optionally, for the above step S224, an embodiment of the present invention provides a possible implementation method.
[0134] It is understandable that a weapon usually has a standard name, abbreviation, code name, etc., and a weapon may have multiple names. A weapon also has an attribute name describing its attributes and an attribute value corresponding to the attribute name. In this embodiment, the basic information includes multiple names of the weapon and its multiple attribute names and attribute values. Each weapon has a weapon identification.
[0135] Step S224-1, obtaining any one weapon from all weapons as the first weapon;
[0136] In this embodiment, the method for obtaining the physical library of each weapon is similar. For ease of understanding, the following description will be given by taking any weapon obtained from all weapons as the first weapon as an example.
[0137] Step S224-3, binding each name of the first weapon to the weapon identifier of the first weapon;
[0138] In this embodiment, binding each name of the first weapon with its weapon identifier can be understood as associating all names of the same weapon, eliminating the ambiguity caused by different names of the same weapon, and allowing different names to be used together to describe the same weapon.
[0139] Step S224-5, binding each attribute name and attribute value of the first weapon with the weapon identifier of the first weapon to obtain an entity library of the first weapon;
[0140] In this embodiment, each attribute name and attribute value of the first weapon is bound to the weapon identification of the first weapon, which can be understood as establishing a correspondence between the weapon identification, attribute name and attribute value, and associating all attributes of the same weapon with it, so that all attributes are used together to describe the same weapon.
[0141] All the names and all the attribute names and attribute values of the first weapon are bound to the weapon identifier of the first weapon, thereby obtaining the entity library of the first weapon.
[0142] Step S224-7, traverse each weapon and obtain the entity library of each weapon.
[0143] In this embodiment, for each weapon, the above steps S224-3 to S224-5 can be executed to obtain the physical library of each weapon.
[0144] It can be seen that by binding the weapon identification of each weapon with its entire name and all attribute names and attribute values, the influence of different weapon names is eliminated, so that the weapon information can be quickly and accurately obtained through the weapon knowledge graph.
[0145] Optionally, for the above step S226, an embodiment of the present invention provides a possible implementation method.
[0146] Step S226-1, obtaining any one weapon from all weapons as a second weapon;
[0147] In this embodiment, the method for obtaining the target tag of each weapon is similar. For ease of understanding, any weapon obtained from all weapons will be used as the second weapon as an example for explanation below.
[0148] Step S226-3, based on the initial tag of the second weapon, obtaining each initial associated weapon of the second weapon, and obtaining each weapon to be processed;
[0149] In this embodiment, based on the initial tag of the second weapon, each initially associated weapon in the initial tag is obtained, that is, each weapon to be processed is obtained.
[0150] For example, the second weapon is weapon Y. Based on the initial tag of weapon Y, all of its initial associated weapons, namely weapon X, are obtained, and weapon X is used as the weapon to be processed.
[0151] Step S226-5, for each weapon to be processed, obtaining indirectly associated weapons from all initially associated weapons of the weapon to be processed, to obtain each indirectly associated weapon;
[0152] The type of association between the indirectly associated weapon and the weapon to be processed is the same as the type of association between the weapon to be processed and the second weapon.
[0153] In this embodiment, for each weapon to be processed, all initial associated weapons of the weapon to be processed can be obtained based on the initial tag of the weapon to be processed, and indirectly associated weapons can be obtained from all initial associated weapons of the weapon to be processed to obtain each indirectly associated weapon.
[0154] For example, for weapon X, based on the initial label of weapon X, all of its initial associated weapons, namely weapon M and weapon N, are obtained, and then indirectly associated weapons are obtained from weapon M and weapon N. Among them, if the relationship type between weapon M and weapon X is the same as the relationship type between weapon X and weapon Y, weapon M is taken as an indirectly associated weapon.
[0155] Step S226-7, determining the association type between the second weapon and each indirectly associated weapon according to a preset rule;
[0156] In this embodiment, the preset rule can be understood as an inference rule set based on the relationship type between weapons. According to the preset rule, the relationship type between the second weapon and each indirectly associated weapon can be inferred to determine the association type between the second weapon and each indirectly associated weapon.
[0157] For example, the relationship type between weapon M and weapon X is mounted, that is, weapon M is mounted on weapon X; the relationship type between weapon X and weapon Y is mounted, that is, weapon X is mounted on weapon Y. According to the preset rules, the second weapon, weapon Y, and the indirectly related weapon, weapon M, are inferred to obtain the relationship type between weapon Y and weapon M is mounted, that is, weapon M is mounted on weapon Y.
[0158] Step S226-9, taking each initially associated weapon and each indirectly associated weapon of the second weapon as each target associated weapon of the second weapon;
[0159] In this embodiment, after obtaining each indirectly associated weapon, each indirectly associated weapon and each initially associated weapon of the second weapon are used as each target associated weapon of the second weapon. It can be understood that the initially associated weapon is directly associated with the second weapon, and the indirectly associated weapon is indirectly associated with the second weapon.
[0160] For example, the initial associated weapon, namely weapon X, and the indirect associated weapon, namely weapon M, are both used as target associated weapons of the second weapon, namely weapon Y, to obtain each target associated weapon.
[0161] Step S226-11, obtaining a target tag of the second weapon according to the association type between the second weapon and each of its target-associated weapons;
[0162] In this embodiment, the association type between the second weapon and each of its target-associated weapons is obtained, and the initial tag of the second weapon can be updated, that is, the target tag of the second weapon is obtained.
[0163] Step S226-13, traverse each weapon and obtain the target tag of each weapon.
[0164] In this embodiment, for each weapon, the above steps S226-3 to S226-11 can be executed to obtain the target tag of each weapon.
[0165] It can be seen that for each weapon, based on the initial label of the weapon, all the initial associated weapons of the weapon are used as the weapons to be processed, and the indirect related weapons are obtained from all the initial associated weapons of the weapon to be processed, and the association type between the weapon and the indirect associated weapons is determined according to the preset rules, that is, all the target associated weapons and target labels of the weapon are obtained. Through the initial associated weapons of the weapon, the weapons indirectly associated with it are obtained, and the relationship type is determined according to the preset rules, so as to expand and improve the relationship between weapons, making the constructed weapon knowledge graph richer.
[0166] Optionally, based on the entity library of each weapon obtained in the above steps S224-1 to S224-7, after constructing the weapon knowledge graph, the following steps are further included:
[0167] Step S230, obtaining each attribute value of each attribute name and its corresponding weapon identification;
[0168] In an embodiment, based on the entity library of all weapons, all attribute values of each attribute name and the weapon identification corresponding to the attribute value can be extracted.
[0169] Step S232, constructing an attribute tag library according to the maximum attribute value of each attribute name and its corresponding weapon identification, and the minimum attribute value of each attribute name and its corresponding weapon identification;
[0170] In this embodiment, for each attribute name, the maximum attribute value and its corresponding weapon identification, and the minimum attribute value and its corresponding weapon identification are obtained from all attribute values of the attribute name and stored in the attribute tag library, that is, the attribute tag library is obtained.
[0171] Step S234, constructing an attribute index library according to each intermediate attribute value of each attribute name and its corresponding weapon identification;
[0172] The middle attribute value refers to the attribute value other than the maximum attribute value and the minimum attribute value among all the attribute values of the attribute name.
[0173] In this embodiment, for each attribute name, each intermediate attribute value and its corresponding weapon identification are obtained from all attribute values of the attribute name and stored in the attribute index library, that is, the attribute index library is obtained.
[0174] It can be seen that by obtaining each attribute value of each attribute name and its corresponding weapon identification; then for each attribute name, based on its maximum attribute value and its corresponding weapon identification and its minimum attribute value and its corresponding weapon identification, an attribute tag library is constructed; and based on each intermediate attribute value other than the maximum attribute value and the minimum attribute value and its corresponding weapon identification, an attribute index library is constructed. By constructing an attribute tag library of the weapon's maximum attribute value and an attribute index library of the weapon's non-maximum attribute value, it is convenient to quickly obtain weapon information, thereby improving query efficiency.
[0175] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing an intelligent question-answering device for weapons and equipment is given below. Figure 6 , Figure 6 This is a functional module diagram of an intelligent question-answering device 300 for weapons and equipment provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the intelligent question-answering device 300 for weapons and equipment provided in this embodiment are the same as those in the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments. The intelligent question-answering device 300 for weapons and equipment includes:
[0176] A determination module 310 is used to determine the target problem type to which the problem to be processed belongs according to the problem to be processed input by the user;
[0177] A matching module 330 is used to obtain a target question template that matches the question to be processed from all question templates of the target question type;
[0178] The reply module 350 is used to obtain an answer corresponding to the question to be processed according to the target question template and the weapon knowledge graph.
[0179] Optionally, the reply module 350 is also used to: determine the target answer type corresponding to the target question type; if the target answer type is a definite value type, then based on the target question template, obtain the answer corresponding to the question to be processed from the weapon knowledge graph; if the target answer type is an indefinite value type, then based on the target question template, obtain the answer corresponding to the question to be processed from the attribute tag library or the attribute index library.
[0180] Optionally, the matching module 330 is further used to: identify the name and attributes of the target weapon corresponding to the problem to be processed according to a preset algorithm; match the name and attributes of the target weapon with all question templates of the target question type to obtain the target question template.
[0181] Optionally, the intelligent question-answering device 300 for weapons and equipment further includes a construction module 370, which is used to: extract basic information and initial labels of multiple weapons from the original weapon information; the initial label indicates the association type between the weapon and each of its initially associated weapons; determine the weapon category of each weapon based on the basic information of each weapon, and obtain an ontology library including all weapon categories; perform knowledge fusion based on the basic information of each weapon to obtain an entity library of each weapon; perform knowledge reasoning based on the initial label of each weapon to obtain a target label of each weapon; the target label indicates the association type between the weapon and each of its target-associated weapons; and obtain a weapon knowledge graph based on the ontology library, the entity library of each weapon, and the target label.
[0182] Optionally, the construction module 370 is also used to: obtain any one weapon from all weapons as the first weapon; bind each name of the first weapon to the weapon identifier of the first weapon; bind each attribute name and attribute value of the first weapon to the weapon identifier of the first weapon to obtain the entity library of the first weapon; traverse each weapon to obtain the entity library of each weapon.
[0183] Optionally, the construction module 370 is also used to: obtain any one weapon from all weapons as the second weapon; based on the initial label of the second weapon, obtain each initial associated weapon of the second weapon to obtain each weapon to be processed; for each weapon to be processed, obtain indirectly associated weapons from all initial associated weapons of the weapon to be processed to obtain each indirectly associated weapon; wherein the association type between the indirectly associated weapon and the weapon to be processed is the same as the association type between the weapon to be processed and the second weapon; determine the association type between the second weapon and each indirectly associated weapon according to a preset rule; use each initial associated weapon and each indirectly associated weapon of the second weapon as each target associated weapon of the second weapon; obtain the target label of the second weapon according to the association type between the second weapon and each of its target associated weapons; traverse each weapon to obtain the target label of each weapon.
[0184] Optionally, construction module 370 is also used to: obtain each attribute value of each attribute name and its corresponding weapon identification; construct an attribute tag library according to the maximum attribute value of each attribute name and its corresponding weapon identification, the minimum attribute value of each attribute name and its corresponding weapon identification; construct an attribute index library according to each intermediate attribute value of each attribute name and its corresponding weapon identification; the intermediate attribute value represents the attribute value of all attribute values of the attribute name except the maximum attribute value and the minimum attribute value.
[0185] An embodiment of the present invention further provides an electronic device, including a processor 120 and a memory 130, wherein the memory 130 stores a computer program, and when the processor executes the computer program, the intelligent question-answering method for weapons and equipment disclosed in the above embodiment is implemented.
[0186] The embodiment of the present invention also provides a storage medium on which a computer program is stored. When the computer program is executed by the processor 120, the intelligent question-answering method for weapons and equipment disclosed in the embodiment of the present invention is implemented.
[0187] In summary, the embodiments of the present invention provide an intelligent question-answering method, device, electronic device, and storage medium for weapons and equipment. A weapon knowledge graph and multiple question types are pre-stored in the electronic device, and each question type includes multiple question templates; the target question type to which the question to be processed belongs is determined according to the question to be processed input by the user; then, the target question template matching the question to be processed is obtained from all question templates of the target question type; and then, the answer corresponding to the question to be processed is obtained according to the target question template and the weapon knowledge graph. According to multiple question types and their question templates, the question template that best matches the question input by the user can be quickly determined, and the corresponding answer can be obtained from the weapon knowledge graph according to the most suitable question template, thereby simplifying the operation, improving the query efficiency, and enhancing the user experience.
[0188] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0189] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0190] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as 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.
[0191] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. An intelligent question-answering method for weapons and equipment, characterized in that: Applied to an electronic device, the electronic device pre-stores a weapon knowledge graph and a plurality of question types, each of the question types includes a plurality of question templates, and the electronic device also pre-stores an attribute tag library and an attribute index library; Each of the question types has a corresponding answer type, and the answer type includes a definite value type and an indefinite value type; the method includes: Determine the target problem type to which the problem to be processed belongs according to the problem to be processed input by the user; Acquire a target question template matching the question to be processed from all question templates of the target question type; Determine a target answer type corresponding to the target question type; If the target answer type is the determined value type, then based on the target question template, an answer corresponding to the pending question is obtained from the weapon knowledge graph; If the target answer type is the non-deterministic value type, then based on the target question template, an answer corresponding to the question to be processed is obtained from the attribute tag library or the attribute index library; The weapon knowledge graph includes basic information of each weapon, and the basic information includes multiple attribute names and attribute values. Each weapon has a weapon identifier. The attribute tag library and the attribute index library are constructed in the following manner: Obtain each attribute value of each attribute name and its corresponding weapon ID; Constructing an attribute tag library according to the maximum attribute value of each attribute name and its corresponding weapon identification, and the minimum attribute value of each attribute name and its corresponding weapon identification; According to each intermediate attribute value of each attribute name and its corresponding weapon identification, an attribute index library is constructed; the intermediate attribute value represents the attribute value of all attribute values of the attribute name except the maximum attribute value and the minimum attribute value.
2. The method according to claim 1, characterized in that The step of acquiring a target question template matching the question to be processed from all question templates of the target question type comprises: Identify the name and attributes of the target weapon corresponding to the problem to be processed according to a preset algorithm; The name and attributes of the target weapon are matched with all question templates of the target question type to obtain the target question template.
3. The method according to claim 1, characterized in that The weapon knowledge graph is obtained in the following way: Extracting basic information and initial tags of multiple weapons from the original weapon information; the initial tags indicate the type of association between the weapon and each of its initially associated weapons; Determine the weapon category of each weapon according to the basic information of each weapon, and obtain an ontology library including all weapon categories; Performing knowledge fusion according to the basic information of each of the weapons to obtain an entity library of each of the weapons; Performing knowledge reasoning based on the initial label of each of the weapons to obtain a target label of each of the weapons; The target tag indicates the type of association between the weapon and each of its target-associated weapons; The weapon knowledge graph is obtained according to the ontology library, the entity library of each weapon and the target label.
4. The method according to claim 3, characterized in that The basic information also includes multiple names; The step of performing knowledge fusion according to the basic information of each weapon to obtain the entity library of each weapon includes: Take any weapon from all weapons as the first weapon; Binding each name of the first weapon to a weapon identifier of the first weapon; Binding each attribute name and attribute value of the first weapon to the weapon identifier of the first weapon to obtain an entity library of the first weapon; Traverse each of the weapons to obtain the entity library of each of the weapons.
5. The method according to claim 3, characterized in that: The step of performing knowledge reasoning based on the initial label of each weapon to obtain the target label of each weapon includes: Take any weapon from all weapons as a second weapon; Based on the initial tag of the second weapon, acquiring each initial associated weapon of the second weapon to obtain each weapon to be processed; For each of the weapons to be processed, an indirectly associated weapon is obtained from all the initially associated weapons of the weapon to be processed, to obtain each indirectly associated weapon; wherein the type of association between the indirectly associated weapon and the weapon to be processed is the same as the type of association between the weapon to be processed and the second weapon; Determine the type of association between the second weapon and each of the indirectly associated weapons according to a preset rule; each initially associated weapon of the second weapon and each indirectly associated weapon as each target associated weapon of the second weapon; Obtaining a target tag of the second weapon according to an association type between the second weapon and each of its target-associated weapons; Traverse each of the weapons to obtain the target tag of each of the weapons.
6. An intelligent question-answering device for weapons and equipment, characterized in that: Applied to an electronic device, the electronic device pre-stores a weapon knowledge graph and a plurality of question types, each of the question types includes a plurality of question templates, and the electronic device also pre-stores an attribute tag library and an attribute index library; Each of the question types has a corresponding answer type, and the answer type includes a definite value type and an indefinite value type; the device includes: A determination module, used to determine the target problem type to which the problem to be processed belongs according to the problem to be processed input by the user; A matching module, used for acquiring a target question template matching the question to be processed from all question templates of the target question type; A reply module, used to determine the target answer type corresponding to the target question type; if the target answer type is the determined value type, then based on the target question template, obtain the answer corresponding to the pending question from the weapon knowledge graph; if the target answer type is the undetermined value type, then based on the target question template, obtain the answer corresponding to the pending question from the attribute tag library or the attribute index library; The weapon knowledge graph includes basic information of each weapon, and the basic information includes multiple attribute names and attribute values. Each weapon has a weapon identification. A construction module is used to obtain each attribute value of each attribute name and its corresponding weapon identification; an attribute tag library is constructed according to the maximum attribute value of each attribute name and its corresponding weapon identification, the minimum attribute value of each attribute name and its corresponding weapon identification; an attribute index library is constructed according to each intermediate attribute value of each attribute name and its corresponding weapon identification; the intermediate attribute value represents the attribute value of all attribute values of the attribute name except the maximum attribute value and the minimum attribute value.
7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
8. A storage medium, characterized in that: The storage medium stores a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 5.