Alignment enhanced semantic parsing method, device and computer program product

By predicting and generating alignment relationship phrases, combining encoder-decoder model and noise-containing alignment training, the problem of low overfitting and generalization capabilities of analytical models in the existing technology is solved, and higher analytical accuracy and reliance Great.

CN115062603BActive Publication Date: 2024-11-29INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210557374.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-20
Publication Date
2024-11-29
Estimated Expiration
2042-05-20

AI Technical Summary

Technical Problem

The existing table-oriented knowledge question and answer model has the problem of low overfitting and generalization capabilities of analytical models, and cannot effectively perform multi-grained alignment, resulting in the decoder generating attention module error.

Method used

By predicting the alignment relationship phrases in the knowledge question and answer task and generating query fragments based on the phrase type, the alignment relationship information is spliced ​​into the input sequence using the encoder-decoder analytical model, and the decoder model trained with noisy alignment is used in the decoding stage. , enhance attentional operations of alignment relationships to improve resolution accuracy and robustness.

Benefits of technology

A larger granularity alignment modeling is achieved, the generalization ability and parsing accuracy of the analytical model are improved, the robustness to noise is enhanced, and the negative impact of incorrect alignment on the decoder model is alleviated.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115062603B_ABST
    Figure CN115062603B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of natural language processing, and provides an alignment-enhanced semantic parsing method, device and computer program product, the method comprising: predicting phrases corresponding to alignment relationships in a knowledge question-answering task, and generating corresponding query fragments based on the types of phrases corresponding to the alignment relationships, wherein the alignment relationships include phrases and corresponding query fragments; splicing the serialized alignment relationships to an input sequence, and inputting the input sequence into an encoder model of an encoder-decoder parsing model to obtain an aligned encoding result; performing an attention operation on the aligned encoding result and inputting it into a decoder model of an encoder-decoder parsing model, parsing and outputting the query sentence corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training. The present invention can achieve modeling alignment of larger granularity, and improve the parsing accuracy and the robustness of the parsing model to noise.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular to an alignment-enhanced semantic parsing method, device and computer program product. Background Art

[0002] In recent years, table-oriented question answering (also known as table semantic parsing or text to SQL statements) has been a hot research direction. It is used to automatically convert questions described in natural language into corresponding formal language queries based on a specific table or a database consisting of multiple tables, generally using SQL statements.

[0003] In fact, most of the data in the real world is stored in relational databases. To access the database, we need to write corresponding SQL query statements according to the needs. The writing of SQL query statements requires high professional requirements. The writer needs to master the syntax rules of SQL and have a sufficient understanding of the structure (schema) of the database, that is, to have a sufficient understanding of the table names and column names contained in the database. Therefore, table-oriented knowledge questions and answers are born, making it possible for ordinary users who are not familiar with SQL syntax and database structure to access large-scale databases. It has high application value and broad application prospects.

[0004] In the prior art, for table-oriented knowledge question answering, most existing models model alignment through the weight of the attention matrix, and implicitly add the result vector obtained according to the weight to the model. This method has the following two main problems: (1) The standard attention mechanism can only model word-level alignment, while the knowledge answering task has many multi-granular and non-continuous alignments. The standard attention mechanism cannot treat the knowledge answering task as a whole, which may cause the decoder to fail to correctly generate the attention module; (2) The traditional attention mechanism will cause the model to overfit on the training set, which is not conducive to the generalization ability of the model. Summary of the invention

[0005] The present invention provides an alignment-enhanced semantic parsing method, device and computer program product, which are used to solve the defects of overfitting and low generalization ability of parsing models in the prior art, realize modeling alignment with larger granularity, and improve parsing accuracy and the robustness of the parsing model to noise.

[0006] The present invention provides an alignment enhanced semantic parsing method, comprising:

[0007] Predicting phrases corresponding to the alignment relationship in the knowledge question answering task, and generating corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes phrases and corresponding query fragments;

[0008] splicing the serialized alignment relationship to an input sequence, and inputting the input sequence into an encoder model of an encoder-decoder parsing model to obtain an aligned encoding result;

