Data processing method and device, electronic equipment, storage medium and program product
By searching and classifying the semantic logical relationship of the first object in the conversation text, the problem of insufficient information mining in the existing technology is solved, and the communication adaptability and customer experience of the language model are improved.
Patent Information
- Application Number
- CN202510698534.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-23
AI Technical Summary
Existing technologies find it difficult to extract sufficiently rich information from conversation texts, which makes it difficult for language models to adapt to diverse customer needs in natural language communication, resulting in a poor customer experience.
By searching for two first texts of the first object according to the conversation order of the conversation texts and classifying their semantic logical relationships, the semantic logical relationships are determined to mine richer information.
This improves the language model’s understanding of customers’ true attitudes, enhancing communication diversity and customer experience.
Smart Images

Figure CN120687612A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a data processing method, device, electronic device, storage medium and program product. Background Art
[0002] With the development of AI (Artificial Intelligence) technology, the application of large language models is becoming increasingly widespread. Large language models are a type of natural language processing model based on deep learning that can understand and generate human language.
[0003] In some service scenarios, large language models can provide technical support for the natural language communication capabilities of robot agents. The text of conversations between customers and robot agents can contain a wealth of information, which can serve as a reference for subsequent communication. Therefore, the question of how to extract richer information from conversational texts is gaining increasing attention. Summary of the Invention
[0004] The embodiments of the present application provide a data processing method, device, electronic device, storage medium and program product, which can mine richer information from conversation text.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, comprising: Searching for two first texts of the first object according to a dialog sequence between the first object and the second object, wherein the second text of the second object is included between the two first texts; The semantic logical relationship between the two first texts is classified to obtain a classification result.
[0006] In a second aspect, an embodiment of the present application provides a question-answering processing method, including: The fourth text of the third object and the generated dialogue text between the third object and the fourth object are input into the second model to obtain a fifth text in response to the fourth text; the second model is trained based on the classification results of two sample texts of the first object in the dialogue text between the first object and the second object, and the classification results are determined by the data processing method as described in the first aspect.
[0007] In a third aspect, an embodiment of the present application provides a data processing device, including: a search unit, configured to search for two first texts of the first object according to a dialogue order between the dialogue texts of the first object and the second object, wherein the second text of the second object is included between the two first texts; The classification unit is used to classify the semantic logical relationship between the two first texts to obtain a classification result.
[0008] In a fourth aspect, an embodiment of the present application provides a question-and-answer processing device, comprising: An input unit is used to input the fourth text of the third object and the generated dialogue text between the third object and the fourth object into a second model to obtain a fifth text in response to the fourth text; the second model is trained based on the classification results of two sample texts of the first object in the dialogue text between the first object and the second object, and the classification results are determined by the data processing method as described in the first aspect.
[0009] In a fifth aspect, an embodiment of the present application provides an electronic device comprising: a processor; and a memory configured to store computer-executable instructions, wherein when the computer-executable instructions are executed, the processor executes the data processing method as described in the first aspect or the question-and-answer processing method as described in the second aspect.
[0010] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium for storing computer-executable instructions, which, when executed by a processor, implement the data processing method as described in the first aspect or the question-and-answer processing method as described in the second aspect.
[0011] In the seventh aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the data processing method described in the first aspect or the question-and-answer processing method described in the second aspect.
[0012] As can be seen, in this embodiment of the present application, first, based on the conversation order of the first and second objects, two first texts of the first object are searched, wherein the second text of the second object is included between the two first texts; then, the semantic logical relationship between the two first texts is classified to obtain a classification result. It can be seen that in this embodiment of the present application, by searching the two first texts of the first object, the first texts that respectively precede and follow the second text in the conversation text can be determined. Considering that the semantic logical relationship between the first texts may reflect the first object's true attitude towards the second object's second text, by classifying the semantic logical relationship between the first texts, richer information can be mined from the conversation text. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments described in this specification. Those skilled in the art can also derive other drawings based on these drawings without inventive work. Figure 1 A schematic diagram of an implementation environment of a data processing method provided in an embodiment of the present application; Figure 2 A processing flow chart of a data processing method provided in an embodiment of the present application; Figure 3 A processing flow chart of another data processing method provided in an embodiment of the present application; Figure 4 A processing flow chart of a question-and-answer processing method provided in an embodiment of the present application; Figure 5 A schematic diagram of a data processing device provided in an embodiment of the present application; Figure 6 A schematic diagram of a question-and-answer processing device provided in an embodiment of the present application; Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0014] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0015] In the text generation process, historical conversation data can serve as contextual information to provide reference for text generation. Therefore, the amount of information mined from historical conversation data may affect the quality of text generation.
[0016] For example, in some service scenarios, customers may not directly express dissatisfaction with agents, but their true attitude is often reflected in the conversation. Mining historical conversation data can help train language models to learn responses from these conversations. However, if the amount of information mined is too limited, the language model may only learn superficial responses, making it difficult to adapt to the diverse natural language communication process, resulting in a poor customer experience.
[0017] Therefore, in order to solve the above problems, an embodiment of the present application provides a data processing method.
[0018] The data processing method provided in one or more embodiments of this specification may be applicable to an implementation environment of the data processing method, which implementation environment at least includes a server 101 for data processing.
[0019] The server 101 may be a single server, or a server cluster consisting of several servers, or one or more cloud servers in a cloud computing platform for data processing.
[0020] In this implementation, during data processing, server 101 first searches for two first texts of the first object based on the order of the conversation between the first and second objects, where the second text of the second object is included between the two first texts. Then, the semantic logical relationship between the two first texts is classified to obtain a classification result. This shows that, in this embodiment of the present application, by searching for the two first texts of the first object, the first texts that are located before and after the second text, respectively, can be determined in the conversation text. Considering that the semantic logical relationship between the first texts may reflect the first object's true attitude toward the second text of the second object, by classifying the semantic logical relationship between the first texts, richer information can be mined from the conversation text.
[0021] Figure 2 A processing flow chart of a data processing method provided in an embodiment of the present application. Figure 2 The data processing method provided in this embodiment specifically includes steps S202 to S204.
[0022] Step S202 : searching for two first texts of the first object according to the dialog sequence of the dialog texts of the first object and the second object, wherein the second text of the second object is included between the two first texts.
[0023] The first object and the second object can be two different participants in the same conversation. The first object can be any user, a robot with natural language capabilities, or any other entity with natural language capabilities, such as a virtual assistant, smart home device, or digital human. The second object can be any user, a robot with natural language capabilities, or any other entity with natural language capabilities.
[0024] The natural language capabilities of the above-mentioned robots with natural language capabilities and any other entities with natural language capabilities can be supported by a large language model.
[0025] The use of ordinal numbers such as "first" and "second" in the embodiments of this application is to facilitate the distinction between different features and has no actual meaning, so they will not be repeated below.
[0026] The dialogue text between the first object and the second object consists of the text of the first object and the text of the second object, that is, in the dialogue text, the speaking object of a part of the text is the first object, and the speaking object of another part of the text is the second object, and the first object and the second object speak alternately.
[0027] For example, in a recommendation scenario, the first subject is customer A, and the second subject is agent B, which is a robot agent or a human agent. Conversation text 1 includes: Customer A: Are there any low-interest products you can recommend to me? Agent B: Product recommendation script for X1. Product recommendation script for X2. Product recommendation script for X3.
[0028] Customer A: These aren't very good. Any other recommendations? Ideally, one with a discount, but even if it's not on sale, a free gift is fine.
[0029] Agent B: Recommendation script for product Y.
[0030] For another example, in a complaint scenario, the first subject is robot agent C, and the second subject is customer D. Conversation text 2 includes: Robot Agent C: We're in the queue. XX people remaining. Hello, how can I help you? Customer D: Your product A is of poor quality. I want to complain. It clearly says "XXXX" on the product page, but it broke after just two uses.
[0031] Robot Agent C: Hello, could you please provide the order number?
[0032] Customer D: Order number 0000000.
[0033] Robot Agent C: OK, please wait, I will verify it for you.
[0034] The text of a conversation between a first object and a second object can be considered a paragraph consisting of one or more texts from the first object and one or more texts from the second object. The order of the conversation between the first and second objects refers to the order in which the texts from the first object and the second object are arranged within the paragraph. For example, in conversation text 1, the texts from the first object include A1, A2, A3, and A4, and the texts from the second object include B1, B2, and B3. The order of conversation in conversation text 1 is as follows: A1—>B1—>A2—>B2—>A3—>B3—>A4.
[0035] The above-mentioned conversation order can be determined by the chronological order of the texts of the first subject and the second subject. For example, the first subject enters A1 in the chat interface. The second subject sees A1 and then responds to the first subject with B1. The first subject sees B1 and then enters A2. In chronological order, A1 comes before B1, which in turn comes before A2.
[0036] A text in the first object can include one or more sentences, and a text in the second object can include one or more sentences. For example, the dialogue sequence of dialogue text 2 is as follows: A1->B1->A2. A1 includes two sentences: S1 and S2, B1 includes one sentence: S3, and A2 includes three sentences: S4, S5, and S6. The dialogue sequence of dialogue text 2 can also be expressed as follows: S1S2->S3->S4S5S6.
[0037] Searching for the two first texts of the first object according to the dialogue order of the dialogue text of the first object and the second object can be based on the dialogue order of the dialogue text of the first object and the second object, or by determining the arrangement numbers of the respective texts of the first object and the second object in the dialogue text according to the dialogue order, and selecting the two first texts of the first object according to the arrangement numbers.
[0038] For example, a conversation text may be composed of the following texts: text 1, text 2, text 3, text 4, and text 5. Among them, text 1, text 3, and text 5 are all texts of the first object, and text 2 and text 4 are both texts of the second object. The conversation order of the conversation text is as follows: text 1 -> text 2 -> text 3 -> text 4 -> text 5. Based on this conversation order, it can be determined that the arrangement number of text 1 in the conversation text is "1", the arrangement number of text 2 in the conversation text is "2", ..., and the arrangement number of text 5 in the conversation text is "5". According to the arrangement number, the two first texts of the first object are selected: text 1 and text 3, and the text 2 of the second object is included between text 1 and text 3. According to the arrangement number, the two first texts of the first object are selected: text 3 and text 5, and the text 4 of the second object is included between text 3 and text 5.
[0039] In the above-mentioned step S202, the second text of the second object is included between the two first texts. In this embodiment, the speaking object of the first text is the first object, and the speaking object of the second text is the second object. When there are multiple second texts, for any second text, the first text corresponding to the second text includes: the text whose speaking object is the first object, adjacent to the second text and located before the second text, and the text whose speaking object is the first object, adjacent to the second text and located after the second text. That is, for any second text, the second text corresponds to two first texts, one of which is located before the second text, and the other is located after the second text. A first text may include one or more sentences, and a second text may include one or more sentences.
[0040] For example, a conversation text consists of multiple texts as follows: first text 1, second text 1, first text 2, second text 2, etc. The first text 1 and first text 2 are addressed to the first object, and the second text 1 and second text 2 are addressed to the second object. Thus, the two first texts of the first object are: first text 1 and first text 2, and the second text 1 of the second object is included between first text 1 and first text 2.
[0041] For the second text 1, the first text corresponding to the second text 1 includes: the first text 1 whose speaking object is the first object, adjacent to the second text 1 and located before the second text 1, and the first text 2 whose speaking object is the first object, adjacent to the second text 1 and located after the second text 1.
[0042] To search for two first texts of a first object according to the dialogue order of the dialogue text between the first object and the second object, the method may be to first determine a second text of the second object in the dialogue text, and then select the text of the first object that is adjacent to and before the second text in the dialogue text according to the dialogue order of the dialogue text between the first object and the second object and the second text, and select the text of the first object that is adjacent to and after the second text in the dialogue text according to the dialogue order of the dialogue text between the first object and the second object and the second text, and use the selected text as the first text.
[0043] For example, a conversation text can consist of the following texts: Text 1, Text 2, Text 3, Text 4, Text 5, and Text 6. The speaker for Text 1 is the first object, the speaker for Text 2 is the second object, the speaker for Text 3 is the first object, the speaker for Text 4 is the second object, the speaker for Text 5 is the first object, and the speaker for Text 6 is the second object. The conversation order of the conversation text is as follows: Text 1 -> Text 2 -> Text 3 -> Text 4 -> Text 5 -> Text 6.
[0044] The second text for determining the second object in the dialogue text includes: text 2 , text 4 , and text 6 .
[0045] For Text 2, based on the aforementioned conversation order of the conversation text and Text 2, the text of the first object adjacent to and preceding Text 2 can be selected from the conversation text: Text 1. Furthermore, based on the aforementioned conversation order of the conversation text and Text 2, the text of the first object adjacent to and following Text 2 can be selected from the conversation text: Text 3. The selected Text 1 and Text 3 are regarded as the two first texts of the first object, with Text 2 of the second object included between the two first texts.
[0046] With respect to Text 4, based on the aforementioned conversation order of the conversation text and Text 4, we can select Text 3, a first object text adjacent to and preceding Text 4 within the conversation text. Furthermore, based on the aforementioned conversation order of the conversation text and Text 4, we can select Text 5, a first object text adjacent to and following Text 4 within the conversation text. The selected Texts 3 and 5 are considered the two first texts of the first object, with Text 4 of the second object located between them.
[0047] Considering that there is no text of the first object adjacent to and after the text 6 in the dialogue text, processing of the text 6 may be skipped.
[0048] The two first texts of the first object can be searched according to the dialogue order of the dialogue text between the first object and the second object. Alternatively, a text of the first object can be first determined in the dialogue text, and then another text of the first object can be selected in the dialogue text according to the dialogue order of the dialogue text between the first object and the second object and the one text of the first object, with the second text of the second object being included between the one text of the first object and the selected another text.
[0049] For example, a conversation text can consist of the following texts: Text 1, Text 2, Text 3, Text 4, Text 5, and Text 6. The speaker for Text 1 is the first object, the speaker for Text 2 is the second object, the speaker for Text 3 is the first object, the speaker for Text 4 is the second object, the speaker for Text 5 is the first object, and the speaker for Text 6 is the second object. The conversation order of the conversation text is as follows: Text 1 -> Text 2 -> Text 3 -> Text 4 -> Text 5 -> Text 6.
[0050] A text of the first object is determined in the dialogue text: text 1. Based on the dialogue sequence of the dialogue text and text 1, another text of the first object is selected in the dialogue text: text 3. Text 2 of the second object is included between text 1 and text 3.
[0051] In addition, in the above step S202, the "two first texts" in "searching for the two first texts of the first object" can be understood as illustrative of the processing method of the dialogue text using the "two first texts" as an example. For example, the dialogue order of the dialogue text is as follows: Text 1 -> Text 2 -> Text 3 -> Text 4 -> Text 5 -> Text 6 -> Text 7. According to the dialogue order of the dialogue text between the first object and the second object, the two first texts of the first object are searched, and the results are: Text 1 and Text 3. According to the dialogue order of the dialogue text between the first object and the second object, the two first texts of the first object are searched, and the results are: Text 3 and Text 5. According to the dialogue order of the dialogue text between the first object and the second object, the two first texts of the first object are searched, and the results are: Text 5 and Text 7.
[0052] That is, when the number of texts of the first object in the dialogue text is equal to two, step S202 is executed once to obtain the "two first texts of the first object"; when the number of texts of the first object in the dialogue text is greater than two, step S202 is executed multiple times to obtain the "two first texts of the first object" multiple times. The number of executions of step S202 can be determined by the number of texts of the first object in the dialogue text. For example, if the number of texts of the first object in the dialogue text is N, step S202 can be executed (N-1) times, where N is an integer greater than 2.
[0053] In some implementations, after step S202 is executed, a text set of the first object may be determined based on the two first texts of the first object.
[0054] Determining the text set of the first object based on the two first texts of the first object may involve combining the two first texts to obtain a text set of the first object. Considering that the "two first texts of the first object" may be obtained multiple times when step S202 is performed multiple times, determining the text set allows the "two first texts of the first object" obtained each time step S202 is performed to be grouped together, thereby avoiding mixing the various first texts of the first object together and causing interference in subsequent classification steps.
[0055] Step S204: classify the semantic logical relationship between the two first texts to obtain a classification result.
[0056] Semantic-logical relationships refer to the way words, sentences, or paragraphs in a language are connected based on meaning and logic. They determine how a text expresses coherent ideas in an implicit or explicit way.
[0057] The classification result is used to represent the semantic logical relationship between the two first texts of the first object. For example, the classification result can be one of the following multiple preset relationships: a restatement relationship, a supplementary relationship, a process dependency relationship, a transition relationship, and an irrelevant relationship, etc.
[0058] Taking the first text as question text / answer text as an example, each preset relationship is exemplarily explained: (a1) The two first texts of the first object are: question text A1 and question text B1. The classification result is a restatement relationship, which can be understood as question text B1 is a restatement of the previous question text A1.
[0059] For example, question text A1 is: Is there any product with low interest that you can recommend to me? Question text B1 is: Are there any products with lower interest rates? Alternatively, the two first texts of the first object are: reply text A1' and reply text B1'. The classification result is a repetition relationship, which can be understood as the reply text B1' is a restatement of the previous reply text A1'.
[0060] For example, the reply text A1' is: The discount information of activity A is XXX.
[0061] The reply text B1' is: The discount of Activity A can be given to XXX.
[0062] (a2) The two first texts of the first object are Question Text A2 and Question Text B2. The classification result is a supplementary relationship, which means that Question Text B2 provides additional details based on Question Text A2. Question Text B2 can be considered as a follow-up to the answer of Question Text A2.
[0063] For example, question text A2 is: Is there any event with great discounts that you can recommend to me? Question B2 in the text is: Is this activity online or offline? Alternatively, the two first texts of the first object are: reply text A2' and reply text B2'. The classification result is a supplementary relationship, which means that reply text B2' provides additional detailed information based on reply text A2'. Reply text B2' can be considered as continuing reply text A2' and providing more details.
[0064] For example, the reply text A2' is: Based on the demand you just raised, it is recommended that you purchase product A.
[0065] Reply text B2' is: Compared with similar products, product A has the following advantages: XXXXXX.
[0066] (a3) The two first texts of the first object are: question text A3 and question text B3. The classification result is a process dependency relationship, which can be understood as question text A3 and question text B3 describing the previous and next steps.
[0067] For example, the text of question A3 is: What preparations do I need to make for the first part of activity A? Question text B3 is: Okay, so what do I need to do in the second step? Alternatively, the two first texts of the first object are: reply text A3' and reply text B3'. The classification result is a process dependency relationship, which can be understood as reply text A3' and reply text B3' describing the previous and next steps.
[0068] For example, the reply text A3' is: Step 1, please enter your user name and password and confirm.
[0069] Reply text B3' is: Step 2, please click on the reservation button on the event page.
[0070] (a4) The two first texts of the first object are: question text A4 and question text B4. The classification result is a transition relationship, which can be understood as question text B4 pointing out a situation that is different from the previous question text A4.
[0071] For example, question text A4 is: I want a large-capacity product B, do you have any recommendations? Question Text B4: The capacity is similar, but the price is too expensive. Is there a cheaper one? Alternatively, the two first texts of the first object are: reply text A4' and reply text B4'. The classification result is a transition relationship, which can be understood as the reply text B4' points out a situation different from the previous reply text A4'.
[0072] For example, the reply text A4' is: This product has excellent quality, good reviews, and is very popular.
[0073] Reply text B4' is: However, the price of this product is a bit high. For users who are looking for cost-effectiveness, there may be better options.
[0074] (a5) The two first texts of the first object are: question text A5 and question text B5. The classification result is irrelevant, which can be understood as question text B5 has no direct relationship with the previous question text A5.
[0075] For example, question text A5 is: Is there any recent event you can recommend to me? Question text B5 is: Why is the product B that I bought before taken off the shelves? Alternatively, the two first texts of the first object are: reply text A5' and reply text B5'. The classification result is irrelevant, which can be understood as that reply text B5' has no direct relationship with the previous reply text A5'.
[0076] For example, the reply text A5' is: Product C is currently participating in a discount event. Please refer to the product page for the specific discount.
[0077] The reply text B5' is: The product B you are interested in is sold out.
[0078] The preset relationships listed above are merely exemplary. In actual applications, each preset relationship can be configured in combination with specific scenarios.
[0079] The semantic logical relationship between the two first texts is classified to obtain a classification result. The two first texts may be input into a pre-trained classification model to classify the semantic logical relationship between the two first texts to obtain a classification result.
[0080] The above-mentioned pre-trained classification model can be a pre-trained language model, a logistic regression model, a naive Bayes model, or any other model with a classification function.
[0081] The following is an example of the role of the classification results in this embodiment using a service scenario: Considering that during the communication between the customer and the robot agent, the customer's feedback on the robot agent's response may be relatively implicit. For example, the customer does not clearly express whether he is satisfied with the robot agent's response, but continues to ask another question. In this case, the customer's true attitude can be indirectly determined by determining the semantic logical relationship between the customer's two previous and subsequent texts. This is conducive to the robot agent providing customers with better responses in subsequent communications. For example, repeatedly expressing similar needs may be because the customer is dissatisfied with the robot agent's previous response. Asking for details on the response to the previous question can be regarded as the customer's interest in the robot agent's response, and so on.
[0082] In the process of classifying the semantic logical relationship between the two first texts and obtaining the classification result, one or more of the following classification methods may be used: (b1) Semantic matching and sentiment contrast The first text is encoded using a large language model pre-trained with BERT, combining the following features: Semantic features: Calculate the similarity score between two first texts based on sentence vector or token level comparison.
[0083] Sentiment features: For example, the two first texts of a first object include first text 1 and first text 2, and between first text 1 and first text 2 is second text 1 of a second object. The sentiment classification model extracts the sentiment difference between second text 1 and first text 2. If first text 2 has a negative sentiment and second text 1 has a positive sentiment, it indicates an oppositional relationship between first text 1 and first text 2. If first text 1 is a question text, second text 1 is a response text to the question text.
[0084] It should be emphasized that here the relationship between the first text 1 and the first text 2 is determined by the emotional difference between the first text 2 and the second text 1, rather than the relationship between the first text 1 and the first text 2. This is because the first text 2 is a new text proposed by the first object based on the reception of the second text 1, so the first text 2 can indirectly reflect the first object's true attitude towards the second text 1.
[0085] (b2) Contextual logic analysis Combined with the continuity judgment in the conversation: For example, the two first texts of the first object include first text 1 and first text 2, and the second text 1 of the second object is included between first text 1 and first text 2. If the first text 2 directly quotes an entity or attribute in the second text 1 and expands it, it can be preliminarily determined to be a complementary relationship. If the first text 2 uses negative words for the key points in the second text 1, such as "not", "no", "useless", etc., the classification result can be determined to be an opposition relationship.
[0086] (b3) Time and business attribute filtering Features that are sensitive to business scenarios, such as the timeliness of promotional activities, are verified, and a classification result of the semantic logical relationship between the two first texts of the first object is determined based on the verification result.
[0087] The classification methods shown in (b1) to (b3) above are merely exemplary.
[0088] In a specific implementation method, the semantic logical relationship between two first texts is classified to obtain a classification result, including: extracting information from the first texts to obtain triples of the first texts; processing the triples of the two first texts to obtain a first result; and classifying the semantic logical relationship between the two first texts based on the first result to obtain a classification result.
[0089] Information extraction is an important task in natural language processing, which aims to extract specific and meaningful information from unstructured or semi-structured text and convert it into structured data.
[0090] By performing information extraction on each first text, a triple of each first text can be obtained. For example, the triple is (entity, relationship, entity).
[0091] An entity is something with independent existence and meaning. It can be a concrete object such as a person, a book, or a car, or an abstract concept such as an emotion, an event, or an organization. A relationship describes a connection or association between entities and defines a specific semantic connection between two entities.
[0092] For example, the first text 1 of the first object is: "What is the profit of Product A?" Information extraction on the first text 1 yields the triple (product A, profit, profit value). The first text 2 of the first object is: "What are the processing conditions for Product A?" Information extraction on the first text 2 yields the triple (product A, processing conditions, condition details).
[0093] In a specific implementation method, the triples of two first texts are processed to obtain a first result, including at least one of the following: comparing entities in the triples of the two first texts to obtain the first result; performing semantic logical processing on the entity relationship in the triples of the two first texts to obtain the first result; analyzing the syntactic relationship of the first text based on the triples of the first text to obtain the first result.
[0094] Comparing entities in triples of two first texts to obtain a first result, which can represent an entity comparison result. For example, the two first texts of the first object include first text 1 and first text 2, the triple of first text 1 is (entity A, relationship 1, entity B), and the triple of first text 2 is (entity C, relationship 2, entity D). Comparing whether entity A and entity C are identical, whether entity B and entity C are identical, whether entity A and entity D are identical, and whether entity B and entity D are identical, to obtain the first result.
[0095] By comparing entities within triples, we can determine whether there is entity overlap between triples in two different first texts. Entity overlap is an important basis for determining relationships between triples and is commonly used in tasks such as knowledge graph construction, information extraction, and semantic analysis. Entity overlap in triples refers to the presence of identical entities or highly semantically related entities in two or more triples. This overlap can involve identical entities or semantically related entities, such as hyponyms, synonyms, and referential relationships.
[0096] In the case where the first result can represent the entity comparison result, the semantic logical relationship between the two first texts is classified according to the first result to obtain the classification result. The semantic logical relationship between the two first texts can be determined based on the first result and the correspondence between the pre-configured entity comparison result and the semantic logical relationship, and the semantic logical relationship between the two first texts is used as the classification result.
[0097] For example, the two first texts of the first object include first text 1 and first text 2. The triple of first text 1 is (entity 1, relationship 1, entity 2), and the triple of first text 2 is (entity 2, relationship 2, entity 3). After comparison, it can be seen that entity 2 in the triple of first text 1 is the same as entity 2 in the triple of first text 2. Therefore, it can be determined that the object of first text 1 is the subject of first text 2, and the semantic logical relationship between first text 1 and first text 2 is a complementary relationship.
[0098] Perform semantic logic processing on the entity relationships in the triples of the two first texts to obtain a first result. This first result can represent the predicate dependency relationship between the two first texts. For example, the two first texts of the first object include first text 1 and first text 2. The triple of first text 1 is (entity A, relationship 1, entity B), and the triple of first text 2 is (entity C, relationship 2, entity D). Based on relationship 1 and relationship 2, the predicate dependency relationship between the two first texts can be determined, and this predicate dependency relationship is used as the first result.
[0099] The semantic logic processing can be to compare whether two entity relationships are the same, or to determine whether two entity relationships have a specific logical relationship, etc. For example, the predicate dependency relationship of a triple can include the following types: Same predicate: Two triples share the same predicate.
[0100] Related predicates: The predicates of the two triples are semantically related, for example, synonyms, antonyms, hyponyms, etc.
[0101] Logical relationship: There is a logical relationship between the predicates of two triples, such as causal relationship, time order, conditional relationship, etc.
[0102] In the case where the first result represents a predicate dependency relationship, the semantic logical relationship of the two first texts is classified according to the first result to obtain a classification result. The semantic logical relationship between the two first texts can be determined based on the first result and the correspondence between the preconfigured predicate dependency relationship and the semantic logical relationship, and the semantic logical relationship between the two first texts is used as the classification result.
[0103] For example, the two first texts of the first object include first text 1 and first text 2. The triple of first text 1 is (entity A, relationship 1, entity B), and the triple of first text 2 is (entity C, relationship 2, entity D). According to relationship 1 and relationship 2, the predicate dependency relationship is determined to be a causal relationship, and then the semantic logical relationship between the two first texts can be determined to be a causal relationship.
[0104] According to the triples of the first text, the syntactic relationship of the first text is analyzed to obtain a first result, which can represent the syntactic relationship of the first text. Then, according to the syntactic relationship of the first text, the semantic logical relationship between the two first texts is classified to obtain a classification result.
[0105] In linguistics, syntactic relations describe the structural relationships between words or components within a sentence. They refer to how words are combined into larger grammatical units, such as phrases, clauses, and sentences, according to specific rules. Syntactic relations focus on the formal connection rather than the semantic content. Examples include, but are not limited to, subject-verb relationships, verb-object relationships, parallel relationships, and complement relationships.
[0106] For example, the two first texts of the first object include first text 1 and first text 2. The syntactic relationship R1 of first text 1 is determined based on the triples of first text 1, and the syntactic relationship R2 of first text 2 is determined based on the triples of first text 2. Furthermore, if it is inferred from R1 and R2 that there is a semantic conflict between the two first texts, the classification result can be determined as a transition relationship.
[0107] Alternatively, the syntactic relationship between the two first texts can be analyzed based on the triples of the two first texts to obtain a first result, which can represent the syntactic relationship between the two first texts. Furthermore, the semantic logical relationship between the two first texts can be classified based on the syntactic relationship between the two first texts to obtain a classification result.
[0108] For example, the two first texts of the first object include first text 1 and first text 2. The syntactic relationship R3 between first text 1 and first text 2 is determined based on the triple of first text 1. Furthermore, if it is inferred that the two first texts are parallel based on R3, the classification result can be determined to be a parallel relationship.
[0109] In this embodiment, triples are extracted from the first text by means of information extraction, and each text element in the triple is important information in the first text. Information extraction facilitates the subsequent use of text elements of the same type in different first texts for data analysis, for example, comparing entities with entities, using entity relationships with entity relationships for semantic logical processing, etc., thereby accurately analyzing the semantic logical relationship between the first texts and improving classification accuracy.
[0110] In a specific implementation, the semantic logical relationship between two first texts is classified to obtain a classification result, including: encoding the first texts to obtain a first vector representing the semantics of the first texts; calculating the semantic similarity of the two first texts based on the first vector; performing context analysis on the two first texts based on the dialogue text to obtain a second result of the two first texts; and determining the classification result based on the second result and the semantic similarity.
[0111] In the process of encoding the first text to obtain a first vector representing the semantics of the first text, a BERT pre-trained language model, a sentence embedding model, or any other method for converting text into a vector representing semantics can be used.
[0112] For example, the first text s1 is input into the BERT pre-trained language model for encoding to obtain a first vector S1, where S1 represents the semantics of s1; the first text s2 is input into the BERT pre-trained language model for encoding to obtain a first vector S2, where S2 represents the semantics of s2.
[0113] The semantic similarity between the two first texts is calculated based on the first vectors. This can be done by calculating the cosine similarity between the first vectors, calculating the Euclidean distance between the first vectors, or any other method for calculating semantic similarity.
[0114] For example, the cosine similarity between the first vector S1 and the first vector S2 is calculated, and the cosine similarity is used as the semantic similarity between the two first texts.
[0115] Based on the dialogue text, a contextual analysis of the two first texts is performed to obtain a second result for the two first texts. This can be done by using the dialogue text as the context for the two first texts and analyzing the coherence or dependency between the two first texts based on this context to obtain the second result. That is, the second result indicates whether there is coherence or dependency between the two first texts. In a textual context, coherence refers to the interconnectedness and natural connection between the various parts of a text in terms of meaning, logic, and language expression, forming an organic whole that allows readers to smoothly understand the text's content and the author's intention. Dependency between two texts refers to a certain degree of reliance, association, or constraint between one text and the other in terms of content, meaning, structure, or function, such as information supplementation or hierarchical delivery.
[0116] Exemplarily, the time expression and pronoun reference of the first text are analyzed in combination with the context to determine whether there is coherence or dependency between the two first texts.
[0117] The second result can be used to determine the contextual relevance between the two first texts. The contextual relevance between two texts refers to the degree of their semantic, thematic, or contextual connection. For example, if the second result indicates that there is coherence between the two first texts, the contextual relevance between the two first texts is strong; if the second result indicates that there is no coherence or dependency between the two first texts, the contextual relevance between the two first texts is weak.
[0118] The classification result is determined based on the second result and the semantic similarity. For example, if the semantic similarity between the two first texts is high, it indicates that there may be a restatement relationship or a supplementary relationship between the two first texts. If the semantic similarity between the two first texts is low, but the contextual relevance is strong, it may be a causal relationship or a transitional relationship. In this embodiment, by combining semantic similarity and contextual relevance, feature information from different angles can be comprehensively utilized to improve the classification accuracy of semantic logical relationships.
[0119] In addition, the semantic similarity in the above text is relatively high and can be combined with a pre-configured threshold definition. For example, if the semantic similarity x1 between the two first texts is greater than the preset similarity threshold X, then the semantic similarity x1 between the two first texts is relatively high; if the semantic similarity x1 between the two first texts is less than or equal to the preset similarity threshold X, then the semantic similarity x1 between the two first texts is relatively low.
[0120] In some implementations, it is also possible to detect whether at least one keyword in a preset keyword set exists in the first text based on a preset keyword set. If at least one keyword exists, the semantic logical relationship between the first texts is determined based on the keywords to obtain a classification result.
[0121] For example, the two first texts include "but" or "however", based on which the classification result can be determined to be a transition relationship.
[0122] In addition, in the process of classifying the semantic logical relationship between the two first texts and obtaining the classification results, at least two of the classification models, information extraction, semantic similarity, context analysis, and keyword extraction can be combined to determine the classification results.
[0123] For example, a large number of question-answer pairs are annotated, with the relationship categories of each text set labeled. A classification model is then trained. Each text set includes two first documents of a first object. Each training sample includes: the text set, triplet annotation information for the text set, and the context vector for the text set. In this way, during the model training process, the classification model learns how to extract information from the text set and how to use the extracted triples and context information to classify the semantic logical relationships between the first documents in the text set.
[0124] Due to the similar concepts, the specific implementation process of combining the above-mentioned multiple methods to jointly determine the classification results can refer to the corresponding description part in the previous text.
[0125] In actual natural language communication, users may express their true attitude directly, for example, by bluntly rejecting the other party's suggestion and expressing dissatisfaction, or explicitly stating that they are very interested in the other party's suggestion. Users may also express their true attitude in a more subtle way, for example, by shelving the other party's suggestion to indicate disinterest, or by actively asking questions to express strong interest. In this embodiment, by classifying the semantic logical relationship between the two first texts, richer information can be mined from the conversation text.
[0126] On this basis, the classification results obtained by executing the data processing method provided in this embodiment can be widely applied in various information mining application scenarios. For example, the classification results can be used to analyze user data in consultation / complaint scenarios, or to evaluate recommendation efficiency in recommendation scenarios, or to determine emotional tendencies or assist in intent recognition in artificial intelligence dialogue scenarios, etc. In addition, the dialogue text used in each of the above application scenarios is obtained with the user's authorization.
[0127] In some implementations, the first object is a consulting user, the second object is an agent, and the conversation text between the first object and the second object represents consulting information regarding the first product. The data processing method also includes: determining the consulting user's interest information regarding the first product based on the classification results, and adding the interest information to the consulting user's user portrait information.
[0128] The inquiry user's interest information for the first product refers to which features of the first product the inquiry user is interested in. For example, for the first product A, the user values the battery life of the first product A and cares about the price, but does not care much about the size information of the first product A, and so on.
[0129] User portrait information is a set of labeled and modeled user features abstracted by collecting and analyzing multi-dimensional data of users, which is used to accurately describe user attributes, behaviors, preferences and needs.
[0130] In consultation scenarios, by using classification results to mine information in conversation texts, users' preferences for specific products can be more accurately identified, thereby expanding the content of user portrait information.
[0131] In other implementations, the first object is a real user, the second object is a chatbot, the conversation text between the first object and the second object includes a first event, and the data processing method further includes: predicting the real user's emotional tendency towards the first event based on the classification results, and generating text based on the emotional tendency.
[0132] In artificial intelligence dialogue scenarios, by using classification results to mine information in dialogue texts, the accuracy of predicting the emotional tendencies of real users can be improved. Generating text based on accurate predictions of emotional tendencies can improve the dialogue experience of real users.
[0133] In a specific implementation, the data processing method further includes: determining first weight parameters corresponding to the two first texts according to the classification result.
[0134] This embodiment exemplifies one application of the classification results. For the two first texts of the first object obtained in step S202, the first weight parameters corresponding to the two first texts can reflect the feedback information of the first object on the second object. The first weight parameters can be used in subsequent dialogue generation or recommendation logic.
[0135] For example, in a service scenario, the first weight parameter may be the weight generated for the robot agent's response based on the customer's feedback after the robot agent answers the customer's question. Once generated, the first weight parameter will remain unchanged. The purpose of this is to enable the model supporting the robot agent to remember the customer's past questions and feedback, so as to generate more coherent and logically consistent sales copy.
[0136] According to the classification result, the first weight parameter corresponding to the two first texts is determined. The weight value corresponding to the classification result can be determined based on the correspondence between the classification result and the pre-configured relationship and the weight value, and the weight value is used as the first weight parameter corresponding to the two first texts.
[0137] The first weight parameter corresponding to the two first texts is determined according to the classification result. Alternatively, the semantic similarity between the two first texts is obtained, and the first weight parameter is calculated according to the semantic similarity and the classification result.
[0138] To obtain the semantic similarity between the two first texts, the first texts may be encoded to obtain a first vector representing the semantics of the first texts; and the semantic similarity between the two first texts may be calculated based on the first vector. For details, please refer to the corresponding description in the previous text.
[0139] According to the semantic similarity and the classification result, the first weight parameter is calculated. For example, the calculation process can refer to the following formula (1): (1) Wherein, w represents the first weight parameter. and These are all customizable parameters. Indicates semantic similarity, middle represents a first vector, represents another first vector, Indicates the semantic similarity between two first texts. Indicates the score of the classification result. For example, the score of the complementary relationship is x1, the score of the transition relationship is x2, and x1 is greater than x2. Indicates the scores of the classification results corresponding to the two first texts.
[0140] Furthermore, the classification results can be saved as a graph structure. Specifically, based on the classification results, graph data of the conversation text can be generated. This graph data includes nodes and edges, where each node represents a first text of a first object, and each edge represents the classification result of the semantic logical relationship between two first texts. Saving the classification results as a graph structure provides a reference for subsequent data analysis of the conversation text. Using graph neural networks, graph features can be extracted from the graph-structured data, helping to uncover deeper features from the conversation text and providing more information for subsequent data analysis or text generation.
[0141] In some implementations, for example, the classification results may include a repetitive relationship and a progressive relationship; based on the classification results, the first weight parameters corresponding to the two first texts are determined, including: if the classification result is a repetitive relationship, the first weight parameters corresponding to the two first texts are configured as a first value; if the classification result is a progressive relationship, the first weight parameters corresponding to the two first texts are configured as a second value.
[0142] If the classification result is a repetition, it means that one of the two first texts is a restatement of the other. If the first subject expresses a need and receives a satisfactory response, there's no need for the first subject to repeat the same content or repeat the previous first text. Therefore, a repetition classification result may indicate that the first subject is dissatisfied with the second subject's response.
[0143] If the classification result is a progressive relationship, it means that one of the two first texts may be a first subject communicating further details along the topic of the other first text, which indirectly means that the first subject may be relatively satisfied with the response of the second subject and is interested in further discussion.
[0144] The first value and the second value can be custom configured, and the first value can be smaller than the second value.
[0145] In a specific implementation, the data processing method also includes: obtaining a third text of the first object; extracting information from the third text to obtain a triple of the third text; extracting information from each first text in the conversation text to obtain a triple of each first text; determining a second weight parameter for each first text based on the triple of the third text and the triple of each first text; and training a first model based on the third text, the conversation text, the two first texts, the first weight parameter, and each first text and the second weight parameter.
[0146] The third text may be any text of the first object other than the dialogue text. The first model may be any language model with text generation capability.
[0147] Information extraction is performed on the third text to obtain a triple for the third text. The triple can be (entity, relation, entity) or (subject, predicate, object). Information extraction is performed on each first text in the conversation text to obtain a triple for each first text. The triple can be (entity, relation, entity) or (subject, predicate, object). Each first text corresponds to one triple.
[0148] The subject is the performer of an action or the initiator of a relationship in a triple, typically an entity. The predicate describes the subject's action or the relationship between the subject and the object. It can be a verb or a term expressing a relationship. The object is the recipient of the subject's action or the object of a relationship, also an entity.
[0149] Determining the second weight parameter of each first text based on the triples of the third text and the triples of each first text can be performed by determining the correlation between the third text and each first text in the dialogue text based on the triples of the third text and the triples of each first text, and determining the second weight parameter of each first text based on the correlation.
[0150] The relevance of two texts refers to the degree of association or similarity between the two texts in terms of content, subject matter, semantic information, etc.
[0151] Next, taking a first text in a conversation text as an example, how to determine the relevance of a third text to the first text is explained: The triple of the third text is (subject 1, predicate 1, object 1), and the triple of the first text is (subject 2, predicate 2, object 2).
[0152] (c1) Entity matching is performed based on subject 1, object 1, subject 2, and object 2. If there are identical or similar entities in two triples, then the two texts may be related.
[0153] (c2) Match the relations between predicate 1 and predicate 2. When the relations in two triples are the same, it may also imply that the texts are related.
[0154] (c3) Match entities and relations simultaneously based on (subject 1, predicate 1, object 1) and (subject 2, predicate 2, object 2). If two triples contain not only the same entities but also the same relations between the entities, the text is more relevant.
[0155] (c4) Calculate the semantic similarity between entities based on subject 1, object 1, subject 2, and object 2. If two triples contain the two entities respectively, and other elements also have a certain correlation, then the two texts can be considered to have a certain correlation.
[0156] The above-mentioned (c1)-(c4) are merely exemplary. In practical applications, any method for determining the relevance between two texts based on two triples may be adopted in combination with specific scenarios.
[0157] The relevance of the third text to each first text in the conversation text is determined based on the triples of the third text and the triples of each first text. The second weight parameter of each first text can be determined based on the relevance.
[0158] For example, the triple of the third text is (X1, Y1, Z1), and the dialogue text includes n first texts, where n is an integer greater than 0. Then the triples of the n first texts include: (A1, B1, C1), (A2, B2, C2), ..., (An, Bn, Cn).
[0159] According to (X1, Y1, Z1) and (A1, B1, C1), the correlation R1 between the third text and the first text can be determined. According to R1 and the correspondence between the pre-configured correlation and weight, the second weight parameter corresponding to R1 can be determined to be k1; According to (X1, Y1, Z1) and (A2, B2, C2), the correlation R2 between the third text and the first text can be determined. According to R2 and the pre-configured correspondence between the correlation and the weight, the second weight parameter corresponding to R2 can be determined to be k2; … According to (X1, Y1, Z1) and (An, Bn, Cn), the correlation Rn between the third text and the first text can be determined. According to the correspondence between Rn and the pre-configured correlation and weight, the second weight parameter corresponding to Rn can be determined to be kn.
[0160] Taking the service scenario as an example, the correlation between customer questions in historical data and current questions to be answered is determined. The higher the correlation, the higher the weight value. The weight will change dynamically with the new questions raised. The purpose of this is to enable the language model to decide in real time which historical information is more valuable when generating a certain script.
[0161] In addition, the step of "extracting information from the third text to obtain a triple of the third text; extracting information from each first text in the dialogue text to obtain a triple of each first text; and determining the second weight parameter of each first text based on the triple of the third text and the triple of each first text" can also be replaced by the following steps: encoding the third text to obtain a third vector representing the semantics of the third text; encoding each first text in the dialogue text to obtain a fourth vector representing the semantics of each first text; determining the semantic similarity between the third text and each first text based on the third vector and each fourth vector; determining the second weight parameter of each first text based on the semantic similarity between the third text and each first text; and together with the other processing steps in the embodiments of the present application, a new implementation method is constituted.
[0162] The higher the semantic similarity, the more likely the two texts are to be related, so text similarity can also be used to determine the second weight parameter.
[0163] In the process of training the first model based on the third text, the dialogue text, the two first texts, the first weight parameter, and each first text and the second weight parameter, iterative training can be performed based on the third text, the dialogue text, the first weight parameter and the second weight parameter until the training end condition is met.
[0164] For example, the order of the conversation text is as follows: Text 1 -> Text 2 -> Text 3 -> Text 4 -> Text 5 -> Text 6 -> Text 7. The text of the first object includes: Text 1, Text 3, Text 5, Text 7, and the text of the second object includes Text 2, Text 4, Text 6.
[0165] According to the conversation order of the conversation text between the first object and the second object, the two first texts of the first object are searched, and the two first texts of the first object can be obtained: text 1 and text 3. The semantic logical relationship between text 1 and text 3 is classified to obtain classification result 1. According to classification result 1, the first weight parameter k1 corresponding to text 1 and text 3 can be determined.
[0166] According to the conversation order of the conversation text between the first object and the second object, the two first texts of the first object are searched, and the two first texts of the first object can be obtained: text 3 and text 5. The semantic logical relationship between text 3 and text 5 is classified to obtain classification result 2. According to classification result 2, the first weight parameter k2 corresponding to text 3 and text 5 can be determined.
[0167] According to the conversation order of the conversation text between the first object and the second object, the two first texts of the first object are searched, and the two first texts of the first object can be obtained: text 5 and text 7. The semantic logical relationship between text 5 and text 7 is classified to obtain classification result 3. According to classification result 3, the first weight parameter k3 corresponding to text 5 and text 7 can be determined.
[0168] That is, there is a corresponding relationship between the two first texts obtained by executing step S202 and the aforementioned first weight parameter.
[0169] In addition, in the above example, each first text in the dialogue text includes: text 1, text 3, text 5, and text 7.
[0170] Based on the triples of the third text and the triples of text 1, determine the second weight parameter k4 of text 1; based on the triples of the third text and the triples of text 3, determine the second weight parameter k5 of text 3; based on the triples of the third text and the triples of text 5, determine the second weight parameter k6 of text 5; based on the triples of the third text and the triples of text 7, determine the second weight parameter k7 of text 7.
[0171] That is, there is a corresponding relationship between the first text and the second weight parameter.
[0172] In the process of training the first model, the following data can be used: the third text, the dialogue text, text 1 and text 3, the first weight parameter k1 corresponding to text 1 and text 3, text 3 and text 5, the first weight parameter k2 corresponding to text 3 and text 5, text 5 and text 7, the first weight parameter k3 corresponding to text 5 and text 7, text 1 and the second weight parameter k4 of text 1, text 3 and the second weight parameter k5 of text 3, text 5 and the second weight parameter k6 of text 5, and the second weight parameter k7 of text 7 and text 7.
[0173] The above example illustrates a portion of the data used in the process of training the first model.
[0174] The training end condition can be that the number of training times reaches a preset threshold, or the training loss is less than or equal to a preset loss threshold, etc.
[0175] During each training process, the first model can generate context information of the third text based on the dialogue text, the two first texts, the first weight parameter, and each first text and the second weight parameter. The first model can also generate text based on the third text and the context information of the third text to obtain a first generated text, and generate a training loss for this training based on the first generated text. The training loss is used to adjust the model parameters of the first model.
[0176] Among them, the above-mentioned contextual information can provide background information and constraints in the text generation process, ensuring that the generated first generated text is consistent with the expected goals in terms of semantics, style and coherence. The first weight parameter enables the first model to remember the first object's past questions and feedback, so as to generate a more coherent and logically consistent first generated text. The second weight parameter enables the first model to find content in the dialogue text that is highly correlated with the third text, thereby making full use of the dialogue text as historical data to provide richer reference information for text generation.
[0177] In this embodiment, by putting the first weight parameter and the second weight parameter into use during the training of the first model, the first model is helped to learn how to generate better context information during the training process, and thus the trained first model can improve the quality of text generation.
[0178] In addition, considering that the conversation text can be regarded as the historical conversation data of the first subject, the conversation text can also contain the behavior pattern, emotional tendency and other contextual information related to the generation target (ie, the first generated text) of the first subject.
[0179] For example, contextual information in historical conversation data that helps improve the quality of generated text includes but is not limited to: (d1) Customer behavior patterns: purchase intention / behavioral characteristics, for example, whether the customer shows a tendency to buy, and whether they mention important information such as price and specifications.
[0180] (d2) Question progression pattern: The questions asked by customers in multiple rounds of conversations follow a logical progression.
[0181] (d3) Emotional change trend: Emotional state: A sentiment analysis model is used to extract the changing trends of customer emotions in historical conversations, for example, from "neutral" to "positive" or "negative."
[0182] Key signals: Identify certain information points in historical conversation data that indicate high sentiment or high attention.
[0183] (d4) Time correlation Recent interaction weight: Gives higher weight to historical data that is closer to the current question, which is usually more in line with the needs of the current context.
[0184] Conversation topic switching weight: Determine whether the current conversation continues a specific topic based on the frequency of topic switching. If so, the weight of the topic-related data will be increased.
[0185] (d5) Special modes in business scenarios In business scenarios, some pre-configured special key points may not appear directly in the problem, but can be extracted through associated information.
[0186] The context information shown in (d1)-(d5) above is merely exemplary. Any context information that can provide background information and constraints for the generation process and ensure that the generated text is consistent with the intended goal in terms of semantics, style, and coherence can be applied in the embodiments of the present application.
[0187] Based on the above content, in the process of determining the second weight parameter of each first text based on the triples of the third text and the triples of each first text, the following steps can be performed: obtaining the context information of the third text based on the dialogue text; determining the second weight parameter of each first text based on the triples of the third text, the triples of each first text and the context information.
[0188] Determine the second weight parameter of each first text based on the triples of the third text, the triples of each first text and the context information. The relevance score of the third text to each first text can be determined based on the triples of the third text and the triples of each first text; and determine the second weight parameter of each first text based on the context information and the relevance score of each first text.
[0189] For example, in the process of determining the second weight parameter of each first text according to the context information and the relevance score of each first text, the weights of the relevance score and the context information may be allocated in the following manner: (f1) Dynamically adjust weights based on relevance scores For example, the relevance score between the third text and each first text is calculated. The higher the relevance score is, the larger the value of the second weight parameter of the first text corresponding to the relevance score is.
[0190] For example, the relevance score between the third text and each first text may be calculated according to formula (2): (2) in, Indicates the second weight parameter of the i-th first text of the first object in the conversation text. Indicates the semantic similarity between the third text and the i-th first text. Scores representing contextual information such as sentiment, temporal correlation, and behavioral patterns. A balancing factor that controls the weight of context information.
[0191] (f2) Dynamic priority mechanism High-priority features: Dynamically determine the most important information dimensions based on the characteristics of the current problem. Prioritize emotional features when emotions change dramatically.
[0192] Time series feature weight: The most recent data is given a higher base weight.
[0193] In addition, in the process of determining the second weight parameter of each first text, the following formula may also be referred to: (3) in, Represents the old question in the historical dialogue data, that is, the first text in the aforementioned dialogue text, Indicates a new question, namely the third text mentioned above. Indicates the comprehensive evaluation score of old questions. Indicates the semantic similarity between the new question and the old question, The score of the classification result representing the semantic logical relationship between the new question and the historical answers. When the old question is the first text, the historical answer to the old question is the aforementioned second text. is a time-based decay weight, the closer to the current moment, the higher the weight. 、 as well as is a parameter that controls the weights of each item and can be adjusted dynamically through model tuning. A second weight parameter for the old problem may be determined.
[0194] In addition, during the training of the first model, you can use FPDT (Fully Pipelined Distributed Transformer). FPDT is a distributed computing and pipeline parallel technology for language models.
[0195] FPDT efficiently trains long-context language models even with limited hardware resources. It is suitable for processing multi-turn customer conversations and long-context information that require long-term dependencies. FPDT divides the transformer model training process into multiple independent pipeline stages, each of which is processed in parallel on different devices and nodes. Unlike traditional batch training methods, FPDT uses a pipeline approach to reduce video memory usage and the computational overhead of model transmission, thereby achieving efficient parallelization. When hardware resources are limited, each layer of the model is distributed across different devices. Through a fully pipelined architecture, FPDT simultaneously performs forward propagation, backward propagation, and gradient calculation without increasing hardware burden, significantly reducing video memory usage. For example, customer conversation information is divided into different paragraphs, processed in stages by different nodes, and finally aggregated at the decoder. Pipeline parallelism significantly reduces video memory usage and enables processing of longer contexts.
[0196] When processing long contexts, FPDT can use relative position encoding to enhance the model's ability to model long-term dependencies. By expanding the context window, the model can remember and process extremely long conversation records, avoiding information loss. For example, multiple rounds of customer conversations are treated as context fragments and processed. Each conversation fragment is processed through the transformer layer, and the attention weight for the previous conversation is retained, that is, the first weight parameter mentioned above. This allows the model to remember customers' past questions and feedback and generate more coherent and logically consistent sales copy. Long-context language models can be efficiently trained to handle multiple rounds of customer conversations and long context information even with limited hardware resources. The model uses a controllable retrieval attention mechanism to perform fine-grained correlation matching between the decoder and historical information.
[0197] The controllable retrieval attention mechanism is a mechanism introduced in the FPDT architecture to optimize context retrieval and matching, ensuring that the decoder can more accurately utilize historical conversations and external knowledge base information when generating sales pitches, achieving more refined relevance matching.
[0198] In addition, the first model may be iteratively trained based on the third text, the conversation text, the two first texts, and the first weight parameter until a training end condition is met.
[0199] In each training, the first model generates context information of the third text based on the two first texts, the first weight parameter and the dialogue text. The first model generates text based on the third text and the context information of the third text to obtain a second generated text. The training loss of this training is generated based on the second generated text, and the training loss is used to adjust the model parameters of the first model.
[0200] In a specific implementation, the data processing method also includes: generating labels for the two first texts based on the classification results; marking the conversation text based on the labels and the second texts corresponding to the two first texts to obtain the marked conversation text; training the first model based on the third text, the two first texts, the first weight parameter, and each first text and the second weight parameter, including: training the first model based on the third text, the marked conversation text, the two first texts, the first weight parameter, and each first text and the second weight parameter.
[0201] Take the example of the first subject's two first texts, namely the first question text and the second question text, as an example: the classification results show that the second question text follows the answer to the first question text to ask detailed questions. In this case, the first subject may be relatively satisfied with the second subject's answer to the first question text and is interested in learning more, so he asks the second question text. In this case, the labels of the two first texts are positive labels, indicating that the first subject has a positive attitude towards the above answer. Alternatively, the classification results show that the second question text directly or indirectly rejects the answer to the first question text. In this case, the first subject may be dissatisfied with the answer. In this case, the labels of the two first texts are negative labels, indicating that the first subject has a negative attitude towards the answer. When the classification results determine that the first question text is unrelated to the second question text, the labels of the two first texts are non-related labels, indicating that the first subject's attitude towards the answer is unknown.
[0202] Different tags can play different roles in the subsequent text generation process.
[0203] For example, positive references are prioritized: if a historical question is identified as supplementary, the second text corresponding to the historical question carries a positive label, and its relevance score will be amplified and prioritized in the context. The relevance score can be used to quantitatively indicate how much value the second text has in the text generation process. The higher the relevance score, the more important the second text is in the subsequent text generation process. Conversely, the lower the relevance score, the less important the second text is in the subsequent text generation process. Negative reference filtering: Negatively marked historical questions will be excluded from candidate contexts to avoid affecting answer generation. Neutral references as an alternative: If there is no clear supplementary reference, neutral references are considered and sorted according to time weight.
[0204] Generating labels for the two first texts according to the classification result may include determining the label corresponding to the classification result according to the classification result and a correspondence between the pre-configured relationship and the label, and using the label corresponding to the classification result as the label for the two first texts.
[0205] In the process of labeling the conversation text based on the label and the second text corresponding to the two first texts to obtain the labeled conversation text, a corresponding labeling method can be determined based on the label types of the two first texts, and the second text corresponding to the two first texts can be labeled in the conversation text using the corresponding labeling method. The label type can be one of a positive label, a negative label, and an irrelevant label.
[0206] Taking the recommendation scenario as an example, if the classification results determine that the first question text and the second question text repeatedly express similar needs, considering that the second text represents the second subject's response to the first question, the response can be marked with a "negative label". This can avoid recommending the previously rejected product / service again in the subsequent text generation process, or avoid recommending similar products / services, thereby improving the communication experience of the first subject. If the classification results determine that the second question is to ask for details based on the response to the first question, the response can be marked with a "positive label". This can help the first model better remember the responses that the first subject is more satisfied with, and then the first model can generate high-quality text that better meets the first subject's preferences and needs in the subsequent text generation process.
[0207] The first model is trained based on the third text, the marked conversation text, the two first texts, the first weight parameter, and each first text and the second weight parameter. You can refer to the corresponding instructions in the previous article for training the first model based on the third text, the conversation text, the two first texts, the first weight parameter, and each first text and the second weight parameter.
[0208] In this embodiment, when the first subject's language expression is relatively euphemistic and he does not directly express whether he is satisfied, the classification result of the semantic logical relationship between the two first texts may indirectly reflect the first subject's true attitude towards the second subject's speech. Therefore, by labeling the conversation text with labels generated based on the classification result, it is beneficial for the first model to learn how to generate better contextual information during the training process. Furthermore, the trained first model can improve the quality of text generation.
[0209] In such Figure 2In the illustrated embodiment, first, based on the order of the conversation between the first and second objects, two first texts of the first object are searched, where the second text of the second object is included between the two first texts. Then, the semantic logical relationship between the two first texts is classified to obtain a classification result. As can be seen, in this embodiment of the application, by searching the two first texts of the first object, the first texts that respectively precede and follow the second text in the conversation text can be determined. Considering that the semantic logical relationship between the first texts may reflect the first object's true attitude towards the second object's second text, by classifying the semantic logical relationship between the first texts, richer information can be mined from the conversation text.
[0210] Figure 3 A processing flow chart of another data processing method provided in an embodiment of the present application.
[0211] like Figure 3 As shown, step S302, data preparation.
[0212] The customer's historical conversation data is obtained under the premise of user authorization. The customer's historical conversation data can refer to the corresponding description of the conversation text between the first object and the second object in the above method embodiment.
[0213] In addition, one or more of the following operations can be performed: use a large-scale public web crawler corpus to crawl text data such as social media, news, and customer conversations, and use a similarity-based document retrieval mechanism to obtain written documents related to the target task; combine with a semi-structured knowledge base to crawl business-related data such as product information and customer historical interaction records; use a large-scale language model tuned by instructions to preprocess the data and expand the data format to customized task samples for fine-tuning the model; automatically generate user interest tags, purchase behavior prediction tags, and conversation intention tags, etc.
[0214] Step S304: data preprocessing.
[0215] Text feature preprocessing: Context Compression: A compressor retriever is introduced to compress and retrieve context through the forward function of the base model, ensuring end-to-end differentiable processing of historical information.
[0216] Semantic Encoding: Use a pre-trained semantic encoder to extract semantic features, which will be used in the encoder stage of the model and combined with the speech features.
[0217] Historical Context Enhancement: Using a memory-enhanced retriever, historical information retrieval is performed to enhance long-context language modeling capabilities.
[0218] Audio feature processing: Frame-level audio processing techniques are used to extract speech features and generate time series audio representations.
[0219] Step S306: feature encoding.
[0220] Multimodal feature encoding: Use a multimodal transformer to jointly encode text, speech, and images, fusing language, speech, and visual features from customer conversations. It also integrates semantic features from the semantic encoder before the residual vector quantization stage to improve the model's performance in multimodal tasks.
[0221] Feature Compression and Retrieval: Use a compressor retriever to perform efficient context management in the forward pass of large language models, retrieve relevant information from historical conversations and external knowledge bases, and provide context-enhanced features.
[0222] Furthermore, after step S306 is executed, two first texts of the first object can be searched based on the conversation sequence of the conversation texts of the first object and the second object, where the second text of the second object is included between the two first texts; the semantic logical relationship between the two first texts can be classified to obtain a classification result; and first weight parameters corresponding to the two first texts can be determined based on the classification result. For details, please refer to the corresponding description of steps S202 to S204 in the aforementioned method embodiment.
[0223] Step S308: loss function design.
[0224] Semantic reconstruction loss: Semantic reconstruction loss is introduced after the residual vector quantization stage to ensure that the model effectively reconstructs the semantic information of the input and improves audio and text comprehension capabilities.
[0225] For example, the semantic reconstruction loss can refer to the following formula (4): (4) in, represents the semantic reconstruction loss, and N is the number of samples. represents the target semantic vector of the i-th sample. represents the reconstructed semantic vector of the i-th sample after decoding by residual vector quantization. The L2 norm square of the representation vector measures the similarity between the generated semantics and the target semantics.
[0226] Retrieval loss: We design a specialized loss function for the non-differentiable memory augmentation module to evaluate the accuracy and relevance of retrieval results. We also introduce a loss for the controllable retrieval mechanism generated for long texts to ensure that the retrieved chunks are semantically relevant.
[0227] For example, the retrieval loss can refer to the following formula (5): (5) in, represents the retrieval loss. N is the number of query samples, and M is the number of candidates in the retrieval database. is the vector of the i-th query, is the target vector most relevant to it (positive sample), are other irrelevant candidate vectors (negative samples). sim represents the cosine similarity between the query and the candidate. τ is the temperature coefficient, which controls the sensitivity of the similarity. The loss optimizes the model's retrieval capability by maximizing the similarity of positive samples and minimizing the similarity of negative samples.
[0228] Context Compression Loss: Design a loss in the context compression stage to evaluate the accuracy of compression and retrieval, and ensure the fidelity of context information during the compression process.
[0229] For example, the context compression loss can refer to the following formula (6): (6) in, represents the context compression loss, is the context vector reconstructed after compression by the compressor. is the original context vector. CE is the cross entropy loss, which ensures the semantic information of the context sequence is consistent. is the L2 norm squared, ensuring the accuracy of context vector reconstruction. λ is the adjustment weight to balance the cross entropy loss and L2 loss.
[0230] Semantic reconstruction loss is used to evaluate the model's ability to restore semantics after compression and decoding. Assuming the model performs tasks (such as text generation and speech synthesis) by combining residual vector quantization with semantic features to complete the encoding and decoding process, the goal is to minimize the difference between the generated semantics and the target semantics.
[0231] The retrieval loss is used to measure the relevance of the semantic blocks obtained by the memory-enhanced retrieval module and the target context in long context management.
[0232] The context compression loss is used to optimize the information compression quality of the compressor in the forward process of large language models, ensuring that the loss of contextual information is minimized during the compression process.
[0233] The joint loss function combines the three losses mentioned above and optimizes them as a whole through a weighted sum. The weight coefficient is used to adjust the contribution of each loss to ensure that the model can simultaneously optimize semantic reconstruction, retrieval relevance, and context compression.
[0234] For example, the joint loss function can refer to the following formula (7): (7) Among them: α, β, and γ are the weight parameters of the three losses, which control the impact of each part of the loss in the overall optimization.
[0235] The above-mentioned joint loss function can be used for model training of the first model in the above-mentioned embodiment.
[0236] Step S310: model reasoning.
[0237] The model uses a memory-enhanced retrieval mechanism to generate long-context language using historical conversation data. During the inference phase, it generates targeted sales pitches based on the customer's historical conversations and external knowledge base information.
[0238] During the reasoning process, the model first screens potential candidate answers through a triple-based retrieval mechanism, then ranks the answers using the similarity of unstructured data, and finally generates sales copy that conforms to the semantic context.
[0239] When processing long text generation, the model uses a memory-enhanced retrieval mechanism, which enhances the model's contextual language generation capabilities by efficiently searching historical conversation data and external knowledge bases.
[0240] In long text generation tasks, customers' historical conversation records are stored as vectorized contextual information. Through the memory-enhanced module, the model calls upon this historical information during inference and retrieves it based on chronological order and semantic relevance. The retrieval results provide a reference for the currently generated text.
[0241] During the generation phase, the model compresses long conversation data into a more compact semantic representation through a forward propagation compressor-retrieval mechanism. This compression process retains key semantic information and is used to combine it with the current conversation state to form a long context input.
[0242] The model uses retrieved historical conversations and external knowledge base information as additional input to further enrich the context during the generation process. For example, the customer's previously mentioned interests and needs, as well as product features and market data from external knowledge bases, all become references for the generated text.
[0243] In the generation phase, the model combines memory-enhanced historical conversation retrieval with compressed context to start generating long text.
[0244] The current conversation content, retrieved historical information, compressed context vectors, and relevant information from the external knowledge base are input into the language model. The model's decoder generates coherent, contextually appropriate long text based on these inputs.
[0245] This mechanism uses fine-grained control to match historical conversation data and focus on highly relevant parts, ensuring that the generated text is consistent with the customer's previous interactions. This attention mechanism can dynamically adjust the focus to ensure that the generated text content is consistent with historical conversation information.
[0246] When processing multiple rounds of conversations, the model continuously inputs and processes the previous rounds of conversations as new context, ensuring coherent memory capabilities for long-term conversations through memory-enhanced retrieval.
[0247] Triplet generation: During inference, a large language model extracts key relationship data from conversations and external knowledge bases and generates triples. Each triplet contains relevant information between the customer and the product being promoted, such as the customer's needs and the product's features.
[0248] Knowledge graphs narrow down the candidate list: Using knowledge graphs, we replace and match variables in the generated triples, further filtering answer candidates from external knowledge bases that are relevant to the conversation context. For example, in sales reasoning, knowledge graphs can help match customer needs with product features in external data, thereby narrowing down the candidate list.
[0249] Similarity ranking of unstructured data: After obtaining candidate answers, the model uses a vector similarity-based search method to rank the relevance of external unstructured data. By vectorizing the unstructured data, the model identifies the relevant documents that best match the current conversation.
[0250] Re-ranking candidate answers: In the final ranking stage, the large language model combines the previous contextual information to re-rank the candidate answers in the semantic context, ensuring that the most relevant answers are consistent with the current conversation context.
[0251] Step S312: real-time dynamic update.
[0252] As customers raise new questions, the amount of historical conversation data continues to increase, and steps S304 to S310 can be repeatedly performed to obtain new first weight parameters and dynamically update the model parameters of the language model in real time.
[0253] For example, during the data preparation phase, customer historical conversation data includes: Customer 1: User A mentioned in a past conversation that he was interested in the first product with feature A and asked about the purchase restrictions of the product.
[0254] Conversation record: "I'd like to know about the top product with feature A. Do you have any recommendations?" "If I want to purchase this product, what are the restrictions?" The encoded semantic vector is: [0.45, 0.78, 0.66, 0.54, 0.32].
[0255] Client 2: User B inquires about feature B of the second service and shows interest in time parameter C of the second service.
[0256] Conversation record: "What is characteristic B of the second service? What is the typical duration of time parameter C?" Encoded semantic vector: [0.62, 0.81, 0.45, 0.39, 0.72].
[0257] External knowledge base data: The product information 1 of the first product is the preset words S1.
[0258] Encoded semantic vector: [0.55, 0.79, 0.53, 0.71, 0.33].
[0259] The service information 2 of the second service is the preset speech S2.
[0260] Encoded semantic vector: [0.61, 0.85, 0.46, 0.47, 0.76].
[0261] For example, the input and output data of the language model are as follows: The input data includes the customer's historical conversations and external knowledge base information, as well as the latest question in the customer's current conversation, which is the aforementioned fourth text.
[0262] Specifically, the conversation and product information of customer A can be used as input: Dialogue vector: [0.45, 0.78, 0.66, 0.54, 0.32].
[0263] The vector representing product information 1 is [0.55, 0.79, 0.53, 0.71, 0.33].
[0264] The output data includes the model-generated speech S3, which is the fifth text mentioned above.
[0265] The semantic vector corresponding to the model-generated speech S3 is: [0.58, 0.81, 0.57, 0.69, 0.35].
[0266] In the specific implementation process of text generation: The compressor retriever performs context management: Input: Customer A's historical conversation data and current conversation context.
[0267] Current context: [0.47, 0.75, 0.64, 0.52, 0.34].
[0268] Output: Compressed context vector.
[0269] Compressed context vector: [0.53, 0.77, 0.61, 0.70, 0.36].
[0270] FPDT: Input: compressed context vector, customer current conversation vector, external knowledge base vector.
[0271] Compressed context vector: [0.53, 0.77, 0.61, 0.70, 0.36].
[0272] The vector representing product information 1 is [0.55, 0.79, 0.53, 0.71, 0.33].
[0273] Output: Model-generated speech S3.
[0274] Controllable retrieval attention mechanism: Input: Model decoder, fine-grained matching results of historical conversation data and product information.
[0275] Dialogue matching: 0.85.
[0276] Product matching degree: 0.78.
[0277] Output: Attention weights after matching.
[0278] Weight results: [0.87, 0.75].
[0279] 4. Loss function specific data Use a joint loss function for multiple tasks: Semantic reconstruction loss: used to ensure that the compressed context vector maintains key semantics during the generation process.
[0280] Calculation formula: L_s = ||E(x) - Residual Vector Quantization (x)||^2 Data example: Input: Semantic Encoder Output: [0.53, 0.77, 0.61, 0.70, 0.36].
[0281] Residual vector quantization output: [0.52, 0.75, 0.63, 0.69, 0.35].
[0282] Loss value: L_s = 0.002.
[0283] Retrieval Attention Loss: used to optimize the controllable attention mechanism.
[0284] Calculation formula: L_a = -\sum_i p_i \log q_i Data example: Probability distribution p_i = [0.87, 0.13], q_i = [0.85, 0.15].
[0285] Loss value: L_a = 0.004.
[0286] Data example: Weights: λ1 = 0.6, λ2 = 0.4.
[0287] Total loss value: L_total = 0.6 * 0.002 + 0.4 * 0.004 = 0.0028.
[0288] 5. Reasoning about input and output data Reasoning input: customer's current conversation, historical conversation retrieval results, and external knowledge base.
[0289] Current conversation: A1.
[0290] Retrieve history dialogue: B1.
[0291] External Knowledge Base Product Information: C1.
[0292] Reasoning output: The model generates speech S3 based on the context and knowledge base.
[0293] Semantic vector output: [0.59, 0.82, 0.55, 0.67, 0.38].
[0294] Furthermore, prompts can be pre-designed during the text generation process. For example, during the data preparation phase, data sources include, but are not limited to, customer conversations, historical transaction records, FAQs, business processes, and customer sentiment feedback. This data is pre-processed to adapt to different task requirements. Based on the task objectives, multi-task labels are generated for each conversation sample, including intent recognition, emotion perception, and knowledge point matching, to construct a relevant knowledge graph.
[0295] Prompt Structure: Guiding statements are designed within prompts, using clear task descriptions and examples to help the model understand the generation objective. Prompts contain examples of customer needs, desired emotional tone, contextual information, and more. Leveraging instruction tuning techniques, prompts are designed as nested structures to gradually guide the model through the task execution sequence, from intent recognition and sentiment analysis to knowledge matching. Dynamically updated prompts are used throughout multi-round conversations to gradually add contextual information, improving generation quality and consistency.
[0296] Prompt design of nested structure: a. Task layering Split the dialogue task into multiple subtasks: Intent Identification: Determine the customer’s intent.
[0297] Sentiment Analysis: Analyze the emotional state of your customers.
[0298] Knowledge matching: Retrieving relevant information from the knowledge base.
[0299] By layering these subtasks, Prompt is designed into multiple nested parts, each focusing on a specific task. Each nested part is dynamically updated based on the context, allowing for more nuanced conversation management.
[0300] b. Dynamically updated prompt In multi-round conversations, prompts are dynamically adjusted as the context changes. The specific steps are as follows: First, context maintenance.
[0301] Maintain conversation history and current context to promptly integrate the latest information into prompts. For example, when a customer asks a question, the prompt must include the context of the question.
[0302] Second, add information gradually.
[0303] After each response, the prompt is updated to include new information based on the generated content and customer feedback, ensuring that the model generates the next round of replies based on understanding the context.
[0304] c. The example is as follows: The customer asks about the first product in the service scenario conversation.
[0305] The initial prompt is "The customer is asking for sales information for the first product. Please identify the intent and analyze the sentiment. Intent: Product sales information inquiry; Sentiment: Neutral." Generates the following response: "The sales information of the first product includes XXXXX." Update the prompt example as follows: Based on customer feedback, update the prompt to reflect the context change: "The customer has further questions about the sales information and expresses some doubts. Please provide more detailed information and inquire about the customer's specific needs." An example of a dynamically updated prompt is as follows: "The customer inquired about sales information for the first product and expressed doubt. Please identify the intent and sentiment, provide detailed sales information, and ask if the customer has any specific needs. Intent: Inquiry for product sales information; Sentiment: Doubt." The resulting response is: "Are you confused about the XXX in the sales information? Generally speaking, we need XXXXX. Do you need further explanation?" Prompt's dynamic updates and nested instruction structure enable the model to maintain accurate task execution in complex dialogue scenarios and ensure coherent responses.
[0306] Knowledge graph integration: Use prompts to guide triple information in the knowledge graph to improve answer accuracy and ensure the applicability of the model in customer business scenarios.
[0307] Use Prompt to guide the triple information steps of the knowledge graph: a. Triples in the knowledge graph A triple in a knowledge graph consists of a subject, a predicate, and an object, and is used to represent entities and their relationships.
[0308] Triples provide the model with structured knowledge information and help it understand business scenario information.
[0309] b. Prompt design for guiding model Relevant triple information is embedded in the prompt to help the model better understand customer questions.
[0310] By directly introducing triples from the knowledge graph into Prompt, the model generates more accurate and business-relevant answers. The model relies on existing structured knowledge when processing specific customer inquiries.
[0311] Since the technical concept is the same, the description in this embodiment is relatively simple, and the relevant parts can refer to the corresponding description of the method embodiment provided above.
[0312] Based on the same technical concept, an embodiment of the present application also provides a question-and-answer processing method. Figure 4 A processing flow chart of a question-and-answer processing method provided in an embodiment of the present application.
[0313] Step S402, input the fourth text of the third object and the generated dialogue text between the third object and the fourth object into the second model to obtain a fifth text in response to the fourth text; the second model is trained based on the classification results of two sample texts of the first object in the dialogue text between the first object and the second object.
[0314] The third object can be any user, a robot with natural language capabilities, or any other entity with natural language capabilities, such as a virtual assistant, smart home device, digital human, etc.
[0315] The third object may be the same as or different from the first object. The fourth object may be the same as or different from the second object. The first object and the second object may refer to the corresponding description in the aforementioned data processing method embodiment.
[0316] Taking the service scenario as an example, the second object is a human agent, and the fourth object is a robot agent. The natural language communication ability of the robot agent is supported by a pre-trained second model. During the training stage of the second model, a part of the conversation texts between the customer and the human agent can be used, that is, the conversation texts between the first object and the second object. During the application stage of the second model, the fourth text of the old customer whose conversation text has participated in the model training and the generated conversation text between the old customer and the robot agent can be received. The generated conversation text is the historical conversation text between the old customer and the robot agent. The fourth text of the new customer who is not related to the model training and the historical conversation text between the new customer and the robot agent can also be received.
[0317] The fourth text may be any text from the third object. For example, the fourth text may be a question text, a request text, a command text, and the like.
[0318] Before executing step S402, a fourth text of the third object may be obtained. Specifically, obtaining the fourth text of the third object may include receiving input from the third object and generating the fourth text based on the input. Exemplarily, the input of the third object may be key input, text input, voice input, etc.
[0319] The fourth text of the third object may be obtained by detecting that a communication trigger condition pre-configured for the third object is satisfied.
[0320] For example, the third party is a customer who has subscribed to a system-provided service that periodically urges customer service on after-sales progress. At a first point in time, the communication trigger condition is met, and the system sends a fourth text message 1 urging customer service on after-sales progress. At a second point in time, the communication trigger condition is met, and the system sends a fourth text message 2 again urging customer service on after-sales progress.
[0321] The time period between the first time point and the second time point is a predetermined time period, and the fourth text sent by the system each time can be the same or different. For example, the system can generate fourth text 1 based on the first time point and a pre-configured text template, and generate fourth text 2 based on the second time point and the text template.
[0322] In addition, the reason why the fourth text obtained through the communication trigger condition can also be used in the question-and-answer processing method provided in this embodiment is that, when the customer has specific needs, repeating the same topic many times but failing to promote the progress of communication may bring a bad feeling to the customer. On the basis of the customer's pre-clarification of his or her communication purpose, another language model can represent the customer in communicating with the robot agent, and the final communication results can be fed back to the customer. This is conducive to improving the customer's information acquisition efficiency and optimizing the customer's communication experience.
[0323] In the embodiment of the present application, the method for obtaining the fourth text can be flexibly configured according to the specific scenario.
[0324] In the process of inputting the fourth text of the third object and the generated dialogue text between the third object and the fourth object into the second model to obtain the fifth text in response to the fourth text, the generated dialogue text can be used to generate context information of the fourth text, providing background information and constraints for the generation process, and ensuring that the generated fifth text is consistent with the expected goals in terms of semantics, style and coherence.
[0325] The second model is trained based on the classification results of two sample texts of the first subject in the conversation text between the first subject and the second subject. The classification results are determined using the data processing method provided in the aforementioned method embodiment. The training process of the second model can refer to the training process of the first model in the aforementioned method embodiment.
[0326] Exemplarily, the second model can be trained in the following manner: according to the dialogue order of the dialogue text between the first object and the second object, two first texts of the first object are searched, wherein the second text of the second object is included between the two first texts; the semantic logical relationship of the two first texts is classified to obtain a classification result; according to the classification result of the two sample texts of the first object, the first weight parameters corresponding to the two sample texts are determined; and, the third text of the first object is obtained; information is extracted from the third text to obtain a triple of the third text; information is extracted from each first text in the dialogue text to obtain a triple of each first text; the second weight parameter of each first text is determined based on the triple of the third text and the triple of each first text; the first model is trained based on the third text, the dialogue text, the two sample texts, the first weight parameter, and each sample text and the second weight parameter. Please refer to the corresponding description part of the first model in the aforementioned data processing method embodiment.
[0327] Alternatively, the second model can also be trained in the following manner: according to the dialogue order of the dialogue text between the first object and the second object, two first texts of the first object are searched, wherein the second text of the second object is included between the two first texts; the semantic logical relationship of the two first texts is classified to obtain a classification result; according to the classification result of the two sample texts of the first object, the first weight parameters corresponding to the two sample texts are determined; and, the third text of the first object is obtained; according to the third text, the dialogue text, the two sample texts, and the first weight parameter, the first model is trained, and reference may be made to the corresponding description part of the first model in the aforementioned data processing method embodiment.
[0328] In a specific implementation, the fourth text of the third object and the generated dialogue text between the third object and the second object are input into the second model to obtain the fifth text that responds to the fourth text. The question-answering processing method also includes: extracting information from the fourth text to obtain triples of the fourth text; querying in the first knowledge base based on the triples of the fourth text to obtain first knowledge that matches the triples of the fourth text; searching based on the fourth text through a preset search engine to obtain web page information corresponding to the fourth text; and determining second knowledge in the first knowledge based on the similarity between the first knowledge and the web page information, the second knowledge being the first knowledge with the highest similarity to the web page information.
[0329] Information extraction is performed on the fourth text to obtain a triple of the fourth text. The triple may be (entity, relationship, entity), or the triple may be (subject, predicate, object).
[0330] For example, a language model can be used to perform semantic analysis on customer conversations or requests, automatically extracting relational data in the form of triples. A triple consists of a subject, a predicate, and an object, representing key semantic relationships. In a service scenario, if a customer asks, "What are the benefits of this product?" the language model might extract a triple like the following: Subject: Product A; Predicate: Benefit; Object: How. The key to triple generation is capturing the customer's key intent and laying the foundation for the subsequent knowledge matching step.
[0331] A query is performed in the first knowledge base based on the triples of the fourth text to obtain first knowledge matching the triples of the fourth text. For example, the first knowledge graph is a structured external knowledge base that stores a large number of entities and their relationships. A query is performed in the first knowledge graph based on the triples of the fourth text to obtain first knowledge matching the triples of the fourth text. In specific implementations, variables in the triples of the fourth text can be replaced based on the first knowledge graph to narrow the range of candidate answers to the fourth text.
[0332] For example, the variable in the triple is the object "how". Using the first knowledge graph to replace the variables in the triple (product A, revenue, how), we get: (Product A, Revenue, X1), based on the replaced triple, the first knowledge 1 that matches the triple can be determined in the first knowledge graph; (Product A, Revenue, X2), based on the replaced triple, the first knowledge 2 that matches the triple can be determined in the first knowledge graph; (Product A, Revenue, X3), based on the replaced triple, the first knowledge 3 matching the triple can be determined in the first knowledge graph, and so on.
[0333] By replacing the variables in the triples, the scope of candidate answers for replying to the fourth text can be narrowed. That is, the initial scope of the candidate answers is the entire first knowledge base. By replacing the variables in the triples using the first knowledge graph, the scope of candidate answers can be narrowed from the entire first knowledge base to multiple candidate answers related to the interests of product A: first knowledge 1, first knowledge 2, first knowledge 3, and so on.
[0334] The number of first pieces of knowledge that match the triples of the fourth text may be one or more, and each piece of first knowledge may be considered as a structured candidate answer to the fourth text.
[0335] By searching the fourth text through a preset search engine to obtain web page information corresponding to the fourth text, query keywords may be determined in the fourth text, and then searching the fourth text through a preset search engine based on the query keywords to obtain web page information corresponding to the fourth text.
[0336] Through a preset search engine, a search is performed based on the fourth text to obtain web page information corresponding to the fourth text. Alternatively, the fourth text can be matched with a preset question template to obtain a target question template corresponding to the fourth text, and a target question can be generated based on the fourth text and the target question template. Through a preset search engine, a search is performed based on the target question to obtain web page information corresponding to the fourth text.
[0337] For example, the fourth text asks about the warranty period of product A. The searched web page information may include an advertisement page of product A, and may also include web pages where netizens share their reviews of various products including product A, and so on.
[0338] The number of web page information corresponding to the fourth text may be one or more, and each web page information may be regarded as an unstructured candidate answer to the fourth text.
[0339] According to the similarity between the first knowledge and the webpage information, the second knowledge is determined in the first knowledge, and the second knowledge is the first knowledge with the highest similarity to the webpage information.
[0340] In this embodiment, the similarity between the first knowledge and the web page information is used because the structured candidate answers and the unstructured candidate answers have different sources and can verify each other. The higher the similarity between the two candidate answers from different sources, the more likely it is that the candidate answer will be more accurate. Therefore, by determining the first knowledge with the highest similarity to the web page information, richer reference information can be provided for the subsequent text generation of the second model and the accuracy of text generation can be improved.
[0341] In a specific implementation method, the fourth text of the third object and the generated dialogue text between the third object and the second object are input into the second model to obtain a fifth text that responds to the fourth text, including: inputting the fourth text, the second knowledge and the generated dialogue text into the second model for text generation to obtain the fifth text that responds to the fourth text.
[0342] The input data of the second model may include: the fourth text, the first knowledge, and the historical conversation text.
[0343] It should be emphasized that the text generation performed by the second model is not a simple conversion of the "second knowledge" into a fifth text in a natural language form to provide the second knowledge to the user, but rather uses the second knowledge as part of the reference information for text generation.
[0344] In a specific implementation, the above text generation may be to generate context information of a fourth text based on the second knowledge and the generated dialogue text, and to generate text based on the fourth text and the context information of the fourth text.
[0345] The second knowledge can be considered an objective answer to the fourth text based on pre-set criteria and has nothing to do with the historical conversation text of the third object. For example, a user asks about recent promotions. According to the pre-set criteria, four promotions, A, B, and D, all fall under the category of currently ongoing promotions. The fifth text generated by the second model needs to reference both the objective answer and contextual information. In generating contextual information, the fourth text is used to locate corresponding content in the historical conversation text. The fourth text also serves to inform the second model about the text content to be generated. For example, if promotion A was previously recommended to the user in the historical conversation text, and the user had a negative attitude towards it, then it would be inappropriate to recommend it again. Furthermore, the user previously expressed a negative attitude towards discount x in the historical conversation text, while promotion B offered a discount less than x, and promotions C and D offered discounts greater than x. Ultimately, only promotions C and D are recommended to the user. In other words, the fifth text is a natural language text recommending promotions C and D to the user.
[0346] In this embodiment, the second knowledge can be used to generate richer context information during the text generation process, thereby improving the quality of text generation.
[0347] In this embodiment of the present application, by searching for two first texts of a first subject, the first texts that precede and follow the second text can be identified in the conversation text. Considering that the semantic and logical relationship between the first texts may reflect the first subject's true attitude toward the second text of the second subject, by classifying the semantic and logical relationships between the first texts, richer information can be mined from the conversation text. Furthermore, using the information mined from the conversation text to train the second model helps improve the text generation quality of the second model.
[0348] An embodiment of a data processing device provided in this specification is as follows: In the above-mentioned embodiment, a data processing method is provided. Based on the same technical concept, the embodiment of the present application also provides a data processing device, which is described below with reference to the accompanying drawings.
[0349] Figure 5 Schematic diagram of a data processing device provided in an embodiment of the present application. This embodiment provides a data processing device 500, including: A searching unit 502 is configured to search for two first texts of the first object according to a dialog sequence between the first object and the second object, wherein the second text of the second object is included between the two first texts; The classification unit 504 is configured to classify the semantic logical relationship between the two first texts to obtain a classification result.
[0350] Optionally, when the classification unit 504 classifies the semantic logical relationship between the two first texts and obtains a classification result, it performs the following steps: performing information extraction on the first text to obtain triples of the first text; Processing the triples of the two first texts to obtain a first result; The semantic logical relationship between the two first texts is classified according to the first result to obtain the classification result.
[0351] Optionally, when the classification unit 504 processes the triples of the two first texts to obtain a first result, it performs at least one of the following steps: Comparing entities in the triples of the two first texts to obtain a first result; Performing semantic logic processing on the entity relationship in the triples of the two first texts to obtain a first result; According to the triples of the first text, the syntactic relationship of the first text is analyzed to obtain a first result.
[0352] Optionally, when classifying the semantic logical relationship between the two first texts and obtaining a classification result, the classification unit 504 performs the following steps: Encoding the first text to obtain a first vector representing the semantics of the first text; Calculating the semantic similarity between the two first texts based on the first vector; performing context analysis on the two first texts according to the conversation text to obtain second results of the two first texts; The classification result is determined according to the second result and the semantic similarity.
[0353] Optionally, the data processing device further includes: A determination unit is used to determine first weight parameters corresponding to the two first texts according to the classification result.
[0354] Optionally, the data processing device further includes: an acquiring unit, configured to acquire a third text of the first object; an extraction unit, configured to extract information from the third text to obtain triples of the third text; The extraction unit is further configured to extract information from each first text in the conversation text to obtain a triplet of each first text; The determining unit is further configured to determine a second weight parameter of each of the first texts based on the triple of the third text and the triple of each of the first texts; A training unit is used to train a first model based on the third text, the conversation text, two first texts, the first weight parameter, and each of the first texts and the second weight parameter.
[0355] Optionally, the data processing device further includes: a generating unit, configured to generate two labels for the first text according to the classification result; a marking unit, configured to mark the conversation text according to the label and the second texts corresponding to the two first texts, to obtain a marked conversation text; When training the first model based on the third text, the conversation text, the two first texts, the first weight parameter, and each of the first texts and the second weight parameter, the training unit performs the following steps: A first model is trained based on the third text, the marked conversation text, two first texts, the first weight parameter, and each of the first texts and the second weight parameter.
[0356] In an embodiment of the present application, a search unit is configured to search for two first texts of the first object based on the order of the conversation between the first and second objects, wherein the second text of the second object is located between the two first texts; and a classification unit is configured to classify the semantic logical relationship between the two first texts to obtain a classification result. It can be seen that in this embodiment of the present application, by searching for the two first texts of the first object, the first texts that respectively precede and follow the second text can be determined in the conversation text. Considering that the semantic logical relationship between the first texts may reflect the first object's true attitude toward the second text of the second object, by classifying the semantic logical relationship between the first texts, richer information can be mined from the conversation text.
[0357] An embodiment of a question-answering processing device provided in this specification is as follows: In the above embodiment, a question and answer processing method is provided. Based on the same technical concept, the embodiment of the present application also provides a question and answer processing device, which is described below with reference to the accompanying drawings.
[0358] Figure 6 Schematic diagram of a question-answering processing device provided in an embodiment of the present application. This embodiment provides a question-answering processing device 600, comprising: Input unit 602 is used to input the fourth text of the third object and the generated dialogue text between the third object and the fourth object into the second model to obtain a fifth text in response to the fourth text; the second model is trained based on the classification results of two sample texts of the first object in the dialogue text between the first object and the second object, and the classification results are determined by a data processing method.
[0359] Optionally, the question-answer processing device further includes: an extraction unit, configured to extract information from the fourth text to obtain triples of the fourth text; A query unit, configured to query the first knowledge base according to the triples of the fourth text to obtain first knowledge matching the triples of the fourth text; A search unit, configured to search according to the fourth text using a preset search engine to obtain web page information corresponding to the fourth text; The determining unit is configured to determine second knowledge from the first knowledge according to the similarity between the first knowledge and the web page information, wherein the second knowledge is the first knowledge having the highest similarity with the web page information.
[0360] Optionally, when the input unit 602 inputs the fourth text of the third object and the historical conversation text between the third object and the second object into the second model to obtain the fifth text in response to the fourth text, it performs the following steps: The fourth text, the second knowledge and the historical conversation text are input into a second model for text generation to obtain a fifth text that responds to the fourth text.
[0361] In this embodiment of the present application, by searching for two first texts of a first subject, the first texts that precede and follow the second text can be identified in the conversation text. Considering that the semantic and logical relationship between the first texts may reflect the first subject's true attitude toward the second text of the second subject, by classifying the semantic and logical relationships between the first texts, richer information can be mined from the conversation text. Furthermore, using the information mined from the conversation text to train the second model helps improve the text generation quality of the second model.
[0362] Corresponding to the data processing method or question-answering processing method described above, based on the same technical concept, an embodiment of the present application further provides an electronic device, which is used to execute the data processing method or question-answering processing method provided above. Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0363] like Figure 7As shown, electronic devices can vary significantly due to different configurations or performance. They may include one or more processors 701 and memory 702. Memory 702 may store one or more applications or data. Memory 702 may be either ephemeral or persistent. Applications stored in memory 702 may include one or more modules (not shown), each of which may include a series of computer-executable instructions within the electronic device. Furthermore, processor 701 may be configured to communicate with memory 702 to execute the series of computer-executable instructions within memory 702 on the electronic device. The electronic device may also include one or more power supplies 703, one or more wired or wireless network interfaces 704, one or more input / output interfaces 705, one or more keyboards 706, and the like.
[0364] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the electronic device, and the one or more programs are configured to be executed by one or more processors, including computer-executable instructions for performing the following: Searching for two first texts of the first object according to a dialog sequence between the first object and the second object, wherein the second text of the second object is included between the two first texts; The semantic logical relationship between the two first texts is classified to obtain a classification result.
[0365] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented: Searching for two first texts of the first object according to a dialog sequence between the first object and the second object, wherein the second text of the second object is included between the two first texts; The semantic logical relationship between the two first texts is classified to obtain a classification result.
[0366] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the data processing method in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.
[0367] Another embodiment of the present disclosure further provides a computer program product, the computer program product including a computer program, which implements the following process when executed by a processor: Searching for two first texts of the first object according to a dialog sequence between the first object and the second object, wherein the second text of the second object is included between the two first texts; The semantic logical relationship between the two first texts is classified to obtain a classification result.
[0368] The computer program product in the embodiment of the present disclosure can implement each process of the above-mentioned data processing method embodiment and achieve the same effects and functions, which will not be repeated here.
[0369] In another specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the electronic device, and the one or more programs are configured to be executed by one or more processors, including computer-executable instructions for performing the following: The fourth text of the third object and the generated dialogue text between the third object and the fourth object are input into the second model to obtain a fifth text that responds to the fourth text; the second model is trained based on the classification results of two sample texts of the first object in the dialogue text between the first object and the second object, and the classification results are determined by a data processing method.
[0370] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented: The fourth text of the third object and the generated dialogue text between the third object and the fourth object are input into the second model to obtain a fifth text that responds to the fourth text; the second model is trained based on the classification results of two sample texts of the first object in the dialogue text between the first object and the second object, and the classification results are determined by a data processing method.
[0371] It should be noted that the embodiment of the computer-readable storage medium in this specification and the embodiment of the question-and-answer processing method in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.
[0372] Another embodiment of the present disclosure further provides a computer program product, the computer program product including a computer program, which implements the following process when executed by a processor: The fourth text of the third object and the generated dialogue text between the third object and the fourth object are input into the second model to obtain a fifth text that responds to the fourth text; the second model is trained based on the classification results of two sample texts of the first object in the dialogue text between the first object and the second object, and the classification results are determined by a data processing method.
[0373] The computer program product in the embodiment of the present disclosure can implement each process of the above-mentioned question-answering processing method embodiment and achieve the same effects and functions, which will not be repeated here.
[0374] In an embodiment of the present application, first, based on the conversation order of the first and second objects, two first texts of the first object are searched, wherein the second text of the second object is included between the two first texts; then, the semantic logical relationship between the two first texts is classified to obtain a classification result. It can be seen that in this embodiment of the present application, by searching the two first texts of the first object, the first texts that respectively precede and follow the second text in the conversation text can be determined. Considering that the semantic logical relationship between the first texts may reflect the first object's true attitude towards the second object's second text, by classifying the semantic logical relationship between the first texts, richer information can be mined from the conversation text.
[0375] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0376] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the embodiments of the present application may take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0377] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable electronic device to produce a machine, so that the instructions executed by the processor of the computer or other programmable electronic device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0378] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable electronic device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0379] These computer program instructions can also be loaded onto a computer or other programmable electronic device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0380] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0381] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0382] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology for information storage. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0383] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0384] The embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0385] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0386] The foregoing description is merely an example of the present invention and is not intended to limit the present invention. Persons skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims herein.
Claims
1. A data processing method, characterized in that: include: Searching for two first texts of the first object according to a dialog sequence between the first object and the second object, wherein the second text of the second object is included between the two first texts; The semantic logical relationship between the two first texts is classified to obtain a classification result.
2. The method according to claim 1, characterized in that The classifying the semantic logical relationship between the two first texts to obtain a classification result includes: performing information extraction on the first text to obtain triples of the first text; Processing the triples of the two first texts to obtain a first result; The semantic logical relationship between the two first texts is classified according to the first result to obtain the classification result.
3. The method according to claim 2, characterized in that The processing of the triples of the two first texts to obtain a first result includes at least one of the following: Comparing entities in the triples of the two first texts to obtain a first result; Performing semantic logic processing on the entity relationship in the triples of the two first texts to obtain a first result; According to the triples of the first text, the syntactic relationship of the first text is analyzed to obtain a first result.
4. The method according to claim 1, wherein The classifying the semantic logical relationship between the two first texts to obtain a classification result includes: Encoding the first text to obtain a first vector representing the semantics of the first text; Calculating the semantic similarity between the two first texts based on the first vector; performing context analysis on the two first texts according to the conversation text to obtain second results of the two first texts; The classification result is determined according to the second result and the semantic similarity.
5. The method according to claim 1, wherein The method further comprises: According to the classification result, first weight parameters corresponding to the two first texts are determined.
6. The method according to claim 1, characterized in that The method further comprises: Get the third text of the first object; performing information extraction on the third text to obtain triples of the third text; performing information extraction on each first text in the conversation text to obtain a triplet of each first text; determining a second weight parameter for each of the first texts according to the triple of the third text and the triple of each of the first texts; A first model is trained based on the third text, the conversation text, two first texts, the first weight parameter, and each of the first texts and the second weight parameter.
7. The method according to claim 6, characterized in that The method further comprises: generating two labels for the first text according to the classification result; Marking the conversation text according to the label and the second texts corresponding to the two first texts to obtain a marked conversation text; The step of training the first model according to the third text, the conversation text, the two first texts, the first weight parameter, and each of the first texts and the second weight parameter includes: A first model is trained based on the third text, the marked conversation text, two first texts, the first weight parameter, and each of the first texts and the second weight parameter.
8. A question-answering processing method, characterized in that: include: Inputting a fourth text of a third object and a generated dialogue text between the third object and the fourth object into a second model to obtain a fifth text in response to the fourth text; The second model is trained based on classification results of two sample texts of the first object in the conversation text between the first object and the second object, and the classification results are determined by the data processing method according to any one of claims 1 to 7.
9. The method according to claim 8, characterized in that Before inputting the fourth text of the third object and the generated dialogue text between the third object and the second object into the second model to obtain the fifth text in response to the fourth text, the method further includes: performing information extraction on the fourth text to obtain triples of the fourth text; Searching the first knowledge base according to the triple of the fourth text to obtain first knowledge matching the triple of the fourth text; Searching the fourth text using a preset search engine to obtain web page information corresponding to the fourth text; According to the similarity between the first knowledge and the web page information, second knowledge is determined in the first knowledge, where the second knowledge is the first knowledge having the highest similarity with the web page information.
10. The method according to claim 9, characterized in that The step of inputting the fourth text of the third object and the generated dialogue text between the third object and the second object into the second model to obtain a fifth text that responds to the fourth text includes: The fourth text, the second knowledge and the generated dialogue text are input into a second model for text generation to obtain a fifth text that responds to the fourth text.
11. A data processing device, characterized in that: include: a search unit, configured to search for two first texts of the first object according to a dialogue order between the dialogue texts of the first object and the second object, wherein the second text of the second object is included between the two first texts; The classification unit is used to classify the semantic logical relationship between the two first texts to obtain a classification result.
12. An electronic device, characterized in that: include: processor; And, a memory configured to store computer-executable instructions, which, when executed, cause the processor to perform the data processing method according to any one of claims 1 to 7, or the question-and-answer processing method according to any one of claims 8 to 10.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store computer-executable instructions, which, when executed by a processor, implement the data processing method according to any one of claims 1 to 7, or the question-and-answer processing method according to any one of claims 8 to 10.
14. A computer program product, characterized in that It comprises a computer program which, when executed by a processor, implements the data processing method according to any one of claims 1 to 7, or the question-answering processing method according to any one of claims 8 to 10.