Semantic matching method and device, electronic equipment and storage medium

By constructing a target graph and replacing the mask matrix with an adjacency matrix, the problem of ignoring the relationship between semantic components in the existing technology is solved, and the accuracy of semantic matching is improved.

CN111324699BActive Publication Date: 2025-10-10GUANGZHOU TENCENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010105193.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-02-20
Publication Date
2025-10-10
Estimated Expiration
2040-03-08

AI Technical Summary

Technical Problem

Existing semantic matching methods ignore the relationship between semantic components, resulting in low accuracy of semantic matching results.

Method used

By constructing a target graph based on word dependencies and replacing the mask matrix of the language model with an adjacency matrix, the relationship between semantic structures is enhanced.

Benefits of technology

The accuracy of semantic matching is improved and the understanding of structural semantics is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111324699B_ABST
    Figure CN111324699B_ABST
Patent Text Reader

Abstract

The application provides a semantic matching method and device, electronic equipment and storage medium, and belongs to the technical field of natural language processing. The method comprises the following steps: constructing a target graph based on the dependency relationship of words in at least two sentences to be matched, one node of the target graph being used to represent a word in the at least two sentences, and an edge of the target graph being used to represent that there is a dependency relationship between the words represented by the nodes connected by the edge or the words do not belong to the same sentence; replacing a mask matrix in a language model with an adjacency matrix of the target graph, the mask matrix being used to make part of the values participating in calculation ineffective; and determining the semantic relationship between the at least two sentences based on the sentence vectors corresponding to the at least two sentences and the language model after replacement. The above technical solution enhances the relationship between semantic structures and improves the accuracy of semantic matching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a semantic matching method, device, electronic device and storage medium. Background Art

[0002] With the emergence of large-scale datasets and the development of deep learning, numerous approaches have emerged to address semantic matching. Semantic matching involves determining semantic relationships between sentences, such as similarity or contradiction. The core of semantic matching lies in word meaning understanding and structural semantic understanding. Word meaning understanding involves accurately grasping the meaning of words in context, while structural semantic understanding involves understanding the relationships between semantic components. Semantic components refer to the components that make up a semantic structure. Since semantic matching is widely used in scenarios such as search, question-answering, and content recommendation, the accuracy of semantic matching results is crucial.

[0003] In related technologies, an encoder is typically used to encode sentences to be matched into vectors, and the semantic relationship between the sentences is determined by comparing the distances between the vectors. This encoder can be based on LSTM (Long Short-Term Memory) or CNN (Convolutional Neural Networks).

[0004] In the above semantic matching process, the meaning of each word in the sentence in the context is understood from the perspective of the sentences, ignoring the relationship between the semantic components, that is, ignoring the understanding of structural semantics, resulting in low accuracy of the semantic matching results. Summary of the Invention

[0005] The embodiments of the present application provide a method, apparatus, electronic device, and storage medium for semantic matching, which enhance the relationship between semantic components and improve the accuracy of semantic matching. The technical solution is as follows:

[0006] In one aspect, a semantic matching method is provided, the method comprising:

[0007] Based on dependency relationships between words in at least two sentences to be matched, construct a target graph, where a node of the target graph is used to represent a word in the at least two sentences, and an edge of the target graph is used to represent that there is a dependency relationship between the words represented by the nodes connected by the edge or that they do not belong to the same sentence;

[0008] Replacing a mask matrix in the language model with an adjacency matrix of the target graph, wherein the mask matrix is ​​used to disable some values ​​involved in the calculation;

[0009] Determine a semantic relationship between the at least two sentences based on the sentence vectors corresponding to the at least two sentences and the replaced language model.

[0010] In one aspect, a semantic matching apparatus is provided, comprising:

[0011] a construction module, configured to construct a target graph based on dependency relationships between words in at least two sentences to be matched, wherein a node of the target graph is used to represent a word in the at least two sentences, and an edge of the target graph is used to represent that there is a dependency relationship between the words represented by the nodes connected by the edge or that they do not belong to the same sentence;

[0012] A replacement module, configured to replace a mask matrix in the language model with an adjacency matrix of the target graph, wherein the mask matrix is ​​configured to disable some values ​​involved in the calculation;

[0013] A determination module is used to determine a semantic relationship between the at least two sentences based on the sentence vectors corresponding to the at least two sentences and the replaced language model.

[0014] In an optional implementation, the construction module is further used to perform dependency syntactic analysis on at least two sentences to be matched respectively to obtain at least two dependency syntactic trees, one of which is used to represent the dependency relationship between words in a sentence; in response to two words in the at least two sentences having the dependency relationship or not belonging to the same sentence, an edge is constructed between two nodes used to represent the two words to obtain a target graph.

[0015] In an optional implementation, the determination module is further used to input the sentence vectors corresponding to the at least two sentences into the replaced language model; determine the similarity between the words in the at least two sentences based on the encoding layer of the language model; and determine the semantic relationship between the at least two sentences based on the decoding layer of the language model.

[0016] In an optional implementation, the determination module is also used to adjust the first association information between words that meet the target condition to the second association information in the encoding layer according to the adjacency matrix, and the degree of association between the words represented by the second association information is greater than the first association information; based on the second association information, determine the degree of similarity between the words in the at least two sentences.

[0017] In an optional implementation, the first association information and the second association information are expressed in numerical form; the determination module is further used to use the element value of the adjacency matrix as a relationship enhancement parameter, and the value of the relationship enhancement parameter is 1 or 0, 1 indicates that the words meet the target condition, and 0 indicates that the words do not meet the target condition; obtain the target parameter, and input the target parameter into the activation function, the target parameter is a parameter optimized as the language model is trained, and the activation function is used to ensure the positive enhancement of the degree of association between words; the first association information between words is adjusted according to the product of the relationship enhancement parameter and the activation function to obtain the second association information.