[0009] The aligned encoding result is subjected to an attention operation and input into a decoder model of an encoder-decoder parsing model to parse and output a query statement corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

[0010] According to the alignment enhanced semantic parsing method provided by the present invention, phrases corresponding to the alignment relationship in the knowledge question answering task are predicted, and corresponding query fragments are generated based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes phrases and corresponding query fragments, including:

[0011] Based on the knowledge question answering task, a sequence labeling method is used to predict phrases corresponding to the alignment relationship, and the type of the phrase is identified, wherein the type of the phrase includes any one of the following: keyword type, column type and value type;

[0012] According to the type of the phrase, a query fragment corresponding to the phrase is generated.

[0013] According to the alignment enhanced semantic parsing method provided by the present invention, generating a query fragment corresponding to the phrase according to the type of the phrase includes:

[0014] In the case that the type of the phrase includes a keyword type, a query segment corresponding to the keyword type phrase is obtained based on a sequence generation model.

[0015] According to the alignment enhanced semantic parsing method provided by the present invention, generating a query fragment corresponding to the phrase according to the type of the phrase includes:

[0016] In the case where the type of the phrase includes a column type or a value type, based on an attention mechanism, a column in a specific table that has the highest matching degree with the column type phrase or the value type phrase is obtained.

[0017] According to the alignment enhanced semantic parsing method provided by the present invention, the serialized alignment relationship is spliced ​​to an input sequence, and the input sequence is input into an encoder model of an encoder-decoder parsing model to obtain an aligned encoding result, including:

[0018] In the encoder model of the encoder-decoder parsing model, each alignment category symbol, the phrase of the corresponding alignment relationship and the query fragment corresponding to the phrase are spliced ​​into the input sequence to realize the linking of the knowledge question answering task with the specific table content.

[0019] According to the alignment enhanced semantic parsing method provided by the present invention, the alignment encoding result is subjected to attention operation and input into a decoder model of an encoder-decoder parsing model, and a query statement corresponding to the alignment relationship is parsed and output, wherein the decoder model is obtained by using noisy alignment training, and comprises:

[0020] Based on the pre-trained model, the decoder model is trained using the cross-validation method when the training set includes both labeled alignments and noisy alignments.

[0021] Performing an attention operation on the alignment relationship of the hidden state of each alignment category symbol in the input sequence;

[0022] The attention operation vector of the hidden state of each alignment category symbol in the input sequence is concatenated with the embedding representation of the previous word and input into the decoder model, and the parsed query statement is output to inject the alignment relationship into the hidden state at the next moment.

[0023] The present invention also provides an alignment enhanced semantic parsing device, comprising:

[0024] A prediction module, used to predict the phrases corresponding to the alignment relationship in the knowledge question answering task, and generate corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes phrases and corresponding query fragments;

[0025] An encoding module, used for splicing the serialized alignment relationship to an input sequence, and inputting the input sequence into an encoder model of an encoder-decoder parsing model to obtain an aligned encoding result;

[0026] A parsing module is used to perform an attention operation on the aligned encoding result and input it into a decoder model of an encoder-decoder parsing model, parse and output a query statement corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

[0027] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the alignment enhanced semantic parsing method as described above is implemented.

[0028] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the alignment-enhanced semantic parsing methods described above.

[0029] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the alignment enhanced semantic parsing method as described above is implemented.

[0030] The alignment-enhanced semantic parsing method, device and computer program product provided by the present invention predict phrases with corresponding alignment relationships and generate query fragments corresponding to the phrases based on the phrase types, thereby obtaining the "lexical-logical" alignment contained in the knowledge question-answering task, explicitly utilizing the "lexical-logical" alignment, and realizing modeling alignment at a larger granularity phrase level, thereby improving the generalization ability of the parsing model between different fields; at the same time, using an encoder-decoder parsing model, in the encoding stage, the alignment information is spliced ​​into the input sequence and input into the encoder model, thereby better realizing the linking of the knowledge question-answering task with the content of a specific table, and in the decoding stage, the decoder model is trained using an enhanced training set formed by splicing the noisy alignment and the labeled alignment, thereby enhancing the robustness of the decoder to the noise on the decoder model, improving the parsing accuracy, and alleviating the negative impact of incorrect alignment on the decoder model based on data enhancement, and realizing end-to-end parsing by inputting the decoder model after performing an attention operation on the alignment relationship. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0032] Figure 1 This is one of the flow charts of the alignment enhanced semantic parsing method provided by the present invention;

