Method, device, electronic device and storage medium for processing reply content
By constructing and adjusting directed acyclic graphs in a task-based dialogue system, the problem of insufficient interrelationship of reply content when the system processes text recognition in different time periods is solved, and more effective reply content generation and information traceability are achieved.
Patent Information
- Application Number
- CN202311120150.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2043-08-31
AI Technical Summary
The existing task-based dialogue system is difficult to effectively process the identification text of different time periods when generating reply content, resulting in insufficient interrelationship of reply content and information traceability.
By obtaining the association categories of the initially recognized text and the text to be identified, and constructing a directed acyclic graph corresponding to the initially and the text to be identified, the second directed acyclic graph corresponding to the text to be identified is determined, thereby realizing the mutual correlation of the reply content.
It realizes adjustments to the recognition text received in different time segments, enhances the interrelationship of reply content, and supports information traceability, improving the ability of task-based dialogue systems to generate reply content.
Smart Images

Figure CN117196035B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of information processing technology, and in particular to a method, device, electronic device and storage medium for processing reply content. Background Art
[0002] The task-based dialogue system can generate appropriate response content to complete the task according to the task proposed by the user. The task-based dialogue system usually includes four modules: natural language understanding module (or NLU module, full name Natural Language Understanding), dialogue management (or DM module, full name Dialogue Management) and natural language generation module (or NLG module, full name Natural Language Generation). The response content can be generated by calling the above modules in sequence. Task-based dialogue systems are widely used in human-computer interaction scenarios. Therefore, how to better build a task-based dialogue system so that it can better generate response content is a technical problem that developers urgently need to solve. Summary of the invention
[0003] The present disclosure proposes a technical solution for processing reply content.
[0004] According to one aspect of the present disclosure, a method for processing reply content is provided, the processing method comprising: obtaining an initial recognition text; wherein the initial recognition text represents an initial reply request; obtaining a first directed acyclic graph corresponding to the initial recognition text; wherein the first directed acyclic graph is used to represent the reply content of the reply request corresponding to the initial recognition text, and is generated by a code sequence corresponding to the initial recognition text; obtaining a text to be recognized; wherein the text to be recognized represents the reply content of a current reply request, and the initial reply request is different from the current reply request; determining a second directed acyclic graph corresponding to the text to be recognized based on an association category between the initial recognition text and the text to be recognized, and the first directed acyclic graph; wherein the second directed acyclic graph is used to represent the reply content of the current reply request.
[0005] In a possible implementation, the association category is a category without a set attribute value, and the second directed acyclic graph corresponding to the text to be recognized is determined based on the association category of the initial recognition text and the text to be recognized, and the first directed acyclic graph, including: matching the association category with each node in the first directed acyclic graph; when any node is matched successfully and the operation corresponding to the text to be recognized is determined to be a reference operation, the attribute value corresponding to the successfully matched node is used as the attribute value corresponding to the association category; wherein the reference operation indicates that the text to be recognized references the initial recognition text; and obtaining the second directed acyclic graph based on the attribute value corresponding to the association category and the first code sequence corresponding to the text to be recognized.
[0006] In a possible implementation, the second directed acyclic graph is obtained according to the attribute values corresponding to the associated categories and the first code sequence corresponding to the text to be identified, including: generating nodes corresponding to each category and each function according to each category and each function in the first code sequence; updating the nodes corresponding to the associated categories according to the attribute values corresponding to the associated categories; and connecting the corresponding nodes in a directed manner as a second directed acyclic graph according to the logical processing order between categories and functions, functions and functions, and categories and categories in the first code sequence; wherein the lines between the nodes in the directed acyclic graph correspond to the input parameters transmitted between the nodes.
[0007] In a possible implementation, the association category is a category with set attribute values, and the second directed acyclic graph corresponding to the text to be recognized is determined based on the association category between the initial recognized text and the text to be recognized, and the first directed acyclic graph, including: matching the association category with each node in the first directed acyclic graph; when the association category successfully matches any node and it is determined that the operation corresponding to the text to be recognized is a modification operation, copying the first directed acyclic graph; wherein the modification operation indicates that the text to be recognized modifies the initial recognized text; and setting the attribute value corresponding to the target node in the copied first directed acyclic graph to the attribute value corresponding to the association category, thereby serving as the second directed acyclic graph.
[0008] In a possible implementation, the association category is a category existing in a code sequence corresponding to the initial recognition text, and the processing method further includes any one of the following: taking the text in the text to be recognized that is identical to a preset field as an association category, inputting the text to be recognized into an association category detection model, and taking the output field as an association category.
[0009] In a possible implementation, matching the association category with each node in the first directed acyclic graph includes: comparing the association category with each node through a preset operator, and when the association category and the target node are the same category, treating the target node as a successfully matched node.
[0010] In a possible implementation, determining the operation corresponding to the text to be recognized includes: inputting the text to be recognized and the initial recognition text into a trained classification model to obtain an operation identifier corresponding to the text to be recognized; wherein the trained classification model is trained by training text and its previous text, and operation identifiers corresponding to the training text; the operation identifier is any one of the following: a reference operation, a modification operation, not a reference operation, not a modification operation, not a reference operation, and a modification operation; and determining the operation corresponding to the text to be recognized based on the operation identifier corresponding to the text to be recognized.
[0011] In a possible implementation, the text to be recognized includes at least one phrase, and the phrase includes at least one entity information; the first code sequence corresponding to the text to be recognized includes: a function corresponding to each phrase in the at least one phrase, and the function corresponding to each phrase includes a category corresponding to each entity information in the phrase.
[0012] In a possible implementation, the processing method further includes: for each function in the first code sequence, determining an instance corresponding to at least one category in the function through an application programming interface corresponding to each function, or corresponding entity information in the text to be identified; wherein the instance is a category with at least one attribute value set; and executing the functions with instances in the first code sequence in sequence to generate reply content for the current reply request.
[0013] In a possible implementation, the category is used to represent the type of entity information in the text, the function is used to represent the operation on the category, and the operator is used to represent the constraint on the category.
[0014] In a possible implementation, the processing method further includes: obtaining a first code sequence corresponding to the text to be recognized based on the text to be recognized and a trained second generation model; wherein the trained second generation model is obtained by training a training text and a training code sequence corresponding to the training text, or by training text and a training translated text corresponding to the training text; the training translated text is used to represent a content description of a training code sequence corresponding to the training text.
[0015] In a possible implementation, the processing method further includes: inputting the text to be recognized and the initial recognized text into a trained first generation model to obtain a second code sequence corresponding to the text to be recognized; wherein the trained first generation model is obtained by training the code sequence corresponding to the training text and its previous text, and the training text updated based on the previous text; the update includes at least one of the following: a text update for referencing the text before the training text, and a text update for modifying the text before the training text; and a second directed acyclic graph is generated based on the second code sequence.
[0016] According to one aspect of the present disclosure, a reply content processing device is provided, the processing device comprising: an initial recognition text acquisition module, used to acquire an initial recognition text; wherein the initial recognition text represents an initial reply request; a graph acquisition module, used to acquire a first directed acyclic graph corresponding to the initial recognition text; wherein the first directed acyclic graph is used to represent the reply content of the reply request corresponding to the initial recognition text, and is generated by a code sequence corresponding to the initial recognition text; a to-be-recognized acquisition module, used to acquire a to-be-recognized text; wherein the to-be-recognized text represents the reply content of a current reply request, and the initial reply request is different from the current reply request; a second directed acyclic graph generation module, used to determine a second directed acyclic graph corresponding to the to-be-recognized text based on an association category between the initial recognition text and the to-be-recognized text, and the first directed acyclic graph; wherein the second directed acyclic graph is used to represent the reply content of the current reply request.
[0017] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
[0018] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor.
[0019] In the disclosed embodiment, the initial recognition text can be obtained, and then the corresponding first directed acyclic graph of the initial recognition text can be obtained, and then the text to be recognized can be obtained, and finally the second directed acyclic graph corresponding to the text to be recognized can be determined based on the association category between the initial recognition text and the text to be recognized, and the first directed acyclic graph. The processing method provided by the disclosed embodiment can realize the adjustment of the recognition text received in different time periods, which is conducive to the mutual correlation of the reply content. In addition, the user's historical intentions are also represented by the first directed acyclic graph, which can realize the traceability of information.
[0020] It should be understood that the above general description and the following detailed description are exemplary and explanatory only and do not limit the present disclosure. Other features and aspects of the present disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used to illustrate the technical solutions of the present disclosure together with the specification.
[0022] Figure 1 A method for processing reply content provided according to an embodiment of the present disclosure is shown.
[0023] Figure 2 A block diagram of a reply content processing device provided according to an embodiment of the present disclosure is shown.
[0024] Figure 3 A block diagram of an electronic device provided according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0025] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0026] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0027] The term "and / or" herein is only a description of the association relationship of the associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can represent including any one or more elements selected from the set consisting of A, B, and C.
[0028] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, methods, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present disclosure.
[0029] See also Figure 1 As shown, Figure 1A method for processing reply content provided according to an embodiment of the present disclosure is shown, and the processing method includes:
[0030] Step S100, obtaining initial recognition text. The initial recognition text represents an initial reply request. The initial recognition text is obtained by converting the voice to be recognized or receiving the electronic device, and is used to represent the initial reply request. In one example, the initial recognition text can be manually input by the user. In another example, step S100 may include: obtaining initial recognition voice. Then converting the initial recognition voice into initial recognition text. The embodiment of the present disclosure may support application scenarios of text input and voice input. The above-mentioned initial recognition text can be obtained by the user's input in the text box in the display interface. The above-mentioned initial recognition voice can be obtained by the voice acquisition device of the electronic device in the relevant technology, and the initial recognition voice can be converted into the initial recognition text by the recognition model and recognition algorithm in the relevant technology, which will not be elaborated in the embodiment of the present disclosure.
[0031] Step S200, obtaining the first directed acyclic graph corresponding to the initial recognition text. Wherein, the first directed acyclic graph is used to represent the reply content of the reply request corresponding to the initial recognition text, and is generated by the code sequence corresponding to the initial recognition text. The code sequence is a sequence of code elements representing the reply request, and the code elements include one or more of categories, functions, and operators. Wherein, the code sequence is a sequence of code elements representing the current reply request, and the code elements include one or more of categories, functions, and operators. In a possible implementation, the text to be recognized includes at least one phrase, and the phrase includes at least one entity information. The code sequence corresponding to the text to be recognized includes: a function corresponding to each phrase in the at least one phrase, and the function corresponding to each phrase includes a category corresponding to each entity information in the phrase. Wherein, the categories corresponding to the same entity information in different phrases are the same, and the functions corresponding to phrases of different texts to be recognized are the same or different. For example: phrase 1 can be "new meeting", phrase 2 can be "change meeting", then the category corresponding to "meeting" can be the same. In addition, different texts to be recognized can also reuse the same function to achieve long-tail representation of a large amount of text information through a small number of code elements. In one example, the category is used to represent the type of entity information in the text, the function is used to represent the operation on the category, and the operator is used to represent the constraints on the category. Exemplarily, the code sequence described in this article may include categories (or classes), functions, and operators. Among them, the category is used to represent the type of entity information in the text, the function is used to represent the operation on the category, and the operator is used to represent the constraints on the category, or in other words, the operator gives the category specific content (such as attribute values) and becomes an instance. Exemplarily, the above categories can be expressed as person category, datetime category, event category, etc., which correspond to the types of entity information that may appear in the text. For example, the attributes of the person category may include: surname, first name, contact number, email address, etc. A specific person instance can be obtained by assigning values to each attribute with operators. For example, surname: Li, first name: Er, contact number: 11111, email address 11.com can be used as a specific person instance, which is equivalent to the entity information in the text.Functions can be expressed as different operations on various categories, for example, calling a person instance (for example, obtaining the contact number 11111 of "Li Er" by accessing the person instance "Li Er", and then calling the call-related API of the electronic device to implement the dialing call to 11111, where the full name of API is Application Programming Interface), obtaining the information of a person instance, obtaining the year of a datatime instance, etc. The developer can set it according to the actual situation. It should be understood that functions can also be nested to form a complex processing logic. It should be understood that the above categories, functions, and operators are pre-set by the developer according to different application scenarios, and the specific composition can be determined by the developer. Here, taking personal schedule management as an example, in this application scenario, the categories may include: Event category, which is used to represent a schedule, and the attributes may include start time, end time, duration, location, meeting theme, etc. Person category, which is used to represent the participants of the schedule, and the attributes may include name, email address, phone number, etc. The DateTime category is used to indicate the start time and end time of a schedule. Its attributes may include year, month, date, hour, minute, etc. (the start time and end time in the Event category can be represented by the DateTime category. In other words, the categories can be nested to achieve multi-level data representation). Duration is used to indicate the duration of a schedule. Its attributes may include the duration in seconds as the unit of measurement (the duration in the Event category can be represented by the Duration category). The Location category is used to indicate the location of a schedule. Its attributes may include the location, location description, etc. (the location in the Event category can be represented by the Location category). In this application scenario, functions may include: CreateEvent function, used to create a schedule. DeleteEvent function, used to delete a schedule. UpdateEvent function, used to update a schedule (for a created schedule). RemindEvent function, used to remind a schedule. Operators may be used to determine the size of a specific parameter value of an instance, determine the type of an attribute in an instance, etc. It should be understood that a function may process a category through an operator to implement the function's function.Exemplarily, the CreateEvent function may include the Event category (only an exemplary statement is made here, and the number of categories that can be called by each function is determined by the developer according to the actual situation), and then through the restriction conditions in the text to be recognized (such as the Constraint [category] function, which can restrict the attribute values of the attributes in the category, or restrict the category to be processed), assign values to the attributes in the Event category (for example: assign values through operators) to obtain a specific Event instance. By combining functions, categories, and operators, the code sequence described above can be obtained. For example: if the text to be recognized is "A regular meeting will be held at 8 o'clock this morning", the attribute value of the start time attribute in the Event instance in the corresponding generated code sequence is restricted to "8 o'clock in the morning", and the attribute value of the meeting topic attribute in the Event instance is restricted to "regular meeting". It should be understood that the attribute value of each attribute corresponding to each category does not necessarily have a specific value. If there is no restriction description of the attribute in the text to be recognized, the attribute value of the attribute can be set to empty. In other words, when the user inputs the text to be recognized, it is not necessary to describe each attribute, that is, "a regular meeting was held at 8 o'clock this morning" does not need to be described as "a regular meeting lasting two hours was held on the eighth floor from 8 o'clock to 10 o'clock this morning", in order to conform to the user's natural language habits, that is, when the user inputs the text to be recognized in the actual scenario, it is not necessary to pay attention to how each instance is specifically constructed. Although the amount of information in the above two statements is different, they can both be expressed as a code sequence to be executed normally. For another example: the text to be recognized is "Is it hot today?", then its corresponding code sequence may include the following functions: IsHot (Is it hot) function, which compares the temperature threshold with the input temperature value to determine whether the input temperature value is cold or hot. The above temperature threshold can be set by the developer according to the actual situation. The temperature value to be input in the IsHot function is obtained through the WeatherQueryApi (weather query API) function. The WeatherQueryApi function is used to call an external API to input a location instance and a time instance, and output a temperature instance (that is, the temperature value mentioned above). The location instance required for the WeatherQueryApi function is obtained through the AtPlace function, and the time instance is obtained through the Today function. The AtPlace function can obtain the location instance mentioned above, for example, the location instance can be the current location of the electronic device. The Today function can obtain the time instance mentioned above, for example, the time instance can be the current time of the electronic device. The location instance and time instance called in the function are the instances corresponding to the location category and time category, and the process of assigning values in the instance is represented by operators.
[0032] The directed acyclic graph is used to represent the reply content corresponding to the text for the reply request. Among them, the associated category is used to represent the category that is associated with the initial recognition text, and the initial recognition text is the text before the text to be recognized. Exemplarily, the above-mentioned directed acyclic graph is composed of a number of nodes connected in a directed manner through a logical processing sequence, and each node corresponds to a function or category. The specific generation method of the associated category is not limited in the embodiment of the present disclosure. In one example, the associated category is a category existing in the code sequence corresponding to the initial recognition text, and the processing method also includes any one of the following: taking the text in the text to be recognized that is the same as the preset field as the associated category, inputting the text to be recognized into the associated category detection model, and taking the output field as the associated category. For example, a regular matching algorithm can be used to take specific text as an associated category when it appears, for example, text such as "that day" or "that place" that refers to the previous text (that is, the reference operation to be described later), or text appearing after the specific text can be taken as an associated category, for example, text such as "modified to" that modifies the previous text (that is, the modification operation to be described later), and the text after "modified to" can be taken as an associated category (such as "modified to 10 o'clock" is an associated category). The associated category in the text to be identified can also be output according to the model (the process of the model outputting the associated category will be described in detail later), and the embodiments of the present disclosure are not limited here.
[0033] Step S300, obtaining the text to be recognized. The text to be recognized can be obtained by converting the voice to be recognized or receiving the electronic device, and is used to represent the current reply request, and the initial reply request is different from the current reply request. In one example, the text to be recognized can be manually input by the user. In another example, step S300 may include: obtaining the voice to be recognized. Then converting the voice to be recognized into the text to be recognized. The embodiment of the present disclosure may support application scenarios of text input and voice input. The above-mentioned text to be recognized can be obtained by the user's input in the text box in the display interface. The above-mentioned voice to be recognized can be obtained by the voice acquisition device of the electronic device in the relevant technology, and the voice to be recognized can be converted into the text to be recognized by the recognition model and recognition algorithm in the relevant technology, and the embodiment of the present disclosure will not be elaborated here.
[0034] Step S400: Determine a second directed acyclic graph corresponding to the text to be recognized based on the association categories of the initial recognized text and the text to be recognized, and the first directed acyclic graph, wherein the second directed acyclic graph is used to represent the reply content of the current reply request.
[0035] In a possible implementation, the processing method may include: obtaining a first code sequence corresponding to the text to be recognized according to the text to be recognized and the trained second generation model. The trained second generation model is obtained by training the training text and the training code sequence corresponding to the training text. In this case, the first code sequence corresponding to the text to be recognized according to the text to be recognized and the trained second generation model may include: inputting the text to be recognized into the trained second generation model to obtain the first code sequence corresponding to the text to be recognized. Exemplarily, the training code sequence corresponding to the training text is obtained by the developer through annotation, and the second generation model is trained based on this to obtain the second generation model that can convert the text to be recognized into a code sequence. It should be understood that the specific model structure, parameter settings, etc. of the above-mentioned second generation model can be determined according to the actual needs of the developer, and the embodiment of the present disclosure is not limited here. Exemplarily, the loss function of the second generation model can also be set by the developer, for example: the loss value can be determined according to the difference between the training code sequence and the predicted first code sequence generated according to the training text, and the second generation model can reduce the loss value as its training goal, and continuously adjust its model parameters to obtain the trained second generation model. The above-mentioned training text may include historical chat information in several actual scenarios, so that the life model can be used to generate a corresponding first code sequence for the text to be recognized in the several actual scenarios.
[0036] In a possible implementation, the trained second generation model is obtained through a training text and a training translated text corresponding to the training text. The training translated text is used to represent the content description of the training code sequence corresponding to the training text. In this case, obtaining the first code sequence corresponding to the text to be recognized based on the text to be recognized and the trained second generation model may include: inputting the text to be recognized into the trained second generation model to obtain the translated text corresponding to the text to be recognized. Then, according to the preset correspondence between the first code sequence and the translated text, the first code sequence corresponding to the translated text is determined as the first code sequence corresponding to the text to be recognized. The training translated text is used to represent the content description of the training code sequence corresponding to the training text. For example: the training text is a human-oriented natural language, the training code sequence is a machine-oriented modular language, and the training translated text is a human-oriented and machine-oriented modular natural language between the two, so as to establish an association between the training text and the first code sequence. Exemplarily, modular natural language can be expressed as translating the functions in the first code sequence into representations in natural language, for example, the training translation text corresponding to the CreateEvent function in the above text is "create a schedule", and the training translation text corresponding to the DeleteEvent function is "delete a schedule". The training text corresponding to the training translation text "create a schedule" can be "meeting", "appointment", etc. Exemplarily, the above correspondence can be set by the developer according to the actual situation, and the corresponding first code sequence can be determined according to the translated text, and the embodiments of the present disclosure are not limited here. In combination with actual scenarios, the naming of functions and classes is usually set by developers and has a certain degree of subjectivity. There are many English abbreviations among them, and the semantic expression ability is poor. In this case, if the second generation model directly predicts the first code sequence, the training difficulty will be higher and the accuracy cannot be guaranteed. Therefore, the embodiment of the present disclosure establishes a correspondence between the training translated text and the training code sequence (the correspondence can also be understood as the correspondence between the translated text and the first code sequence. In addition, the correspondence can be changed according to the actual situation. For example, after the function name changes, it is only necessary to change the original function name in the correspondence to re-establish the correspondence without retraining the second generation model itself, which is more modifiable). The second generation model is trained with the ability of the second generation model to predict the translated text as the training goal. This can not only reduce the training difficulty but also improve the generation accuracy of the first code sequence finally generated.
[0037] In a possible implementation, the association category is a category without a set attribute value, and step S400 may include: matching the association category with each node in the first directed acyclic graph. In one example, matching the association category with each node in the first directed acyclic graph includes: comparing the association category with each node through a preset operator, and when the association category and the target node are of the same category, taking the target node as a successfully matched node. The above-mentioned preset operator may be "=" or "?=" in the related art. When any node is successfully matched and it is determined that the operation corresponding to the text to be recognized is a reference operation, the attribute value corresponding to the successfully matched node is taken as the attribute value corresponding to the association category. Among them, the reference operation indicates that the text to be recognized refers to the initial recognition text. Exemplarily, if the text to be recognized input by the user is "What was the weather like that day", and the initial recognition text is "Going to a meeting on June 2", the association category in the text to be recognized is "that day". If only the text to be identified is referred to, "that day" is only a time category, not a time instance, that is, there is no specific attribute value. In other words, the electronic device cannot obtain the specific date of "that day" (that is, the associated category has no attribute value set, and the operation corresponding to the text to be identified is a reference operation). In this case, a node query of a time category can be performed on the first directed acyclic graph. If a node corresponding to a time category is queried, the attribute value corresponding to the node is used as the attribute value of "that day" in the above text. For example, in the directed acyclic graph corresponding to "going to a meeting on June 2", there may be a node corresponding to "June 2" and a node corresponding to "going to a meeting". In this example, "June 2" is the node corresponding to the time category, so "June 2" can be used as "that day". Exemplarily, the above-mentioned successful matching can be manifested as the associated category being the same as or having a corresponding relationship with the category corresponding to a node. For example: matching can be performed through input parameters between nodes and / or categories corresponding to nodes. For another example: if the associated category is a person category, the nodes in the first directed acyclic graph can be searched until a node corresponding to a person category is searched, and then it is considered to be a successful match. The searched person category is regarded as a category with which the associated category matches successfully, and the attribute value corresponding to the searched person category (which may be the attribute value of the person instance corresponding to the person category) is assigned to the associated category to visualize the associated category and complete the reference operation of the text to be recognized. In another example, in the case of a match failure, a prompt may be generated to inform the user that the attribute values corresponding to some or all of the attributes of the associated category need to be entered. Finally, a second directed acyclic graph is obtained based on the attribute values corresponding to the associated category and the first code sequence corresponding to the text to be recognized.
[0038] In a possible implementation, the second directed acyclic graph is obtained according to the attribute value corresponding to the associated category and the first code sequence corresponding to the text to be identified, including: generating nodes corresponding to each category and each function according to each category and each function in the first code sequence. According to the attribute value corresponding to the associated category, the node corresponding to the associated category is updated. Exemplarily, the above update can be expressed as filling the attribute value corresponding to the associated category into the node corresponding to the associated category. Then, according to the logical processing order between the category and the function, the function and the function, and the category and the category in the first code sequence, the corresponding nodes are connected in a directed manner as the second directed acyclic graph. Among them, the connection between the nodes in the directed acyclic graph corresponds to the input parameters transmitted between the nodes. Exemplarily, the above logical processing order can be determined by the nested relationship between functions and functions, categories and categories, and functions and categories in the code sequence. For example: the Yield (result) function (a function for outputting the result) obtains the cold or hot result through the IsHot function to output the reply content. The IsHot function obtains the table parameter through the WeatherQueryApi function, and obtains the above-mentioned cold or hot result by comparing the temperature value in the table parameter with the temperature threshold. The WeatherQueryApi function obtains the place parameter through the AtPlace function, and obtains the time parameter through the Constraint[DateTime] function. Through the location indicated by the palce parameter, the time indicated by the time parameter, and the weather-related API, a table parameter can be queried. The table parameter is used to indicate the temperature, humidity, air pollution level, and other information of the location at that time. The Constraint[DateTime] function generates a time instance of the time category through the Today function. If the text to be recognized is "Is the weather hot today?", the time instance is "Today". The Atplace function generates a place instance of the place category through the Here function. If the text to be recognized is "Is the weather hot today?", the place instance is the current location of the electronic device, for example: Shanghai. In this example, each function and each category corresponds to a node. Through the directed connection of the above logical processing sequence, a directed acyclic graph corresponding to the code sequence can be obtained. The table parameter, place parameter, and time parameter passed between the above functions are the above input parameters, which drive the functions to generate calculation results in sequence.
[0039] In a possible implementation, the nodes include: a root node, a leaf node, and a common node. Among them, the root node is the node corresponding to the first function in the logical processing sequence, the leaf node is the node corresponding to the last function in the logical processing sequence, and the common node is the other nodes except the root node and the leaf node. Continuing with the above example, the node corresponding to the Yield function in the above example is the first to be called in the logical processing sequence, and the node corresponding to the Yield function is the root node in the above example. The nodes corresponding to the Today function and the Here function are the last to be called in the logical processing sequence, and the Today function and the Here function are both leaf nodes. The nodes corresponding to the IsHot function, the WeatherQueryApi function, the AtPlace function, and the Constraint[DateTmie] function are not the first to be called or the last to be called, that is, the other nodes in the above example. In this case, generating the second directed acyclic graph in step S300 may include: from the root node to the leaf node, calling the function corresponding to each node in turn, and then using the call result corresponding to the leaf node as the result subgraph corresponding to the leaf node. Among them, the result subgraph is used to save the generation process of the attribute value of the category corresponding to the leaf node. Finally, the result subgraph is saved to the directed acyclic graph. Continuing with the above example, the leaf nodes corresponding to the Today function and the Here function need to establish the time instance of "today" according to the time category and the place instance of "Shanghai" according to the place category respectively. The process of obtaining each instance is as follows: establish a category, obtain the specific value of the attribute corresponding to the category, and assign the specific value to the category to obtain the instance corresponding to the category. The embodiment of the present disclosure saves the generation process of the attribute value of the category corresponding to the leaf node as a result subgraph to the directed acyclic graph, which can improve the data storage breadth of the directed acyclic graph and make the functions executed according to the directed acyclic graph traceable.
[0040] In a possible implementation, the association category is a category with set attribute values, and the second directed acyclic graph corresponding to the text to be recognized is determined based on the association category of the initial recognition text and the text to be recognized, and the first directed acyclic graph, including: matching the association category with each node in the first directed acyclic graph; when the association category successfully matches any node and it is determined that the operation corresponding to the text to be recognized is a modification operation, copying the first directed acyclic graph; wherein the modification operation indicates that the text to be recognized modifies the initial recognition text; after setting the attribute value corresponding to the target node in the copied first directed acyclic graph to the attribute value corresponding to the association category, it is used as the second directed acyclic graph. For example: the text to be recognized is "still go to location B" (in this example, "location B" is used as the association category, and is a location category with set attribute values), the initial recognition text is "go to location A today", and the initial recognition text corresponds to a directed acyclic graph a (that is, the target directed acyclic graph described above). Then the directed acyclic graph a is copied to obtain the directed acyclic graph b, and the attribute value of the node corresponding to "Place A" in the directed acyclic graph b (that is, the attribute value corresponding to the target node) is updated to "Place B" as the directed acyclic graph of "Go to Place B". In the case where the operation corresponding to the text to be recognized is a modification operation, the copied directed acyclic graph can be modified by copying in the embodiment of the present disclosure, without changing the directed acyclic graph corresponding to the previous text, so that the modification operation will not cause information loss. For example, the information of "Place A" in the above example will still be retained. When the user enters the new text to be recognized "Forget it, let's go to the next place", the new text to be recognized can still query "Place A" and a directed acyclic graph can be generated based on this. The matching process can be referred to above, and the embodiment of the present disclosure will not be repeated here.
[0041] In a possible implementation, the operation corresponding to the text to be recognized is determined, including: inputting the text to be recognized and the initial recognition text into a trained classification model to obtain an operation identifier corresponding to the text to be recognized. The trained classification model is obtained by training the training text and the text before it, and the operation identifier corresponding to the training text. The operation identifier is any one of the following: a reference operation, a modification operation, not a reference operation, not a modification operation, not a reference operation, and a modification operation. Finally, the operation corresponding to the text to be recognized is determined according to the operation identifier corresponding to the text to be recognized. Exemplarily, the above operation identifier can be obtained by calibration by developers. The disclosed embodiment does not limit the model structure and training method of the above classification model, and the developer can set it according to the actual situation. For example, the training text and the text before it can be input into the classification model to obtain a predicted operation identifier, and the training is carried out by reducing the difference between it and the operation identifier as a training target, so as to obtain the above trained classification model. The disclosed embodiment can determine the operation corresponding to the text to be recognized through the trained classification model to improve the determination accuracy of the operation corresponding to the text to be recognized.
[0042] In a possible implementation, the processing method further includes: inputting the text to be recognized and the initial recognition text into the trained first generation model to obtain a second code sequence corresponding to the text to be recognized. The trained first generation model is obtained by training the training text and its previous text, and the code sequence corresponding to the training text after the training text is updated based on the previous text. The update includes at least one of the following: a text update for a reference operation on the text before the training text, and a text update for a modification operation on the text before the training text. Finally, a second directed acyclic graph is generated according to the second code sequence. The disclosed embodiment does not limit the model structure and training method of the above-mentioned first generation model, and the developer can set it according to the actual situation. For example: the training text and its previous text can be input into the first generation model to obtain a predicted code sequence, and reducing the difference between it and the code sequence corresponding to the updated training text can be used as a training goal for training, so as to obtain the above-mentioned trained first generation model. For example: if the training text is "How is the weather there?", and the text before the training text is "Going to Beijing today", then the code sequence corresponding to the updated training text based on the reference operation of the text before the training text is the code sequence corresponding to "How is the weather in Beijing?", and for another example, if the training text is "No, let's go to Shanghai", and the text before the training text is "Going to Henan today", then the code sequence corresponding to the updated training text based on the modification operation of the text before the training text is the code sequence corresponding to "Going to Shanghai today". The first generation model provided by the disclosed embodiment can directly output the second code sequence after the reference operation or modification operation of the text to be recognized is performed according to the text to be recognized and the initial recognition text in an end-to-end manner, and then according to the second code sequence, a second directed acyclic graph can be obtained (the generation process of the directed acyclic graph can refer to the above), which can reduce the generation complexity of the directed acyclic graph.
[0043] In a possible implementation, the processing method further includes: for each function in the code sequence, determining an instance corresponding to at least one category in the function through the application programming interface corresponding to each function, or the corresponding entity information in the text to be identified. Wherein, the instance is a category with at least one attribute value set. The functions with instances in the code sequence are executed in sequence to generate reply content. Exemplarily, the function with instances can guide the electronic device to accurately perform the corresponding operation so that the function can realize the function predetermined by the developer. For example: "Meeting at 10 o'clock today", the function is a function for creating a meeting, which includes a function for querying the time of "today" (the application programming interface related to time query can be called to generate an instance corresponding to "today" (category is time, attribute values can include year, month, day, hour, etc.), here, "today" is October 13, 2020 as an example, then the function for creating a meeting can realize the function of establishing a meeting at 10 o'clock on October 13, 2020.
[0044] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0045] In addition, the present disclosure also provides electronic devices, computer-readable storage media, and programs, all of which can be used to implement any reply content processing method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to in the corresponding records of the method part and will not be repeated here.
[0046] See also Figure 2 , Figure 2 A block diagram of a reply content processing device provided according to an embodiment of the present disclosure is shown, Figure 2, the processing device 100 includes: an initial recognition text acquisition module 110, used to acquire the initial recognition text; wherein the initial recognition text represents an initial reply request; a graph acquisition module 120, used to acquire the first directed acyclic graph corresponding to the initial recognition text; wherein the first directed acyclic graph is used to represent the reply content of the reply request corresponding to the initial recognition text, and is generated by the code sequence corresponding to the initial recognition text; a to-be-recognized acquisition module 130, used to acquire the to-be-recognized text; wherein the to-be-recognized text represents the reply content of the current reply request, and the initial reply request is different from the current reply request; a second directed acyclic graph generation module 140, used to determine the second directed acyclic graph corresponding to the to-be-recognized text according to the association category between the initial recognition text and the to-be-recognized text, and the first directed acyclic graph; wherein the second directed acyclic graph is used to represent the reply content of the current reply request.
[0047] In a possible implementation, the association category is a category without a set attribute value, and the second directed acyclic graph corresponding to the text to be recognized is determined based on the association category of the initial recognition text and the text to be recognized, and the first directed acyclic graph, including: matching the association category with each node in the first directed acyclic graph; when any node is matched successfully and the operation corresponding to the text to be recognized is determined to be a reference operation, the attribute value corresponding to the successfully matched node is used as the attribute value corresponding to the association category; wherein the reference operation indicates that the text to be recognized references the initial recognition text; and obtaining the second directed acyclic graph based on the attribute value corresponding to the association category and the first code sequence corresponding to the text to be recognized.
[0048] In a possible implementation, the second directed acyclic graph is obtained according to the attribute values corresponding to the associated categories and the first code sequence corresponding to the text to be identified, including: generating nodes corresponding to each category and each function according to each category and each function in the first code sequence; updating the nodes corresponding to the associated categories according to the attribute values corresponding to the associated categories; and connecting the corresponding nodes in a directed manner as a second directed acyclic graph according to the logical processing order between categories and functions, functions and functions, and categories and categories in the first code sequence; wherein the lines between the nodes in the directed acyclic graph correspond to the input parameters transmitted between the nodes.
[0049] In a possible implementation, the association category is a category with set attribute values, and the second directed acyclic graph corresponding to the text to be recognized is determined based on the association category between the initial recognized text and the text to be recognized, and the first directed acyclic graph, including: matching the association category with each node in the first directed acyclic graph; when the association category successfully matches any node and it is determined that the operation corresponding to the text to be recognized is a modification operation, copying the first directed acyclic graph; wherein the modification operation indicates that the text to be recognized modifies the initial recognized text; and setting the attribute value corresponding to the target node in the copied first directed acyclic graph to the attribute value corresponding to the association category, thereby serving as the second directed acyclic graph.
[0050] In one possible implementation, the association category is a category existing in a code sequence corresponding to the initial recognition text, and the processing device is also used to perform any one of the following: using the text in the text to be recognized that is identical to a preset field as an association category, inputting the text to be recognized into an association category detection model, and using the output field as an association category.
[0051] In a possible implementation, matching the association category with each node in the first directed acyclic graph includes: comparing the association category with each node through a preset operator, and when the association category and the target node are the same category, treating the target node as a successfully matched node.
[0052] In a possible implementation, determining the operation corresponding to the text to be recognized includes: inputting the text to be recognized and the initial recognition text into a trained classification model to obtain an operation identifier corresponding to the text to be recognized; wherein the trained classification model is trained by training text and its previous text, and operation identifiers corresponding to the training text; the operation identifier is any one of the following: a reference operation, a modification operation, not a reference operation, not a modification operation, not a reference operation, and a modification operation; and determining the operation corresponding to the text to be recognized based on the operation identifier corresponding to the text to be recognized.
[0053] In a possible implementation, the text to be recognized includes at least one phrase, and the phrase includes at least one entity information; the first code sequence corresponding to the text to be recognized includes: a function corresponding to each phrase in the at least one phrase, and the function corresponding to each phrase includes a category corresponding to each entity information in the phrase.
[0054] In a possible implementation, the processing device is also used to: for each function in the first code sequence, determine an instance corresponding to at least one category in the function through an application programming interface corresponding to each function, or corresponding entity information in the text to be identified; wherein the instance is a category with at least one attribute value set; and execute the functions with instances in the first code sequence in sequence to generate reply content for the current reply request.
[0055] In a possible implementation, the category is used to represent the type of entity information in the text, the function is used to represent the operation on the category, and the operator is used to represent the constraint on the category.
[0056] In a possible implementation, the processing device is also used to: obtain a first code sequence corresponding to the text to be recognized based on the text to be recognized and a trained second generation model; wherein the trained second generation model is obtained by training a training text and a training code sequence corresponding to the training text, or by training text and a training translated text corresponding to the training text; the training translated text is used to represent a content description of a training code sequence corresponding to the training text.
[0057] In a possible implementation, the processing device is also used to: input the text to be recognized and the initial recognition text into a trained first generation model to obtain a second code sequence corresponding to the text to be recognized; wherein the trained first generation model is trained by a code sequence corresponding to a training text and its previous text, and an updated training text based on the previous text; the update includes at least one of the following: a text update for a reference operation on the text before the training text, a text update for a modification operation on the text before the training text; and a second directed acyclic graph is generated based on the second code sequence.
[0058] This method has a specific technical connection with the internal structure of the computer system, and can solve the technical problem of how to improve the hardware computing efficiency or execution effect (including reducing the amount of data storage, reducing the amount of data transmission, increasing the hardware processing speed, etc.), thereby obtaining the technical effect of improving the internal performance of the computer system in accordance with the laws of nature.
[0059] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0060] The embodiment of the present disclosure also provides a computer-readable storage medium on which computer program instructions are stored, and the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0061] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to call the instructions stored in the memory to execute the above method.
[0062] The embodiments of the present disclosure also provide a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0063] The electronic device may be provided as a terminal device, a server, or a device in other forms.
[0064] See also Figure 3 As shown, Figure 3 1 shows a block diagram of an electronic device 1900 provided according to an embodiment of the present disclosure. For example, the electronic device 1900 can be provided as a server or a terminal device. Figure 3 , the electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute instructions to perform the above method.
[0065] The electronic device 1900 may also include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958. The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as a Microsoft Server operating system (Windows Server 2003). TM ), a graphical user interface operating system launched by Apple (Mac OS X TM ), a multi-user, multi-process computer operating system (Unix TM ), a free and open source Unix-like operating system (Linux TM ), an open source Unix-like operating system (FreeBSD TM ) or similar.
[0066] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions, which can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0067] The present disclosure may be a system, a method and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0068] Computer readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. Computer readable storage medium can be, for example, (but not limited to) an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (non-exhaustive list) of computer readable storage medium include: 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), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, for example, a punch card or a convex structure in a groove on which instructions are stored, and any suitable combination thereof. The computer readable storage medium used here is not interpreted as a transient signal itself, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagated by a waveguide or other transmission medium (for example, a light pulse by an optical fiber cable), or an electrical signal transmitted by a wire.
[0069] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0070] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of 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., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0071] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0072] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0073] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0074] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0075] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK) and the like.
[0076] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0077] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0078] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
[0079] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. A method for processing reply content, characterized in that: The processing method comprises: Acquire an initial recognition text; wherein the initial recognition text represents an initial reply request; Obtain a first directed acyclic graph corresponding to the initial recognition text; wherein the first directed acyclic graph is used to represent the reply content of the reply request corresponding to the initial recognition text, and is generated by a code sequence corresponding to the initial recognition text, the first directed acyclic graph is formed by directed connections in a logical processing sequence, each node of the first directed acyclic graph corresponds to a function or a category, the lines between the nodes correspond to input parameters transmitted between the nodes, and the logical processing sequence is the logical processing sequence between categories and functions, functions and functions, and categories and categories in the code sequence; Acquire a text to be recognized; wherein the text to be recognized represents a current reply request, and the initial reply request is different from the current reply request; According to the association categories of the initial recognition text and the text to be recognized, and the first directed acyclic graph, a second directed acyclic graph corresponding to the text to be recognized is determined; wherein the second directed acyclic graph is used to represent the reply content of the current reply request.
2. The processing method according to claim 1, characterized in that: The associated category is a category without a set attribute value, and determining the second directed acyclic graph corresponding to the text to be recognized based on the associated category of the initial recognized text and the text to be recognized, and the first directed acyclic graph, includes: matching the association category with each node in the first directed acyclic graph; When any node is successfully matched and it is determined that the operation corresponding to the text to be recognized is a reference operation, the attribute value corresponding to the successfully matched node is used as the attribute value corresponding to the associated category; wherein the reference operation indicates that the text to be recognized refers to the initial recognition text; A second directed acyclic graph is obtained according to the attribute value corresponding to the association category and the first code sequence corresponding to the text to be recognized.
3. The processing method according to claim 2, characterized in that: The step of obtaining a second directed acyclic graph according to the attribute value corresponding to the association category and the first code sequence corresponding to the text to be recognized includes: According to each category and each function in the first code sequence, generate a node corresponding to each category and a node corresponding to each function; According to the attribute value corresponding to the association category, updating the node corresponding to the association category; According to the logical processing order between categories and functions, functions and functions, and categories and categories in the first code sequence, the corresponding nodes are connected in a directed manner as a second directed acyclic graph; wherein the connections between the nodes in the directed acyclic graph correspond to input parameters transmitted between the nodes.
4. The processing method according to claim 1, characterized in that: The associated category is a category with a set attribute value, and determining the second directed acyclic graph corresponding to the text to be recognized based on the associated category of the initial recognized text and the text to be recognized, and the first directed acyclic graph, includes: matching the association category with each node in the first directed acyclic graph; When the association category successfully matches any node and it is determined that the operation corresponding to the text to be recognized is a modification operation, copying the first directed acyclic graph; wherein the modification operation indicates that the text to be recognized modifies the initial recognition text; After setting the attribute value corresponding to the target node in the copied first directed acyclic graph to the attribute value corresponding to the association category, the second directed acyclic graph is obtained.
5. The processing method according to claim 1, characterized in that: The associated category is a category existing in the code sequence corresponding to the initial recognition text, and the processing method further includes any one of the following: The text to be recognized that is identical to the preset field is used as the associated category, the text to be recognized is input into the associated category detection model, and the output field is used as the associated category.
6. The processing method according to claim 2 or 4, characterized in that: The matching of the association category with each node in the first directed acyclic graph includes: comparing the association category with each node through a preset operator, and when the association category and the target node are the same category, taking the target node as a successfully matched node.
7. The processing method according to claim 2 or 4, characterized in that: The operation of determining the text to be recognized corresponding to comprises: Input the text to be recognized and the initial recognition text into the trained classification model to obtain the operation identifier corresponding to the text to be recognized; wherein the trained classification model is trained by the training text and its previous text, and the operation identifier corresponding to the training text; the operation identifier is any one of the following: a reference operation, a modification operation, not a reference operation, not a modification operation, not a reference operation, and a modification operation; The operation corresponding to the text to be recognized is determined according to the operation identifier corresponding to the text to be recognized.
8. The processing method according to claim 1, characterized in that: The text to be recognized includes at least one phrase, and the phrase includes at least one entity information; the first code sequence corresponding to the text to be recognized includes: a function corresponding to each phrase in the at least one phrase, and the function corresponding to each phrase includes a category corresponding to each entity information in the phrase.
9. The processing method according to claim 2, characterized in that: The processing method also includes: For each function in the first code sequence, determine an instance corresponding to at least one category in the function through an application programming interface corresponding to each function or corresponding entity information in the text to be recognized; wherein the instance is a category with at least one attribute value set; The functions with instances in the first code sequence are executed in sequence to generate reply content for the current reply request.
10. The processing method according to claim 1, characterized in that: The code sequence is a sequence of reply requests represented by code elements, and the code elements include one or more of categories, functions, and operators. The category is used to represent the type of entity information in the text, the function is used to represent the operation on the category, and the operator is used to represent the constraint on the category.
11. The processing method according to claim 1, characterized in that: The processing method also includes: obtaining a first code sequence corresponding to the text to be recognized based on the text to be recognized and a trained second generation model; wherein the trained second generation model is obtained by training a training text and a training code sequence corresponding to the training text, or by training a training translated text corresponding to the training text; the training translated text is used to represent a content description of a training code sequence corresponding to the training text.
12. The processing method according to claim 1, characterized in that: The processing method also includes: The text to be recognized and the initial recognition text are input into the trained first generation model to obtain a second code sequence corresponding to the text to be recognized; wherein the trained first generation model is trained by the code sequence corresponding to the training text and its previous text, and the training text updated based on the previous text; the updating includes at least one of the following: text update for citing the text before the training text, and text update for modifying the text before the training text; A second directed acyclic graph is generated according to the second code sequence.
13. A reply content processing device, characterized in that: The processing device comprises: An initial recognition text acquisition module, used to acquire an initial recognition text; wherein the initial recognition text represents an initial reply request; A graph acquisition module, used for acquiring a first directed acyclic graph corresponding to the initial recognition text; wherein the first directed acyclic graph is used for representing the reply content of the reply request corresponding to the initial recognition text, and is generated by a code sequence corresponding to the initial recognition text, the first directed acyclic graph is formed by directed connection in a logical processing sequence, each node of the first directed acyclic graph corresponds to a function or a category, the connection between the nodes corresponds to the input parameters transmitted between the nodes, and the logical processing sequence is the logical processing sequence between category and function, function and function, and category and category in the code sequence; A module for obtaining text to be recognized, used for obtaining text to be recognized; wherein the text to be recognized represents a current reply request, and the initial reply request is different from the current reply request; A second directed acyclic graph generation module is used to determine a second directed acyclic graph corresponding to the text to be recognized based on the association category between the initial recognition text and the text to be recognized, and the first directed acyclic graph; wherein the second directed acyclic graph is used to represent the reply content of the current reply request.
14. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to call the instructions stored in the memory to execute the reply content processing method described in any one of claims 1 to 12.
15. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method for processing reply content described in any one of claims 1 to 12 is implemented.
Citation Information
Patent Citations
Text processing method and device
CN115934904A
Response text generation method and device, communication equipment and storage medium
CN116644170A