Question and answer text optimization method and device, electronic equipment and storage medium
By detecting the expression form of the user input text and adding operation statements to complete the content, the problem that the artificial intelligence model cannot accurately understand the user's intentions is solved, and the output accuracy of the question-and-answer model is improved.
Patent Information
- Application Number
- CN202410232492.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-29
- Publication Date
- 2025-09-05
AI Technical Summary
In the prior art, artificial intelligence models cannot accurately understand the intention of user input content, resulting in inaccurate output results and cannot meet user inquiry needs.
By obtaining the user input text, detecting its expression form, determining the target processing link based on the expression information, adding corresponding operation statements to complete the content, and generating optimized text to improve the model's understanding of user intentions.
By optimizing text, the model's understanding of user intentions is improved and the output results of the question and answer model is improved.
Smart Images

Figure CN120596595A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of artificial intelligence technology, and in particular to a question-and-answer text optimization method, device, electronic device, and storage medium. Background Art
[0002] Currently, smart assistants based on artificial intelligence models are increasingly being used in various applications. Users can input text information in a free dialogue mode and complete question-and-answer conversations with smart assistants.
[0003] In the existing technology, artificial intelligence models usually predict user intentions based on text information input by users, thereby providing the most suitable reply content. However, in actual application, the solutions in the existing technology have the problem that the model cannot accurately understand the user intentions based on the content input by the user, which leads to inaccurate model output results and cannot solve the user's inquiry needs. Summary of the Invention
[0004] The embodiments of the present disclosure provide a question-answer text optimization method, device, electronic device, and storage medium to overcome the problem that the model cannot accurately understand the user's intention based on the content input by the user.
[0005] In a first aspect, an embodiment of the present disclosure provides a question-answer text optimization method, comprising:
[0006] Obtain user input text and detect the user input text to obtain expression information, wherein the expression information represents the expression form of the user input text; obtain a target processing link based on the expression information, wherein the target processing link represents at least one content completion step for the user input text having the expression form; process the user input text based on the target processing link to obtain corresponding optimized text.
[0007] In a second aspect, an embodiment of the present disclosure provides a question-answer text optimization device, comprising:
[0008] A detection module, configured to obtain user input text and detect the user input text to obtain expression information, wherein the expression information represents the expression form of the user input text;
[0009] an optimization module, configured to obtain a target processing link based on the expression information, wherein the target processing link represents at least one content completion step for the user input text having the expression form;
[0010] A processing module is used to process the user input text based on the target processing link to obtain a corresponding optimized text.
[0011] In a third aspect, an embodiment of the present disclosure provides an electronic device, including: a processor and a memory;
[0012] The memory stores computer-executable instructions;
[0013] The processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the question-and-answer text optimization method described in the first aspect and various possible designs of the first aspect.
[0014] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the question-and-answer text optimization method described in the first aspect and various possible designs of the first aspect is implemented.
[0015] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, including a computer program, which, when executed by a processor, implements the question and answer text optimization method described in the first aspect and various possible designs of the first aspect.
[0016] The question-answer text optimization method, device, electronic device, and storage medium provided in this embodiment obtain user input text and detect the user input text to obtain expression information, wherein the expression information represents the expression form of the user input text; obtain a target processing link based on the expression information, wherein the target processing link represents at least one content completion step for the user input text having the expression form; and process the user input text based on the target processing link to obtain a corresponding optimized text. By obtaining a unique processing link for the user input text based on the expression form of the user input text, and optimizing the inquiry culture based on the processing link, an optimized text is obtained. Since the expression form of the user input text can reflect the user's intention to a certain extent, the user input text is optimized through the expression form characteristics so that the obtained optimized text can more accurately describe the user's intention, thereby improving the accuracy of the model in understanding the user's intention and improving the accuracy of the model output results. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, a brief introduction will be given below to 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 disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0018] Figure 1 A diagram of an application scenario of the question-answer text optimization method provided in an embodiment of the present disclosure;
[0019] Figure 2 Schematic diagram of the process of the question and answer text optimization method provided in the embodiment of the present disclosure Figure 1 ;
[0020] Figure 3 A schematic diagram of a process for determining a target processing link provided by an embodiment of the present disclosure;
[0021] Figure 4 A schematic diagram of a process for generating optimized text provided by an embodiment of the present disclosure;
[0022] Figure 5 for Figure 2 A flowchart of a specific implementation method of step S103 in the embodiment shown;
[0023] Figure 6 for Figure 5 A flowchart of a specific implementation method of step S1032 in the embodiment shown;
[0024] Figure 7 A schematic diagram of a process for generating a reply text provided in an embodiment of the present disclosure;
[0025] Figure 8 Schematic diagram of the process of the question and answer text optimization method provided in the embodiment of the present disclosure Figure 2 ;
[0026] Figure 9 for Figure 8 A flowchart of a specific implementation method of step S203 in the embodiment shown;
[0027] Figure 10 for Figure 8 A flowchart of a specific implementation method of step S206 in the embodiment shown;
[0028] Figure 11 A structural block diagram of a question-answer text optimization device provided in an embodiment of the present disclosure;
[0029] Figure 12 A schematic structural diagram of an electronic device provided in an embodiment of the present disclosure;
[0030] Figure 13 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0031] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure more clear, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present disclosure without making any creative efforts shall fall within the scope of protection of the present disclosure.
[0032] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] The following explains the application scenarios of the embodiments of the present disclosure:
[0034] Figure 1 This is an application scenario diagram of the question-answer text optimization method provided by the embodiment of the present disclosure. The question-answer text optimization method provided by the embodiment of the present disclosure can be applied to the application scenarios of artificial intelligence assistants and intelligent question-answering. More specifically, it can be applied to applications with artificial intelligence assistant functions. The execution subject of this embodiment can be a terminal device running the above-mentioned application with artificial intelligence assistant, or a server that deploys the service end corresponding to the above-mentioned application, or other electronic devices that perform similar functions. Figure 1 As shown in , taking the terminal device as an example, an artificial intelligence assistant function is provided in the application running on the terminal device. When the artificial intelligence assistant function is awakened, the user can enter the user input text in the question input area of the function page where the artificial intelligence assistant is located (for example, corresponding to an editable text box component). The content of the user input text is, for example, "Introduce the development prospects of XXX" as shown in the figure (where XXX refers to any content). Afterwards, the artificial intelligence assistant implemented based on the language model will understand the questions raised by the user based on the above-mentioned user input text (intention understanding), and generate a reply message (which can correspond to different categories of media including pictures, text, etc.) by searching the network / local knowledge base, and display it in the result display area of the function page, thereby completing a "question and answer process". Afterwards, based on specific needs, the user can further enter other user input text in the question input area. After processing by the model, the corresponding reply message continues to be generated, thereby realizing multiple rounds of "question and answer process".
[0035] In the existing technology, artificial intelligence models usually predict user intentions based on text information input by users, thereby providing the most suitable reply content. However, in actual application, due to the certain randomness and ambiguity of user input content, directly processing the input content through the model makes it difficult for the model to capture the user's true intentions, or the model infers that there are multiple possibilities, and it is necessary to further clarify the user's true intentions by increasing the number of interaction rounds. This will lead to a decline in the dialogue performance of the question-answering model, and then cause the model output results to be inaccurate and unable to solve the user's inquiry needs.
[0036] The embodiments of the present disclosure provide a question-answer text optimization method to solve the above problems.
[0037] refer to Figure 2 , Figure 2 Schematic diagram of the process of the question and answer text optimization method provided in the embodiment of the present disclosure Figure 1 The method of this embodiment can be applied in a terminal device or a server. The question-answer text optimization method includes:
[0038] Step S101: obtaining user input text, and detecting the user input text to obtain expression information, where the expression information represents the expression form of the user input text.
[0039] For example, refer to Figure 1 The application scenario diagram shown takes a terminal device as the execution subject of this embodiment as an example. After the terminal device runs the above-mentioned application with artificial intelligence assistant function, the user enters content through the function page corresponding to the artificial intelligence assistant in the application, so that the terminal device obtains the user input text. The user can enter the user input text into the terminal device through text input or voice input. The specific implementation method can be set as needed and is not limited here. Further, by way of example, the user input text is a set of sentences based on natural language that are used to describe the user's question intention. For example, the content of the user input text is "Introduce the development prospects of XXX." Of course, it is understood that the content of the above user input text is only an example. In the application scenario of free dialogue, the user can enter any content. Therefore, the process of user inputting the user input text is subjective and arbitrary, which may lead to missing or ambiguous information in the user input text. For example, based on the previous example, for the same user intention, the content of the user input text may also be "Introduce XXX" or "XXX development." Alternatively, the content of the user input text may also include information such as code and internal code. The specific content of the user input text is not limited here.
[0040] Afterwards, the terminal device checks the user input text and obtains expression information that characterizes the expression form of the user input text. The expression information is also information that characterizes the defect form and defect type of the user input text. Specifically, the expression form refers to the type or feature of the expression of the sentence that constitutes the user input text. For example, based on whether the user input text contains program code, whether it contains internal code or abbreviations, whether it contains a single or multiple single entity objects, whether there are incomplete sentence components (subject, predicate, and object), etc., the user input text can be divided into different expression forms or expression defects. Furthermore, the expression information may include feature identifiers that characterize the expression form, for example, including:
[0041] Feature identifier P00 indicates that the user input text is expressed in pure code to describe the user's intention, referred to as pure code form;
[0042] Feature identifier P01 indicates that the user input text is expressed in the form of describing the user's intention through codes and text, referred to as mixed code form;
[0043] Feature identifier P10 indicates that the user input text is expressed in the form of describing the user's intention through a single entity, referred to as the single entity form;
[0044] Feature identifier P20 indicates that the expression form of the user input text is: describing the user intention through an incomplete sentence, referred to as the incomplete form.
[0045] Of course, in other possible implementations, the expression information may include formal feature vectors and formal feature matrices that represent the expression form. Formal feature vectors and formal feature matrices can be used to represent more sophisticated and complex expression forms. They can be set as needed and will not be given as examples here.
[0046] Furthermore, there are many specific implementation methods for detecting the user input text and obtaining the expression information. For example, the user input text is segmented by a preset text segmentation strategy or a pre-trained text segmentation model, and the segmented objects obtained after segmentation are identified to determine the expression form of the query statement, that is, the expression information; or the user input text is directly detected by a pre-trained expression form recognition model to obtain the expression information output by the expression form recognition model; or the user input text is recognized by multiple different recognition units (such as a recognition unit for recognizing codes, a recognition unit for recognizing single entity objects, etc.), respectively, to obtain the expression features of the user input text, thereby determining the expression form of the user input text, that is, obtaining the expression information. The specific settings can be made as needed.
[0047] Step S102: obtaining a target processing link according to the expression information, where the target processing link represents at least one content completion step for the user input text in the expression form.
[0048] Exemplarily, after obtaining the representation information, the terminal device determines the target processing link corresponding to the representation information based on the preset mapping information, wherein the processing link refers to an ordered set of a series (at least one) of link nodes, and each link node corresponds to a processing step for the user input text; based on the introduction of the steps of the previous embodiment, the representation information may include a feature identifier, a feature vector or a feature matrix. Afterwards, the terminal device maps the above feature identifier or feature vector or feature matrix to the corresponding processing link identifier in combination with the preset mapping information, thereby obtaining the target processing link. The mapping information may include a mapping table, a mapping rule or a mapping model, and the mapping information may be pre-set by the user as needed. The specific implementation method of the mapping information is not limited here.
[0049] In one possible implementation, the target processing link is used to add an operation statement to the user input text, where the operation statement includes at least one of the following:
[0050] a first operation statement, the first operation statement including at least one of a run instruction statement, an error correction instruction statement, and an interpretation instruction statement for the code statement;
[0051] a second operation statement, the second operation statement including at least one of a search instruction statement, a creation instruction statement, and an expression instruction statement for a single entity statement;
[0052] a third operation statement, the third operation statement including at least one of a polishing instruction statement, a rewriting instruction statement, and a continuing instruction statement for the missing statement;
[0053] The fourth operation statement includes at least one of an expression instruction statement and a search instruction statement for the fuzzy statement.
[0054] Specifically, the target processing link for adding a first operation statement to the user input text is the first processing link. The first processing link is used to complete the content of the user input text containing code, thereby forming a completed representation of the code statement, that is, optimizing the text. The content completion step includes, for example, adding operation statements such as run, interpret, and test to the code statement. This allows the user input text after the operation statement is added to more clearly describe the operation intent, improve the accuracy of the input content subsequently fed into the question-answering model, and avoid ambiguity.
[0055] Similarly, the target processing link for adding a second operation statement to the user input text is the second processing link, and the second processing link is used to complete the content of the user input text containing a single entity sentence, thereby forming a complete statement for the single entity sentence; the target processing link for adding a third operation statement to the user input text is the third processing link, and the third processing link is used to complete the content of the user input text containing an erroneous sentence, thereby forming a complete statement for the erroneous sentence; the target processing link for adding a fourth operation statement to the user input text is the fourth processing link, and the fourth processing link is used to complete the content of the user input text containing an ambiguous sentence, thereby forming a complete statement for the ambiguous sentence.
[0056] Figure 3 A schematic diagram of a process for determining a target processing link provided by an embodiment of the present disclosure is shown as follows: Figure 3 As shown, after the user input text is detected to obtain the expression information, it is mapped to the corresponding processing link according to the different expression information. For example, as shown in the figure, after the user input text Text_0 is detected, the corresponding expression information is obtained according to the expression form of the user input text, for example, it can be any one of the expression information Info_1, expression information Info_2, expression information Info_3, and expression information Info_4. Afterwards, each expression information can be mapped to the corresponding processing link, so as to determine the target processing link. For example, if the expression information Info_1 is obtained, the target processing link is determined to be the first processing link; if the expression information Info_2 is obtained, the target processing link is determined to be the second processing link; if the expression information Info_3 is obtained, the target processing link is determined to be the third processing link; if the expression information Info_4 is obtained, the target processing link is determined to be the fourth processing link.
[0057] Step S103: Process the user input text based on the target processing link to obtain a corresponding optimized text.
[0058] Furthermore, after obtaining a specific target processing link, the user input text is completed based on the target processing link to obtain the corresponding optimized text. In one possible implementation, the target processing link corresponds to a specific content completion step, and the content completion step is used to add a corresponding specific operation statement to the user input text.
[0059] Figure 4 A schematic diagram of a process for generating optimized text provided by an embodiment of the present disclosure is shown as follows: Figure 4As shown, for example, for user input texts with different contents (user input text Text_1, user input text Text_2, user input text Text_3, user input text Text_4), if the user input text Text_1 is detected to obtain the expression information Info_1, the target processing link is determined to be the first processing link, and then the first processing link (target processing link) is used to process the user input text Text_1 to generate the optimized text R_Text_1, wherein, more specifically, the text content of the user input text Text_1 is, for example, "print(f"test:%v".(data))". After the first processing link performs the content completion operation, the generated optimized text R_Text_1 is generated. The text content of the text R_Text_1 is, for example, "Check the errors in this code: print(f"test:%v".(data))", that is, the error correction instruction statement in the first operation statement is added to the code statement in the user input text. Of course, it can be understood that in the case where the user input text contains code statements, the first processing link can also add other first operation statements to it, such as adding a running instruction statement to the code statement (the statement content is, for example, "Run this code:") to generate the optimized text R_Text_1', and for another example, adding an explanation instruction statement to the code statement (the statement content is, for example, "Explain the meaning of this code:") to generate the optimized text R_Text_1".
[0060] Correspondingly, if the user input text Text_2 is detected and the expression information Info_2 is obtained, the target processing link is determined to be the second processing link, and then the second processing link (target processing link) is used to process the user input text Text_2 to generate the optimized text R_Text_2; specifically, the text content of the user input text Text_2 is, for example, "Yesterday's GPT comments on XXX", and after the second processing link performs the content completion operation, the text content of the generated optimized text R_Text_2 is, for example, "Search: Yesterday's GPT comments on XXX". That is, for a single instance sentence in the user input text, a search instruction sentence in the second operation sentence is added. For the case where the user input text contains a single instance sentence, the second processing link can also add other second operation sentences to it, such as a creation instruction sentence (the sentence content is, for example, "Please create based on the following content:") and an expression instruction sentence (the sentence content is, for example, "Please express your opinion on the following content:").
[0061] Correspondingly, if the user input text Text_3 is detected and the expression information Info_3 is obtained, the target processing link is determined to be the third processing link, and then the third processing link (target processing link) is used to process the user input text Text_3 to generate the optimized text R_Text_3; specifically, the text content of the user input text Text_3 is, for example, "I like this toy", and after the third processing link performs the content completion operation, the text content of the generated optimized text R_Text_3 is, for example, "Please correct the following content: I like this toy". That is, for the missing sentences in the user input text, the rewrite instruction statement in the third operation statement is added. For the case where the user input text contains missing sentences, the third processing link can also add other third operation statements, such as polishing instruction statements (the sentence content is, for example, "Please help me polish the expression of this sentence:") and continuation instruction statements (the sentence content is, for example, "Please help me continue writing this sentence:").
[0062] Correspondingly, if the user input text Text_4 is detected and expression information Info_4 is obtained, the target processing link is determined to be the fourth processing link. This fourth processing link (target processing link) is then used to process the user input text Text_4 to generate optimized text R_Text_4. Specifically, if the text content of the user input text Text_4 is, for example, "hair color v12," after the fourth processing link performs a content completion operation, the generated optimized text R_Text_4 will have the text content, for example, "Just a quick chat about: hair color v12." That is, the expression instruction statement in the fourth operation statement is added to the ambiguous statement in the user input text. If the user input text contains ambiguous statements, the fourth processing link can also add other fourth operation statements, such as a search instruction statement (for example, the statement content is: "Search for the following content:").
[0063] Based on the above introduction, after obtaining the expression information, the terminal device obtains the corresponding target processing link according to the expression information, and then processes the user input text based on the target processing link, adds the corresponding operation statement to the user input text, and completes the content of the user input text to obtain the corresponding optimized text. Among them, the specific sentence content of the operation statements (first operation statement, second operation statement, third operation statement, and fourth operation statement) in the above examples are all exemplary and can be generated and configured as needed. The specific sentence structure and content of the operation statements are not limited here. Figure 3In the illustrated embodiment, the target processing link includes a specific link node (processing step), through which a corresponding specific operation statement is added to the user input text. For example, the target processing link is the first processing link L1, which includes a link node P1 for adding an error correction instruction statement to the user input text. That is, the target processing link determined based on the representation information includes a unique link node for adding an operation statement to the user input text. Therefore, after the target processing link is determined, the content completion step for the user input text can be completed based on the target processing link.
[0064] In another possible implementation, the target processing link includes multiple link nodes. In this case, after determining the target processing link, it is necessary to further determine at least one target link node based on the conditions of each link node in the target processing link to process the user input text to obtain optimized text.
[0065] Exemplarily, the target processing link includes at least two link nodes, such as Figure 5 As shown, the specific implementation of step S103 includes:
[0066] Step S1031: Obtain the probability weight corresponding to each link node.
[0067] Step S1032: Determine the target link node according to the probability weight of each link node, and process the user input text based on the target link node to obtain the optimized text.
[0068] Exemplarily, after determining the target processing link, the target processing link includes at least two link nodes, each link node corresponds to a content completion step, and each link node has a corresponding probability weight, wherein the probability weight is information that characterizes the degree of matching between the content completion step corresponding to the processing node and the user input text. The larger the probability weight, the more the content completion step corresponding to the link node matches the user input text; otherwise, the less the match.
[0069] Specifically, for example, the target processing link is processing link L1, which includes link nodes P1, P2, and P3. Link node P1 is used to add error correction instructions to the user input text, link node P2 is used to add interpretation instructions to the user input text, and link node P3 is used to add execution instructions to the user input text. After the terminal device determines processing link L1 based on the user input text, it further obtains weight configuration information corresponding to processing link L1. This weight configuration information includes probability weights corresponding to the link nodes of processing link L1. Specifically, for example, according to the weight configuration information, the weight of link node P1 is 0.6, the weight of link node P2 is 0.3, and the weight of link node P3 is 0.1. Subsequently, based on the probability weights of each link node, at least one of link node P1, link node P2, and link node P3 is determined as the target link node. For example, the link node P1 with the largest probability weight is determined as the target link node; for another example, the two link nodes with the largest probability weight, namely link node P1 and link node P2, are determined as the target link node; for another example, the link node with a probability weight greater than a preset value (such as 0.5) is determined as the target link node, that is, link node P1 is determined as the target link node. Based on the probability weight, the specific method of determining the target link node can be set as needed and is not limited here. Among them, the method of obtaining the weight configuration information (i.e., the probability weight corresponding to each link node) is similar to the method of obtaining the target processing link. It can be generated by processing the user input text through a pre-trained model or processing rule, and this will not be introduced in detail here.
[0070] Afterwards, the content completion step corresponding to the target link node is used to process the user input text, thereby adding matching operation statements to the user input text to obtain an optimized text. In the steps of this embodiment, the probability weight is determined based on the user input text to evaluate the matching degree of each link node in the target processing link, thereby selecting the target link node that best matches the user input text, and using the content completion step corresponding to the target link node to complete the user input text. This implements a solution for dynamically determining the content completion step, and reasonably sets the order of multiple content completion steps through probability weights, further improving the rationality of content completion and the quality of the generated optimized text so that it can better describe the user's intention.
[0071] Furthermore, in the case that the target link nodes determined based on step S1031 include at least two, the at least two target link nodes can be executed in sequence to add corresponding at least two operation statements to the user input text. For example, Figure 6 As shown, the specific implementation of step S1032 includes:
[0072] Step S1032A: Based on the description information, obtain the priority weight corresponding to each target link node;
[0073] Step S1032B: Based on the priority weight corresponding to each target link node, the user input text is processed in sequence to obtain an optimized text.
[0074] Exemplarily, when there are at least two target link nodes, the priority weight corresponding to each target link node is further obtained, and then the execution order of the target link nodes is arranged based on the priority weight. For example, the target link nodes include link node P1 and link node P2, and the priority weight of link node P1 is 2, and the priority weight corresponding to link node P1 is 1. Therefore, link node P2 is now executed, and then link node P1 is executed, thereby completing the content completion of the user input text.
[0075] The above steps are described below with a more specific embodiment. Figure 7 A schematic diagram of a process for generating a reply text provided by an embodiment of the present disclosure is shown as follows: Figure 7 As shown in the example, the text content of the user input text is: "How many things are there in the mall?" Based on the user input text, the expression information is determined, and the target processing link L1 is determined, including link nodes P1, link node P2, and link node P3. Based on the probability weights corresponding to each link node, link nodes P1 and link node P2 are determined as target link nodes. Link node P1 is used to add a continuation instruction statement to the user input text, and link node P2 is used to add a polishing instruction statement to the user input text. Subsequently, the priority weights corresponding to link nodes P1 and link nodes P2 are obtained: W_P1 = 2 and W_P2 = 1, respectively. Then, based on the priority weights corresponding to link nodes P1 and link nodes P2, link node P1 is executed first, that is, adding a continuation instruction statement to the text content. The sentence content is, for example, "Please help me complete the following content." Then, link node P2 is executed, that is, adding a polishing instruction statement to the text content. The sentence content is, for example, "Please help me complete the following content and polish it: How many things are there in the mall."
[0076] The question-answering model then processes this optimized text as input. Based on the intended action described in the optimized text, it first completes the user input text, "There are so many things in the mall," producing, for example, the completed text: "There are (a lot) of things in the mall." This completed text is then refined to produce the final response text, "There are a dazzling array of various goods in the mall." In this embodiment, the priority weights corresponding to each target link node control the execution order of the content completion steps corresponding to the target processing link, thereby making the generated optimized text more reasonable and improving the question-answering model's response performance.
[0077] In this embodiment, the user input text input by the user is obtained and tested to obtain expression information, which represents the expression form of the user input text; based on the expression information, a target processing link is obtained, which represents at least one content completion step for the user input text having the expression form; the user input text is processed based on the target processing link to obtain the corresponding optimized text. Based on the expression form of the user input text input by the user, a unique processing link for the user input text is obtained, and the query culture is optimized based on the processing link to obtain the optimized text. Since the expression form of the user input text can reflect the user's intention to a certain extent, the user input text is optimized through the expression form characteristics so that the obtained optimized text can more accurately describe the user's intention, thereby improving the accuracy of the model's understanding of the user's intention and improving the accuracy of the model's output results.
[0078] refer to Figure 8 , Figure 8 Schematic diagram of the process of the question and answer text optimization method provided in the embodiment of the present disclosure Figure 2 In this embodiment Figure 2 Based on the embodiment shown, steps S101-S102 are further refined, and the question-answer text optimization method includes:
[0079] Step S201: Obtain user input text.
[0080] Step S202: performing code recognition on the user input text to obtain a code recognition result.
[0081] Step S203: Based on the code recognition result, if the user input text contains text content that complies with the preset code specification, the code statement in the user input text is obtained, and first expression information is generated based on the code statement.
[0082] Step S204: obtaining a first processing link according to the first expression information, the first processing link being used to add a first operation statement for the code statement, and then processing the user input text based on the first processing link to obtain a corresponding optimized text.
[0083] For example, in this embodiment, the specific processing steps for the user input text are limited. Specifically, after obtaining the user input text, the user input text is firstly subjected to code recognition. The specific implementation method can be to recognize common code statement forms through regular expressions. If the code recognition result contains text content that meets the preset code specifications, that is, it contains code statements. The code statement can be a part of the user input text or the user input text itself. In this case, the expression information of the user input text in the above-mentioned identification form is determined as the first expression information, wherein the specific implementation method of the expression information is as follows: Figure 2 The embodiment shown has been described in detail and will not be repeated here. Afterwards, according to the determined first expression information, the first processing link is mapped to the corresponding first processing link, and the first processing link is executed to add a first operation statement for the code statement to obtain the corresponding optimized text.
[0084] In one possible implementation, Figure 9 As shown, the specific implementation of step S203 includes:
[0085] Step S2031: Obtain the development language type corresponding to the code statement.
[0086] Step S2032: Generate corresponding first expression information based on the development language type.
[0087] For example, in a possible implementation, after detecting a code statement, the development language type corresponding to the code statement is further detected, such as C language, Java language, etc. Afterwards, based on the development language type, the corresponding first expression information is determined. The first expression information can represent the defect type of the code statement, such as common errors in code statements such as lack of definition and reference errors, or it can represent the execution function of the code statement. The above detailed information on the code statement needs to be parsed and obtained using the corresponding method under different development languages. Therefore, it is necessary to first determine the development language type so that the first expression information can represent the above detailed information on the code statement; then, based on the first expression information, it is mapped to the corresponding first processing link so that the first operation statement (run instruction statement, detection instruction statement, interpretation instruction statement) added by the first processing link can better match the code statement in the user input text. For example, when there is an error in the code statement, a detection instruction statement is added; or when there is no error in the code statement, an interpretation instruction statement or a run instruction statement is added. This improves the rationality of the optimized text finally generated.
[0088] Step S205: Based on the code recognition result, if the user input text does not contain text content that complies with the preset code specification, entity recognition is performed on the user input text to obtain an entity recognition result.
[0089] Step S206: Based on the entity recognition result, if the user input text contains a single entity object, a single entity sentence corresponding to the single entity object in the user input text is obtained, and second expression information is generated based on the single entity sentence.
[0090] Step S207: According to the second expression information, a second processing link is obtained, where the second processing link is used to add a second operation statement for the single entity statement, and then the user input text is processed based on the second processing link to obtain a corresponding optimized text.
[0091] In another case, if the user input text does not contain text content that conforms to the preset code specification, that is, the user input text does not contain recognizable code statements, that is, the expression information of the user input text is not the first expression information, then the user input text is further detected, that is, the user input text is subjected to entity recognition to obtain an entity recognition result, the specific implementation of which includes performing named entity recognition (NER) on the user input text to detect potential entities in the user input text, such as names, organizations, documents, emails and other entity objects. If, according to the entity recognition result, the query statement contains one of the above-mentioned entity objects, then the statement composed of the single entity object is a single entity statement, which can be part of the query statement or the query statement itself. The expression form (expression defect) of the single entity statement corresponds to the second expression information. In the case where the single entity statement only contains the entity object but does not contain specific operation actions for the entity object, it is impossible to clearly describe "what to do" with respect to the entity object. In this case, it is determined that the expression information corresponding to the user input text is the second expression information, wherein the specific implementation of the expression information is in Figure 2 The embodiment shown has been described in detail and will not be repeated here. Afterwards, according to the determined second expression information, the corresponding second processing link is mapped and executed, and the second operation statement for the single entity statement is added to obtain the corresponding optimized text.
[0092] In one possible implementation, Figure 10 As shown, the specific implementation of step S206 includes:
[0093] Step S2061: Obtain the object category of the single entity object corresponding to the single entity statement.
[0094] Step S2062: Generate corresponding second description information according to the object category of the single entity object.
[0095] For example, in one possible implementation, after detecting a single entity object, the object category corresponding to the single entity object is further detected, such as news, merchandise, or people. Subsequently, corresponding second expression information is determined based on the object category corresponding to the single entity object. The second expression information includes expression information specific to the object category. Therefore, when determining the corresponding second processing link based on the second expression information, the resulting second processing link is matched with the single instance object in the user input text. For example, when the object category is "people," the generated second expression information includes description information cag_1 for the object category. Subsequently, when determining the second processing link based on the second expression information including the description information cag_1, the resulting second processing link adds a "expression instruction statement" to the user input text. For another example, when the object category is "news," the generated second expression information includes description information cag_2 for the object category. Subsequently, when determining the second processing link based on the second expression information including the description information cag_2, the resulting second processing link adds a "search instruction statement" to the user input text. In the steps of this embodiment, the object category of the single entity object corresponding to the single instance statement is detected, and the second expression information is generated based on the object category, so that the second expression information can represent the object category of the single entity object in the query statement, thereby making the second processing link generated based on the second expression information more reasonable for the second operation statement added to the user input text, thereby improving the quality of the generated optimized text.
[0096] Step S208: Based on the entity recognition result, if the user input text does not contain a single entity object, the perplexity of the user input text is calculated to obtain the sentence perplexity, which represents the fluency of the sentence in the user input text.
[0097] Step S209: If the sentence perplexity is greater than the sentence perplexity threshold, obtaining the missing sentences in the user input text, and generating third expression information based on the missing sentences.
[0098] Step S210: obtaining a third processing link based on the third expression information, the third processing link being used to add a third operation statement for the missing sentence, and then processing the user input text based on the third processing link to obtain a corresponding optimized text.
[0099] Furthermore, when the user input text does not contain text content that conforms to the preset code specification and the user input text does not contain a single entity object, the user input text is further perplexity calculated to obtain a sentence perplexity that characterizes the fluency of the user input text. The specific implementation method includes, for example, calculating the fluency of the user input text through the N-Gram language model. If the sentence perplexity is greater than the corresponding sentence perplexity threshold, the missing sentence in the user input text is obtained. Specifically, for example, the user input text is divided into several parts, the sentence perplexity of each part is calculated, and the part with a sentence perplexity greater than the sentence perplexity threshold is determined as a missing sentence. Of course, the sentence perplexity of the user input text as a whole can also be calculated. If it is greater than the sentence perplexity threshold, the user input text itself is regarded as a missing sentence. At the same time, after determining that there is a missing sentence, the expression information of the user input text is determined to be the third expression information. Afterwards, according to the determined third expression information, it is mapped to the corresponding third processing link, and the third processing link is executed to add a third operation statement for the missing sentence to obtain the corresponding optimized text.
[0100] Step S211: If the sentence perplexity is less than or equal to the sentence perplexity threshold, obtaining the fuzzy sentence in the user input text, and generating fourth expression information based on the fuzzy sentence.
[0101] Step S212: According to the fourth expression information, a fourth processing link is obtained, where the fourth processing link is used to add a fourth operation statement for the fuzzy statement, and then the user input text is processed based on the third processing link to obtain a corresponding optimized text.
[0102] In the last case, if the user input text does not contain text content that conforms to the preset code specification, and the user input text does not contain a single entity object, and if the sentence perplexity is less than or equal to the sentence perplexity threshold, then the user input text corresponds to the fourth expression information. In this case, the user input text contains fuzzy sentences, that is, sentences whose defect types cannot be confirmed (not belonging to any of the above code sentences, single entity object sentences, and missing sentences). The fuzzy sentences can be the user input text itself or a part of the user input text. For user input text in this expression form, its expression information is determined to be the fourth expression information, and then mapped to the corresponding fourth processing link according to the fourth expression information, and the fourth processing link is executed to add the fourth operation statement for the missing sentence to obtain the corresponding optimized text.
[0103] Among them, the specific implementation of the first operation statement, the second operation statement, the third operation statement, and the fourth operation statement in the above embodiment is as follows: Figure 2The corresponding parts of the illustrated embodiment have been introduced and will not be repeated here. In this embodiment, by setting up a specific process for generating optimized text, the user input text is sequentially subjected to code detection, single entity detection, and perplexity calculation, thereby maximizing the detection of expression defects and content completion in the user input text. At the same time, the above-mentioned various detection steps for the user input text usually need to be implemented with the help of a local or cloud knowledge base. By arranging the above-mentioned detection order, the comprehensive probability of defects can be increased, thereby reducing the overall detection steps, improving detection efficiency, and reducing system resource overhead.
[0104] In this embodiment, the implementation of step S201 is the same as that of the present disclosure. Figure 2 The implementation of step S101 in the illustrated embodiments is the same and will not be described in detail here.
[0105] Corresponding to the question-answer text optimization method in the above embodiment, Figure 11 This is a structural block diagram of the question-answer text optimization device provided by the embodiment of the present disclosure. For the sake of convenience, only the parts related to the embodiment of the present disclosure are shown. Figure 11 , the question-answer text optimization device 3 includes:
[0106] The detection module 31 is used to obtain the user input text and detect the user input text to obtain expression information, where the expression information represents the expression form of the user input text;
[0107] An optimization module 32 is configured to obtain a target processing link based on the expression information, where the target processing link represents at least one content completion step for the user input text in the expression form;
[0108] The processing module 33 is used to process the user input text based on the target processing link to obtain the corresponding optimized text.
[0109] In one embodiment of the present disclosure, when the detection module 31 detects the user input text and obtains the expression information, it is specifically used to: perform code recognition on the user input text to obtain a code recognition result; based on the code recognition result, if the user input text contains text content that meets the preset code specification, the code statement in the user input text is obtained; based on the code statement, the first expression information is generated; the optimization module 32 is specifically used to: based on the first expression information, obtain a first processing link, and the first processing link is used to add a first operation statement for the code statement.
[0110] In one embodiment of the present disclosure, when generating the first expression information according to the code statement, the detection module 31 is specifically configured to: obtain the development language type corresponding to the code statement; and generate the corresponding first expression information based on the development language type.
[0111] In one embodiment of the present disclosure, the detection module 31 is further used to: based on the code recognition result, if the user input text does not contain text content that conforms to the preset code specification, then perform entity recognition on the user input text to obtain an entity recognition result; based on the entity recognition result, if the user input text contains a single entity object, then obtain a single entity statement corresponding to the single entity object in the user input text; based on the single entity statement, generate second expression information; the optimization module 32 is specifically used to: based on the second expression information, obtain a second processing link, and the second processing link is used to add a second operation statement for the single entity statement.
[0112] In one embodiment of the present disclosure, when the detection module 31 generates the second expression information based on the single entity statement, it is specifically used to: obtain the object category of the single entity object corresponding to the single entity statement; and generate the corresponding second expression information based on the object category of the single entity object.
[0113] In one embodiment of the present disclosure, the detection module 31 is further used to: based on the entity recognition result, if the user input text does not contain a single entity object, calculate the perplexity of the user input text to obtain the sentence perplexity, where the sentence perplexity represents the fluency of the sentence in the user input text; if the sentence perplexity is greater than the sentence perplexity threshold, obtain the missing sentence in the user input text; generate third expression information based on the missing sentence; the optimization module 32 is specifically used to: obtain a third processing link based on the third expression information, and the third processing link is used to add a third operation statement for the missing sentence.
[0114] In one embodiment of the present disclosure, the detection module 31 is further used to: if the sentence perplexity is less than the sentence perplexity threshold, obtain the fuzzy sentence in the user input text; generate fourth expression information based on the fuzzy sentence; the optimization module 32 is specifically used to: obtain a fourth processing link based on the fourth expression information, and the fourth processing link is used to add a fourth operation statement for the fuzzy sentence.
[0115] In one embodiment of the present disclosure, the target processing link is used to add operation statements for user input text, and the operation statements include at least one of the following: a first operation statement, the first operation statement includes at least one of a running instruction statement, an error correction instruction statement, and an interpretation instruction statement for a code statement; a second operation statement, the second operation statement includes at least one of a search instruction statement, a creation instruction statement, and an expression instruction statement for a single entity statement; a third operation statement, the third operation statement includes at least one of a polishing instruction statement, a rewriting instruction statement, and a continuation instruction statement for an erroneous statement; a fourth operation statement, the fourth operation statement includes at least one of an expression instruction statement and a search instruction statement for an ambiguous statement.
[0116] In one embodiment of the present disclosure, the target processing link includes at least two link nodes, and the processing module 33 is specifically used to: obtain the probability weight corresponding to each link node; determine the target link node based on the probability weight of each link node, and process the user input text based on the target link node to obtain optimized text.
[0117] In one embodiment of the present disclosure, the target link nodes include at least two. When the processing module 33 processes the user input text based on the target link nodes to obtain the optimized text, it is specifically used to: obtain the priority weight corresponding to each target link node based on the expression information; and process the user input text in turn based on the priority weight corresponding to each target link node to obtain the optimized text.
[0118] The detection module 31, optimization module 32 and processing module 33 are connected in sequence. The question and answer text optimization device 3 provided in this embodiment can implement the technical solution of the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated in this embodiment.
[0119] Figure 12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure is shown in FIG. Figure 12 As shown, the electronic device 4 includes:
[0120] A processor 41, and a memory 42 communicatively connected to the processor 41;
[0121] Memory 42 stores computer-executable instructions;
[0122] The processor 41 executes the computer execution instructions stored in the memory 42 to implement the following Figure 2-Figure 10 The question and answer text optimization method in the illustrated embodiment.
[0123] Optionally, the processor 41 and the memory 42 are connected via a bus 43 .
[0124] For related instructions, please refer to Figure 2-Figure 10 The relevant descriptions and effects corresponding to the steps in the corresponding embodiments can be understood, and no further details are given here.
[0125] The present invention provides a computer-readable storage medium that stores computer-executable instructions. When the computer-executable instructions are executed by a processor, the computer-executable instructions are used to implement the present invention. Figure 2-Figure 10 The question and answer text optimization method provided in any one of the corresponding embodiments.
[0126] The present invention provides a computer program product, including a computer program, which implements the present invention when executed by a processor. Figure 2-Figure 10 The question and answer text optimization method provided in any one of the corresponding embodiments.
[0127] In order to implement the above embodiment, the embodiment of the present disclosure further provides an electronic device.
[0128] refer to Figure 13 , which shows a schematic structural diagram of an electronic device 900 suitable for implementing the embodiments of the present disclosure. The electronic device 900 may be a terminal device or a server. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (PMPs), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 13 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0129] like Figure 13 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0130] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 13 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0131] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network via the communication device 909, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0132] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0133] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0134] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.
[0135] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0136] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0137] The units or modules involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit or module does not, in some cases, limit the unit itself.
[0138] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0139] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0140] In a first aspect, according to one or more embodiments of the present disclosure, a method for optimizing question and answer text is provided, comprising:
[0141] Obtain user input text and detect the user input text to obtain expression information, wherein the expression information represents the expression form of the user input text; obtain a target processing link based on the expression information, wherein the target processing link represents at least one content completion step for the user input text having the expression form; process the user input text based on the target processing link to obtain corresponding optimized text.
[0142] According to one or more embodiments of the present disclosure, the detecting the user input text to obtain expression information includes: performing code recognition on the user input text to obtain a code recognition result; based on the code recognition result, if the user input text contains text content that conforms to a preset code specification, obtaining a code statement in the user input text; generating first expression information based on the code statement; and obtaining a target processing link based on the expression information includes: obtaining a first processing link based on the first expression information, the first processing link being used to add a first operation statement for the code statement.
[0143] According to one or more embodiments of the present disclosure, generating the first expression information according to the code statement includes: obtaining a development language type corresponding to the code statement; and generating corresponding first expression information based on the development language type.
[0144] According to one or more embodiments of the present disclosure, the method also includes: based on the code recognition result, if the user input text does not contain text content that conforms to a preset code specification, performing entity recognition on the user input text to obtain an entity recognition result; based on the entity recognition result, if the user input text contains a single entity object, obtaining a single entity statement corresponding to the single entity object in the user input text; generating second expression information based on the single entity statement; and obtaining a target processing link based on the expression information, including: obtaining a second processing link based on the second expression information, the second processing link being used to add a second operation statement for the single entity statement.
[0145] According to one or more embodiments of the present disclosure, generating second expression information based on the single entity statement includes: obtaining the object category of the single entity object corresponding to the single entity statement; and generating corresponding second expression information based on the object category of the single entity object.
[0146] According to one or more embodiments of the present disclosure, the method further includes: based on the entity recognition result, if the user input text does not contain a single entity object, performing perplexity calculation on the user input text to obtain sentence perplexity, wherein the sentence perplexity represents the sentence fluency of the user input text; if the sentence perplexity is greater than a sentence perplexity threshold, obtaining the missing sentence in the user input text; generating third expression information based on the missing sentence; and obtaining a target processing link based on the expression information, including: obtaining a third processing link based on the third expression information, wherein the third processing link is used to add a third operation statement for the missing sentence.
[0147] According to one or more embodiments of the present disclosure, the method further includes: if the sentence perplexity is less than a sentence perplexity threshold, obtaining a fuzzy sentence in the user input text; generating fourth expression information based on the fuzzy sentence; and obtaining a target processing link based on the expression information, including: obtaining a fourth processing link based on the fourth expression information, the fourth processing link being used to add a fourth operation statement for the fuzzy sentence.
[0148] According to one or more embodiments of the present disclosure, the target processing link is used to add operation statements for the user input text, and the operation statements include at least one of the following: a first operation statement, the first operation statement includes at least one of a running instruction statement, an error correction instruction statement, and an interpretation instruction statement for a code statement; a second operation statement, the second operation statement includes at least one of a search instruction statement, a creation instruction statement, and an expression instruction statement for a single entity statement; a third operation statement, the third operation statement includes at least one of a polishing instruction statement, a rewriting instruction statement, and a continuation instruction statement for an erroneous statement; a fourth operation statement, the fourth operation statement includes at least one of an expression instruction statement and a search instruction statement for an ambiguous statement.
[0149] According to one or more embodiments of the present disclosure, the target processing link includes at least two link nodes, and processing the user input text based on the target processing link to obtain the corresponding optimized text includes: obtaining the probability weight corresponding to each of the link nodes; determining the target link node based on the probability weight of each of the link nodes, and processing the user input text based on the target link node to obtain the optimized text.
[0150] According to one or more embodiments of the present disclosure, the target link nodes include at least two, and the processing of the user input text based on the target link nodes to obtain the optimized text includes: obtaining the priority weight corresponding to each of the target link nodes based on the expression information; and processing the user input text in turn based on the priority weight corresponding to each of the target link nodes to obtain the optimized text.
[0151] In a second aspect, according to one or more embodiments of the present disclosure, a question-answer text optimization device is provided, comprising:
[0152] A detection module, configured to obtain user input text and detect the user input text to obtain expression information, wherein the expression information represents the expression form of the user input text;
[0153] an optimization module, configured to obtain a target processing link based on the expression information, wherein the target processing link represents at least one content completion step for the user input text having the expression form;
[0154] A processing module is used to process the user input text based on the target processing link to obtain a corresponding optimized text.
[0155] According to one or more embodiments of the present disclosure, when the detection module detects the user input text and obtains the expression information, it is specifically used to: perform code recognition on the user input text to obtain a code recognition result; based on the code recognition result, if the user input text contains text content that conforms to a preset code specification, obtain the code statement in the user input text; generate first expression information based on the code statement; the optimization module is specifically used to: obtain a first processing link based on the first expression information, and the first processing link is used to add a first operation statement for the code statement.
[0156] According to one or more embodiments of the present disclosure, when the detection module generates the first expression information based on the code statement, it is specifically used to: obtain the development language type corresponding to the code statement; and generate the corresponding first expression information based on the development language type.
[0157] According to one or more embodiments of the present disclosure, the detection module is further used to: based on the code recognition result, if the user input text does not contain text content that complies with the preset code specification, perform entity recognition on the user input text to obtain an entity recognition result; based on the entity recognition result, if the user input text contains a single entity object, obtain a single entity statement corresponding to the single entity object in the user input text; generate second expression information based on the single entity statement; the optimization module is specifically used to: obtain a second processing link based on the second expression information, and the second processing link is used to add a second operation statement for the single entity statement.
[0158] According to one or more embodiments of the present disclosure, when the detection module generates the second expression information based on the single entity statement, it is specifically used to: obtain the object category of the single entity object corresponding to the single entity statement; and generate corresponding second expression information based on the object category of the single entity object.
[0159] According to one or more embodiments of the present disclosure, the detection module is further used to: based on the entity recognition result, if the user input text does not contain a single entity object, perform perplexity calculation on the user input text to obtain sentence perplexity, where the sentence perplexity represents the sentence fluency of the user input text; if the sentence perplexity is greater than a sentence perplexity threshold, obtain the missing sentence in the user input text; generate third expression information based on the missing sentence; the optimization module is specifically used to: obtain a third processing link based on the third expression information, where the third processing link is used to add a third operation statement for the missing sentence.
[0160] According to one or more embodiments of the present disclosure, the detection module is further used to: if the sentence perplexity is less than a sentence perplexity threshold, obtain a fuzzy sentence in the user input text; generate fourth expression information based on the fuzzy sentence; the optimization module is specifically used to: obtain a fourth processing link based on the fourth expression information, and the fourth processing link is used to add a fourth operation statement for the fuzzy sentence.
[0161] According to one or more embodiments of the present disclosure, the target processing link is used to add operation statements for the user input text, and the operation statements include at least one of the following: a first operation statement, the first operation statement includes at least one of a running instruction statement, an error correction instruction statement, and an interpretation instruction statement for a code statement; a second operation statement, the second operation statement includes at least one of a search instruction statement, a creation instruction statement, and an expression instruction statement for a single entity statement; a third operation statement, the third operation statement includes at least one of a polishing instruction statement, a rewriting instruction statement, and a continuation instruction statement for an erroneous statement; a fourth operation statement, the fourth operation statement includes at least one of an expression instruction statement and a search instruction statement for an ambiguous statement.
[0162] According to one or more embodiments of the present disclosure, the target processing link includes at least two link nodes, and the processing module is specifically used to: obtain the probability weight corresponding to each of the link nodes; determine the target link node based on the probability weight of each of the link nodes, and process the user input text based on the target link node to obtain the optimized text.
[0163] According to one or more embodiments of the present disclosure, the target link nodes include at least two, and when the processing module processes the user input text based on the target link nodes to obtain the optimized text, it is specifically used to: obtain the priority weight corresponding to each of the target link nodes based on the expression information; and process the user input text in turn based on the priority weight corresponding to each of the target link nodes to obtain the optimized text.
[0164] In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device, comprising: at least one processor and a memory;
[0165] The memory stores computer-executable instructions;
[0166] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor executes the question-and-answer text optimization method described in the first aspect and various possible designs of the first aspect.
[0167] In a fourth aspect, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the question-and-answer text optimization method described in the first aspect and various possible designs of the first aspect is implemented.
[0168] In a fifth aspect, according to one or more embodiments of the present disclosure, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the question-and-answer text optimization method as described in the first aspect and various possible designs of the first aspect.
[0169] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0170] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0171] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A question-answer text optimization method, characterized in that: include: Acquire a user query text, and detect the user input text to obtain expression information, wherein the expression information represents the expression form of the user input text; Obtaining a target processing link according to the expression information, wherein the target processing link represents at least one content completion step for the user input text having the expression form; The user input text is processed based on the target processing link to obtain a corresponding optimized text.
2. The method according to claim 1, characterized in that The detecting the user input text to obtain the expression information includes: Performing code recognition on the user input text to obtain a code recognition result; According to the code recognition result, if the user input text contains text content that meets the preset code specification, then obtain the code statement in the user input text; According to the code statement, first expression information is generated.
3. The method according to claim 2, characterized in that Obtaining a target processing link according to the expression information includes: A first processing link is obtained according to the first expression information, where the first processing link is used to add a first operation statement for the code statement.
4. The method according to claim 2, characterized in that Generating first expression information according to the code statement includes: Obtain the development language type corresponding to the code statement; Based on the development language type, corresponding first expression information is generated.
5. The method according to claim 2, characterized in that The method further comprises: According to the code recognition result, if the user input text does not contain text content that meets the preset code specification, entity recognition is performed on the user input text to obtain an entity recognition result; According to the entity recognition result, if the user input text contains a single entity object, obtaining a single entity sentence corresponding to the single entity object in the user input text; Generate second expression information according to the single-entity sentence.
6. The method according to claim 5, characterized in that Obtaining a target processing link according to the expression information includes: A second processing link is obtained according to the second expression information, where the second processing link is used to add a second operation statement for the single entity statement.
7. The method according to claim 5, characterized in that Generating second expression information according to the single entity statement includes: Obtaining an object category of a single entity object corresponding to the single entity statement; Generate corresponding second representation information according to the object category of the single entity object.
8. The method according to claim 5, characterized in that The method further comprises: According to the entity recognition result, if the user input text does not contain a single entity object, performing perplexity calculation on the user input text to obtain sentence perplexity, where the sentence perplexity represents the fluency of the sentence of the user input text; If the sentence perplexity is greater than the sentence perplexity threshold, obtaining the missing sentences in the user input text; According to the missing sentence, third expression information is generated.
9. The method according to claim 8, characterized in that Obtaining a target processing link according to the expression information includes: A third processing link is obtained according to the third expression information, and the third processing link is used to add a third operation statement for the missing statement.
10. The method according to claim 8, characterized in that The method further comprises: If the sentence perplexity is less than the sentence perplexity threshold, obtaining the fuzzy sentence in the user input text; generating fourth expression information according to the fuzzy sentence; According to the description information, a target processing link is obtained, including: A fourth processing link is obtained according to the fourth expression information, and the fourth processing link is used to add a fourth operation statement for the fuzzy statement.
11. The method according to claim 1, wherein The target processing link is used to add an operation statement to the user input text, and the operation statement includes at least one of the following: a first operation statement, wherein the first operation statement includes at least one of a run instruction statement, an error correction instruction statement, and an interpretation instruction statement for a code statement; a second operation statement, the second operation statement including at least one of a search instruction statement, a creation instruction statement, and an expression instruction statement for a single entity statement; a third operation statement, the third operation statement including at least one of a polishing instruction statement, a rewriting instruction statement, and a continuing instruction statement for the missing sentence; A fourth operation statement includes at least one of a statement instruction statement and a search instruction statement for a fuzzy statement.
12. The method according to claim 1, characterized in that The target processing link includes at least two link nodes, and processing the user input text based on the target processing link to obtain a corresponding optimized text includes: Obtaining the probability weight corresponding to each of the link nodes; A target link node is determined according to the probability weight of each link node, and the user input text is processed based on the target link node to obtain the optimized text.
13. The method according to claim 12, characterized in that The target link nodes include at least two, and the processing of the user input text based on the target link nodes to obtain the optimized text includes: Based on the description information, obtaining the priority weight corresponding to each of the target link nodes; Based on the priority weight corresponding to each target link node, the user input text is processed in sequence to obtain the optimized text.
14. A question-answer text optimization device, characterized in that: include: A detection module, configured to obtain user input text and detect the user input text to obtain expression information, wherein the expression information represents the expression form of the user input text; an optimization module, configured to obtain a target processing link based on the expression information, wherein the target processing link represents at least one content completion step for the user input text having the expression form; A processing module is used to process the user input text based on the target processing link to obtain a corresponding optimized text.
15. An electronic device, characterized in that: include: processor and memory; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the question-answer text optimization method according to any one of claims 1 to 13.
16. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the question-and-answer text optimization method according to any one of claims 1 to 13 is implemented.
17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the question-answer text optimization method according to any one of claims 1 to 13 is implemented.
Citation Information
Patent Citations
Missing semantic supplementing method for multi-round question-answering system
CN105589844A
Wrong sentence detection method and device, and computer readable storage medium
CN110211571A
Text error correction method and device, electronic equipment and readable storage medium
CN112597754A
Text processing method and device, electronic equipment and readable storage medium
CN114417834A
Multi-round question and answer method, device and equipment
CN114547274A