A weapon entity relationship graph construction method, device and computing equipment

Through entity recognition and neural network models, the weapon entity relationship is automatically extracted and displayed, and the problem of extracting and displaying weapons entity relationships in the military field is solved, intuitive relationship map construction is realized, and the application value of the military field knowledge map is enhanced.

CN114328756BActive Publication Date: 2024-12-13ZHENGZHOU XINDA ADVANCED TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111563138.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2024-12-13
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

In the military field, it is difficult for the existing technology to quickly and accurately extract the relationships of weapon entities from relevant materials, and the display of weapon knowledge graphs mainly relies on text descriptions, lacking intuitive relationship graph display methods, limiting knowledge sharing and tactical decision-making support.

Method used

A weapon entity relationship graph construction method is adopted to judge the isometric and superior-under-position relationship through entity recognition and word vector offset value, and use neural network relationship extraction model to extract entity relationships to construct the relationship map of weapon entities. The method includes entity recognition, word vector offset value judgment and the use of neural network models to automatically extract and store relationships between weapon entities.

Benefits of technology

It realizes accurate extraction and rich display of weapon entity relationships, and the relationship map constructed is more reference value, solves the problem that traditional methods require manual annotation and unsupervised methods, and improves the intuitiveness and practicality of the knowledge map in the military field. sex.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114328756B_ABST
    Figure CN114328756B_ABST
Patent Text Reader

Abstract

The present invention provides a method for constructing a weapon entity relationship graph, comprising the following steps: obtaining text data to be extracted; performing entity recognition on the text data to be extracted, and combining recognized entity words into pairs of words to be recognized; obtaining word pair vector offset values ​​of the word pairs to be recognized; if the word pair vector offset values ​​conform to a pre-obtained co-location relationship distribution, determining that the word pairs to be recognized have a co-location relationship; if the word pair vector offset values ​​conform to a pre-obtained hyponymy relationship distribution, determining that the word pairs to be recognized have a hyponymy relationship; otherwise, searching for a sentence containing the word pairs to be recognized in the text data to be extracted, and sending the sentence containing the word pairs to be recognized and the sentences before and after the sentence into a trained neural network relationship extraction model to extract the entity relationship of the word pairs to be recognized; storing the extracted entity relationship in a graph database, and constructing a relationship graph of weapon entities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for constructing a relationship graph, and in particular to a method, device and computing equipment for constructing a weapon entity relationship graph. Background Art

[0002] Today, the world's military transformation is moving towards intelligence and informatization. The current war is no longer a single combat mode, but has put forward higher requirements for comprehensive combat capabilities. For example, how to quickly and accurately understand the battlefield situation and the enemy's situation, and then make corresponding strategic and tactical decisions, requires information technology to support. The degree of military informatization reflects the military strength of a country. In the process of informatization, it puts forward higher requirements on the breadth and depth of scientific research knowledge of scientific researchers. The military combat system and related knowledge involve many disciplines and are relatively complex. At present, strategic decision-making mainly relies on commanders to consult relevant combat materials and personal experience, which faces the limitation of insufficient breadth and depth of knowledge reserves, and it is difficult to realize a knowledge system from top to bottom and from point to surface. In addition, knowledge sharing is relatively difficult. There is an urgent need for an intuitive and structured knowledge base platform to provide systematic knowledge for military information systems. The application of knowledge graphs has solved this problem well.

[0003] The knowledge graph is a structured semantic knowledge base that describes concepts, entities and their relationships in the objective world in a structured form, expresses Internet information in a form closer to the human cognitive world, and provides a better ability to organize, manage and understand the massive amount of Internet information. By using multi-source heterogeneous data to build a knowledge graph of weapons and equipment, introducing concepts such as automated feature extraction, reinforcement learning, and cluster intelligence, it provides mature functions such as weapon and equipment portraits, tactics simulation, equipment question and answer, and equipment statistical analysis, and realizes a dynamic and panoramic information display of the weapon and equipment system; at the same time, based on knowledge graphs, AI modeling, intelligent question and answer and other technologies, the equipment system and combat system of foreign and our armies are studied, which can further provide command decision-making assistance capabilities, provide a basis for scientific research demonstration of the equipment system, and provide flexible and changeable support for the combat command of digital forces.

[0004] However, due to the high degree of specialization in the military field and the confidentiality of related knowledge data, there are few studies on knowledge graphs in the military field. Weapons and equipment are of paramount importance in the military field. How to quickly and accurately extract weapon entity relationships from relevant materials is the focus and difficulty of knowledge graph research in the military field. In the construction of weapon knowledge graphs, weapons are generally classified and displayed for easy management and viewing, including the division of major categories and the integration of similar categories. However, such displays are currently limited to listing through text piling, lacking intuitive display methods such as relationship diagrams.

[0005] In order to solve the above problems, people have been seeking an ideal technical solution. Summary of the invention

[0006] The purpose of the present invention is to address the deficiencies of the prior art and thus provide a method, device and computing equipment for constructing a weapon entity relationship graph.