[0033] Figure 2 This is the second flow chart of the alignment enhanced semantic parsing method provided by the present invention;

[0034] Figure 3 It is a structural schematic diagram of the alignment enhanced semantic parsing device provided by the present invention;

[0035] Figure 4 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0036] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] Combine the following Figure 1-Figure 2 The alignment enhanced semantic parsing method of the present invention is described.

[0038] The present invention provides an alignment enhanced semantic parsing method. Figure 1 is one of the flow charts of the alignment enhanced semantic parsing method provided by the present invention, such as Figure 1 As shown, the method includes:

[0039] Step 110: predict the phrases corresponding to the alignment relationship in the knowledge question answering task, and generate corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes the phrases and the corresponding query fragments.

[0040] Optionally, the method comprises:

[0041] Based on the knowledge question answering task, a sequence labeling method is used to predict the phrases corresponding to the alignment relationship and identify the type of the phrase, where the type of the phrase includes any of the following: keyword type, column type, and value type;

[0042] According to the type of phrase, a query fragment corresponding to the phrase is generated.

[0043] Optionally, a keyword-type phrase refers to a phrase in a knowledge question answering task that corresponds to a query pattern consisting of keywords in an SQL query statement. Both a column-type phrase and a value-type phrase correspond to a column in a specific table in a database. The difference between a column-type phrase and a value-type phrase is that the value-type phrase itself is also a value in an SQL query statement. By analogy with a named entity recognition model, a pre-training model is constructed, and a sequence labeling method is used to achieve alignment prediction. The pre-training model is shown in formulas (1) and (2):

[0044] P(Label i |Q,T)=softmax(MLP([h i ;c i ])) (1),

[0045] c i =Attention(h i ,h c ,h c ) (2),

[0046] Among them, h i represents the hidden layer representation of the i-th word in the knowledge question answering task, c i represents the column-aware representation corresponding to the i-th word in the knowledge question answering task, h c Represents the hidden layer representation of all columns, and h i and c iAfter concatenation, the words are sent to a multi-layer perceptron (MLP) and the normalized exponential function softmax is used to predict the label of the i-th word. Q represents the knowledge question answering task, and T represents the specific table corresponding to the knowledge question answering task.

[0047] Optionally, when the type of phrase includes a keyword type, a query fragment corresponding to the keyword type phrase is obtained based on a sequence generation model.

[0048] Optionally, the sequence generation model may use an attention mechanism-enhanced RNN model to generate a query model consisting of keywords corresponding to a keyword type phrase.

[0049] Optionally, when the type of the phrase includes a column type or a value type, based on an attention mechanism, a column in a specific table that has the highest matching degree with the column type phrase or the value type phrase is obtained.

[0050] Optionally, based on the attention matrix, for column-type phrases or value-type phrases, the sum of the attention scores of the words in each phrase, that is, the sum of the similarity values, is obtained, so as to obtain the column c* that best matches the phrase p. The calculation formula of the column c* is shown in formula (3):

[0051]

[0052] Among them, C represents the set of all columns in a specific table in the database, w represents the words in phrase p, and f represents the similarity function.

[0053] Step 120: splice the serialized alignment relationship to the input sequence, and input the input sequence into the encoder model of the encoder-decoder parsing model to obtain an aligned encoding result.

[0054] Optionally, the encoder-decoder parsing model in the present application includes but is not limited to a standard word-level encoder-decoder parsing model, which combines an encoder model based on a BERT pre-trained model and an autoregressive pointer generation network (Pointer-generator) to achieve an end-to-end parsing process.

