Supply and demand question and answer method and system based on hydrogen energy field entity relationship extraction
Through the BERT-based pre-trained language model and semantic focus fusion module, the noise problem of remote supervision relationship extraction in the hydrogen energy field was solved, an efficient hydrogen energy knowledge supply and demand question-answering system was realized, and the accuracy and robustness of hydrogen energy knowledge were improved.
Patent Information
- Application Number
- CN202510818246.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-09-16
AI Technical Summary
Existing remote supervision relationship extraction technology in the hydrogen energy field has problems such as excessive noise data and asymmetric information supply and demand, making it difficult to efficiently extract structured hydrogen energy knowledge from unstructured text.
A BERT-based pre-trained language model is used, combined with a semantic focus fusion module and a relationship perception module. Through the Euclidean distance confidence measurement mechanism and the multi-association attention mechanism, an entity fusion vector is constructed to achieve accurate extraction of hydrogen energy entity relationships.
The accuracy and robustness of knowledge extraction in the field of hydrogen energy have been improved, an efficient supply and demand question-answering system has been realized, and structured hydrogen energy knowledge can be quickly acquired.
Smart Images

Figure CN120653752A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of entity relationship extraction in the hydrogen energy field, and in particular to a supply and demand question-answering method and system based on entity relationship extraction in the hydrogen energy field. Background Art
[0002] Relation extraction refers to the process of identifying and extracting potential relationships between pairs of entities from unstructured text. This task is crucial for a variety of applications, including information retrieval and question-answering systems. Distant Supervision for Relation Extraction (DSE) is a method for automatically extracting entities and their relationships from large-scale text data, without the need for manually labeled training data, in the absence of labeled data. By combining this technology with hydrogen research, it is possible to efficiently extract hydrogen-related information from scientific literature.
[0003] In the field of hydrogen energy research, a vast amount of literature exists covering information on hydrogen production, storage, applications, and interactions with other substances. This literature is often presented in natural language, making direct reading and analysis both time-consuming and labor-intensive. Using distantly supervised relationship extraction (DLE) technology, we can automatically identify hydrogen-related entities (such as catalysts, hydrogen storage materials, and energy devices) and their relationships (e.g., "used for," "catalysis," and "influence") from relevant literature.
[0004] The extracted entities and relationships related to hydrogen can be further used to construct a knowledge graph for the hydrogen energy field. A knowledge graph is a structured semantic knowledge base that visually displays hydrogen applications and related technologies in different scenarios by representing entities and their relationships in a graph.
[0005] In practice, distant supervision first uses existing knowledge bases (such as Wikipedia and chemical databases) to annotate entities and relationships within text. For example, if a knowledge base entry states that "platinum is a catalyst in hydrogen electrolysis," then when "platinum" and "hydrogen electrolysis" appear in a text, a "catalytic" relationship can be automatically assumed. A machine model is then trained to identify and predict relationships between other unannotated entities within the text, but this approach can introduce significant amounts of noisy data.
[0006] With the development of deep learning, the application of neural network methods for relation extraction has continued to evolve. These methods have significantly reduced the need for handcrafted features, instead focusing on innovation and optimization of model architecture. Neural relation extraction methods emphasize model architecture, including the use of attention mechanisms and pre-trained language models based on BERT. These methods typically convert each sentence into a rich feature vector to capture deep semantic features. Although BERT excels in capturing relationships between words, it may have limitations in handling the order and structure of sequences. Summary of the Invention
[0007] In order to address the deficiencies of the prior art, the present invention provides a supply and demand question-answering method and system based on entity relationship extraction in the hydrogen energy field; On the one hand, a supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field is provided, including: Obtaining the hydrogen energy field problem data to be processed; performing preprocessing operations on the hydrogen energy field problem data to be processed to obtain feature vectors of all words; Based on the feature vectors of all words, determine the feature vectors of entity pairs; determine the global features of the hydrogen energy problem data to be processed; Based on the feature vectors of all words and the feature vectors of entity pairs, the semantic association mapping between entities and all words is realized to obtain the entity driving vector; The entity driving vector and global features are jointly modeled to construct the initial entity fusion vector. The dynamic weights of the initial entity fusion vector and word feature vector are determined by introducing the Euclidean distance confidence measurement mechanism. The dynamic weights are used to weight the sum of different features to obtain the entity fusion vector. A relationship mapping vector is randomly initialized, and based on the relationship mapping vector, a hydrogen energy entity relationship is established between the entity fusion vector and the entity driving vector; According to the hydrogen energy entity relationship, search in the existing hydrogen energy field knowledge graph, find the answer corresponding to the hydrogen energy entity relationship, and output the answer.
[0008] On the other hand, a supply and demand question-answering system based on entity relationship extraction in the hydrogen energy field is provided, including: An acquisition module is configured to: acquire the hydrogen energy field problem data to be processed; perform preprocessing operations on the hydrogen energy field problem data to be processed to obtain feature vectors of all words; A determination module is configured to: determine a feature vector of an entity pair based on the feature vectors of all words; determine a global feature of the hydrogen energy field problem data to be processed; A mapping module is configured to: implement semantic association mapping between entities and all words based on the feature vectors of all words and the feature vectors of entity pairs to obtain entity driving vectors; The construction module is configured to: jointly model the entity driving vector and the global features to construct an initial entity fusion vector; determine the dynamic weights of the initial entity fusion vector and the word feature vector by introducing a Euclidean distance confidence measurement mechanism; and obtain the entity fusion vector by weighted summing different features using the dynamic weights; A relationship establishment module is configured to: randomly initialize a relationship mapping vector, and guide the establishment of a hydrogen energy entity relationship between the entity fusion vector and the entity driving vector based on the relationship mapping vector; The output module is configured to: search in the existing hydrogen energy field knowledge graph according to the hydrogen energy entity relationship, find the answer corresponding to the hydrogen energy entity relationship, and output the answer.
[0009] In another aspect, an electronic device is provided, comprising: a memory for non-transitory storage of computer-readable instructions; and a processor for executing said computer-readable instructions, When the computer-readable instructions are executed by the processor, the method described in the first aspect is executed.
[0010] On the other hand, a storage medium is provided, which non-temporarily stores computer-readable instructions, wherein when the non-temporary computer-readable instructions are executed by a computer, the method described in the first aspect is executed.
[0011] On the other hand, a computer program product is provided, comprising a computer program, wherein the computer program is configured to implement the method described in the first aspect when running on one or more processors.
[0012] The above technical solution has the following advantages or beneficial effects: The present invention utilizes a semantic focus fusion module and a relationship perception module to jointly construct a method for reducing remote supervision relationship extraction tasks.
[0013] The semantic focus fusion module considers that words surrounding an entity may contain key information about their relationship, and therefore assigns different weights to them based on the relationship between the entity and other words. The randomly initialized relationship mapping vectors in the relationship perception module gradually learn relationship representations during training.
[0014] Finally, the present invention uses attention to aggregate the results of the semantic focus fusion module and the relationship perception module in the final multi-association attention, and introduces position encoding information to help the model capture the relative positions between entities and their distances from the context, and classify entity relationships through a relationship classifier. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0016] Figure 1 A flowchart of the method provided in Example 1 of the present invention; Figure 2 This is a schematic diagram of the functional modules of the entity relationship extraction model in the hydrogen energy field provided in the first embodiment of the present invention; Figure 3 A schematic diagram of a semantic focus fusion module provided in the first embodiment of the present invention; Figure 4 A schematic diagram of adaptive adjustment provided in the first embodiment of the present invention; Figure 5 Schematic diagram of the relationship perception module provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0017] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.
[0018] Explanation of terms: Relation extraction: Extract the relationship between a pair of entities from unstructured text, represented by a triple (head entity, tail entity, relationship).
[0019] Example 1 This embodiment provides a supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field; like Figure 1 As shown in the figure, the supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field includes: S101: Obtaining hydrogen energy problem data to be processed; performing preprocessing operations on the hydrogen energy problem data to be processed to obtain feature vectors of all words; S102: Determine the feature vectors of entity pairs based on the feature vectors of all words; and determine the global features of the hydrogen energy field problem data to be processed; S103: Based on the feature vectors of all words and the feature vectors of entity pairs, semantic association mapping between entities and all words is implemented to obtain entity driving vectors; S104: Jointly modeling the entity driving vector and the global features to construct an initial entity fusion vector; determining the dynamic weights of the initial entity fusion vector and the word feature vector by introducing a Euclidean distance confidence measurement mechanism; and obtaining the entity fusion vector by weighted summing different features using the dynamic weights. S105: randomly initialize a relationship mapping vector, and guide the establishment of a hydrogen energy entity relationship between the entity fusion vector and the entity driving vector based on the relationship mapping vector; S106: Based on the hydrogen energy entity relationship, search in the existing hydrogen energy field knowledge graph, find the answer corresponding to the hydrogen energy entity relationship, and output the answer.
[0020] The hydrogen energy field problem data to be processed is proposed by the knowledge demander client; S101-S106 are executed by the knowledge provider client.
[0021] like Figure 2 As shown, S101 is implemented by the BERT model; S102 is implemented by the mask vector; S103 is implemented by the semantic focus fusion module; S104 is implemented by the adaptive adjustment module; S105 is implemented by the relationship perception module; and S106 is implemented by the relationship classifier.
[0022] In the hydrogen energy question-and-answer system, users raise hydrogen-related questions such as "What are the main storage materials for hydrogen?" and "What is the catalyst used in hydrogen electrolysis?" The system's target users include researchers, enterprise engineers, and technical managers, who have diverse information needs in hydrogen energy research and applications. These needs are often highly specialized and semantically complex, making accurate answers difficult to obtain through traditional search methods, resulting in a significant "information supply and demand asymmetry."
[0023] On the one hand, demanders hope to quickly obtain structured, authoritative, and context-related hydrogen energy knowledge, such as material selection, process optimization, technical routes, regulatory standards, etc.; on the other hand, the information on the supply side (such as scientific research papers, patents, policy texts, and technical standards, etc.) is scattered across different sources and different semantic expressions, making it difficult to directly meet these precise questions.
[0024] This question-answering system uses entity relationship extraction technology to identify keywords in questions (such as "hydrogen," "storage materials," and "catalyst") and the relationships between them (for example, the relationship between "storage materials" and "hydrogen" is "used for"). Then, based on the extracted entities and relationships, it searches and infers relevant answers from the existing hydrogen energy knowledge graph.
[0025] The core value of this system lies in the automated semantic closed loop of "understanding problems - identifying knowledge - generating answers", thereby achieving efficient knowledge docking and supply and demand matching.
[0026] Application examples: User question: "What are the main storage materials for hydrogen?" Relationship extraction: Identify the relationship between "hydrogen" and "storage materials" (such as "used for"), and extract "metal hydride", "liquid hydrogen", etc. as storage materials from literature or knowledge graphs.
[0027] Answer: Metal hydrides, liquid hydrogen, etc.
[0028] Furthermore, the step S101: obtaining the problem data in the field of hydrogen energy to be processed specifically includes: Unstructured text data; such unstructured text data includes information about hydrogen production methods, storage technologies, application scenarios, catalytic materials, energy devices, chemical reaction mechanisms, etc. For example, "What are the main storage materials for hydrogen?" and "What is the catalyst used in the hydrogen electrolysis process?"
[0029] Furthermore, the step S101: performing preprocessing operations on the hydrogen energy field problem data to be processed to obtain feature vectors of all words, specifically includes: Use the Bert tokenizer to convert the input text into a sequence of subword units, represented as:
[0030] in, Input is the input text, It is the Bert model.
[0031] In this embodiment, the Bert model is used as a sentence encoder, and the sentence after word segmentation is input into the Bert model to obtain the feature vectors of all words.
[0032] Through data preprocessing, words in unstructured text in the hydrogen energy field are mapped into word feature vectors. When input text enters the BERT model, the text content is segmented to facilitate the entry of well-known individual word codes into the BERT model. After text preprocessing, the feature vector of each word is obtained.
[0033] Furthermore, the step S102 of determining the feature vectors of entity pairs based on the feature vectors of all words specifically includes: The entity pair includes: a head entity and a tail entity; Define a mask vector; expand the mask vector to obtain an expanded mask vector; Multiply the expanded mask vector by the feature vector of each word in each sentence element by element to obtain the multiplication result; According to the multiplication result, the head entity feature vector is extracted from each sentence; The extraction process of the tail entity feature vector is consistent with that of the head entity feature vector.
[0034] For example, in this embodiment, a mask vector strategy of equal length is used to calculate entity features. This strategy accurately marks the position of the entity in the sentence vector, with the entity position set to 1 and all other positions set to 0. Through this precise positioning mechanism, we can accurately extract the entity feature vector.
[0035] Define the mask vector :
[0036] in, =1 means the The first position is the physical position, =0 indicates a non-entity position.
[0037] Expand the mask vector to obtain the expanded mask vector; the expanded mask vector matches the shape of the input embedding matrix, and multiply the expanded mask vector by the feature vector of each word in each sentence element by element:
[0038]
[0039] in is a length of d A vector of all 1s, represents element-wise multiplication, , Indicates the The first sentence The feature vector of each word; Extract non-zero rows (i.e. entity feature vectors):
[0040] in, Indicates the The first position is the physical position, represents element-wise multiplication, is the head entity feature vector, is the tail entity feature vector, calculated in the same way as the head entity feature vector .
[0041] The beneficial effect of the above technical solution is: screening mask vector M The position with the median value of 1 is used to extract the feature vector of the entity pair. , By using mask vectors to accurately extract the feature vectors of the head and tail entities, the accuracy of entity boundary recognition is improved and the interference of redundant information is reduced, which is conducive to the accurate modeling of entity semantics in subsequent relationship extraction.
[0042] Furthermore, the S102: determining the global characteristics of the hydrogen energy field problem data to be processed includes: Each sentence of the hydrogen energy problem data to be processed is input into the BERT model to obtain the global features of the hydrogen energy problem data to be processed.
[0043] For example, in this embodiment, a special marker [CLS] is added at the beginning of the input sequence to mark the beginning of a sentence. The feature vector of the [CLS] marker is generally used to capture the global information of the entire input sequence, and is expressed as:
[0044] in The global information of the input sequence represented by Represents the i-th sentence in the bag.
[0045] The beneficial effect of the above technical solution is: by using the [CLS] vector to extract the global features of the sentence, the model can simultaneously integrate global context information when constructing the relationship representation, thereby enhancing the overall consistency of the semantic expression of entity relationships.
[0046] Further, if Figure 3 As shown, the S103: based on the feature vectors of all words and the feature vectors of entity pairs, implementing the semantic association mapping between entities and all words to obtain the entity driving vector, specifically includes: S103-1: Calculate semantic matching between entity feature vector and each word in the sentence; S103-2: Dynamically adjust the weight of each word feature in relationship prediction based on the combination of word features, entity features, and global features of the sequence; determine the feature representation of the head entity based on the semantic matching degree, weight, and feature vector of the head entity; Among them, the feature representation of the tail entity is obtained in the same way as the feature representation of the head entity; S103-3: Concatenate the feature representation of the head entity and the feature representation of the tail entity in series, and then perform linear mapping on the concatenation result to obtain the entity driving vector.
[0047] The beneficial effects of the above technical solution are: Through semantic matching and dynamic weighting mechanisms, an entity-driven vector is constructed, which focuses on the semantic fragments most relevant to relationship prediction while maintaining contextual relevance, thereby improving the robustness and accuracy of relationship extraction.
[0048] Exemplarily, S103-1: calculating the semantic matching degree between the entity feature vector and each word in the sentence, specifically includes: The semantic matching degree is calculated by using the entity feature vector and each word in the sentence to measure the The first sentence Features of words The degree of matching with the entity feature vector is used to filter out keywords whose correlation with entity features is higher than the set threshold to help predict the relationship between entity pairs:
[0049]
[0050] in and Is with entity The associated learnable matrix parameters. Indicates the The first sentence The feature vector of each word, Indicates the The first sentence The feature vector of a word, Indicates the number of words in the sentence, , A feature vector representing the head entity. ( , ) is the cosine similarity function, Indicates Expand to and The same dimensions, where is a length of d A vector of all 1s. is the bias term. is a regularization constant, Used to control the size of the denominator. The calculation process is the same as the head entity.
[0051] Exemplarily, S103-2: dynamically adjusting the weight of each word feature in relationship prediction based on a combination of word features, entity features, and global features of the sequence; determining a feature representation of the head entity based on the semantic matching degree, the weight, and the feature vector of the head entity; including: The entity-aware gating mechanism is used to focus on words with higher similarity to entities, reducing attention to invalid information to obtain entity-driven information. The entity-aware gating mechanism dynamically adjusts the weight of each word feature in relationship prediction based on the combination of word features, entity features, and global features of the sequence:
[0052]
[0053]
[0054] in, It is The context-aware weight of each token based on part of speech and position information, The value of is determined by the entity-aware gating mechanism. is the added random noise term that simulates the uncertainty in the data. and is a learnable weight matrix, and is a learnable bias term. ( ) is a function used to fuse the feature vectors of the head entity and the global features of the entire sequence . Indicates concatenation. Tail entity The calculation process is the same as the head entity.
[0055] Furthermore, the step S103-3: concatenating the feature representation of the head entity and the feature representation of the tail entity, and then linearly mapping the concatenated result to obtain the entity driving vector, includes: By serial operation and The entities are concatenated into a unified representation and linearly mapped through a fully connected layer to obtain the entity driving vector. Since the two entities focus on different information, the feature information from different entities is integrated to enhance the model's focus on valid information and reduce the impact of noise on the final relationship extraction results:
[0056] in, is the weight, is the bias term. Indicates splicing, It is the entity driving vector obtained by semantic association mapping.
[0057] Furthermore, the step S104 of jointly modeling the entity driving vector and the global feature to construct an initial entity fusion vector includes: Jointly model the entity driving vector and global features to construct an entity fusion vector that integrates local semantics and global structural information;
[0058]
[0059] in, is the entity driving vector, representing local semantic information, is the i-th element in the entity vector. is the global feature vector, representing the global structural information, is the jth element in the global vector. and are matrices that control the weights of local semantic and global structural information respectively. and It is a hyperparameter that adjusts the ratio of local and global information fusion. is a slice in a tensor, representing the interaction term between the weight matrix in the i-th and j-th dimensions.
[0060] The beneficial effects of the above technical solution are: by jointly modeling entity driving vectors and global features, local and global semantic information is integrated, the expressive power of feature representation is enhanced, and the semantic deviation problem caused by single-perspective modeling is effectively alleviated.
[0061] Further, if Figure 4 As shown, the S104: determining the dynamic weights of the initial entity fusion vector and the word feature vector by introducing the Euclidean distance confidence measurement mechanism; using the dynamic weights to weight and sum different features to obtain the entity fusion vector, specifically includes: By introducing the Euclidean distance confidence measurement mechanism, adaptive adjustment of the information fusion process is achieved, dynamic weights are assigned to different features, and the connection vector is obtained by weighted summation of different features using the dynamic weights.
[0062]
[0063]
[0064] in, is the Euclidean distance between the entity fusion vector and the word feature vector, A standard deviation parameter that controls the influence of distance on similarity. is a weighted summation coefficient. If the similarity between the entity driving vector and the word feature vector is high, it depends more on the entity driving vector. If the similarity is low, it depends more on the feature vectors of all words.
[0065] The beneficial effects of this technical solution are: by introducing a Euclidean distance confidence metric to measure the spatial similarity between the entity driver vector and the feature vectors of all words, fine-grained control of the information fusion process is achieved, enabling the model to achieve differentiated focus based on different relationship types, thereby more accurately depicting complex semantic relationships between entities. The similarity is normalized using the softmax function to generate a dependency, which is then used to adjust the contribution of the entity driver vector and the feature vectors of all words, ultimately calculating a weighted sum.
[0066] Further, if Figure 5As shown, the step S105: randomly initializing a relationship mapping vector includes: A trainable relation mapping vector will be randomly initialized , Different relationship mapping vectors provide different focal points, guiding the entity fusion vector to establish a connection with the entity driving vector. Randomly generate relationship mapping vectors The process is:
[0067]
[0068] is the dimension of the relation mapping vector, is a random vector, is the mean of the random vector, is the covariance matrix, is the determinant of the covariance matrix.
[0069] The beneficial effect of this technical solution is that it randomly initializes a relationship mapping vector as a trainable query vector. During training, this vector continuously learns the semantic representations of different relationships, thereby achieving refined modeling of different types of relationships. By guiding the entity fusion vector and the entity driving vector to establish a connection through the relationship mapping vector, the model can effectively focus on the semantic areas most closely related to the predicted relationship, enhancing the model's ability to identify key semantic fragments and improving the accuracy and robustness of entity relationship extraction.
[0070] Furthermore, the step S105 of guiding the establishment of a hydrogen energy entity relationship between the entity fusion vector and the entity driving vector based on the relationship mapping vector includes: The similarity is calculated by matrix multiplication of the relationship mapping vector and the connection vector, and the attention score is calculated by the softmax function to weight the information of different parts, so as to query and match the most relevant entity relationship:
[0071]
[0072] in, represents matrix multiplication, is the connection vector, is the entity driving vector, and L is the maximum length of the input sequence. Different relation mapping vectors provide different focal points, which enables the model to integrate contextual information more specifically according to the target relation.
[0073] Classify hydrogen energy entity relationships through relationship classifiers:
[0074] When predicting entity relationships, if > (in indicates that the threshold is 0.5), a positive prediction is made and it is judged as a positive example of the relationship; that is, the model believes that there is a specific relationship between the pair of entities. For example, if = 0.92, it means that the model believes that there is a relationship between entity A and entity B.
[0075] If there are multiple > , it indicates that a pair of entities has multiple relationships, that is, the same pair of entities may have multiple different relationships. For example, if the model predicts both the "product application relationship" (used_in, score 0.91) and the "technology R&D relationship" (developed_by, score 0.86) for the entities "hydrogen fuel cell" and "Toyota Motor Corporation," and both scores are greater than 0.5, it indicates that multiple relationships exist between "hydrogen fuel cell" and "Toyota Motor Corporation."
[0076]
[0077] in represents the probability of predicting entity relationships, Indicates a threshold of 0.5.
[0078] The beneficial effect of the above technical solution is: this method uses the relationship mapping vector to guide the interaction between the entity fusion vector and the entity driving vector, and uses the attention mechanism to achieve differentiated weighted convergence, which significantly improves the model's discrimination ability and robustness when multiple relationships coexist.
[0079] Furthermore, the S106: based on the hydrogen energy entity relationship, search in the existing hydrogen energy field knowledge graph, find the answer corresponding to the hydrogen energy entity relationship, and output the answer, wherein the existing hydrogen energy field knowledge graph includes: first entity-relationship-second entity; the first entity and the second entity are both keywords of hydrogen energy field knowledge, and the relationship refers to the existing relationship between the first entity and the second entity, such as: belongs to relationship, contains relationship, etc.
[0080] The beneficial effect of the above technical solution is: by setting thresholds for multi-relationship judgment, it is possible to distinguish whether there is a single or multiple relationships between a pair of entities, so that the model can support multi-label relationship modeling in complex scenarios, thereby enhancing the adaptability and generalization ability of the system.
[0081] In this example, the binary cross entropy loss function is used to measure the difference between the model's predicted probability and the actual label:
[0082] in, θ represents the model parameters, y is the manual label of each bag (0 for negative class, 1 for positive class).
[0083] In this embodiment, the selected dataset includes 570,088 samples in the training set and 172,448 samples in the test set, which contain 53 types of relationships in total.
[0084] Example sentence: "They now share an apartment, along with a third roommate, in the upscale Pacific Heights section of San Francisco." The relation is " / location / location / contains," the head entity is "Pacific Heights," and the tail entity is "San Francisco." Each mention of the entity pair e1 and e2 uses a special token. <e1> 、< / e1> and <e2> 、< / e2> Surround it.
[0085] The present invention performs preprocessing operations on hydrogen energy data to extract feature vectors of all words in unstructured texts in the hydrogen energy field; obtains feature vectors of related entity pairs and global features of sequences through the feature vectors of all words; performs semantic association mapping between entity pairs and all words through a semantic focus fusion module to obtain entity driving vectors; jointly models the entity driving vectors with global features to construct an entity fusion vector that integrates local semantics and global structural information; introduces a Euclidean distance confidence measurement mechanism to achieve adaptive adjustment of the information fusion process, assigns dynamic weights to different features, and performs weighted summation to obtain the entity fusion vector; the relationship perception module randomly initializes a relationship mapping vector, and different relationship mapping vectors provide different focus points to guide the entity fusion vector to establish a connection with the entity driving vector; finally, the hydrogen energy entity relationship is identified and classified through a relationship classifier.
[0086] Example 2 This embodiment provides a supply and demand question-answering system based on entity relationship extraction in the hydrogen energy field, including: An acquisition module is configured to: acquire the hydrogen energy field problem data to be processed; perform preprocessing operations on the hydrogen energy field problem data to be processed to obtain feature vectors of all words; A determination module is configured to: determine a feature vector of an entity pair based on the feature vectors of all words; determine a global feature of the hydrogen energy field problem data to be processed; A mapping module is configured to: implement semantic association mapping between entities and all words based on the feature vectors of all words and the feature vectors of entity pairs to obtain entity driving vectors; The construction module is configured to: jointly model the entity driving vector and the global features to construct an initial entity fusion vector; determine the dynamic weights of the initial entity fusion vector and the word feature vector by introducing a Euclidean distance confidence measurement mechanism; and obtain the entity fusion vector by weighted summing different features using the dynamic weights; A relationship establishment module is configured to: randomly initialize a relationship mapping vector, and guide the establishment of a hydrogen energy entity relationship between the entity fusion vector and the entity driving vector based on the relationship mapping vector; The output module is configured to: search in the existing hydrogen energy field knowledge graph according to the hydrogen energy entity relationship, find the answer corresponding to the hydrogen energy entity relationship, and output the answer.
[0087] It should be noted that the acquisition module, determination module, mapping module, construction module, relationship establishment module, and output module described above correspond to steps S101 to S106 in Example 1. The examples and application scenarios implemented by these modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the above modules, as part of a system, can be executed in a computer system, such as a set of computer-executable instructions.
[0088] The descriptions of the various embodiments in the above embodiments have different focuses. For parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0089] The proposed system can be implemented in other ways. For example, the system embodiment described above is merely illustrative. For example, the above module division is only a logical function division. In actual implementation, other division methods may be used. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not implemented.
[0090] Example 3 This embodiment also provides an electronic device, comprising: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory. When the electronic device is running, the processor executes the one or more computer programs stored in the memory, so that the electronic device executes the method described in the above embodiment one.
[0091] It should be understood that in this embodiment, the processor may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), off-the-shelf field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
[0092] The memory may include a read-only memory and a random access memory, and provides instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0093] During implementation, each step of the above method may be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software.
[0094] The method in Example 1 can be directly implemented as being executed by a hardware processor, or by a combination of hardware and software modules within the processor. The software module can be located in a storage medium well-established in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. The storage medium is located in the memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, a detailed description is not given here.
[0095] Those skilled in the art will appreciate that the units and algorithm steps of the various examples described in conjunction with this embodiment can be implemented using electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0096] Example 4 This embodiment further provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the method described in the first embodiment is performed.
[0097] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. The supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field is characterized by: include: Obtaining the hydrogen energy field problem data to be processed; performing preprocessing operations on the hydrogen energy field problem data to be processed to obtain feature vectors of all words; Based on the feature vectors of all words, determine the feature vectors of entity pairs; determine the global features of the hydrogen energy problem data to be processed; Based on the feature vectors of all words and the feature vectors of entity pairs, the semantic association mapping between entities and all words is realized to obtain the entity driving vector; The entity driving vector and global features are jointly modeled to construct the initial entity fusion vector. The dynamic weights of the initial entity fusion vector and word feature vector are determined by introducing the Euclidean distance confidence measurement mechanism. The dynamic weights are used to weight the sum of different features to obtain the entity fusion vector. A relationship mapping vector is randomly initialized, and based on the relationship mapping vector, a hydrogen energy entity relationship is established between the entity fusion vector and the entity driving vector; According to the hydrogen energy entity relationship, search in the existing hydrogen energy field knowledge graph, find the answer corresponding to the hydrogen energy entity relationship, and output the answer.
2. The supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field according to claim 1 is characterized in that: Based on the feature vectors of all words, determine the feature vectors of entity pairs, including: The entity pair includes: a head entity and a tail entity; Define a mask vector; expand the mask vector to obtain an expanded mask vector; Multiply the expanded mask vector by the feature vector of each word in each sentence element by element to obtain the multiplication result; According to the multiplication result, the head entity feature vector is extracted from each sentence; The extraction process of the tail entity feature vector is consistent with that of the head entity feature vector.
3. The supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field according to claim 1 is characterized in that: Based on the feature vectors of all words and the feature vectors of entity pairs, the semantic association mapping between entities and all words is realized to obtain the entity driving vector, which specifically includes: Calculate the semantic matching degree between the entity feature vector and each word in the sentence; Based on the combination of word features, entity features, and global features of the sequence, the weight of each word feature in relationship prediction is dynamically adjusted; based on the semantic matching degree, weight, and feature vector of the head entity, the feature representation of the head entity is determined; the feature representation of the tail entity is obtained in the same way as the feature representation of the head entity; The feature representation of the head entity is concatenated with the feature representation of the tail entity, and then the concatenated result is linearly mapped to obtain the entity driving vector.
4. The supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field according to claim 1 is characterized in that: The entity driving vector and global features are jointly modeled to construct the initial entity fusion vector, including: Jointly model the entity driving vector and global features to construct an entity fusion vector that integrates local semantics and global structural information; ; ; in, is the entity driving vector, representing local semantic information, is the i-th element in the entity vector; is the global feature vector, representing the global structural information, is the jth element in the global vector; and are matrices that control the weights of local semantic and global structural information respectively; and It is a hyperparameter that adjusts the ratio of local and global information fusion; is a slice in a tensor, representing the interaction term between the weight matrix in the i-th and j-th dimensions.
5. The supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field according to claim 1 is characterized in that: By introducing the Euclidean distance confidence measurement mechanism, the dynamic weights of the initial entity fusion vector and word feature vector are determined; Use dynamic weights to weight and sum different features to obtain the entity fusion vector, which includes: By introducing the Euclidean distance confidence measurement mechanism, adaptive adjustment of the information fusion process is achieved, dynamic weights are assigned to different features, and the connection vector is obtained by weighted summation of different features using dynamic weights. ; ; in, is the Euclidean distance between the entity fusion vector and the word feature vector, A standard deviation parameter to control the influence of distance on similarity; is the weighted summation coefficient.
6. The supply and demand question-answering method based on entity relationship extraction in the hydrogen energy field according to claim 1 is characterized in that: Randomly initialize a relation mapping vector, including: A trainable relation mapping vector will be randomly initialized , different relationship mapping vectors provide different focal points, guiding the entity fusion vector to establish a connection with the entity driving vector; randomly generating relationship mapping vectors The process is: ; ; is the dimension of the relation mapping vector, is a random vector, is the mean of the random vector, is the covariance matrix, is the determinant of the covariance matrix; The relationship mapping vector is used to guide the establishment of hydrogen entity relationships between the entity fusion vector and the entity driving vector, including: calculating the similarity through the relationship mapping vector through matrix multiplication and the connection vector, and then calculating the attention score through the softmax function to weight the information of different parts, so as to query and match the most relevant entity relationships: ; ; in, represents matrix multiplication, is the connection vector, is the entity driving vector, and L is the maximum length of the input sequence.
7. The supply and demand question-answering system based on entity relationship extraction in the hydrogen energy field is characterized by: include: An acquisition module is configured to: acquire problem data in the field of hydrogen energy to be processed; Preprocess the hydrogen energy problem data to obtain the feature vectors of all words; A determination module is configured to: determine a feature vector of an entity pair based on the feature vectors of all words; determine a global feature of the hydrogen energy field problem data to be processed; A mapping module is configured to: implement semantic association mapping between entities and all words based on the feature vectors of all words and the feature vectors of entity pairs to obtain entity driving vectors; The construction module is configured to: jointly model the entity driving vector and the global features to construct an initial entity fusion vector; determine the dynamic weights of the initial entity fusion vector and the word feature vector by introducing a Euclidean distance confidence measurement mechanism; and obtain the entity fusion vector by weighted summing different features using the dynamic weights; A relationship establishment module is configured to: randomly initialize a relationship mapping vector, and guide the establishment of a hydrogen energy entity relationship between the entity fusion vector and the entity driving vector based on the relationship mapping vector; The output module is configured to: search in the existing hydrogen energy field knowledge graph according to the hydrogen energy entity relationship, find the answer corresponding to the hydrogen energy entity relationship, and output the answer.
8. An electronic device, comprising: a memory for non-transitory storage of computer-readable instructions; as well as a processor for executing said computer-readable instructions, When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 6 is executed.
9. A storage medium, characterized in that: Non-transitory storage of computer-readable instructions, wherein when the non-transitory computer-readable instructions are executed by a computer, the method according to any one of claims 1 to 6 is performed.
10. A computer program product, characterized in that The invention comprises a computer program for implementing the method according to any one of claims 1 to 6 when the computer program is run on one or more processors.