[0007] In order to achieve the above object, the technical solution adopted by the present invention is: a method for constructing a weapon entity relationship graph, comprising the following steps:

[0008] Get the text data to be extracted;

[0009] Perform entity recognition on the extracted text data, and combine the recognized entity words into pairs of words to be recognized;

[0010] Obtaining a word pair vector offset value of the word pair to be recognized;

[0011] If the word pair vector offset value conforms to the pre-obtained co-location relationship distribution, it is determined that the word pair to be identified has a co-location relationship;

[0012] If the word pair vector offset value conforms to the pre-obtained hyponymy distribution, it is determined that the word pair to be identified has a hyponymy relationship;

[0013] Otherwise, searching for a sentence containing the word pair to be identified in the text data to be extracted, and sending the sentence containing the word pair to be identified and the sentences before and after it into a trained neural network relationship extraction model to extract the entity relationship of the word pair to be identified;

[0014] The extracted entity relationships are stored in a relational database to construct a relationship graph of weapon entities.

[0015] In a specific implementation, if the word pair vector offset value conforms to the pre-obtained co-location relationship distribution, determining that the word pair to be identified has a co-location relationship includes:

[0016] It is determined whether the word pair vector offset value is less than an offset threshold value. If so, it is determined that the word pair to be recognized has a co-position relationship.

[0017] In a specific implementation, if the word pair vector offset value conforms to the pre-obtained hyponymy distribution, determining that the to-be-recognized word pair has a hyponymy relationship includes:

[0018] Determine whether the word pair vector offset value is greater than or equal to an offset threshold value, and if so, determine the cluster to which the word pair to be identified belongs based on the word pair vector offset value; wherein each cluster is obtained by clustering the word pair samples based on the word pair mapping deviation values ​​of the hypernyms and hyponyms after obtaining word pair samples consisting of hypernyms and hyponyms;

[0019] Determine a word pair mapping deviation value of the word pair to be identified, wherein the word pair mapping deviation value=the product of the word vector of the first entity word in the word pair to be identified and the clustering cluster mapping matrix and the difference between the word vector of the second entity word in the word pair to be identified, and the clustering cluster mapping matrix is ​​pre-learned for each clustering cluster;

[0020] If the word pair mapping deviation value is less than or equal to the first mapping offset threshold of the cluster, it is determined that the first entity word and the second entity word are a hypernym and a hyponym respectively;

[0021] If the word pair mapping deviation value is greater than the first mapping offset threshold of the cluster cluster and less than or equal to the second mapping offset threshold of the cluster cluster, the word vector cosine similarity of the word pair to be identified is determined, and it is determined whether the word vector cosine similarity satisfies the preset hyponym and hypernym distribution, and if so, it is determined that the first entity word and the second entity word are respectively a hypernym and a hyponym.

[0022] Further, determining whether the word vector cosine similarity satisfies a preset hyponym distribution includes:

[0023] The word pair mapping deviation interval is divided into multiple intervals. If the word pair mapping deviation value is within the nth interval, when the word vector cosine similarity is greater than or equal to the lower limit of the word vector cosine similarity corresponding to the nth interval, it is determined that the word vector cosine similarity satisfies the preset upper and lower distribution.

[0024] Preferably, the neural network relationship extraction model includes:

[0025] The embedding layer uses the entity position information to expand the word vector features, obtain the word embedding vector and sentence vector, and input the word embedding vector and sentence vector into the GRU neural network layer;

[0026] The GRU neural network layer is configured to extract context-dependent long-range hidden features of the input vector;

[0027] The dual attention layer is configured to perform sentence-level weighted transformation and relation-level weighted transformation on the hidden features learned by the GRU neural network layer to obtain a sentence-level weight vector and a relation-level weight vector;

[0028] The output layer is configured to process the weight vectors at the sentence level and the weight vectors at the relationship level to obtain the entity relationship of the word pair to be recognized.

[0029] A second aspect of the present invention provides a weapon entity relationship graph construction device, comprising:

[0030] A first acquisition unit is configured to acquire a word pair to be recognized, wherein the word pair to be recognized includes a first entity word and a second entity word;

[0031] A difference determination unit, configured to determine a word vector difference between the first entity word and the second entity word;

[0032] The relationship determination unit is configured to determine that the to-be-recognized word pair has a hyponymy relationship if the word vector difference meets a preset hyponymy distribution.

[0033] A receiving module, configured to obtain text data to be extracted;

[0034] A module for obtaining word pairs to be recognized is configured to perform entity recognition on the extracted text data and combine the recognized entity words into word pairs to be recognized;

[0035] A word pair vector offset value acquisition module is configured to acquire the word pair vector offset value of the word pair to be recognized;