[0018] In an optional implementation, the target condition is any one of the following:

[0019] words belonging to different sentences;

[0020] Words that belong to the same sentence and have a dependent relationship.

[0021] In an optional implementation, the determination module is also used to, for any word, use the second association information between the word and other words in the two sentences as an element in the attention matrix corresponding to the word; and determine the degree of similarity between the word and the other words based on the attention matrix and the value vectors of the other words.

[0022] In an optional implementation, the determination module is further used to decode the output result of the encoding layer at the decoding layer according to the adjacency matrix; and determine the semantic relationship between the at least two sentences based on the output result of the decoding layer.

[0023] On the one hand, an electronic device is provided, which includes a processor and a memory, wherein the memory is used to store at least one piece of program code, and the at least one piece of program code is loaded and executed by the processor to implement the operations performed in the semantic matching method in an embodiment of the present application.

[0024] On the one hand, a storage medium is provided, in which at least one program code is stored, and the at least one program code is used to execute the semantic matching method in the embodiment of the present application.

[0025] The beneficial effects of the technical solution provided by the embodiments of the present application are:

[0026] In an embodiment of the present application, a target graph is constructed based on the dependency relationship between words in a sentence, edges are used in the graph to represent the dependency relationship between words and words that do not belong to the same sentence, and the adjacency matrix of the target graph replaces the mask matrix in the language model, thereby enhancing the relationship between semantic structures and improving the accuracy of semantic matching. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0028] Figure 1 is a structural block diagram of a semantic matching system provided according to an embodiment of the present application;

[0029] Figure 2 This is a flow chart of a semantic matching method provided according to an embodiment of the present application;

[0030] Figure 3 is a schematic diagram of a dependency syntax tree provided according to an embodiment of the present application;

[0031] Figure 4 is a schematic diagram of a target map provided according to an embodiment of the present application;

[0032] Figure 5 is a flow chart of another semantic matching method provided according to an embodiment of the present application;

[0033] Figure 6 This is a block diagram of a semantic matching device provided according to an embodiment of the present application;

[0034] Figure 7 This is a structural block diagram of a terminal provided according to an embodiment of the present application;

[0035] Figure 8 It is a structural diagram of a server provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0037] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0038] The embodiments of the present application provide a semantic matching method that can be applied to scenarios such as search, question and answer, translation, and content recommendation. For example, when searching for a product name in a search scenario, the semantic matching method provided by the embodiments of the present application can be used to determine the corresponding information of the product name in the database, and then the corresponding information can be extracted from the database for display; or, when a question is detected in a question and answer scenario, the semantic matching method provided by the embodiments of the present application can be used to match the question with other stored questions, and when there are similar questions, the answers to the similar questions can be displayed; or, when translating the content to be translated into the target language in the translation scenario, the semantic matching method provided by the embodiments of the present application can be used to determine the content in the target language with the same semantics as the content to be translated; or, when making recommendations based on the input content in the content recommendation scenario, the semantic matching method provided by the embodiments of the present application can be used to determine recommended content related to the input content.

[0039] The following is a brief introduction to the main steps of the semantic matching method provided by an embodiment of the present application: first, based on the dependency relationship between words in at least two sentences to be matched, a target graph is constructed, wherein a node of the target graph is used to represent a word in the at least two sentences, and an edge of the target graph is used to represent that there is a dependency relationship between the words represented by the nodes connected by the edge or that they do not belong to the same sentence. Then, the mask matrix in the language model is replaced with the adjacency matrix of the target graph, and the mask matrix is ​​used to make the partial values ​​involved in the calculation inactive. Finally, based on the sentence vectors corresponding to the at least two sentences and the replaced language model, the semantic relationship between the at least two sentences is determined. The above-mentioned semantic matching method, by constructing a target graph based on the dependency relationship between words in the sentence, and replacing the mask matrix in the language model with the adjacency matrix of the target graph, thereby enhances the relationship between the semantic structures and improves the accuracy of semantic matching.

[0040] Figure 1 1 is a block diagram of a semantic matching system 100 according to an embodiment of the present application. The semantic matching system 100 includes: a terminal 110 and a semantic matching platform 120.

[0041] Terminal 110 is connected to the semantic matching platform 110 via a wireless or wired network. Terminal 110 can be at least one of a smartphone, a game console, a desktop computer, a tablet computer, an e-book reader, an MP3 player, an MP4 player, and a laptop computer. Terminal 110 has an application installed and running that supports semantic matching. This application can be a question-and-answer, search, translation, or information application. Illustratively, terminal 110 is a terminal used by a user, and the application running on terminal 110 has a user account logged into it.

[0042] The semantic matching platform 120 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. It provides backend services for applications that support semantic matching. Optionally, the semantic matching platform 120 performs primary semantic matching, while the terminal 110 performs secondary semantic matching. Alternatively, the semantic matching platform 120 performs secondary semantic matching, while the terminal 110 performs primary semantic matching. Alternatively, either the semantic matching platform 120 or the terminal 110 can independently perform semantic matching.

[0043] Optionally, the semantic matching platform 120 includes: an access server, a semantic matching server, and a database. The access server is used to provide access services to the terminal 110. The semantic matching server is used to provide background services related to semantic matching. The semantic matching server can be one or more. When there are multiple semantic matching servers, there are at least two semantic matching servers for providing different services, and / or there are at least two semantic matching servers for providing the same service, such as providing the same service in a load balancing manner, which is not limited in this embodiment of the present application. A language model may be provided in the semantic matching server. In this embodiment of the present application, the language model is a model constructed based on a multi-head attention mechanism.