[0055] Optionally, in the encoder model of the encoder-decoder parsing model, each alignment category symbol, the phrase corresponding to the alignment relationship, and the query fragment corresponding to the phrase are spliced ​​into the input sequence to realize the linking of the knowledge question answering task with the specific table content.

[0056] Optionally, each "lexical-logical" alignment is represented as the concatenation of a natural language phrase p and its corresponding query fragment y, which are connected by ":", and a special symbol for indicating the alignment category is added before the concatenated fragment to indicate keywords, columns and values, and they are concatenated into the input sequence, and the "lexical-logical" alignment information is explicitly used to better link the knowledge question answering task with the table content (schema linking). The input sequence is shown in formula (4):

[0057]

[0058] Step 130: Perform an attention operation on the aligned encoding result and input it into a decoder model of the encoder-decoder parsing model to parse and output a query statement corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

[0059] Optionally, at the decoding end of the encoder-decoder parsing model, i.e., the decoder model, based on the pre-trained model, the decoder is trained using a cross-validation method when the training set includes the labeled alignment relationship and the noisy alignment relationship;

[0060] Perform an attention operation on the alignment relationship of the hidden state of each alignment category symbol in the input sequence;

[0061] The attention operation vector of the hidden state of each aligned category symbol in the input sequence is concatenated with the embedding representation of the previous phrase and input into the decoder model, and the parsed query statement is output to inject the alignment relationship into the hidden state of the next moment.

[0062] Optionally, in order to alleviate the negative impact of incorrect alignment relationships on the decoder model, in the training set, a noisy alignment is added based on the labeled alignment, and the alignment on the training set is predicted based on the pre-trained model in step 110 through cross-validation to enhance the decoder model's robustness to noise and parsing accuracy.