[0036] The relationship determination unit is configured to determine that the word pair to be identified has an appositive relationship when the word pair vector offset value conforms to the pre-obtained appositive relationship distribution; determine that the word pair to be identified has a hyponymy relationship when the word pair vector offset value conforms to the pre-obtained hyponymy distribution; otherwise, search for a sentence containing the word pair to be identified in the text data to be extracted, and use the word vector model to pre-process the sentence containing the word pair to be identified to obtain a word embedding vector, and send the word embedding vector to the trained neural network relationship extraction model to extract the entity relationship;

[0037] The relationship graph construction module is configured to store the extracted entity relationships into a relationship database to construct a relationship graph of weapon entities.

[0038] A third aspect of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the aforementioned weapon entity relationship graph construction method is implemented.

[0039] The present invention has outstanding substantive features and significant progress compared to the prior art, specifically:

[0040] The present invention aims at the naming features of weapon entities, judges whether weapon entities are in the same series relationship and in a hierarchical relationship based on word vectors combined with mapping matrices, and further extracts the relationship between weapon entities based on a neural network relationship extraction model for entity pairs that are not in the same series relationship and in a hierarchical relationship, so that the extracted entity relationships are rich and comprehensive, and the constructed weapon entity relationship map has more reference significance;

[0041] The present invention adopts a remote supervised relationship extraction method, which solves the problem that traditional supervised learning methods require manual annotation of training data sets, consuming a lot of manpower and time, and some unsupervised or semi-supervised relationship extraction methods have unsatisfactory results; the neural network relationship extraction model used in the remote supervision process of the present invention adopts a GRU neural network, which solves the long-distance dependency problem in the traditional deep learning process based on remote supervision; the present invention introduces a sentence-level attention mechanism and a relationship-level attention mechanism into the neural network relationship extraction model, which solves the problem that due to the strong assumption conditions of remote supervision, a large amount of data relationships are incorrectly labeled, resulting in a large amount of noise in the training data. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 It is a schematic diagram of the process of the present invention.

[0043] Figure 2 It is the GRU neural network model of the present invention. DETAILED DESCRIPTION

[0044] The technical solution of the present invention is further described in detail below through specific implementation methods.

[0045] First, let's explain the concept of hypernymy. Hypernymy is a linguistic concept used to express the logical relationship between two words. Usually, a word with strong generality is called a hypernym of a word with strong specificity, and a word with strong specificity is called a hyponym of a word with strong generality.

[0046] The same series relationship is a unique relationship formed based on the naming of weapon entities. Weapons of the same category, especially the same series, have similar naming rules. For example, the United States' F series fighters include "F-3 Devil", "F-22 Raptor", "F-100 Super Sabre", "F-117 Nighthawk", etc.; the British Challenger series main battle tanks include "Challenger-1" and "Challenger-2"; Germany's MP5 series submachine guns include "MP5A2", "MP5A3", "MP5A4", "MP5SFA2", etc.

[0047] It can be seen that weapons in the same series have a high degree of similarity in naming, which is reflected in the word vectors, and they will be very close. In the famous Milkolov experiment, it was found that v(king)-v(queen)≈v(man)-v(woman) (v represents the word vector), that is, the difference between vectors can reflect the semantic relationship between words. Therefore, the word vector technology can be used to determine the entity relationship of weapons in the same series and those of upper and lower levels.

[0048] Example 1

[0049] like Figure 1As shown, this embodiment proposes a method for constructing a weapon entity relationship graph, comprising the following steps:

[0050] Get the text data to be extracted;

[0051] Specifically, it includes: obtaining military news data and military encyclopedia data; crawling reports related to weapons and equipment on the military news website, thereby obtaining weapons and equipment information from the China Arsenal and Global Military Network; obtaining military encyclopedia data, which mainly involves weapons and equipment;

[0052] Perform entity recognition on the extracted text data, and combine the recognized entity words into pairs of words to be recognized;

[0053] Obtaining a word pair vector offset value of the word pair to be recognized;

[0054] Specifically, the word pair to be recognized includes a first entity word and a second entity word, and word vectors of the first entity word and the second entity word are obtained respectively, wherein the word vector refers to the vector representation of each word obtained by mapping the word to a unified vector space. Common word vector analysis tools include word2vec, fasttext, and glove. Since the method of obtaining word vectors is a relatively mature technology at present, it will not be described in detail here;

[0055] Subtract the word vector of the first entity word from the word vector of the second entity word to obtain the word pair vector offset value of the word pair to be identified. The calculation formula is as follows:

[0056] d(x,y)=|yx| 2

[0057] Where x and y represent the first entity word and the second entity word respectively, d is the Euclidean distance between the first entity word x and the second entity word y, and represents the word pair vector offset value;

[0058] If the word pair vector offset value conforms to the pre-obtained co-location relationship distribution, it is determined that the word pair to be identified has a co-location relationship;

[0059] If the word pair vector offset value conforms to the pre-obtained hyponymy distribution, it is determined that the word pair to be identified has a hyponymy relationship;

[0060] Otherwise, searching for a sentence containing the word pair to be identified in the text data to be extracted, and sending the sentence containing the word pair to be identified and the sentences before and after it into a trained neural network relationship extraction model to extract the entity relationship of the word pair to be identified;