[0044] The terminal 110 may generally refer to one of multiple terminals. This embodiment only uses the terminal 110 as an example.

[0045] Those skilled in the art will appreciate that the number of terminals may be greater or less. For example, there may be only one terminal, or there may be dozens, hundreds, or even more terminals, in which case the semantic matching system may also include other terminals. The embodiments of this application do not limit the number of terminals or device types.

[0046] Figure 2 This is a flow chart of a semantic matching method provided in an embodiment of the present application. Figure 2 The electronic device can be provided as a terminal or a server. In the embodiment of the present application, the application in the terminal is used as an example for explanation. The semantic matching method includes the following steps:

[0047] 201. The terminal performs dependency syntactic analysis on at least two sentences to be matched, and obtains at least two dependency syntactic trees. One dependency syntactic tree is used to represent dependency relationships between words in a sentence.

[0048] In an embodiment of the present application, for at least two sentences to be matched, the terminal can perform word segmentation on each sentence respectively. For any sentence, the terminal can analyze the dependency relationship between the multiple words included in the sentence according to the preset language rules, and construct the dependency syntax tree corresponding to the sentence based on the dependency relationship. Optionally, the terminal can also perform dependency syntax analysis on the at least two sentences respectively through a dependency syntax analysis tool to obtain the dependency syntax tree corresponding to each sentence, thereby obtaining at least two dependency syntax trees. The above-mentioned at least two sentences can be Chinese sentences, English sentences, or sentences in other languages, and the embodiment of the present application does not limit this. The above-mentioned dependency syntax analysis tool can be a tool constructed based on statistical methods, a tool constructed based on deep learning, or a tool constructed based on certain rules, and the embodiment of the present application does not limit this.

[0049] For example, take the case where the terminal performs dependency syntactic analysis on two matching Chinese sentences, see Figure 3 As shown, Figure 3 This is a schematic diagram of a dependency syntax tree provided according to an embodiment of the present application. Figure 3 In the example, there are two dependency syntactic trees, one for each Chinese sentence. In the dependency syntactic tree corresponding to the sentence "He said a big truth," the three words "he," "le," and "big truth" all have a dependency relationship with "said," while the word "one sentence" has a dependency relationship with "big truth." In the dependency syntactic tree corresponding to the sentence "She once said a lie," the four words "she," "once," "le," and "lie" all have a dependency relationship with "said."

[0050] In an optional implementation, in obtaining the above-mentioned at least two dependency syntax trees, in response to the dependency syntax tree including a compound word, the terminal can further segment the compound word to obtain at least two words, and retain the dependency relationship before and after the segmentation. Among them, a compound word refers to a compound word obtained by compounding at least two words according to certain grammatical rules, such as the compound word "美人" is obtained by compounding the two words "美" and "人", and the compound word "football" is obtained by compounding the two words "foot" and "ball". By further segmenting the compound word, the terminal can make the words in the dependency syntax tree become the smallest word unit, thereby facilitating the representation of the words in the form of vectors.

[0051] For example, Figure 3 In the example, "大实话" is a compound word. After word segmentation, it is divided into two words: "大" and "实话". Keeping the original dependency relationship unchanged, both words have a dependency relationship with "说", and "一句" has a dependency relationship with both words. For another example, some English words include prefixes or suffixes. The terminal can use word segmentation to separate the prefix or suffix of a word and obtain the prefix or suffix and another word.

[0052] 202. In response to the two words in the at least two sentences having a dependency relationship or not belonging to the same sentence, the terminal constructs an edge between two nodes used to represent the two words to obtain a target graph, wherein a node of the target graph is used to represent a word in the at least two sentences.

[0053] In an embodiment of the present application, after obtaining the at least two dependency syntax trees, the terminal can construct a target graph based on the at least two dependency syntax trees, wherein a node in the target graph is used to represent a word, and an edge in the target graph is used to represent that the words represented by the nodes connected by the edge have a dependency relationship or do not belong to the same sentence. The above technical process, that is, for any word in any sentence, in the above target graph, the node corresponding to the word is connected to the node corresponding to each word in other sentences through an edge, and the node corresponding to the word is connected to the node corresponding to other words in the same sentence that have a dependency relationship through an edge.

[0054] For example, see Figure 4 As shown, Figure 4 This is a schematic diagram of a target graph provided according to an embodiment of the present application. Figure 4 In, continue with Figure 3 The dependency syntax trees corresponding to the two Chinese sentences shown in the figure are used as an example to illustrate the target graph. The 11 words included in the two Chinese sentences are used as 11 nodes in the target graph. Among them, the 11 words include the two words "大" and "实话" obtained by the word segmentation of "大实话". For any word among the 11 words, such as the word "他", since there is a dependency relationship between "他" and the word "说" in the same sentence, an edge is constructed between the node corresponding to "他" and the node corresponding to "说". Moreover, since "他" does not belong to the same sentence as the five words "她", "曾", "说", "了", and "骗话", an edge is constructed between the node corresponding to "他" and the nodes corresponding to the above five words.

[0055] 203. The terminal replaces the mask matrix in the language model with the adjacency matrix of the target graph, where the mask matrix is ​​used to disable some values ​​involved in the calculation.

[0056] In the embodiment of the present application, the terminal can determine the semantic relationship between the at least two sentences through a language model, which can be composed of a multi-layer Transformer (a model for natural language processing). The Transformer is mainly based on an encoder-decoder structure and an attention mechanism. The language model includes a mask matrix, through which some data participating in the calculation can be masked, eliminating the influence of these values on parameter updating, that is, these values will not affect the results of parameter updating regardless of the values they take. The adjacency matrix of the target graph is used to represent the adjacent relationship between the nodes in the target graph, that is, the elements in the adjacency matrix are used to represent that two words have a dependency relationship or do not belong to the same sentence, which not only reflects the relationship between the words in the sentence but also reflects the relationship between the words in the sentence. By replacing the mask matrix with the adjacency matrix of the target graph, on the one hand, some data can continue to be masked, and on the other hand, the relationship between the words can be enhanced according to the adjacency matrix, deepening the relationship between the semantic components and enhancing the understanding of the structural semantics.