[0063] Optionally, the hidden state of each aligned category symbol in the input sequence is taken as its vector representation, that is, the hidden state of [TYPE#An] is taken as its vector representation, denoted as h A , and align the hidden state of the decoder model for attention operation, the attention score a t The calculation formula is shown in formula (5):

[0064]

[0065] in, Represents the hidden state of the decoder model at the current moment.

[0066] Optionally, the attention score at and the embedding representation e of the previous word t After splicing, it is used as the input of the decoder model to inject the alignment information into the hidden state of the next moment. The calculation formula is shown in formula (6):

[0067]

[0068] Table 1 Information on the men's 50km walk in track and field at the 1932 Summer Games

[0069] <![CDATA[Name(c1)]]> <![CDATA[Nationality(c2)]]> <![CDATA[Time(c3)]]> paul sievert germany 5:16:41 ernie crosbie united states 5:28:02 Bill Chisholm united states 5:51:00

[0070] For example, Figure 2 This is the second flow chart of the alignment enhanced semantic parsing method provided by the present invention. Figure 2 As shown in Table 1, taking the knowledge question answering task “which competitor from united states had the longest time?” as an example, the matching specific tables are shown in Table 1.

[0071] Through the knowledge answering task, phrase recognition is performed, and corresponding query fragments are generated according to the phrase type, and the "lexical-logical" alignment relationship for the knowledge answering task is obtained as follows:

[0072] "competitor: c1", "from: c2", "time: c3", "united states: c2(value)", "thelongest: order by...limit 1".

[0073] The above “lexical-logical” alignment relationship is concatenated into the input sequence, and the generated input sequence is: [CLS]whichcompetitor…[SEP][TEXT]name…[TIME] time…[SEP][COL]competitor:c1…[VAL]united states:c2…[SEP], and the input sequence is input into the encoder model. Specifically, the encoder model adopts the BERT model.

[0074] After the hidden state of each alignment category symbol in the above input sequence is paid attention to the alignment relationship, it is concatenated with the embedding representation of the previous word and input into the decoder model. Specifically, the decoder model adopts a pointer generation network. After being parsed by the decoder model, the output SQL query statement is: Select c1 from w where c2 = "unitedstates" order by c3 desc limit 1.

[0075] Optionally, the present application uses the Squall dataset and existing methods to verify the performance of the present application method, wherein the Squall dataset provides a cross-domain form dataset with phrase-level alignment annotations. Existing methods include: SEQ2SEQ + +BERT model, ALIGN+BERT model, and compare the method containing noisy alignment (LAP+noisy alignment) and the method not containing noisy alignment (LAP) in this application with the existing method. The comparison results are shown in Table 2.

[0076] In Table 2, ACC LF Used to compare whether the predicted SQL query statement is exactly the same as the answer query. EXE Used to compare whether the execution results of two queries are the same. In this case, the two queries should not be literally identical.

[0077] It can be seen from Table 2 that after adding alignment information in the analysis, the method (LAP) of the present application that does not include noisy alignment achieves performance that is approximately equal to the optimal method on the Squall dataset. Furthermore, by training the decoder model with a training set that adds noisy alignment, the gap between the decoder and the test samples is further narrowed, and the performance is further improved, which further illustrates that noisy alignment does have a considerable negative impact on the decoder, and the method (LAP+noisyalignment) of the present application can effectively alleviate this problem.

[0078] Table 2 Performance comparison results between existing methods and the method of this application

[0079]

[0080] The alignment enhanced semantic parsing method provided by the present invention obtains the "lexical-logical" alignment contained in the knowledge question and answer task by predicting the phrases of the corresponding alignment relationship and generating the query fragments corresponding to the phrases based on the phrase types, and explicitly utilizes the "lexical-logical" alignment, and realizes the modeling alignment from the phrase level with larger granularity, thereby improving the generalization ability of the parsing model between different fields; at the same time, using the encoder-decoder parsing model, in the encoding stage, the alignment information is spliced ​​into the input sequence and input into the encoder model, so as to better realize the linking of the knowledge question and answer task with the specific table content, and in the decoding stage, the decoder model is trained with the enhanced training set formed by splicing the noisy alignment and the labeled alignment, so as to enhance the robustness of the decoder to the noise on the decoder model, improve the parsing accuracy, and alleviate the negative impact of the wrong alignment on the decoder model based on the data enhancement method, and realize end-to-end parsing by inputting the decoder model after the attention operation on the alignment relationship.

[0081] The alignment enhanced semantic parsing device provided by the present invention is described below. The alignment enhanced semantic parsing device described below and the alignment enhanced semantic parsing method described above can be referenced to each other.

[0082] The present invention also provides an alignment enhanced semantic parsing device, Figure 3 is a schematic diagram of the structure of the alignment enhanced semantic parsing device provided by the present invention, such as Figure 3 As shown, the alignment enhanced semantic parsing device 200 includes: a prediction module 201, an encoding module 202, and a parsing module 203, wherein:

[0083] A prediction module 201 is used to predict phrases corresponding to the alignment relationship in the knowledge question answering task, and generate corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes phrases and corresponding query fragments;

[0084] The encoding module 202 is used to splice the serialized alignment relationship to the input sequence, and input the input sequence into the encoder model of the encoder-decoder parsing model to obtain the aligned encoding result;

[0085] The parsing module 203 is used to perform an attention operation on the aligned encoding results and input them into a decoder model of the encoder-decoder parsing model, parse and output a query sentence corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

[0086] The alignment enhanced semantic parsing device provided by the present invention obtains the "lexical-logical" alignment contained in the knowledge question and answer task by predicting the phrases of the corresponding alignment relationship and generating the query fragments corresponding to the phrases based on the phrase types, and explicitly utilizes the "lexical-logical" alignment, and realizes the modeling alignment from the phrase level of larger granularity, thereby improving the generalization ability of the parsing model between different fields; at the same time, using the encoder-decoder parsing model, in the encoding stage, the alignment information is spliced ​​into the input sequence and input into the encoder model, so as to better realize the linking of the knowledge question and answer task with the specific table content, and in the decoding stage, the decoder model is trained with the enhanced training set formed by splicing the noisy alignment and the labeled alignment, so as to enhance the robustness of the decoder to the noise on the decoder model, improve the parsing accuracy, and alleviate the negative impact of the wrong alignment on the decoder model based on the data enhancement method, and realize end-to-end parsing by inputting the decoder model after the attention operation on the alignment relationship.

[0087] Optionally, the prediction module 201 is specifically configured to:

[0088] Based on the knowledge question answering task, a sequence labeling method is used to predict the phrases corresponding to the alignment relationship and identify the type of the phrase, where the type of the phrase includes any of the following: keyword type, column type, and value type;

[0089] According to the type of phrase, a query fragment corresponding to the phrase is generated.

[0090] Optionally, the prediction module 201 is specifically configured to:

[0091] In the case where the type of phrase includes a keyword type, a query fragment corresponding to the keyword type phrase is obtained based on the sequence generation model.

[0092] Optionally, the prediction module 201 is specifically configured to:

[0093] When the type of the phrase includes a column type or a value type, based on an attention mechanism, a column in a specific table that has the highest matching degree with the column type phrase or the value type phrase is obtained.

[0094] Optionally, the encoding module 202 is specifically configured to:

[0095] In the encoder model of the encoder-decoder parsing model, each alignment category symbol, the phrase corresponding to the alignment relationship, and the query fragment corresponding to the phrase are spliced ​​into the input sequence to realize the linking of the knowledge question answering task with the specific table content.

[0096] Optionally, the parsing module 203 is specifically configured to:

[0097] Based on the pre-trained model, the decoder model is trained using the cross-validation method when the training set includes both labeled alignments and noisy alignments.

[0098] Perform an attention operation on the alignment relationship of the hidden state of each alignment category symbol in the input sequence;

[0099] The attention operation vector of the hidden state of each aligned category symbol in the input sequence is concatenated with the embedding representation of the previous phrase and input into the decoder model, and the parsed query statement is output to inject the alignment relationship into the hidden state of the next moment.

[0100] Figure 4 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 4 As shown, the electronic device 300 may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the alignment enhanced semantic parsing method, which includes:

[0101] Predicting phrases corresponding to the alignment relationship in the knowledge question answering task, and generating corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes the phrases and the corresponding query fragments;

[0102] The serialized alignment relationship is spliced ​​to the input sequence, and the input sequence is input into the encoder model of the encoder-decoder parsing model to obtain the aligned encoding result;

[0103] The aligned encoding results are subjected to attention operation and input into the decoder model of the encoder-decoder parsing model to parse and output the query sentence corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

[0104] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0105] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the alignment enhanced semantic parsing method provided by the above methods, the method includes:

[0106] Predicting phrases corresponding to the alignment relationship in the knowledge question answering task, and generating corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes the phrases and the corresponding query fragments;

[0107] The serialized alignment relationship is spliced ​​to the input sequence, and the input sequence is input into the encoder model of the encoder-decoder parsing model to obtain the aligned encoding result;

[0108] The aligned encoding results are subjected to attention operation and input into the decoder model of the encoder-decoder parsing model to parse and output the query sentence corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

[0109] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the alignment enhanced semantic parsing method provided by the above methods, the method comprising:

[0110] Predicting phrases corresponding to the alignment relationship in the knowledge question answering task, and generating corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes the phrases and the corresponding query fragments;

[0111] The serialized alignment relationship is spliced ​​to the input sequence, and the input sequence is input into the encoder model of the encoder-decoder parsing model to obtain the aligned encoding result;

[0112] The aligned encoding results are subjected to attention operation and input into the decoder model of the encoder-decoder parsing model to parse and output the query sentence corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

[0113] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiment.

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. An alignment-enhanced semantic parsing method, It is characterized in that include: Predicting phrases corresponding to the alignment relationship in the knowledge question answering task, and generating corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes phrases and corresponding query fragments; splicing the serialized alignment relationship to an input sequence, and inputting the input sequence into an encoder model of an encoder-decoder parsing model to obtain an aligned encoding result; Performing an attention operation on the aligned encoding result and inputting it into a decoder model of an encoder-decoder parsing model, parsing and outputting a query sentence corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training; Each alignment relationship is represented as a concatenation of a phrase corresponding to the alignment relationship and the query fragment, and is connected by ":", and a special symbol for indicating an alignment category is added before each alignment relationship, and the special symbol includes a keyword, a column, and a value; the serialized alignment relationship is concatenated into the input sequence, and the concatenated input sequence is represented as: ; in, represents the input sequence, represents the start marker of the input sequence, Q represents the knowledge question answering task, Indicates the separator, represents the i-th column in a particular table, and , m represents the total number of columns in a particular table, express The corresponding type, represents the jth alignment relationship, represents the special symbol corresponding to the jth alignment relationship, and , n represents the total number of alignment relationships.