[0061] The extracted entity relationships are stored in a relational database to construct a relationship graph of weapon entities.

[0062] After long-term observation and research, the inventor of the present application discovered the following theory: words with hyponymy and homonymy and homonymy have similar distribution characteristics in word vector differences, thereby automatically identifying the hyponymy and homonymy and homonymy relationships of words.

[0063] It can be understood that the distribution of hyponymy and hyponymy relationships can be obtained in advance by learning a large number of word pair samples with hyponymy and hyponymy relationships; the distribution of homonymy relationships can be obtained in advance by learning a large number of word pair samples with homonymy relationships.

[0064] In the specific implementation, the homonymous relationship distribution satisfies d(x, y)≤δ, where δ is the offset threshold, which can be obtained by learning a large number of word pair samples with homonymous series relationships in advance;

[0065] After obtaining the word pair vector offset value, determine whether the word pair vector offset value is less than the offset threshold. If so, determine that the word pair vector offset value meets the pre-obtained co-location relationship distribution, and the word pair to be identified has a co-location relationship.

[0066] According to the mainstream classification method, weapons and equipment are divided into several major categories, including ships and vessels, aircraft, tanks and armored vehicles, firearms and individual soldiers, explosives, artillery, and space equipment. Each major category may contain many subcategories. For example, firearms and individual soldiers include rifles, submachine guns, machine guns, sniper rifles, knives, etc.

[0067] Since the hyponym-hypernym relationship is more complicated, simple vector subtraction is difficult to apply to all types of hyponym-hypernym relationship extraction, and a more complex method is needed to express it. The present invention uses a relatively complex mapping matrix, that is, multiplying the word vector of the hyponym by the corresponding mapping matrix is ​​approximately equal to the word vector of its hypernym, such as v(Challenger-2)×A≈v(Tank Armored Vehicle).

[0068] In a specific implementation, if the word pair vector offset value conforms to the pre-obtained hyponymy distribution, determining that the to-be-recognized word pair has a hyponymy relationship includes:

[0069] Determine whether the word pair vector offset value is greater than or equal to an offset threshold value, and if so, determine the cluster to which the word pair to be identified belongs based on the word pair vector offset value; wherein each cluster is obtained by clustering the word pair samples based on the word pair mapping deviation values ​​of the hypernyms and hyponyms after obtaining word pair samples consisting of hypernyms and hyponyms;

[0070] Determine a word pair mapping deviation value of the word pair to be identified, wherein the word pair mapping deviation value=the product of the word vector of the first entity word in the word pair to be identified and the clustering cluster mapping matrix and the difference between the word vector of the second entity word in the word pair to be identified, and the clustering cluster mapping matrix is ​​pre-learned for each clustering cluster;

[0071] If the word pair mapping deviation value is less than or equal to the first mapping offset threshold of the cluster, it is determined that the first entity word and the second entity word are a hypernym and a hyponym respectively;

[0072] If the word pair mapping deviation value is greater than the first mapping offset threshold of the cluster cluster and less than or equal to the second mapping offset threshold of the cluster cluster, the word vector cosine similarity of the word pair to be identified is determined, and it is determined whether the word vector cosine similarity satisfies the preset hyponym and hypernym distribution, and if so, it is determined that the first entity word and the second entity word are respectively a hypernym and a hyponym.

[0073] Among them, the word vector similarity can reflect the semantic similarity between two words. For the first entity word x and the second entity word y, the similarity between the two in the word vector space is the cosine similarity

[0074] Further, determining whether the word vector cosine similarity satisfies a preset hyponym distribution includes:

[0075] The word pair mapping deviation area between the first mapping deviation threshold and the second mapping deviation threshold is divided into multiple intervals. If the word pair mapping deviation value is within the nth interval, when the word vector cosine similarity is greater than or equal to the lower limit of the word vector cosine similarity corresponding to the nth interval, it is determined that the word vector cosine similarity satisfies the preset upper and lower distribution.

[0076] From the above content, it can be seen that the distribution of the hierarchical relationship satisfies d(x,y)>δ, and Or satisfy d(x,y)>δ,δ1<…<δ n <

[0077] d(Ax,y)<δ n+1 <…≤δ2,

[0078] Where δ is the offset threshold, δ1 is the first mapping offset threshold, δ2 is the second mapping offset threshold, S n is the lower limit of the word vector cosine similarity corresponding to the nth segment, and the word vector cosine similarity S is the word vector cosine similarity, where δ1, δ2, S n , and n can be obtained in advance by learning a large number of word pair samples with hyponymous and hyponymous relationships.

[0079] Therefore, when the present invention determines the hyponymy relationship, the deviation value of the word pair mapping is obtained by using the Euclidean distance d(Ax,y). When d(Ax,y) ≤ δ1, the hyponymy relationship is directly determined; when δ1 < d(Ax,y) ≤ δ2, the mapping deviation value region between δ1 and δ2 is divided into multiple levels, and the similarity lower limit S of each level is set. n By combining with the word vector similarity S, the probability of misjudgment is reduced as much as possible.