[0057] 204. The terminal determines the semantic relationship between the at least two sentences based on the sentence vectors corresponding to the at least two sentences and the replaced language model.

[0058] In the embodiment of the present application, the terminal can input the sentence vectors corresponding to the at least two sentences into the replaced language model, and determine the semantic relationship between the at least two sentences according to the output result of the replaced language model. Accordingly, this step can be implemented through sub-steps 2041 to 2043:

[0059] 2041. The terminal inputs the sentence vectors corresponding to the at least two sentences into the replaced language model.

[0060] The terminal can connect the at least two sentences together to form a target sentence, and combine the word vectors corresponding to the words in the target sentence into the sentence vectors. The terminal can also obtain the word vectors corresponding to the words in each of the at least two sentences, and combine the obtained word vectors into the sentence vectors. The terminal can convert the words in the at least two sentences into corresponding word vectors based on an embedding algorithm.

[0061] 2042. The terminal determines the similarity between the words in the at least two sentences based on the encoding layer of the language model.

[0062] This language model can be constructed based on a multi-layer Transformer. The Transformer structure simply consists of an encoding component and a decoding component. The encoding component includes at least one encoder, and the decoding component includes the same number of decoders as encoders. The layer containing the encoding component can be called the encoding layer of the language model. The encoder can include two sublayers: a self-attention layer and a feedforward neural network. The encoder receives at least one vector as input, passes the received vector to the self-attention layer, then passes the output of the self-attention layer to the feedforward neural network, and finally sends the output of the feedforward neural network to the next encoder.

[0063] In the self-attention layer, the terminal uses the self-attention mechanism to calculate the self-attention of each word using word vectors. The following steps are performed: First, for each word vector in the input sentence vector, a query vector, a key vector, and a value vector are created. These vectors are obtained by multiplying the word vectors with the corresponding weight matrix, where the weight matrix has a smaller dimension than the word vector. For example, the weight matrix has 64 dimensions, while the word vectors and the encoder input / output vectors have 512 dimensions. By reducing the vector dimension, the dimensionality can be kept constant during the attention matrix calculation. Second, the association information between each word is calculated. This association information indicates the degree of association between the words and can be expressed in numerical form. For any word's query vector, the dot product of the query vector and the key vectors of the other words is calculated to obtain the association information between the word and the other words. Third, this association information is divided by the square root of the key vector's dimensionality to ensure a more stable update process. The fourth step is to normalize the calculated results, such as through logistic regression, so that the sum of the normalized results equals 1. The fifth step is to multiply the value vector of each word by the normalized result. The sixth step is to add the multiplication results obtained in the fifth step to obtain the self-attention of each word, which is used to indicate the similarity between the word and other words.

[0064] For example, by q i 、k i and v i The query vector, key vector, and value vector of word i are represented respectively. Formula (1) can be used to normalize the degree of association between words, thus achieving the second to fourth steps mentioned above. Formula (2) can then be used to achieve the fifth and sixth steps mentioned above.

[0065]

[0066] Among them, αij represents the association information between word i and word j, exp() represents the exponential function with the natural constant e as the base, q i Query vector representing word i, represents the Key vector of word j, T represents transposition, L represents the total number of words in at least two sentences, L is a positive integer, and l represents the identifier of the word.

[0067]

[0068] Among them, i represents the self-attention of word i, α ij Represents the association information between word i and word j, v j Represents the Value vector of word j.

[0069] In an optional implementation, the second to sixth steps can also be simplified into matrix calculations, as shown in formula (3).

[0070]

[0071] Among them, O represents the matrix whose elements are the similarities between words, softmax() represents the logistic regression function, Q represents the matrix composed of the query vectors of each word, K represents the matrix composed of the key vectors of each word, T represents the transposition, d k Represents the number of dimensions, and V represents the matrix composed of the Value vectors of each word.

[0072] In an optional implementation, when the terminal calculates the degree of association between each word in the coding layer, it can adjust the association information between the words, and the association information is used to represent the degree of association between the words. The corresponding steps may be: the terminal may adjust the first association information between the words that meet the target condition to the second association information based on the adjacency matrix of the above-mentioned target graph, and the degree of association between the words represented by the second association information is greater than the first association information. The terminal determines the similarity between the words in the above-mentioned at least two sentences based on the second association information. Among them, the target condition can be words belonging to different sentences or words belonging to the same sentence and having a dependency relationship. By adjusting the association information between the words, the degree of association between the words can be enhanced, thereby enhancing the relationship between the semantic structures.

[0073] In an optional implementation, the first association information and the second association information can be expressed in numerical form, so that the terminal can adjust the association information between words by optimizing the target parameter as the language model is trained. The corresponding steps can be: the terminal can use the element value of the adjacency matrix as a relationship enhancement parameter, and the value of the relationship enhancement parameter is 1 or 0, 1 indicates that the target condition is met between the words, and 0 indicates that the target condition is not met between the words. The terminal obtains the target parameter and inputs the target parameter into the activation function. The target parameter is a parameter optimized as the language model is trained, and the activation function is used to ensure the positive enhancement of the degree of association between the words. The terminal can adjust the first association information between the words according to the product of the relationship enhancement parameter and the activation function to obtain the second association information. Through the characteristics of the adjacency matrix, the words that meet the target condition can be indirectly represented based on the values ​​of the elements in the adjacency matrix, that is, the nodes corresponding to the words that have a dependency relationship or do not belong to the same sentence are connected by edges, and the words corresponding to the nodes connected by the edges are the above-mentioned words that meet the target condition. The values ​​of the elements in the adjacency matrix are used to indicate whether the words meet the target conditions, thereby adjusting the association relationship between the words, saving the judgment process and improving the calculation efficiency.

