Dialogue question rewriting method and device, computer device, and storage medium
By combining U-net and deeplabv3 neural network models, a two-dimensional question-answering matrix is constructed and part-of-speech similarity analysis is performed. This solves the shortcomings of existing models in preserving sentence structure and speed, and achieves efficient rewriting of dialogue questions and accurate understanding of user intent.
Patent Information
- Application Number
- CN202211458362.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2042-11-16
AI Technical Summary
Existing dialogue question rewriting models are insufficient in preserving sentence structure and speed, cannot fully explore inter-word similarities and lack full-scale information, making it difficult for robots to accurately understand user intentions.
A combined model using U-net neural network as the context analysis layer and deeplabv3 neural network as the encoding and semantic segmentation layers is adopted. A two-dimensional question-answering matrix is constructed through character segmentation and annotation. Part-of-speech similarity analysis function is used to predict the resolution of pronouns and omission of characters, thereby realizing the rewriting of dialogue questions.
It improves the chatbot's ability to understand user intent, enhances the resolution rate of user questions, fills in missing information and enriches semantics, and improves the accuracy and efficiency of rewriting.
Smart Images

Figure CN115757731B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of artificial intelligence and intelligent dialogue technology for robots, and in particular to a method, apparatus, computer device and storage medium for rewriting dialogue questions. Background Technology
[0002] Human-computer dialogue is an important task. In our daily communication, we often encounter problems such as cross-referencing and missing information. While humans can correctly understand the speaker's intention, it is more difficult for machines, especially in the early consultation, sales, and underwriting stages of insurance. Telemarketing robots are often used to automatically handle insurance customer inquiries. In these cases, accurately understanding the speaker's intention is crucial for telemarketing robots, which requires rewriting the speaker's intent.
[0003] Traditional rewriting models are typically divided into pointer networks and generative models. Both methods decode the input word by word to output the rewritten sentence. This involves using deep learning encoding to semantically encode the current sentence and the preceding text. During decoding, a dictionary is created from the characters in the current sentence and the preceding text, and a character is selected from the dictionary at each step until decoding is complete. This approach does not consider that the rewritten sentence will have a similar structure to the current sentence; the preceding text is only added as missing auxiliary information, and the process is time-consuming.
[0004] The paper "Incomplete Utterance Rewriting as Semantic Segmentation" proposes the RUN model, transforming the rewriting task into a semantic segmentation task based on U-net. By introducing editing operations, the problem becomes the prediction of a word-level edit matrix. Since this model edits the current sentence, it preserves the general structure of the current sentence and is faster. Although it solves the aforementioned problems, this model still has some shortcomings. First, the multi-angle extraction of word similarity in the encoding layer is not comprehensive enough, lacking other perspectives. Second, the semantic segmentation layer uses the U-net network, which lacks the ability to explore sufficient information at the full scale, thus failing to clearly determine the segmentation location and boundaries. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, computer device, and storage medium for rewriting dialogue questions, so as to explore sufficient text information from the full scale and accurately predict the user's dialogue intent, thereby improving the resolution rate of user questions.
[0006] To address the aforementioned technical problems, this application provides a method for rewriting dialogue questions, employing the following technical solution:
[0007] A method for rewriting dialogue questions includes the following steps:
[0008] The system receives the question-and-answer context text sent by the requesting end of the dialogue question rewriting request. The question-and-answer context text includes the latest question text raised by the user in the current dialogue scenario and the historical dialogue text generated by both parties based on the current dialogue scenario.
[0009] The question-and-answer context text is used as input text and input into the dialogue question rewriting model. The latest question text is rewritten based on the historical dialogue text.
[0010] The rewritten latest question text is obtained and output as the result to the responder in the current dialogue scenario, wherein the responder and the user have a question-and-answer dialogue logic relationship in the current dialogue scenario.
[0011] Furthermore, the dialogue question rewriting model is composed of a U-net neural network as the context analysis layer and a deeplabv3 neural network as the encoding layer and semantic segmentation layer. The step of rewriting the latest question text based on the historical dialogue text specifically includes:
[0012] The historical dialogue text and the latest question text are input into the U-net neural network;
[0013] The historical dialogue text and the latest question text are processed by the U-net neural network for character segmentation and first annotation, and a two-dimensional question-answer matrix is constructed based on the first annotation results.
[0014] Based on the two-dimensional question-answering matrix and the deeplabv3 neural network, the latest question text is subjected to a second annotation prediction, and the latest question text is rewritten based on the second annotation prediction result.
[0015] Furthermore, the step of performing character segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and constructing a two-dimensional question-answer matrix based on the first annotation processing result, specifically includes:
[0016] The BERT word segmentation model is pre-introduced into the U-net neural network, wherein the BERT word segmentation model has a corresponding BERT word segmentation dictionary and character number information corresponding to different characters in the BERT word segmentation dictionary;
[0017] The historical dialogue text and the latest question text are segmented according to the BERT character segmentation model to obtain the character number information of each character in the historical dialogue text and the latest question text in the BERT character segmentation dictionary;
[0018] According to the dialogue order of the historical dialogue text and the latest question text, the character number information is output in the form of a two-dimensional matrix to obtain the two-dimensional question-and-answer matrix.
[0019] Furthermore, the step of performing a second annotation prediction on the latest question text based on the two-dimensional question-answer matrix and the deeplabv3 neural network, and rewriting the latest question text based on the second annotation prediction result, specifically includes:
[0020] Input the two-dimensional question-answering matrix into the deeplabv3 neural network;
[0021] Based on the preset part-of-speech similarity analysis function in the deeplabv3 neural network, the part-of-speech similarity between different characters corresponding to different character number information in the two-dimensional question-and-answer matrix is obtained;
[0022] Based on the part-of-speech similarity, predict the characters that can be resolved by substitution, the omitted characters, and the replacement characters corresponding to the characters that can be resolved by substitution in the latest question text;
[0023] Based on the BERT character segmentation dictionary, obtain the character number information corresponding to the omitted character and the replacement character, and use it as the second annotation prediction result;
[0024] Obtain the first annotation processing information corresponding to the latest question text after adding the omitted characters and updating the characters that can be resolved by substitution to the replacement characters;
[0025] Based on the first annotation processing information and the BERT character segmentation dictionary, the corresponding characters are obtained to generate the rewritten latest question text.
[0026] Furthermore, the step of outputting the character numbering information in the form of a two-dimensional matrix according to the dialogue order of the historical dialogue text and the latest question text to obtain the two-dimensional question-and-answer matrix specifically includes:
[0027] According to the dialogue order, obtain the character number information corresponding to each character in each dialogue text;
[0028] The character number information corresponding to each character in each sentence of dialogue text is used as the matrix row information;
[0029] Following the dialogue sequence, matrix row information corresponding to each dialogue text is added line by line until the matrix row information corresponding to the latest question text is added. Then the two-dimensional question-and-answer matrix is constructed.
[0030] Furthermore, the step of obtaining the part-of-speech similarity between different characters corresponding to different character IDs in the two-dimensional question-answering matrix based on the preset part-of-speech similarity analysis function in the deeplabv3 neural network specifically includes:
[0031] Based on the preset part-of-speech similarity analysis function: F(x n ,c m ) = [element(h n ,u m );cos(h n ,u m );h n Wu m ;match_score(h n ,u m ]], obtain the part-of-speech similarity between different characters corresponding to different character ID information in the two-dimensional question-and-answer matrix, where element(h n ,u m The function represents obtaining the element similarity between two target characters in the two-dimensional question-and-answer matrix, cos(h n ,u m The function represents obtaining the cosine similarity between the two target characters, h. n Wu m This indicates obtaining the bilinear similarity between the two target characters, where W is a learnable parameter, and match_score(h n ,u m )=1 / (1+|h n -u m |), where |h n -u m | represents the Euclidean distance between the two target characters, match_score(h) n ,u m ) indicates that the similarity between the two target characters is obtained based on the Euclidean distance between them, h n and u m The n and m represent the target characters corresponding to any two arbitrary elements in the two-dimensional question-and-answer matrix, where n and m are positive integers representing the number of rows and columns of the matrix, respectively.
[0032] Furthermore, the step of predicting the characters capable of substituting for reference, the omitted characters, and the replacement characters corresponding to the characters capable of substituting for reference in the latest question text based on the part-of-speech similarity specifically includes:
[0033] Pre-set the criteria for resolution and the criteria for omission;
[0034] If the part-of-speech similarity satisfies the reference resolution judgment condition, then the characters in the latest question text that can be resolved by reference and the corresponding replacement characters of the characters that can be resolved by reference are identified as the corresponding predicted characters.
[0035] If the part-of-speech similarity satisfies the omission judgment condition, then the omitted character in the latest question text is identified as the corresponding predicted character.
[0036] To address the aforementioned technical problems, this application also provides a dialog question rewriting device, which employs the following technical solution:
[0037] A dialog question rewriting device, comprising:
[0038] The question-and-answer text receiving module is used to receive the question-and-answer context text sent by the dialogue question rewriting request end. The question-and-answer context text includes the latest question text raised by the user in the current dialogue scenario and the historical dialogue text generated by both parties in this question-and-answer session based on the current dialogue scenario.
[0039] The model rewriting module is used to take the question-and-answer context text as input text, input the dialogue question rewriting model, and rewrite the latest question text based on the historical dialogue text.
[0040] The model output module is used to obtain the latest rewritten question text and output it as the output result to the responder in the current dialogue scenario, wherein the responder and the user have a question-and-answer dialogue logic relationship in the current dialogue scenario.
[0041] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:
[0042] A computer device includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the dialog question rewriting method described above.
[0043] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:
[0044] A computer-readable storage medium storing computer-readable instructions that, when executed by a processor, implement the steps of the dialog question rewriting method described above.
[0045] Compared with the prior art, the embodiments of this application have the following main advantages:
[0046] The dialogue question rewriting method described in this application embodiment receives question-and-answer context text sent by the dialogue question rewriting request end. This context text includes the latest question text raised by the user in the current dialogue scenario and historical dialogue text generated by both parties based on the current dialogue scenario. The context text is then input into a dialogue question rewriting model, which rewrites the latest question text based on the historical dialogue text. The rewritten latest question text is then obtained and output to the responder in the current dialogue scenario. The dialogue question rewriting model is composed of a U-net neural network as the context analysis layer and a deeplabv3 neural network as the encoding and semantic segmentation layer. This model leverages the advantages of the U-net neural network to accurately classify the intent features of characters in the question-and-answer text, and also utilizes the advantages of the deeplabv3 neural network to explore sufficient semantic information from multiple angles and at all scales in the historical question-and-answer text. This more accurately fills in missing user information, enriches the semantics of user questions, enhances the chatbot's ability to understand user intent, and improves the resolution rate of user questions. Attached Figure Description
[0047] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;
[0049] Figure 2 A flowchart of an embodiment of the dialogue rewriting method according to this application;
[0050] Figure 3 yes Figure 2 A flowchart of a specific implementation of step 202 shown;
[0051] Figure 4 yes Figure 3 A flowchart of a specific implementation of step 302 shown;
[0052] Figure 5 yes Figure 4 A flowchart of a specific implementation of step 403 shown;
[0053] Figure 6 yes Figure 3 A flowchart of a specific implementation of step 303 shown;
[0054] Figure 7 yes Figure 6 A flowchart of a specific implementation of step 603 shown;
[0055] Figure 8 A schematic diagram of the structure of an embodiment of the dialogue question rewriting device according to this application;
[0056] Figure 9 yes Figure 8 A schematic diagram of a specific embodiment of 802 is shown;
[0057] Figure 10 A schematic diagram of the structure of an embodiment of the computer device according to this application. Detailed Implementation
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.
[0059] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0060] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
[0061] like Figure 1As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. Network 104 serves as the medium for providing communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc.
[0062] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, and 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.
[0063] Terminal devices 101, 102, and 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.
[0064] Server 105 can be a server that provides various services, such as a backend server that supports the pages displayed on terminal devices 101, 102, and 103.
[0065] It should be noted that the dialogue rewriting method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the dialogue rewriting device is generally set in the server / terminal device.
[0066] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0067] Continue to refer to Figure 2 A flowchart illustrating an embodiment of the dialogue rewriting method according to this application is shown. The dialogue rewriting method includes the following steps:
[0068] Step 201: Receive the question-and-answer context text sent by the requesting end of the dialogue question rewriting request.
[0069] In this embodiment, the question-and-answer context text includes the latest question text raised by the user in the current dialogue scenario and the historical dialogue text generated by both parties based on the current dialogue scenario.
[0070] In this embodiment, the dialogue question rewriting model is composed of a U-net neural network as the context analysis layer and a deeplabv3 neural network as the encoding layer and semantic segmentation layer.
[0071] By using the deeplabv3 neural network as the encoding and semantic segmentation layers of the dialogue question rewriting model, this approach avoids the problem of not being able to comprehensively extract word similarities from multiple perspectives when directly using the U-net neural network. It also solves the drawback of directly using the U-net neural network, which lacks sufficient semantic information to explore across the entire scale. Furthermore, using the U-net neural network as the context analysis layer of the dialogue question rewriting model overcomes the limitation of the deeplabv3 neural network, which can only perform feature context analysis on image targets and cannot directly perform feature context analysis on question-and-answer text. Ultimately, the dialogue question rewriting model, composed of the U-net neural network as the context analysis layer and the deeplabv3 neural network as the encoding and semantic segmentation layers, can both accurately classify the intent features of characters in the question-and-answer text using the advantages of the U-net neural network and explore sufficient semantic information from multiple perspectives and across the entire scale of historical question-and-answer text.
[0072] Step 202: Use the question-and-answer context text as input text, input it into the dialogue question rewriting model, and rewrite the latest question text based on the historical dialogue text.
[0073] In this embodiment, the step of rewriting the latest question text based on the historical dialogue text specifically includes: inputting the historical dialogue text and the latest question text into the U-net neural network; performing character segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and constructing a two-dimensional question-answer matrix based on the first annotation processing result; performing second annotation prediction on the latest question text based on the two-dimensional question-answer matrix and the deeplabv3 neural network, and rewriting the latest question text based on the second annotation prediction result.
[0074] The historical dialogue text and the latest question text are processed by U-net neural network for character segmentation and first annotation. Based on the first annotation result, a two-dimensional question-answer matrix is constructed, converting the characters in the dialogue text into different character number information. Using the character number information as elements, a two-dimensional question-answer matrix is constructed, converting the dialogue text into a two-dimensional matrix form. This matrix is then input into the deeplabv3 neural network, facilitating semantic prediction of the question-answer context text by the deeplabv3 neural network. Then, based on the semantic prediction result of the deeplabv3 neural network, a second annotation prediction is performed on the latest question text, that is, predicting the characters that can be resolved and the omitted characters in the latest question text. Based on the second annotation prediction result, the latest question text is rewritten.
[0075] Continue to refer to Figure 3 , Figure 3 yes Figure 2 A flowchart of a specific implementation of step 202 shown includes:
[0076] Step 301: Input the historical dialogue text and the latest question text into the U-net neural network.
[0077] Step 302: Perform character segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and construct a two-dimensional question-answer matrix based on the first annotation processing results.
[0078] In this embodiment, the step of performing character segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and constructing a two-dimensional question-and-answer matrix based on the first annotation processing result, specifically includes: pre-introducing a BERT character segmentation model into the U-net neural network, wherein the BERT character segmentation model has a corresponding BERT character segmentation dictionary and character number information corresponding to different characters in the BERT character segmentation dictionary; performing character segmentation processing on the historical dialogue text and the latest question text according to the BERT character segmentation model, obtaining the character number information of each character in the historical dialogue text and the latest question text in the BERT character segmentation dictionary; and outputting the character number information in the form of a two-dimensional matrix according to the dialogue order of the historical dialogue text and the latest question text to obtain the two-dimensional question-and-answer matrix.
[0079] By introducing the BERT word segmentation model and BERT word segmentation dictionary into the U-net neural network, characters in the question-and-answer context text are segmented and the character number information corresponding to each segment is accurately obtained. Then, according to the dialogue order, the character number information is output in the form of a two-dimensional matrix to obtain the two-dimensional question-and-answer matrix. This allows the encoding layer of the deeplabv3 neural network to perform semantic prediction on the question-and-answer context text through the two-dimensional question-and-answer matrix.
[0080] Continue to refer to Figure 4 , Figure 4 yes Figure 3 A flowchart of a specific implementation of step 302 shown includes:
[0081] Step 401: In the U-net neural network, a BERT word segmentation model is introduced in advance, wherein the BERT word segmentation model has a corresponding BERT word segmentation dictionary and character number information corresponding to different characters in the BERT word segmentation dictionary;
[0082] Step 402: Perform character segmentation on the historical dialogue text and the latest question text according to the BERT character segmentation model, and obtain the character number information of each character in the historical dialogue text and the latest question text in the BERT character segmentation dictionary;
[0083] Step 403: According to the dialogue order of the historical dialogue text and the latest question text, output the character number information in the form of a two-dimensional matrix to obtain the two-dimensional question-and-answer matrix.
[0084] In this embodiment, the step of outputting the character number information in the form of a two-dimensional matrix according to the dialogue order of the historical dialogue text and the latest question text to obtain the two-dimensional question-and-answer matrix specifically includes: obtaining the character number information corresponding to each character in each dialogue text according to the dialogue order; using the character number information corresponding to each character in each dialogue text as matrix row information; adding the matrix row information corresponding to each dialogue text row by row according to the dialogue order until the matrix row information corresponding to the latest question text is finally added, then the two-dimensional question-and-answer matrix is constructed.
[0085] By using the character number information corresponding to each character in each dialogue text as matrix row information, the matrix row information corresponding to each dialogue text is added row by row until the matrix row information corresponding to the latest question text is added. Then the two-dimensional question-and-answer matrix is constructed. The two-dimensional question-and-answer matrix is constructed by fully considering the characteristics of question and answer text in the dialogue task, while ensuring that the original dialogue sequence is not changed when constructing the two-dimensional question-and-answer matrix, which is more in line with the dialogue business scenario.
[0086] Continue to refer to Figure 5 , Figure 5 yes Figure 4 A flowchart of a specific implementation of step 403 shown includes:
[0087] Step 501: According to the dialogue order, obtain the character number information corresponding to each character in each dialogue text;
[0088] Step 502: Use the character number information corresponding to each character in each dialogue text as matrix row information;
[0089] Step 503: Following the dialogue order, add the matrix row information corresponding to each dialogue text line by line until the matrix row information corresponding to the latest question text is added. Then the two-dimensional question-and-answer matrix is constructed.
[0090] Step 303: Based on the two-dimensional question-answering matrix and the deeplabv3 neural network, perform a second annotation prediction on the latest question text, and rewrite the latest question text based on the second annotation prediction result.
[0091] In this embodiment, the step of performing a second annotation prediction on the latest question text based on the two-dimensional question-answer matrix and the deeplabv3 neural network, and rewriting the latest question text based on the second annotation prediction result, specifically includes: inputting the two-dimensional question-answer matrix into the deeplabv3 neural network; obtaining the part-of-speech similarity between different characters corresponding to different character number information in the two-dimensional question-answer matrix based on the preset part-of-speech similarity analysis function in the deeplabv3 neural network; predicting the characters that can be resolved by substitution, the omitted characters, and the replacement characters corresponding to the characters that can be resolved by substitution in the latest question text based on the part-of-speech similarity; obtaining the character number information corresponding to the omitted characters and the replacement characters based on the BERT character segmentation dictionary, as the second annotation prediction result; obtaining the first annotation processing information corresponding to the latest question text after adding the omitted characters and updating the characters that can be resolved by substitution to the replacement characters; and obtaining the corresponding characters to generate the rewritten latest question text based on the first annotation processing information and the BERT character segmentation dictionary.
[0092] By leveraging the advantages of the deeplabv3 neural network to explore sufficient semantic information from multiple angles and across the entire scale of historical question-and-answer text, the system predicts characters that can be resolved through referential subtraction, omitted characters, and their corresponding replacement characters in the latest question text. Then, based on the BERT word segmentation dictionary, the system obtains the corresponding replacement characters for the omitted characters and the characters that can be resolved through referential subtraction to rewrite the latest question-and-answer text. This avoids the problem of not being able to fully extract word similarities from multiple angles when directly using the U-net neural network. Furthermore, it also solves the drawback of directly using the U-net neural network, which lacks sufficient semantic information to explore across the entire scale.
[0093] Continue to refer to Figure 6 , Figure 6 yes Figure 3 A flowchart of a specific implementation of step 303 shown includes:
[0094] Step 601: Input the two-dimensional question-answering matrix into the deeplabv3 neural network;
[0095] Step 602: Based on the preset part-of-speech similarity analysis function in the deeplabv3 neural network, obtain the part-of-speech similarity between different characters corresponding to different character number information in the two-dimensional question-and-answer matrix;
[0096] In this embodiment, the step of obtaining the part-of-speech similarity between different characters corresponding to different character IDs in the two-dimensional question-answering matrix based on the preset part-of-speech similarity analysis function in the deeplabv3 neural network specifically includes: based on the preset part-of-speech similarity analysis function: F(x n c m ) = [element(h n u m );cos(h n u m );h n Wu m ;match_score(h n u m ]], obtain the part-of-speech similarity between different characters corresponding to different character ID information in the two-dimensional question-and-answer matrix, where element(h n ,u m The function represents obtaining the element similarity between two target characters in the two-dimensional question-and-answer matrix, cos(h n ,u m The function represents obtaining the cosine similarity between the two target characters, h. n Wu mThis indicates obtaining the bilinear similarity between the two target characters, where W is a learnable parameter, and match_score(h n ,u m )=1 / (1+|h n -u m |), where |h n -u m | represents the Euclidean distance between the two target characters, match_score(h) n ,u m ) indicates that the similarity between the two target characters is obtained based on the Euclidean distance between them, h n and u m The n and m represent the target characters corresponding to any two arbitrary elements in the two-dimensional question-and-answer matrix, where n and m are positive integers representing the number of rows and columns of the matrix, respectively.
[0097] The similarity between target characters corresponding to any two elements in the two-dimensional question-answering matrix is obtained from multiple perspectives, including element similarity, cosine similarity, bilinear similarity, and Euclidean distance-based similarity. Cosine similarity is based on data symmetry to obtain the similarity of target characters, while bilinear similarity introduces learnable parameters to incorporate asymmetric analysis of target character similarity when calculating similarity. Both symmetric and asymmetric methods are used to obtain the similarity between two target characters. Furthermore, cosine similarity obtains the similarity between two target characters from the perspective of the direction between text vectors, and Euclidean distance obtains the similarity between two target characters from the perspective of the distance between text vectors. By comprehensively obtaining part-of-speech similarity between target characters from multiple data analysis perspectives, the accuracy of part-of-speech similarity prediction between two target characters is ensured.
[0098] Step 603: Based on the part-of-speech similarity, predict the characters that can be resolved by substitution, the omitted characters, and the replacement characters corresponding to the characters that can be resolved by substitution in the latest question text;
[0099] In this embodiment, the step of predicting the characters that can be resolved by substitution, the omitted characters, and the replacement characters corresponding to the characters that can be resolved by substitution in the latest question text based on the part-of-speech similarity specifically includes: pre-setting the substitution resolution judgment condition and the omission judgment condition; if the part-of-speech similarity satisfies the substitution resolution judgment condition, then identifying the characters that can be resolved by substitution and the replacement characters corresponding to the characters that can be resolved by substitution in the latest question text as the corresponding predicted characters; if the part-of-speech similarity satisfies the omission judgment condition, then identifying the omitted characters in the latest question text as the corresponding predicted characters.
[0100] By pre-setting referential resolution and omission judgment conditions, and combining them with the part-of-speech similarity, the system predicts the characters in the latest question text that can be resolved by referential resolution, the omitted characters, and the replacement characters corresponding to the characters that can be resolved by referential resolution. While ensuring high accuracy in predicting the part-of-speech similarity between two target characters, the system predicts the characters in the latest question text that can be resolved by referential resolution, the omitted characters, and the replacement characters corresponding to the characters that can be resolved by referential resolution, further improving the accuracy of rewriting the latest question text.
[0101] In this embodiment, the reference resolution judgment condition and the omission judgment condition can be implemented by using the part-of-speech similarity result corresponding to the part-of-speech similarity analysis function in step 602 and a pre-set threshold. For example, the threshold corresponding to the reference resolution judgment condition can be pre-set as a first similarity threshold. If the part-of-speech similarity between a character in the latest question text and the corresponding character in the historical question and answer text is greater than the first similarity threshold, then the character in the latest question text satisfies the reference resolution judgment condition, and the corresponding character in the historical question and answer text can be used as a replacement character to replace the character in the latest question text. Similarly, the threshold corresponding to the omission judgment condition can be pre-set as a second similarity threshold. If the part-of-speech similarity between a character in the latest question text and the corresponding character in the historical question and answer text is greater than the second similarity threshold, then the character in the latest question text satisfies the omission judgment condition, and the corresponding character in the historical question and answer text can be used as an omitted character to supplement the position of the character in the latest question text.
[0102] Continue to refer to Figure 7 , Figure 7 yes Figure 6 A flowchart of a specific implementation of step 603 shown includes:
[0103] Step 701: Pre-set the criteria for resolution and the criteria for omission;
[0104] Step 702: If the part-of-speech similarity satisfies the reference resolution judgment condition, then identify the characters in the latest question text that can be resolved by reference and the replacement characters corresponding to the characters that can be resolved by reference, and use them as the corresponding predicted characters.
[0105] Step 703: If the part-of-speech similarity satisfies the omission judgment condition, then the omitted character in the latest question text is identified as the corresponding predicted character.
[0106] Step 604: Based on the BERT character segmentation dictionary, obtain the character number information corresponding to the omitted character and the replacement character, as the second annotation prediction result;
[0107] Step 605: Obtain the first annotation processing information corresponding to the latest question text after adding the omitted characters and updating the characters that can be resolved by substitution to the replacement characters;
[0108] Step 606: Based on the first annotation processing information and the BERT character segmentation dictionary, obtain the corresponding characters to generate the rewritten latest question text.
[0109] Step 203: Obtain the rewritten latest question text and output it as the output to the responder in the current dialogue scenario, wherein the responder and the user have a question-and-answer dialogue logic relationship in the current dialogue scenario.
[0110] In this embodiment, after obtaining the rewritten latest question text and outputting it as the output to the responder in the current dialogue scenario, the method further includes: the responder performing semantic recognition on the rewritten latest question text and generating a corresponding answer text based on the semantic recognition result, which is then sent to the user.
[0111] By using a dialogue rewriting model to fill in missing user information and cross-reference content, the semantics of user questions are enriched, the chatbot's ability to understand user intent is enhanced, and the resolution rate of user questions is improved.
[0112] This application receives question-and-answer context text sent by a requesting client for dialogue question rewriting. This context text includes the latest question text posed by the user in the current dialogue scenario and historical dialogue text generated by both parties based on the current scenario. The context text is then input into a dialogue question rewriting model, which rewrites the latest question text based on the historical dialogue text. The rewritten latest question text is then obtained and output to the responder in the current dialogue scenario. The dialogue question rewriting model is composed of a U-net neural network as the context analysis layer and a deeplabv3 neural network as the encoding and semantic segmentation layer. It leverages the advantages of the U-net neural network to accurately classify the intent features of characters in the question-and-answer text and the deeplabv3 neural network to explore sufficient semantic information from multiple angles and at all scales within the historical question-and-answer text. By using the dialogue question rewriting model, missing user information and cross-referenced content are supplemented, enriching the semantics of user questions, enhancing the chatbot's understanding of user intent, and improving the problem-solving rate.
[0113] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0114] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0115] In this embodiment, the dialogue question rewriting model is composed of a U-net neural network as the context analysis layer and a deeplabv3 neural network as the encoding layer and semantic segmentation layer. It can utilize the advantages of the U-net neural network to accurately classify the intent features of characters in the question and answer text, and also utilize the advantages of the deeplabv3 neural network to explore sufficient textual semantic information from multiple angles and at all scales in the historical question and answer text. By using the dialogue question rewriting model, missing user information and cross-referenced content can be supplemented, the semantics of user questions can be enriched, the chatbot's ability to understand user intent can be enhanced, the resolution rate of user questions can be improved, and the system can be made more intelligent and automated.
[0116] Further reference Figure 8 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a dialog question rewriting device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.
[0117] like Figure 8 As shown, the dialogue question rewriting device 800 described in this embodiment includes: a question-and-answer text receiving module 801, a model rewriting module 802, and a model output module 803. Wherein:
[0118] The question-and-answer text receiving module 801 is used to receive the question-and-answer context text sent by the dialogue question rewriting request end. The question-and-answer context text includes the latest question text raised by the user in the current dialogue scenario and the historical dialogue text generated by both parties in this question-and-answer session based on the current dialogue scenario.
[0119] The model rewriting module 802 is used to input the question-and-answer context text as input text into the dialogue question rewriting model, and rewrite the latest question text according to the historical dialogue text.
[0120] The model output module 803 is used to obtain the latest rewritten question text and output it as the output result to the responder in the current dialogue scenario, wherein the responder and the user have a question-and-answer dialogue logic relationship in the current dialogue scenario.
[0121] Continue to refer to Figure 9 , Figure 9 yes Figure 8 The diagram shows a specific embodiment of the model rewriting module 802, which includes: a text input submodule 901, a U-net neural network processing submodule 902, and a deeplabv3 neural network processing submodule 903. Wherein:
[0122] The text input submodule 901 is used to input the historical dialogue text and the latest question text into the U-net neural network;
[0123] U-net neural network processing submodule 902 is used to perform character segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and construct a two-dimensional question-answer matrix according to the first annotation processing result;
[0124] The deeplabv3 neural network processing submodule 903 is used to perform a second annotation prediction on the latest question text based on the two-dimensional question-answer matrix and the deeplabv3 neural network, and rewrite the latest question text based on the second annotation prediction result.
[0125] This application receives question-and-answer context text sent by a requesting client for dialogue question rewriting. This context text includes the latest question text posed by the user in the current dialogue scenario and historical dialogue text generated by both parties based on the current scenario. The context text is then input into a dialogue question rewriting model, which rewrites the latest question text based on the historical dialogue text. The rewritten latest question text is then obtained and output to the responder in the current dialogue scenario. The dialogue question rewriting model is composed of a U-net neural network as the context analysis layer and a deeplabv3 neural network as the encoding and semantic segmentation layer. It leverages the advantages of the U-net neural network to accurately classify the intent features of characters in the question-and-answer text and the deeplabv3 neural network to explore sufficient semantic information from multiple angles and at all scales within the historical question-and-answer text. By using the dialogue question rewriting model, missing user information and cross-referenced content are supplemented, enriching the semantics of user questions, enhancing the chatbot's understanding of user intent, improving the problem-solving rate, and making the system more intelligent and automated.
[0126] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing related hardware through computer-readable instructions. These computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).
[0127] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0128] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 10 , Figure 10 This is a basic structural block diagram of the computer device in this embodiment.
[0129] The computer device 10 includes a memory 10a, a processor 10b, and a network interface 10c that are interconnected via a system bus. It should be noted that only the computer device 10 with components 10a-10c is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0130] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0131] The memory 10a includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10a may be an internal storage unit of the computer device 10, such as the hard disk or memory of the computer device 10. In other embodiments, the memory 10a may also be an external storage device of the computer device 10, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. Of course, the memory 10a may include both internal storage units and external storage devices of the computer device 10. In this embodiment, the memory 10a is typically used to store the operating system and various application software installed on the computer device 10, such as computer-readable instructions for dialogue rewriting methods. In addition, the memory 10a can also be used to temporarily store various types of data that have been output or will be output.
[0132] In some embodiments, the processor 10b may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 10b is typically used to control the overall operation of the computer device 10. In this embodiment, the processor 10b is used to execute computer-readable instructions stored in the memory 10a or to process data, for example, to execute computer-readable instructions for the dialog question rewriting method.
[0133] The network interface 10c may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 10 and other electronic devices.
[0134] The computer device proposed in this embodiment belongs to the field of robot intelligent dialogue application technology. This application receives question-and-answer context text sent by a dialogue question rewriting request terminal. This context text includes the latest question text raised by the user in the current dialogue scenario and historical dialogue text generated by both parties based on the current dialogue scenario. The context text is used as input text to a dialogue question rewriting model, which rewrites the latest question text based on the historical dialogue text. The rewritten latest question text is then obtained and output to the responder in the current dialogue scenario. This approach leverages the advantages of the U-net neural network to accurately classify the intent features of characters in the question-and-answer text, and also utilizes the advantages of the deeplabv3 neural network to explore sufficient semantic information from multiple angles and at all scales within the historical question-and-answer text. By using the dialogue question rewriting model, missing user information and cross-referenced content are supplemented, enriching the semantics of user questions, enhancing the chatbot's understanding of user intent, improving the problem-solving rate, and making the system more intelligent and automated.
[0135] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by a processor to cause the processor to perform the steps of the dialog question rewriting method described above.
[0136] The computer-readable storage medium proposed in this embodiment belongs to the field of robot intelligent dialogue application technology. This application receives question-and-answer context text sent by a dialogue question rewriting request client. This context text includes the latest question text raised by the user in the current dialogue scenario and historical dialogue text generated by both parties based on the current dialogue scenario. The context text is then used as input to a dialogue question rewriting model, which rewrites the latest question text based on the historical dialogue text. The rewritten latest question text is then obtained and output to the responder in the current dialogue scenario. This approach leverages the advantages of the U-net neural network to accurately classify the intent features of characters in the question-and-answer text, and also utilizes the advantages of the deeplabv3 neural network to explore sufficient semantic information from multiple angles and at all scales within the historical question-and-answer text.
[0137] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0138] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.
Claims
1. A method for rewriting a dialogue question, characterized by, The method comprises the following steps: receiving a dialogue question rewriting request sent by a question and answer context text, wherein the question and answer context text contains the latest question text proposed by a user in a current dialogue scenario and historical dialogue text generated by both parties based on the current dialogue scenario; inputting the question and answer context text as input text into a dialogue question rewriting model, and rewriting the latest question text according to the historical dialogue text, wherein the dialogue question rewriting model is composed of a U-net neural network as a context analysis layer and a deeplabv3 neural network as an encoding layer and a semantic segmentation layer, and the rewriting of the latest question text according to the historical dialogue text specifically comprises: inputting the historical dialogue text and the latest question text into the U-net neural network; performing word segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and constructing a two-dimensional question and answer matrix according to the first annotation processing result; performing second annotation prediction on the latest question text according to the two-dimensional question and answer matrix and the deeplabv3 neural network, and rewriting the latest question text according to the second annotation prediction result and the first annotation processing result; obtaining the rewritten latest question text and outputting it as an output result to a responder in the current dialogue scenario, wherein the responder has a one-question-one-answer dialogue logical relationship with the user in the current dialogue scenario. 2.The dialogue question rewriting method of claim 1, wherein, The step of performing word segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and constructing a two-dimensional question and answer matrix according to the first annotation processing result specifically comprises: previously introducing a BERT word segmentation model into the U-net neural network, wherein the BERT word segmentation model is provided with a corresponding BERT word segmentation dictionary and character number information corresponding to different characters in the BERT word segmentation dictionary; performing word segmentation on the historical dialogue text and the latest question text according to the BERT word segmentation model, and obtaining character number information of each character in the historical dialogue text and the latest question text in the BERT word segmentation dictionary as the first annotation processing result; outputting the character number information in the form of a two-dimensional matrix according to the dialogue order of the historical dialogue text and the latest question text, and obtaining the two-dimensional question and answer matrix. 3.The dialogue question rewriting method of claim 2, wherein, The step of performing second annotation prediction on the latest question text according to the two-dimensional question and answer matrix and the deeplabv3 neural network, and rewriting the latest question text according to the second annotation prediction result and the first annotation processing result specifically comprises: inputting the two-dimensional question and answer matrix into the deeplabv3 neural network; obtaining the part-of-speech similarity between different characters corresponding to different character number information in the two-dimensional question and answer matrix according to a pre-set part-of-speech similarity analysis function in the deeplabv3 neural network; According to the word similarity, the character that can be resolved, the omitted character and the replacement character corresponding to the character that can be resolved in the latest question text are predicted; According to the BERT dictionary, the character number information corresponding to the omitted character and the replacement character is obtained as a second annotation prediction result; The first annotation processing information corresponding to the latest question text after the omitted character is added and the character that can be resolved is updated to the replacement character is obtained; According to the first annotation processing information and the BERT dictionary, the corresponding character is generated to obtain the latest question text after rewriting.
4. The dialogue question rewriting method of claim 2, wherein, According to the conversation order of the historical dialogue text and the latest question text, the character number information is output in the form of a two-dimensional matrix to obtain the two-dimensional question and answer matrix, and the steps specifically include: According to the conversation order, the character number information corresponding to each character in each dialogue text is obtained; The character number information corresponding to each character in each dialogue text is used as matrix row information; According to the conversation order, the matrix row information corresponding to each dialogue text is added row by row until the matrix row information corresponding to the latest question text is added, and then the two-dimensional question and answer matrix is constructed.
5. The dialogue question rewriting method of claim 3, wherein, According to the preset word similarity analysis function in the deeplabv3 neural network, the word similarity between different characters corresponding to different character number information in the two-dimensional question and answer matrix is obtained, and the steps specifically include: according to the preset word similarity analysis function: , obtaining the part-of-speech similarity between different characters corresponding to different character number information in the two-dimensional question and answer matrix, wherein The function represents the element similarity between the two target characters in the two-dimensional question and answer matrix, The function represents the cosine similarity between the two target characters, , wherein W is a learnable parameter, , wherein is the Euclidean distance between the two target characters, , wherein the similarity between the two target characters is obtained according to the Euclidean distance between the two target characters, and , wherein the target character corresponding to the two arbitrary elements in the two-dimensional question and answer matrix is represented, and are positive integers respectively representing the number of rows and columns of the matrix. 6.The dialogue question rewriting method of claim 3, wherein, The steps of predicting the character that can be resolved, the omitted character and the replacement character corresponding to the character that can be resolved in the latest question text according to the word similarity specifically include: The reference resolution judgment condition and the omission judgment condition are set in advance; If the word similarity meets the reference resolution judgment condition, the character that can be resolved in the latest question text and the replacement character corresponding to the character that can be resolved are identified as corresponding prediction characters; If the word similarity meets the omission judgment condition, the omitted character in the latest question text is identified as a corresponding prediction character.
7. A dialogue question rewriting device characterized by comprising: It includes: A question and answer text receiving module is configured to receive a question and answer context text sent by a dialogue question rewriting request end, wherein the question and answer context text includes a latest question text proposed by a user in a current dialogue scenario and historical dialogue texts generated by both parties in the current dialogue scenario based on the current dialogue scenario; A model rewriting module is configured to input the question and answer context text as an input text into a dialogue question rewriting model, and perform text rewriting on the latest question text based on the historical dialogue text, wherein the dialogue question rewriting model is composed of a U-net neural network as a context analysis layer and a deeplabv3 neural network as an encoding layer and a semantic segmentation layer, and the text rewriting on the latest question text based on the historical dialogue text specifically includes: input the historical dialogue text and the latest question text into the U-net neural network; perform character segmentation and first annotation processing on the historical dialogue text and the latest question text respectively according to the U-net neural network, and construct a two-dimensional question and answer matrix according to the first annotation processing result; perform second annotation prediction on the latest question text according to the two-dimensional question and answer matrix and the deeplabv3 neural network, rewrite the latest question text according to the second annotation prediction result and the first annotation processing result; a model output module configured to obtain the rewritten latest question text and output the latest question text as an output result to a respondent in the current dialogue scenario, wherein the respondent has a one-question-one-answer dialogue logical relationship with the user in the current dialogue scenario. 8.A computer device, comprising a memory and a processor, wherein the memory stores computer readable instructions, and the processor executes the computer readable instructions to implement the steps of the dialogue question rewriting method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the steps of the dialogue question rewriting method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Semantic extraction method and device, computer equipment and storage medium
CN112364665A
Certificate identification method and device, computer equipment and storage medium
CN112396059A