[0080] It can be understood that when there is a third word z, and the third word z is in the same series relationship with the first word x, denoted by , and at the same time the first word x is the hyponym of the second word y, then it is considered that the third word z is also the hyponym of the second word y, that is, the same series and hyponymy relationships are transitive. Therefore, when the hyponymy relationship and the same series relationship are obtained, the transitivity of the same series relationship and the hyponymy relationship is used for judgment, so that the number of relationship extraction times can be reduced, and the relationship graph of all entities can be supplemented and improved.

[0081] In specific implementation, the neural network relationship extraction model includes an embedding layer, a GRU neural network layer, a dual attention layer, and an output layer.

[0082] The embedding layer uses the entity position information to expand the character vector features, obtains the word embedding vector and the sentence vector, and inputs the word embedding vector and the sentence vector into the GRU neural network layer.

[0083] Specifically, the embedding layer includes a word embedding layer and a position embedding layer. The word embedding layer converts the words of the input sentence into a word vector representation based on syntax and semantics; for example, a sentence X consists of n characters, and each character is represented by a real number vector w i , then X = {w1, w2, w3,..., w n}.

[0084] In relationship extraction, the words closer to the entity can better express the relationship between the two entities. Among them, the distance between the word and the two entities is called the relative position feature. Therefore, in order to make the sentence meaning expression more accurate, the relative position feature of the weapon entity is introduced into the word vector.

[0085] The function of the position embedding layer is: in the sentence vectorization, if the dimension of the word vector is d w , and the dimension of the position vectorization is d p , the dimension of the obtained sentence vector is

[0086] d s = d w + 2d P

[0087] For example, in the sentence “Nanbu_kijiro was the designer of the gun”, “Nanbu_kijiro” and “gun” are two entities, so the distance from “designer” to “Nanbu_kijiro” is -3, and the distance from “designer” to “gun” is 3.

[0088] The GRU neural network layer is configured to extract context-dependent long-range hidden features of the input vector.

[0089] The GRU neural network model is a very effective variant of LSTM. While maintaining the LSTM structure, the structure is simpler, so there are fewer training parameters and a higher training rate. At the same time, it can solve the long dependency problem in the RNN network.

[0090] like Figure 2 The figure shows the GRU neural network model. t and R t They represent the update gate and reset gate respectively. Basically, these two gating vectors determine which information can eventually be used as the output of the gated recurrent unit. The special thing about these two gating mechanisms is that they can preserve information in long-term sequences and will not be cleared over time or removed because they are not relevant to the prediction. The update gate is used to control the extent to which the state information of the previous moment is brought into the current state. The larger the value of the update gate, the more state information of the previous moment is brought in. The reset gate controls how much information of the previous state is written into the current candidate set. The smaller the reset gate is, the less information of the previous state is written.

[0091] X t Indicates the current input, H t-1 Indicates the hidden state passed down from the previous node. This hidden state contains the relevant information of the previous node. t and H t-1 , GRU will get the output H of the current hidden node t and the hidden state passed to the next node

[0092] The characteristic value formula of each state of the GRU unit is expressed as follows:

[0093] Z t = rec(W hz H t_1 +W xz X t +b z )

[0094] R t = rec(W hrH t_1 +W xr X t +b r )

[0095]

[0096]

[0097] Where: X t Represents the input at the current moment, the activation function rec adopts the relu function, W is the weight matrix, H represents the memory, and b represents the bias.

[0098] The dual attention layer is configured to perform sentence-level weighted transformation and relationship-level weighted transformation on the hidden features learned by the GRU neural network layer to obtain a sentence-level weight vector and a relationship-level weight vector.

[0099] a. Sentence-level attention mechanism

[0100] Assume S = {s1,s2,…,s n} contains the same weapon entity pair<e1,e2> The set of all sentences in the set, in order to indicate the importance of a sentence in the set to the set, introduces the sentence-level attention mechanism. The specific implementation idea is to use weights to indicate the relevance between the weapon entity relationship predicted by the model and the sentence in the set of sentences containing the same pair of entities, and the weight is positively correlated with the relevance. For example, to determine the relevance of two weapon entity pairs<e1,e2> Whether there is a prediction relationship R, then each sentence s in the set S i They all contain information about whether the sentence expresses the relationship R. The relevance between the entity pair’s sentence set S and the predicted relationship can be expressed as follows:

[0101]

[0102] Among them, β i ∈[0,1] is the weight of sentence i, which indicates the matching degree between a sentence and the predicted relation R, and satisfies ∑ i β i =1.

[0103] The weight can be obtained by taking the inner product of the sentence vector and the predicted relationship vector in the sentence set and normalizing it with the softmax function. The formula is as follows:

[0104] β i =softmax(s i Av r )

[0105] Where A is a weighted diagonal matrix, v r is the vector of predicted relation R.

[0106] b. Relational layer attention mechanism