[0074] For example, before the adjustment, the first association information can be calculated using the above formula (1). After the adjustment, the second association information can be calculated using the formula (4).

[0075]

[0076] Among them, α ij represents the association information between word i and word j, exp() represents the exponential function with the natural constant e as the base, q i Query vector representing word i, represents the Key vector of word j, T represents transposition, γ ij represents the relationship enhancement coefficient between word i and word j, that is, the corresponding element value in the adjacency matrix, σ( ) represents the activation function, and λ represents the target parameter.

[0077] In an optional implementation, the terminal may obtain an attention matrix corresponding to each word and determine the similarity between the words based on the attention matrix. Accordingly, the step of determining the similarity between the words in at least two sentences based on the second association information may be as follows: for any word, the terminal may use the second association information between the word and the other words in the above two words as an element in the attention matrix corresponding to the word, and determine the similarity between the word and the other words based on the value vector of the attention matrix and the other words. By using the matrix and vector multiplication method for calculation, the time required for calculation can be shortened to a certain extent and the calculation efficiency can be improved.

[0078] It should be noted that when the encoding component includes two or more encoders, these encoders are stacked together, the input of the bottom encoder is the above-mentioned sentence vector, and the output of the bottom encoder is the input of the encoder adjacent to and above the bottom encoder. That is, for any encoder other than the bottom encoder and the top encoder in the encoding component, the input of the encoder is the output of the encoder adjacent to and below the encoder, and the output of the encoder is the input of the encoder adjacent to and above the encoder. By selecting two or more encoders, the final output of the encoder, that is, the input of the decoder, is more accurate.

[0079] 2043. The terminal determines a semantic relationship between at least two sentences based on a decoding layer of the language model.

[0080] After obtaining the output of the encoding layer, the terminal inputs the output into the decoding component. The layer where the decoding component resides can be called the decoding layer of the language model. At this decoding layer, the terminal can decode the output of the encoding layer based on the above-mentioned adjacency matrix. Based on the output of the decoding layer, the semantic relationship between the at least two sentences can be determined. The decoder can include three sublayers: a self-attention layer, an encoding and decoding attention layer, and a feedforward neural network. The above-mentioned adjacency matrix can make some values ​​involved in the calculation in the self-attention layer of the decoder ineffective, so that the self-attention layer only focuses on the front positions in the output sequence.

[0081] For example, if the output results corresponding to each word in one sentence correspond to the output results corresponding to each word in another sentence, the two sentences are considered similar; otherwise, if they do not correspond, or only partially correspond, the two sentences are considered semantically dissimilar.

[0082] It should be noted that the steps described in steps 201 to 204 are optional implementation schemes of the semantic matching method provided in this application. The process of this implementation scheme can also be found in Figure 5 As shown, Figure 5 This is a flowchart of another semantic matching method provided in an embodiment of the present application, which exemplarily shows the processing process of two sentences by the terminal. Figure 5 In the example, statement 1 and statement 2 are first subjected to dependency parsing, resulting in two dependency trees. These trees are then fused into a target graph. The adjacency matrix corresponding to this target graph is then calculated and used to replace the language model's mask matrix. Finally, based on the replaced language model, the semantic relationship between statements 1 and 2 is output. This semantic relationship can be contradictory, similar, or unrelated.

[0083] In other optional implementation solutions, the terminal can also form the above at least two sentences into a word set respectively, one sentence corresponds to one word set, and for any sentence, a graph corresponding to the sentence is constructed according to the dependency relationship between words, and an edge set corresponding to the graph is determined. Whether the words satisfy the above target relationship is determined based on the edge set. For example, taking sentence A and sentence B as examples, the words contained in sentence A form a set S1, and the words contained in sentence B form a set S2. G1 represents a graph corresponding to sentence A, nodes in G1 represent elements in S1, and E1 represents an edge set corresponding to G1. Similarly, G2 represents a graph corresponding to sentence A, nodes in G2 represent elements in S2, and E2 represents an edge set corresponding to G2. For any two words t i and t j , <t i , t j > represents a directed edge from t i to t j , if the directed edge exists in E1 or E2, it indicates that there is a dependency relationship between the two words, and if t i and t j do not appear in S1 or S2 at the same time, it indicates that the two words belong to different sentences. Then the relationship enhancement coefficient can be represented by formula (5).

[0084]

[0085] Wherein, γ ij represents the relationship enhancement coefficient corresponding to the word i and the word j, if (if) represents the target condition, elsewise (other) represents other cases, t i represents the word i, t j represents the word j, S m represents set m, and S n represents set n.

[0086] In the embodiments of the present application, the target graph is constructed according to the dependency relationship between the words in the sentence, the dependency relationship between the words and the fact that they do not belong to the same sentence are represented by edges in the graph, and the adjacency matrix of the target graph is used to replace the mask matrix in the language model, thereby enhancing the relationship between the semantic structures and improving the accuracy of semantic matching.

[0087] Figure 6 is a device block diagram of semantic matching provided by the embodiments of the present application. The device is used to execute the steps of the above-mentioned semantic matching method, as shown in the figure, the device includes a construction module 601, a replacement module 602 and a determination module 603.

[0088] A construction module 601 is configured to construct a target graph based on dependency relationships between words in at least two sentences to be matched, wherein a node of the target graph represents a word in the at least two sentences, and an edge of the target graph represents that the words represented by the nodes connected by the edge have a dependency relationship or do not belong to the same sentence;