2. The alignment-enhanced semantic parsing method according to claim 1, It is characterized in that The predicting of the phrases corresponding to the alignment relationship in the knowledge question answering task, and generating corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes phrases and corresponding query fragments, including: Based on the knowledge question answering task, a sequence labeling method is used to predict phrases corresponding to the alignment relationship, and the type of the phrase is identified, wherein the type of the phrase includes any one of the following: keyword type, column type and value type; According to the type of the phrase, a query fragment corresponding to the phrase is generated.

3. The alignment-enhanced semantic parsing method according to claim 2, It is characterized in that Generating a query fragment corresponding to the phrase according to the type of the phrase includes: In the case that the type of the phrase includes a keyword type, a query segment corresponding to the keyword type phrase is obtained based on a sequence generation model.

4. The alignment-enhanced semantic parsing method according to claim 2, It is characterized in that Generating a query fragment corresponding to the phrase according to the type of the phrase includes: In the case where the type of the phrase includes a column type or a value type, based on an attention mechanism, a column in a specific table that has the highest matching degree with the column type phrase or the value type phrase is obtained.

5. The alignment enhanced semantic parsing method according to any one of claims 1 to 4, It is characterized in that The serialized alignment relationship is spliced ​​to the input sequence, and the input sequence is input into the encoder model of the encoder-decoder parsing model to obtain the aligned encoding result, including: In the encoder model of the encoder-decoder parsing model, each alignment category symbol, the phrase of the corresponding alignment relationship and the query fragment corresponding to the phrase are spliced ​​into the input sequence to realize the linking of the knowledge question answering task with the specific table content.

6. The alignment-enhanced semantic parsing method according to claim 5, It is characterized in that The attention operation is performed on the aligned encoding result and input into the decoder model of the encoder-decoder parsing model, parsing and outputting the query sentence corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training, including: Based on the pre-trained model, the decoder model is trained using the cross-validation method when the training set includes both labeled alignments and noisy alignments. Performing an attention operation on the alignment relationship of the hidden state of each alignment category symbol in the input sequence; The attention operation vector of the hidden state of each alignment category symbol in the input sequence is concatenated with the embedding representation of the previous word and input into the decoder model, and the parsed query statement is output to inject the alignment relationship into the hidden state at the next moment.

7. An alignment-enhanced semantic parsing device for implementing the alignment-enhanced semantic parsing method according to any one of claims 1 to 6, It is characterized in that include: A prediction module, used to predict the phrases corresponding to the alignment relationship in the knowledge question answering task, and generate corresponding query fragments based on the types of the phrases corresponding to the alignment relationship, wherein the alignment relationship includes phrases and corresponding query fragments; An encoding module, used for splicing the serialized alignment relationship to an input sequence, and inputting the input sequence into an encoder model of an encoder-decoder parsing model to obtain an aligned encoding result; A parsing module is used to perform an attention operation on the aligned encoding result and input it into a decoder model of an encoder-decoder parsing model, parse and output a query statement corresponding to the alignment relationship, wherein the decoder model is obtained by using noisy alignment training.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the alignment enhanced semantic parsing method as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the alignment enhanced semantic parsing method as claimed in any one of claims 1 to 6 is implemented.

10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the alignment enhanced semantic parsing method as claimed in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Query statement rewriting method and device

    CN110969024A

  • Remote supervision relation extraction method based on entity features

    CN113220844A