[0107] Since there are certain similarities and correlations between each relationship, and different relationships have different importance and relevance on the same entity pair, the relevance between two relationships is represented by weights. The relationship vector calculation method is similar to the attention mechanism model at the sentence level. Assuming that the entity pair<e1,e2> The set of n relations C = {R1, R2, ..., R n}, the weighted relationship is expressed as:

[0108]

[0109] Among them, the weight r ij ∈[0,1] represents the relation R i and R i similarity, and satisfy The weight is obtained by normalizing the inner product of the two relationship vectors with the softmax function. The formula is as follows:

[0110] r ij =softmax(R i BR j )

[0111] Among them, B is a weighted diagonal matrix.

[0112] The relationship after the introduction of the double-layer attention mechanism is expressed as {R′1, R′2, …, R′ n}, after obtaining the sentence set vector, the linear function is used to obtain the relationship extraction and classification results:

[0113] O i =W i R′ i +b i

[0114] Among them, b i Indicates the offset, W i Represents the weight of the weapon entity relationship category.

[0115] Then the conditional probability of each relationship category is predicted by the softmax function:

[0116]

[0117] Where i∈(1,2,…,n r ), M represents the set of all aligned sentences, n r Indicates the number of relationship categories.

[0118] The present invention uses the cross entropy loss function for model training, and the objective function is defined as follows:

[0119]

[0120] Among them, θ is the training parameter, and the gradient of the parameter is calculated by back propagation, and the optimization parameter is updated by the Adadelta optimization method. In this way, the probability of entity pairs in different relationships is predicted, and the relationship with the highest probability is selected as the relationship between the two weapon entities.

[0121] The output layer is configured to process the weight vectors at the sentence level and the weight vectors at the relationship level to obtain the entity relationship of the word pair to be recognized.

[0122] The neural network relationship extraction model in this embodiment adopts a weapon entity relationship extraction method based on remote supervision. The core idea is to match and align the unstructured weapon-related text with the weapon entity relationship knowledge base, that is, to use the existing entity relationships in the weapon entity relationship knowledge base to annotate the text, thereby obtaining a large amount of relationship extraction training data, reducing the tediousness of data annotation for the relationship extraction model.

[0123] Among them, the heuristic entity relationship alignment is based on the existing weapon entity relationship knowledge base, and makes the following assumptions: "If there is a triple R in the weapon entity relationship knowledge base<a,b> (Note: a and b represent two weapon equipment entities, and R represents a relationship), then all entities containing this entity<a,b> All sentences in the dataset have this relationship R", and are marked as training positive examples, so that the weapon entity pairs obtained by preprocessing the weapon equipment related corpus are automatically adapted to the corresponding relationship.

[0124] For example, there is a triple in the weapon entity relationship knowledge base: designer <Kijiro Nambu, Type 92 heavy machine gun>. It is considered that as long as there are sentences about Kijiro Nambu and Type 92 heavy machine gun, the relationship between the two is marked as "designer", as shown in Table 1.

[0125] sentence Relationship / Classification Tags Is it correct? The designer of the Type 92 heavy machine gun was Kijiro Nambu Designer correct Nambu Kijiro designed the Type 92 heavy machine gun Designer correct Nambu Kijiro uses the Type 92 heavy machine gun Designer mistake Kirijiro Nambu was shot by a Type 92 heavy machine gun Designer mistake

[0126] The present invention adopts a remote supervised relationship extraction method, which solves the problem that traditional supervised learning methods require manual annotation of training data sets, consuming a lot of manpower and time, and some unsupervised or semi-supervised relationship extraction methods have unsatisfactory results; the neural network relationship extraction model used in the remote supervision process of the present invention adopts a GRU neural network, which solves the long-distance dependency problem in the traditional deep learning process based on remote supervision; the present invention introduces a sentence-level attention mechanism and a relationship-level attention mechanism into the neural network relationship extraction model, which solves the problem that due to the strong assumption conditions of remote supervision, a large amount of data relationships are incorrectly labeled, resulting in a large amount of noise in the training data.

[0127] Example 2

[0128] A second aspect of the present invention provides a weapon entity relationship graph construction device, comprising:

[0129] A first acquisition unit is configured to acquire a word pair to be recognized, wherein the word pair to be recognized includes a first entity word and a second entity word;

[0130] A difference determination unit, configured to determine a word vector difference between the first entity word and the second entity word;

[0131] The relationship determination unit is configured to determine that the to-be-recognized word pair has a hyponymy relationship if the word vector difference meets a preset hyponymy distribution.

[0132] A receiving module, configured to obtain text data to be extracted;

[0133] A module for obtaining word pairs to be recognized is configured to perform entity recognition on the extracted text data and combine the recognized entity words into word pairs to be recognized;

[0134] A word pair vector offset value acquisition module is configured to acquire the word pair vector offset value of the word pair to be recognized;