[0089] A replacement module 602 is configured to replace the mask matrix in the language model with the adjacency matrix of the target graph, where the mask matrix is ​​used to disable some values ​​involved in the calculation;

[0090] The determination module 603 is configured to determine a semantic relationship between at least two sentences based on the sentence vectors corresponding to the at least two sentences and the replaced language model.

[0091] In an optional implementation, the construction module 601 is further used to perform dependency syntactic analysis on at least two sentences to be matched, respectively, to obtain at least two dependency syntactic trees, where one dependency syntactic tree is used to represent the dependency relationship between words in a sentence; in response to two words in at least two sentences having a dependency relationship or not belonging to the same sentence, an edge is constructed between two nodes used to represent the two words to obtain a target graph.

[0092] In an optional implementation, the determination module 603 is further used to input the sentence vectors corresponding to at least two sentences into the replaced language model; based on the encoding layer of the language model, determine the similarity between the words in the at least two sentences; based on the decoding layer of the language model, determine the semantic relationship between the at least two sentences.

[0093] In an optional implementation, the determination module 603 is also used to adjust the first association information between words that meet the target conditions to the second association information in the encoding layer according to the adjacency matrix, and the degree of association between the words represented by the second association information is greater than that of the first association information; and determine the degree of similarity between the words in at least two sentences according to the second association information.

[0094] In an optional implementation, the first association information and the second association information are expressed in numerical form; the determination module 603 is further used to use the element value of the adjacency matrix as a relationship enhancement parameter, the value of the relationship enhancement parameter is 1 or 0, 1 indicates that the target condition is met between the words, and 0 indicates that the target condition is not met between the words; obtain the target parameter, input the target parameter into the activation function, the target parameter is a parameter optimized as the language model is trained, and the activation function is used to ensure the positive enhancement of the degree of association between words; adjust the first association information between the words according to the product of the relationship enhancement parameter and the activation function to obtain the second association information.

[0095] In an optional implementation, the target condition is any of the following:

[0096] words belonging to different sentences;

[0097] Words that belong to the same sentence and have a dependent relationship.

[0098] In an optional implementation, the determination module 603 is also used to, for any word, use the second association information between the word and other words in two sentences as an element in the attention matrix corresponding to the word; and determine the degree of similarity between the word and other words based on the attention matrix and the value vectors of other words.

[0099] In an optional implementation, the determination module 603 is further configured to decode the output result of the encoding layer according to the adjacency matrix at the decoding layer; and determine the semantic relationship between at least two sentences according to the output result of the decoding layer.

[0100] In an embodiment of the present application, a target graph is constructed based on the dependency relationship between words in a sentence, edges are used in the graph to represent the dependency relationship between words and words that do not belong to the same sentence, and the adjacency matrix of the target graph replaces the mask matrix in the language model, thereby enhancing the relationship between semantic structures and improving the accuracy of semantic matching.

[0101] It should be noted that the semantic matching device provided in the above embodiment only uses the division of the above functional modules as an example when running an application. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the semantic matching device provided in the above embodiment and the semantic matching method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0102] In an embodiment of the present application, the electronic device can be provided as a terminal or a server. When provided as a terminal, the operations performed by the above-mentioned semantic matching method can be implemented by the terminal; when provided as a server, the operations performed by the above-mentioned semantic matching method can be implemented by the server. The server can receive at least two statements to be matched sent by the terminal, and the server determines the semantic relationship between the at least two statements based on the semantic matching platform, and returns the semantic relationship to the terminal; the operations performed by the above-mentioned semantic matching method can also be implemented by the interaction between the server and the terminal.

[0103] The above electronic device may be provided as a terminal, Figure 7 This is a block diagram of a terminal 700 provided according to an embodiment of the present application. Figure 7The following is a block diagram of a terminal 700 according to an exemplary embodiment of the present invention. Terminal 700 may be a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. Terminal 700 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other similar names.

[0104] Typically, the terminal 700 includes a processor 701 and a memory 702 .

[0105] The processor 701 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 701 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 701 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 701 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 701 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0106] The memory 702 may include one or more computer-readable storage media, which may be non-transitory. The memory 702 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 702 is used to store at least one instruction, which is used to be executed by the processor 701 to implement the semantic matching method provided in the method embodiment of the present application.

[0107] In some embodiments, terminal 700 can also optionally include a peripheral interface 703 and at least one peripheral device. Processor 701, memory 702, and peripheral interface 703 can be connected through a bus or signal line. Each peripheral device can be connected to peripheral interface 703 through a bus, signal line, or circuit board. Specifically, the peripheral devices include at least one of radio frequency circuit 704, display screen 705, camera component 706, audio circuit 707, positioning component 708, and power supply 709.

[0108] Peripheral interface 703 can be used to connect at least one peripheral device related to input / output to processor 701 and memory 702. In some embodiments, processor 701, memory 702, and peripheral interface 703 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 701, memory 702, and peripheral interface 703 can be implemented on a separate chip or circuit board, and the present embodiments are not limited in this respect.

[0109] Radio frequency circuit 704 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. Radio frequency circuit 704 communicates with communication networks and other communication devices through electromagnetic signals. Radio frequency circuit 704 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, radio frequency circuit 704 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. Radio frequency circuit 704 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to metropolitan area networks, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, radio frequency circuit 704 can also include NFC (Near Field Communication) related circuitry, and the present application is not limited in this respect.