[0135] The relationship determination unit is configured to determine that the word pair to be identified has an appositive relationship when the word pair vector offset value conforms to the pre-obtained appositive relationship distribution; determine that the word pair to be identified has a hyponymy relationship when the word pair vector offset value conforms to the pre-obtained hyponymy distribution; otherwise, search for a sentence containing the word pair to be identified in the text data to be extracted, and use the word vector model to pre-process the sentence containing the word pair to be identified to obtain a word embedding vector, and send the word embedding vector to the trained neural network relationship extraction model to extract the entity relationship;

[0136] The relationship graph construction module is configured to store the extracted entity relationships into a relationship database to construct a relationship graph of weapon entities.

[0137] Example 3

[0138] This embodiment provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the weapon entity relationship graph construction method described in Embodiment 1 is implemented.

[0139] According to another embodiment, there is also provided a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute a combination of Figure 1 The method described.

[0140] With the development of time and technology, the meaning of computer-readable storage media is becoming more and more extensive, and the dissemination path of computer programs is no longer limited to tangible media, and can also be downloaded directly from the Internet, etc. Any combination of one or more computer-readable storage media can be used. Computer-readable storage media can be, for example, - but not limited to - electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this specification, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, device or device.

[0141] The processors mentioned above may include one or more single-core processors or multi-core processors. The processors may include any combination of general-purpose processors or dedicated processors (such as image processors, application processors, baseband processors, etc.).

[0142] The processors may be packaged together with the logic of one or more controllers for system control logic. In one embodiment, at least one of the processors may be packaged together with the logic of one or more controllers for system control logic to form a system-in-package. In one embodiment, at least one of the processors may be integrated on the same die with the logic of one or more controllers for system control logic. In one embodiment, at least one of the processors may be integrated on the same die with the logic of one or more controllers for system control logic to form a system-on-chip.

[0143] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0144] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0145] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, firmware or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0146] It should be noted that the “first” and “second” involved in the embodiments of the present disclosure are only used to distinguish in name, for example, to distinguish two words in name, and do not have any restrictions on the meaning of order, size, quantity, importance, etc.

[0147] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for constructing a weapon entity relationship graph, characterized in that: The following steps are involved: Get the text data to be extracted; Perform entity recognition on the extracted text data, and combine the recognized entity words into pairs of words to be recognized; Obtaining a word pair vector offset value of the word pair to be recognized; If the word pair vector offset value conforms to the pre-obtained co-location relationship distribution, it is determined that the word pair to be identified has a co-location relationship; If the word pair vector offset value conforms to the pre-obtained hyponymy distribution, it is determined that the word pair to be identified has a hyponymy relationship; The hyponymy distribution includes if the word pair vector offset value meets the pre-obtained hyponymy distribution, then determining that the to-be-recognized word pair has a hyponymy relationship includes: Determine whether the word pair vector offset value is greater than or equal to an offset threshold value, and if so, determine the cluster to which the word pair to be identified belongs based on the word pair vector offset value; wherein each cluster is obtained by clustering the word pair samples based on the word pair mapping deviation values ​​of the hypernyms and hyponyms after obtaining word pair samples consisting of hypernyms and hyponyms; Determine a word pair mapping deviation value of the word pair to be identified, wherein the word pair mapping deviation value=the product of the word vector of the first entity word in the word pair to be identified and the cluster mapping matrix and the difference between the word vector of the second entity word in the word pair to be identified, and the cluster mapping matrix is ​​pre-learned for each cluster; If the word pair mapping deviation value is less than or equal to the first mapping offset threshold of the cluster, it is determined that the first entity word and the second entity word are a hypernym and a hyponym, respectively; If the word pair mapping deviation value is greater than the first mapping offset threshold of the cluster and less than or equal to the second mapping offset threshold of the cluster, the word vector cosine similarity of the word pair to be identified is determined, and whether the word vector cosine similarity satisfies the preset hyponym and hyponym distribution is determined, and if so, the first entity word and the second entity word are respectively a hypernym and a hyponym; Determining whether the word vector cosine similarity satisfies a preset hyponym distribution includes: Divide the word pair mapping deviation interval into multiple intervals. If the word pair mapping deviation value is in the n If the word vector cosine similarity is greater than or equal to the first n When the lower limit of the word vector cosine similarity corresponding to the segment interval is reached, it is determined that the word vector cosine similarity satisfies the preset upper and lower distribution; Otherwise, searching for a sentence containing the word pair to be identified in the text data to be extracted, and sending the sentence containing the word pair to be identified and the sentences before and after it into a trained neural network relationship extraction model to extract the entity relationship of the word pair to be identified; The extracted entity relationships are stored in a relational database to construct a relationship graph of weapon entities.

2. The weapon entity relationship graph construction method according to claim 1, characterized in that: The homonymous relationship distribution is that the word pair vector offset value is less than the offset threshold.

3. The weapon entity relationship graph construction method according to claim 1, characterized in that: Determining the cluster to which the to-be-recognized word pair belongs based on the word pair vector offset value includes: Determine the distance between the word pair vector offset value and the center vector of each cluster; The cluster with the shortest distance is determined as the cluster to which the word pair to be recognized belongs.

4. The weapon entity relationship graph construction method according to claim 1, characterized in that: When learning and obtaining the mapping matrix of each cluster cluster, the learning goal adopted is to minimize the difference between the product of the word vector of the hyponym of each word pair sample in the cluster cluster and the mapping matrix and the word vector of the hypernym, and to find the minimum mean square error of the difference.

5. The weapon entity relationship graph construction method according to claim 1, characterized in that: The neural network relationship extraction model includes: The embedding layer uses the entity position information to expand the word vector features, obtain the word embedding vector and sentence vector, and input the word embedding vector and sentence vector into the GRU neural network layer; The GRU neural network layer is configured to extract context-dependent long-range hidden features of the input vector; The dual attention layer is configured to perform sentence-level weighted transformation and relation-level weighted transformation on the hidden features learned by the GRU neural network layer to obtain a sentence-level weight vector and a relation-level weight vector; The output layer is configured to process the weight vectors at the sentence level and the weight vectors at the relationship level to obtain the entity relationship of the word pair to be recognized.

6. A weapon entity relationship graph construction device, characterized in that: include A first acquisition unit is configured to acquire a word pair to be recognized, wherein the word pair to be recognized includes a first entity word and a second entity word; A difference determination unit, configured to determine a word vector difference between the first entity word and the second entity word; A relationship determination unit, configured to determine that the to-be-recognized word pair has a hyponymy relationship if the word vector difference meets a preset hyponymy distribution; A receiving module, configured to obtain text data to be extracted; A module for obtaining word pairs to be recognized is configured to perform entity recognition on the extracted text data and combine the recognized entity words into word pairs to be recognized; A word pair vector offset value acquisition module is configured to acquire the word pair vector offset value of the word pair to be recognized; The relationship determination unit is configured to determine that the word pair to be identified has an appositive relationship when the word pair vector offset value conforms to the pre-obtained appositive relationship distribution; determine that the word pair to be identified has a hyponymy relationship when the word pair vector offset value conforms to the pre-obtained hyponymy distribution; otherwise, search for a sentence containing the word pair to be identified in the text data to be extracted, and use the word vector model to pre-process the sentence containing the word pair to be identified to obtain a word embedding vector, and send the word embedding vector to the trained neural network relationship extraction model to extract the entity relationship; The hyponymy distribution includes if the word pair vector offset value meets the pre-obtained hyponymy distribution, then determining that the to-be-recognized word pair has a hyponymy relationship includes: Determine whether the word pair vector offset value is greater than or equal to an offset threshold value, and if so, determine the cluster to which the word pair to be identified belongs based on the word pair vector offset value; wherein each cluster is obtained by clustering the word pair samples based on the word pair mapping deviation values ​​of the hypernyms and hyponyms after obtaining word pair samples consisting of hypernyms and hyponyms; Determine a word pair mapping deviation value of the word pair to be identified, wherein the word pair mapping deviation value=the product of the word vector of the first entity word in the word pair to be identified and the cluster mapping matrix and the difference between the word vector of the second entity word in the word pair to be identified, and the cluster mapping matrix is ​​pre-learned for each cluster; If the word pair mapping deviation value is less than or equal to the first mapping offset threshold of the cluster, it is determined that the first entity word and the second entity word are a hypernym and a hyponym respectively; If the word pair mapping deviation value is greater than the first mapping offset threshold of the cluster and less than or equal to the second mapping offset threshold of the cluster, the word vector cosine similarity of the word pair to be identified is determined, and whether the word vector cosine similarity satisfies the preset hyponym and hyponym distribution is determined, and if so, the first entity word and the second entity word are respectively a hypernym and a hyponym; Determining whether the word vector cosine similarity satisfies a preset hyponym distribution includes: Divide the word pair mapping deviation interval into multiple intervals. If the word pair mapping deviation value is in the n If the word vector cosine similarity is greater than or equal to the first n When the lower limit of the word vector cosine similarity corresponding to the segment interval is reached, it is determined that the word vector cosine similarity satisfies the preset upper and lower distribution; The relationship graph construction module is configured to store the extracted entity relationships into a relationship database to construct a relationship graph of weapon entities.

7. The weapon entity relationship graph construction device according to claim 6, characterized in that: The neural network relationship extraction model includes: The embedding layer uses the entity position information to expand the word vector features, obtain the word embedding vector and sentence vector, and input the word embedding vector and sentence vector into the GRU neural network layer; The GRU neural network layer is configured to extract context-dependent long-range hidden features of the input vector; The dual attention layer is configured to perform sentence-level weighted transformation and relation-level weighted transformation on the hidden features learned by the GRU neural network layer to obtain a sentence-level weight vector and a relation-level weight vector; The output layer is configured to process the weight vectors at the sentence level and the weight vectors at the relationship level to obtain the entity relationship of the word pair to be recognized.

8. A computing device comprising a memory and a processor, characterized in that: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 5 is implemented.