[0110] Display screen 705 is used to display a user interface (UI). This UI can include graphics, text, icons, videos, or any combination thereof. When display screen 705 is a touchscreen display, it can also capture touch signals on or above the surface of display screen 705. These touch signals can be input as control signals to processor 701 for processing. Display screen 705 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be a single display screen 705, located on the front panel of terminal 700. In other embodiments, there can be at least two display screens 705, located on different surfaces of terminal 700 or in a foldable design. In still other embodiments, display screen 705 can be a flexible display screen, located on a curved or foldable surface of terminal 700. Furthermore, display screen 705 can be configured as a non-rectangular, irregular shape, also known as a special-shaped screen. Display screen 705 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).

[0111] The camera assembly 706 is used to capture images or videos. Optionally, the camera assembly 706 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 706 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0112] The audio circuit 707 can include a microphone and a speaker. The microphone is used to collect sound waves of a user and an environment, and convert the sound waves into an electrical signal input to the processor 701 for processing, or input to the radio frequency circuit 704 to realize voice communication. For the purpose of stereo sound collection or noise reduction, the microphone can be multiple, which are respectively arranged at different parts of the terminal 700. The microphone can also be an array microphone or an omnidirectional collection type microphone. The speaker is used to convert an electrical signal from the processor 701 or the radio frequency circuit 704 into sound waves. The speaker can be a conventional diaphragm speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only can the electrical signal be converted into a sound wave audible to humans, but also can be converted into a sound wave inaudible to humans for ranging purposes. In some embodiments, the audio circuit 707 can also include a headphone jack.

[0113] The positioning component 708 is used to position the current geographic position of the terminal 700 to realize navigation or LBS (Location Based Service). The positioning component 708 can be a positioning component based on the GPS (Global Positioning System) of the United States, the Beidou system of China, the GLONASS system of Russia or the Galileo system of the European Union.

[0114] The power supply 709 is used to supply power to each component in the terminal 700. The power supply 709 can be alternating current, direct current, disposable battery or rechargeable battery. When the power supply 709 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.

[0115] In some embodiments, the terminal 700 also includes one or more sensors 710. The one or more sensors 710 include but are not limited to: an acceleration sensor 711, a gyroscope sensor 712, a pressure sensor 713, a fingerprint sensor 714, an optical sensor 715 and a proximity sensor 716.

[0116] The acceleration sensor 711 can detect the acceleration magnitude in three coordinate axes of the coordinate system established by the terminal 700. For example, the acceleration sensor 711 can be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 701 can control the display screen 705 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 711. The acceleration sensor 711 can also be used for game or user motion data collection.

[0117] The gyroscope sensor 712 can detect the orientation and rotation angle of the terminal 700. It can work with the accelerometer 711 to collect the user's 3D movements on the terminal 700. Based on the data collected by the gyroscope sensor 712, the processor 701 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0118] The pressure sensor 713 can be set on the side frame of the terminal 700 and / or the lower layer of the display screen 705. When the pressure sensor 713 is set on the side frame of the terminal 700, it can detect the user's grip signal of the terminal 700, and the processor 701 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 713. When the pressure sensor 713 is set on the lower layer of the display screen 705, the processor 701 controls the operable controls on the UI interface based on the user's pressure operation on the display screen 705. The operable controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0119] The fingerprint sensor 714 is used to collect the user's fingerprint. The processor 701 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 714, or the fingerprint sensor 714 identifies the user's identity based on the collected fingerprint. When the user's identity is identified as a trusted identity, the processor 701 authorizes the user to perform relevant sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 714 can be set on the front, back, or side of the terminal 700. When a physical button or manufacturer logo is set on the terminal 700, the fingerprint sensor 714 can be integrated with the physical button or manufacturer logo.

[0120] The optical sensor 715 is used to detect ambient light intensity. In one embodiment, the processor 701 can control the display brightness of the display screen 705 based on the ambient light intensity detected by the optical sensor 715. Specifically, when the ambient light intensity is high, the display brightness of the display screen 705 is increased; when the ambient light intensity is low, the display brightness of the display screen 705 is decreased. In another embodiment, the processor 701 can also dynamically adjust the shooting parameters of the camera assembly 706 based on the ambient light intensity detected by the optical sensor 715.

[0121] Proximity sensor 716, also known as a distance sensor, is typically located on the front panel of terminal 700. Proximity sensor 716 is used to detect the distance between the user and the front of terminal 700. In one embodiment, when proximity sensor 716 detects that the distance between the user and the front of terminal 700 is gradually decreasing, processor 701 controls display screen 705 to switch from the screen-on state to the screen-off state. When proximity sensor 716 detects that the distance between the user and the front of terminal 700 is gradually increasing, processor 701 controls display screen 705 to switch from the screen-off state to the screen-on state.

[0122] Those skilled in the art will understand that Figure 7 The structure shown in the figure does not constitute a limitation on the terminal 700, and the terminal 700 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.

[0123] The above electronic device may be provided as a server, Figure 8 This is a schematic diagram of the structure of a server provided in accordance with an embodiment of the present application. The server 800 may have relatively large differences due to different configurations or performances, and may include one or more processors (Central Processing Units, CPU) 801 and one or more memories 802, wherein the memory 802 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 801 to implement the semantic matching method provided in each of the above method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input / output interface for input and output. The server may also include other components for implementing device functions, which will not be described in detail here.

[0124] An embodiment of the present application also provides a computer-readable storage medium, which is applied to an electronic device, and the computer-readable storage medium stores at least one segment of program code, which is used to be executed by a processor and implement the operations performed by the electronic device in the semantic matching method in the embodiment of the present application.

[0125] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.

[0126] The above description is merely an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A semantic matching method, characterized in that: The method comprises: Based on dependency relationships between words in at least two sentences to be matched, construct a target graph, where a node of the target graph is used to represent a word in the at least two sentences, and an edge of the target graph is used to represent that there is a dependency relationship between the words represented by the nodes connected by the edge or that they do not belong to the same sentence; Replacing a mask matrix in the language model with an adjacency matrix of the target graph, wherein the mask matrix is ​​used to disable some values ​​involved in the calculation; Determine a semantic relationship between the at least two sentences based on the sentence vectors corresponding to the at least two sentences and the replaced language model.

2. The method according to claim 1, characterized in that The step of constructing a target graph based on the dependency relationship between words in at least two sentences to be matched includes: Performing dependency syntactic analysis on the at least two sentences to be matched, respectively, to obtain at least two dependency syntactic trees, one of the dependency syntactic trees being used to represent a dependency relationship between words in a sentence; In response to the two words in the at least two sentences having the dependency relationship or not belonging to the same sentence, an edge is constructed between two nodes used to represent the two words to obtain a target graph.

3. The method according to claim 1, characterized in that The determining the semantic relationship between the at least two sentences based on the sentence vectors corresponding to the at least two sentences and the replaced language model includes: Inputting the sentence vectors corresponding to the at least two sentences into the replaced language model; determining, based on the encoding layer of the language model, a degree of similarity between words in the at least two sentences; Based on a decoding layer of the language model, a semantic relationship between the at least two sentences is determined.

4. The method according to claim 3, characterized in that The determining, based on the encoding layer of the language model, the degree of similarity between the words in the at least two sentences comprises: In the encoding layer, according to the adjacency matrix, first association information between words that meet the target condition is adjusted to second association information, where the association degree between the words represented by the second association information is greater than that of the first association information; The similarity between the words in the at least two sentences is determined based on the second association information.

5. The method according to claim 4, characterized in that The first association information and the second association information are expressed in numerical form; The adjusting, according to the adjacency matrix, the first association information between the words that meet the target condition to the second association information includes: The element value of the adjacency matrix is ​​used as a relationship enhancement parameter, wherein the value of the relationship enhancement parameter is 1 or 0, 1 indicates that the words meet the target condition, and 0 indicates that the words do not meet the target condition; Obtaining a target parameter and inputting the target parameter into an activation function, wherein the target parameter is a parameter that is optimized as the language model is trained, and the activation function is used to ensure positive reinforcement of the degree of association between words; The first association information between words is adjusted according to the product of the relationship enhancement parameter and the activation function to obtain the second association information.

6. The method according to any one of claims 4 or 5, characterized in that The target condition is any of the following: words belonging to different sentences; Words that belong to the same sentence and have a dependent relationship.

7. The method according to any one of claims 4 or 5, characterized in that Determining the similarity between the words in the at least two sentences based on the second association information includes: For any word, taking the second association information between the word and other words in the two sentences as an element in the attention matrix corresponding to the word; Determine the degree of similarity between the word and the other words based on the attention matrix and the value vectors of the other words.

8. The method according to claim 3, characterized in that The determining, based on the decoding layer of the language model, the semantic relationship between the at least two sentences comprises: At the decoding layer, decoding the output result of the encoding layer according to the adjacency matrix; Determine a semantic relationship between the at least two sentences according to an output result of the decoding layer.

9. A semantic matching device, characterized in that: The device comprises: a construction module, configured to construct a target graph based on dependency relationships between words in at least two sentences to be matched, wherein a node of the target graph is used to represent a word in the at least two sentences, and an edge of the target graph is used to represent that there is a dependency relationship between the words represented by the nodes connected by the edge or that they do not belong to the same sentence; A replacement module, configured to replace a mask matrix in the language model with an adjacency matrix of the target graph, wherein the mask matrix is ​​configured to disable some values ​​involved in the calculation; A determination module is used to determine a semantic relationship between the at least two sentences based on the sentence vectors corresponding to the at least two sentences and the replaced language model.

10. The device according to claim 9, characterized in that The construction module is further used to perform dependency syntactic analysis on the at least two sentences to be matched, respectively, to obtain at least two dependency syntactic trees, one of the dependency syntactic trees being used to represent the dependency relationship between words in a sentence; in response to two words in the at least two sentences having the dependency relationship or not belonging to the same sentence, an edge is constructed between two nodes used to represent the two words to obtain a target graph.

11. The device according to claim 9, characterized in that The determining module is further configured to input the sentence vectors corresponding to the at least two sentences into the replaced language model; and determine the similarity between the words in the at least two sentences based on the encoding layer of the language model; Based on a decoding layer of the language model, a semantic relationship between the at least two sentences is determined.

12. The device according to claim 11, characterized in that The determination module is also used to adjust, in the encoding layer, the first association information between words that meet the target condition to the second association information according to the adjacency matrix, where the degree of association between the words represented by the second association information is greater than that of the first association information; and determine the degree of similarity between the words in the at least two sentences based on the second association information.

13. The device according to claim 12, characterized in that The first association information and the second association information are expressed in numerical form; the determining module is further configured to use the element value of the adjacency matrix as a relationship enhancement parameter, wherein the value of the relationship enhancement parameter is 1 or 0, where 1 indicates that the words meet the target condition, and 0 indicates that the words do not meet the target condition; Obtain a target parameter and input the target parameter into an activation function, where the target parameter is optimized as the language model is trained, and the activation function is used to ensure the positive enhancement of the degree of association between words; adjust the first association information between words according to the product of the relationship enhancement parameter and the activation function to obtain the second association information.

14. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory is used to store at least one section of program code, and the at least one section of program code is loaded by the processor and executes the semantic matching method according to any one of claims 1 to 8.

15. A storage medium, characterized in that: The storage medium is used to store at least one section of program code, and the at least one section of program code is used to execute the semantic matching method described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Sentence similarity calculating method and device as well as system

    CN108268441A

  • A statement similarity judgment method and system

    CN109918652A