Robot training method, device, equipment, storage medium and program product

By screening conversation data with similar grammatical structures and semantics during robot training and constructing diverse training samples, the problem of insufficient training samples is solved and the robot's conversation adaptability and robustness are improved.

CN119741914BActive Publication Date: 2025-09-30MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411879142.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-09-30
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

When training agent robots or customer robots, existing technologies have difficulty obtaining diverse training samples, resulting in poor training results, especially inaccurate identity recognition of conversation data, which affects the robot's conversation performance.

Method used

By determining the grammatical structure and semantic similarity between different types of robot conversation data, suitable training samples are screened out and diverse training samples are constructed to improve the adaptability and robustness of the robot.

Benefits of technology

The robot's conversational performance is improved, its ability to adapt to different types of interlocutors is enhanced, the limitations of a single type of interlocutor are avoided, and the training effect is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119741914B_ABST
    Figure CN119741914B_ABST
Patent Text Reader

Abstract

The present application provides a robot training method, electronic device, storage medium and program product. The robot training method includes: determining first session data of a first robot and second session data of a second robot, the first session data and the second session data corresponding to the same session scenario, and the first robot and the second robot are trained using different types of training samples; determining a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and determining a second similarity between the semantics of the first session data and the semantics of the second session data; based on the first similarity and the second similarity, screening third session data adapted for the first robot from the second session data; constructing a first training sample based on the third session data, and training the first robot based on the first training sample, thereby improving the diversity of the training samples and thereby improving the performance of the trained robot.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a robot training method, apparatus, equipment, storage medium, and program product. Background Art

[0002] With the increasing prevalence of machine learning models, pre-trained agent robots are often used to answer customer questions, or pre-trained customer service robots are used to simulate customer conversations. The process of training agent robots or customer service robots inevitably requires obtaining corresponding training samples. For example, training an agent robot requires first obtaining historical conversation data. Natural language processing (NLP) technology is then used to identify the agent's identity and obtain the corresponding historical conversation data. This data is then used as training samples to train the agent robot. Summary of the Invention

[0003] The embodiments of the present application provide a robot training method, device, electronic device, storage medium and program product, which improve the diversity of training samples and thereby improve the performance of the trained robot.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] An embodiment of the present application provides a robot training method, the method comprising:

[0006] Determining first session data of a first robot and second session data of a second robot, where the first session data and the second session data correspond to the same session scenario, and the first robot and the second robot are trained using different types of training samples;

[0007] determining a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and determining a second similarity between semantics of the first session data and semantics of the second session data;

[0008] Based on the first similarity and the second similarity, filtering out third conversation data adapted to the first robot from the second conversation data;

[0009] A first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample.

[0010] The present invention provides a robot training device, comprising:

[0011] a determination module, configured to determine first session data of a first robot and second session data of a second robot, wherein the first session data and the second session data correspond to the same session scenario, and the first robot and the second robot are trained using different types of training samples;

[0012] The determining module is further configured to determine a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and to determine a second similarity between the semantics of the first session data and the semantics of the second session data;

[0013] a screening module, configured to screen third conversation data adapted for the first robot from the second conversation data based on the first similarity and the second similarity;

[0014] A training module is used to construct a first training sample based on the third conversation data, and train the first robot based on the first training sample.

[0015] An embodiment of the present application provides an electronic device, comprising:

[0016] a memory for storing computer-executable instructions;

[0017] The processor is configured to implement the robot training method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.

[0018] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the robot training method provided in the embodiment of the present application when executed by a processor.

[0019] An embodiment of the present application provides a computer program product, including computer-executable instructions. When the computer-executable instructions are executed by a processor, the robot training method provided by the embodiment of the present application is implemented.

[0020] The embodiments of the present application have the following beneficial effects:

[0021] First conversation data of a first robot and second conversation data of a second robot are determined. The first conversation data and the second conversation data correspond to the same conversation scenario, and the first and second robots are trained using different types of training samples. Obtaining conversation data between the robots trained using different types of training samples can increase the diversity of the acquired conversation data. A first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data is then determined, as well as a second similarity between the semantics of the first conversation data and the semantics of the second conversation data. Based on the first and second similarities, third conversation data suitable for the first robot is selected from the second conversation data. A first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample. Because the first training sample is generated through conversations between robots trained using different types of training samples, the first training sample can, to a certain extent, reflect the conversational characteristics of different types of interlocutors, rather than being limited to the conversational characteristics of interlocutors of the same type. Compared to using conversational data of only a single type of interlocutor as training samples, using data that can reflect the conversational characteristics of multiple types of interlocutors as training samples significantly increases the diversity of the training samples. Training the first robot based on diverse training samples is beneficial for improving the adaptability and robustness of the first robot, thereby improving the overall conversational performance of the first robot. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 1 is a schematic diagram of the architecture of a robot training system 100 provided in an embodiment of the present application;

[0023] Figure 2 is a structural diagram of an electronic device 500 provided in an embodiment of the present application;

[0024] Figure 3A This is a first flow chart of the robot training method provided in an embodiment of the present application;

[0025] Figure 3B 2 is a schematic diagram of a second flow chart of the robot training method provided in an embodiment of the present application;

[0026] Figure 3C This is a third flow chart of the robot training method provided in an embodiment of the present application;

[0027] Figure 4 This is a flowchart of the overall implementation of the robot training method provided in the embodiment of the present application;

[0028] Figure 5 A schematic diagram of the intent system provided in the embodiments of the present application;

[0029] Figure 6This is a flowchart of obtaining training samples provided in an embodiment of the present application.

[0030] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of distinction between the advantages and disadvantages of the solutions or the priority in the implementation process. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0032] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0033] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0034] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0035] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0036] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.

[0037] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0038] 1) Conversational Robots: Conversational robots, also known as chatbots or conversational robots, are computer programs that simulate human conversation. Leveraging natural language processing and artificial intelligence technologies, conversational robots can engage in real-time verbal interaction with users, providing information, answering questions, and resolving issues. Conversational robots have a wide range of applications, including customer service, sales and marketing, education, healthcare, and other fields, offering personalized services and information.

[0039] 2) Identity conversion: The conversation identity of the conversation robot is converted. For example, the existing conversation robots include agent robots and customer robots, wherein the conversation identity of the agent robot is agent, and the conversation identity of the customer robot is customer. By issuing an instruction indicating the identity conversion to the robot, the conversation identities of the agent robot and the customer robot are interchanged. For example, when a first instruction indicating that the conversation identity is converted from agent to customer is issued to the agent robot, the agent robot conducts the conversation as the customer based on the first instruction during the conversation. For another example, when a second instruction indicating that the conversation identity is converted from customer to agent is issued to the customer robot, the customer robot conducts the conversation as the agent based on the second instruction during the conversation.

[0040] When acquiring conversational data as training samples, existing Automatic Speech Recognition (ASR) technology can misidentify the conversational data. For example, in a conversation between an agent and a customer, the customer's speech might be recognized as the agent's. Consequently, when training the corresponding agent robot, the customer's speech data might be used as the agent's speech data, affecting the accuracy of the trained agent robot.

[0041] Embodiments of the present application provide a robot training method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can improve the conversational performance of a trained robot.

[0042] The following describes exemplary applications of the electronic devices provided in the embodiments of the present application. The electronic devices provided in the embodiments of the present application can be implemented as various types of terminals, such as laptop computers, tablet computers, desktop computers, set-top boxes, mobile devices, smart devices, and vehicle-mounted terminals. They can also be implemented as servers. The following describes exemplary applications when the device is implemented as a server.

[0043] See also Figure 1 , Figure 1This is a schematic diagram of the architecture of the robot training system 100 provided in an embodiment of the present application. In order to support a robot training application, the terminal 400 is connected to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.

[0044] Terminal 400 is used to deploy a first robot and a second robot, and determine first session data for the first robot and second session data for the second robot. The first session data and the second session data correspond to the same session scenario and are trained using different types of training samples. Terminal 400 transmits the first and second session data to server 200 via network 300.

[0045] The server 200 is configured to determine a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and to determine a second similarity between the semantics of the first session data and the semantics of the second session data; based on the first similarity and the second similarity, filter out third session data adapted for the first robot from the second session data; construct a first training sample based on the third session data, and train the first robot based on the first training sample.

[0046] The robot training method provided in the embodiment of the present application can be applied to training a first robot, wherein the first robot can be an agent robot or a customer robot. The following is an example in which the conversation identity of the first robot is an agent, that is, the first robot is an agent robot. In the scenario of training an agent robot, the agent robot can be first trained using existing agent-type training samples, and the customer robot can be trained using existing customer-type training samples. Afterwards, the agent robot can have a conversation with a standard customer robot to obtain first conversation data, and the customer robot can be used as an agent to have a conversation with a standard customer robot to obtain second conversation data. Then, a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data is determined, as well as a second similarity between the semantics of the first conversation data and the semantics of the second conversation data is determined. Based on the first similarity and the second similarity, third conversation data suitable for the first robot is screened out from the second conversation data. Finally, the third conversation data is used as a training sample to retrain the first robot. In this way, the training samples can be enriched, thereby improving the conversation performance of the trained agent robot.

[0047] See also Figure 2 , Figure 2 is a structural diagram of an electronic device 500 provided in an embodiment of the present application, Figure 2The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not shown in FIG. Figure 2 Various buses are labeled as bus system 540 .

[0048] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0049] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0050] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.

[0051] The memory 550 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.

[0052] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0053] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0054] A network communication module 552 for reaching other electronic devices via one or more (wired or wireless) network interfaces 520 , exemplary network interfaces 520 including Bluetooth, Wi-Fi, and Universal Serial Bus (USB);

[0055] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., a display screen, a speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripheral devices and displaying content and information);

[0056] The input processing module 554 is configured to detect one or more user inputs or interactions from one of the one or more input devices 532 and to translate the detected inputs or interactions.

[0057] In some embodiments, the apparatus provided in the embodiments of the present application may be implemented in software. Figure 2 A robot training device 555 stored in memory 550 is shown. This device can be software in the form of a program or plug-in, and includes the following software modules: a determination module 5551, a screening module 5552, and a training module 5553. These modules are logical and can be arbitrarily combined or further separated according to the functions they implement. The functions of each module will be described below.

[0058] In other embodiments, the apparatus provided in the embodiments of the present application may be implemented in hardware. As an example, the apparatus provided in the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the robot training method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0059] The following describes the robot training method provided by the embodiments of the present application. As mentioned above, the electronic device that implements the robot training method of the embodiments of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution entity of each step will not be repeated below.

[0060] See also Figure 3A , Figure 3A This is a first flow chart of the robot training method provided in the embodiment of the present application, which will be combined with Figure 3A Steps 101 to 104 are shown for explanation.

[0061] In step 101, first conversation data of a first robot and second conversation data of a second robot are determined. The first conversation data and the second conversation data correspond to the same conversation scenario, and the first robot and the second robot are trained using different types of training samples.

[0062] As an example, a conversational scenario can be an application scenario of a conversational robot. For example, in a company's customer service center, a conversational robot can handle a large number of customer inquiries, answer common questions, or transfer complex issues to manual service; for example, in the IT service field, a conversational robot can help users solve technical problems, perform troubleshooting, or provide guidance on software operation; for example, a conversational robot can be used to collect information about potential customers, provide product information, guide the sales process, and even complete transactions; for example, in the recruitment process, a conversational robot can be used for preliminary screening of resumes, preliminary communication with job seekers, and arrangement of interviews; for example, when a customer seeks medical advice, a conversational robot can provide basic medical advice, answer questions about symptoms and drug use, or provide initial guidance in emergencies; for example, in the banking, insurance, and securities industries, a conversational robot can help customers make account inquiries, provide financial advice, and even assist in transactions.

[0063] The first and second robots are conversational robots, also known as chatbots or dialogue robots. They are computer programs that simulate human conversation. Using natural language processing and artificial intelligence technologies, conversational robots can engage in real-time verbal interaction with users, providing information, answering questions, and resolving issues.

[0064] In some embodiments, the first session data is data of a conversation between a first robot and a conversation object based on a first identity, and the second session data is data of a conversation between a second robot and a conversation object based on the first identity. The first robot is trained using training samples corresponding to the first identity, and the second robot is trained using training samples corresponding to the second identity. Instructions can be sent to the second robot to instruct the second robot to switch from the second identity to the first identity during the conversation with the conversation object.

[0065] In actual implementation, different types of training samples can be obtained by collecting conversation data of conversation partners with different identities, wherein conversation partners with different identities can be robots with agent identities or robots with customer identities. Based on this, robots trained with different types of training samples have conversation capabilities corresponding to the types of training samples, that is, the conversation identity of the robot is determined to a certain extent by the training samples used to train the robot. For example, a robot trained with training samples with agent identity is usually better at outputting the agent's professional terms during the conversation, and the content of the conversation is closer to the agent's identity, so its conversation identity can be regarded as the agent identity; for another example, a robot trained with training samples with customer identity has conversation data that is closer to the customer identity during the conversation, so its conversation identity can be regarded as the customer identity.

[0066] The first conversation data of the first robot may be conversation data output by the first robot with the first conversation identity, extracted from conversation data between two conversation robots with different conversation identities (e.g., the first robot and the third robot). For example, if the first robot is an agent robot and the third robot conversing with the first robot is a standard customer robot, the first conversation data may be conversation data output by the agent robot, extracted from the conversation data between the agent robot and the standard customer robot.

[0067] The second session data is the session data output by the second robot after sending a command to the second robot to convert the second robot's identity to the first robot's first identity. For example, if the first robot is an agent robot with the first identity of an agent and the second robot's second identity of a customer, the command "Have the following conversation as an agent" is sent to the second robot to convert the second robot's session identity from customer to agent. The second robot then conducts a conversation with a standard customer robot as an agent, and the session data output by the second robot is used as the second session data. It should be noted that the first session data and the second session data are session data for the same session scenario, such as session data for the same consultation question in the resource return scenario.

[0068] As an example, since the first robot and the second robot can be trained through a large amount of customer conversation data and agent conversation data respectively, they can adapt well to the current conversation scenario after identity exchange. And since the speaking habits of the second robot after identity conversion are different from the identity obtained by training, conversation data different from regular conversation data can be obtained.

[0069] In step 102 , a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data is determined, and a second similarity between semantics of the first session data and semantics of the second session data is determined.

[0070] In some embodiments, determining the first similarity between the grammatical structure of the first session data and the grammatical structure of the second session data in step 102 may be implemented by steps 1021 to 1024 as shown in FIG3B :

[0071] In step 1021, the first conversation data is segmented to obtain N first word units, and the second conversation data is segmented to obtain M second word units, where N and M are both positive integers.

[0072] For example, word segmentation is the process of breaking a continuous text sequence into smaller, more meaningful units (called terms or tokens). These units can be words, phrases, sentences, etc. Specifically, word segmentation can be performed on the first and second session data in the following manner.

[0073] Before word segmentation, some preprocessing steps may be necessary, such as capitalization, punctuation removal, and number conversion, to reduce word segmentation complexity and improve efficiency. Next, a word segmentation algorithm is used to identify natural language units in the text. Common word segmentation algorithms include dictionary-based, statistical-based, and deep learning-based. Dictionary-based word segmentation methods require building a dictionary of keywords and phrases, typically including common vocabulary, proper nouns, and idioms. The text is then broken down into terms based on the selected word segmentation algorithm. For example, dictionary-based word segmentation uses vocabulary to segment the text, statistical-based word segmentation uses probabilistic models to determine the optimal word segmentation method, and deep learning-based word segmentation uses neural networks to predict the next term. Finally, after word segmentation, post-processing may be necessary, such as disambiguation, merging synonyms, and eliminating meaningless terms, to improve the quality of the segmentation.

[0074] As an example, the first conversation data is "I would like to consult you about loan-related matters". The first conversation data can be segmented into first word units such as "I", "want", "consult you", "loan", "related", and "matters".

[0075] In step 1022, based on the first grammatical structure, the N first word units are combined to obtain first combination data having the first grammatical structure, and the M second word units are combined to obtain second combination data having the first grammatical structure.

[0076] Among them, the first grammatical structure is a grammatical structure corresponding to a preset combination pattern or a preset context. The preset combination pattern may be that the same components exist in the combined data obtained by combination. For example, the first word unit is "I" and the second word unit is "Mom". When the same component in the combination pattern is "lender XX", the first combination data obtained is "lender himself" and the second combination data is "lender's mother".

[0077] The preset context may be the same as the context corresponding to the combined data obtained by the combination. For example, the preset context is the context for expressing the service that needs to be provided. The first word unit is "I" and "loan", and the second word unit is "I" and "repayment". Then the first combined data is "I need loan services" and the second combined data is "I need repayment services".

[0078] As an example, a first word unit and a second word unit are combined using a first grammatical structure. The first grammatical structure can also refer to the structure of a sentence. For example, the first word unit is "loan," "today," and "I," and the second word unit is "tomorrow," "repay," and "you." The preset data structure is: adverb, subject, and verb. The resulting first combination data is "I took out a loan today," and the second combination data is "I repay tomorrow."

[0079] In step 1023, feature extraction is performed on the first combined data to obtain a first feature, and feature extraction is performed on the second combined data to obtain a second feature.

[0080] In some embodiments, feature extraction is performed on the first combined data in step 1023 to obtain the first feature, which can be achieved through the following technical solutions: feature extraction is performed on the word units in the first combined data to obtain the word features of the word units; feature extraction is performed on the position information of the word units in the first combined data to obtain the position features of the word units; feature extraction is performed on the sentences in the first combined data to obtain the sentence features of the sentences; and the word features, position features and sentence features are integrated to obtain the first feature.

[0081] As an example, a way to obtain word features is to extract features from word units in the first combined data, and then obtain word features that characterize each word unit, wherein the word segmentation features can be the features corresponding to each word unit after the first conversation data is segmented. For example, a sentence in the first combined data is "I will pay back the money tomorrow", wherein the corresponding three word units can be "I", "tomorrow" and "pay back the money", and the word features are the features corresponding to each word unit; a way to obtain position features can be to extract features that characterize the position of each word unit in the first combined data. Continuing with the above example, the position of the word unit "I" is before the word unit "tomorrow", so the position feature of the word unit "I" can be the feature that characterizes the word unit "I" is before the word unit "tomorrow", and there are no other word units before the word unit "I"; a way to obtain sentence features can be to input the complete sentence included in the first combined data into a neural network that performs feature extraction, and the neural network extracts the sentence features corresponding to the sentence.

[0082] In actual implementation, the method of feature fusion of word segmentation features, position features and sentence features can be to concatenate the word segmentation features, position features and sentence features to obtain the first feature, or to perform weighted summation of the word segmentation features, position features and sentence features to obtain the first feature.

[0083] As an example, the feature fusion process can also incorporate role distance features obtained through role distance encoding. Role distance encoding is a technique that encodes role relationships in text data to facilitate analysis and mining of these roles. Role relationships in text data can be diverse. For example, in social media text, users can play different roles, such as publisher, commenter, and liker. In internal corporate communications, employees can play different roles, such as project leader, team member, and manager. These role relationships can reveal interpersonal relationships and behavioral patterns within the text.

[0084] Similarly, the method for determining the second feature is consistent with the method for determining the first feature. For example, first, feature extraction is performed on the word units in the second combined data to obtain word features representing each word unit. Then, position features representing the position of each word unit in the second combined data are extracted, and the complete sentence included in the second combined data is input into the neural network for feature extraction. The neural network extracts the sentence features corresponding to the sentence, and finally, the word segmentation features, position features and sentence features corresponding to the second combined data are feature spliced ​​to obtain the second feature. The word segmentation features, position features and sentence features corresponding to the second combined data can also be weighted and summed to obtain the second feature.

[0085] Through the above method, the information dimension contained in the first feature can be increased, thereby improving the accuracy of the obtained first feature.

[0086] In step 1024 , a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data is determined based on the first feature and the second feature.

[0087] In some embodiments, determining the first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data based on the first feature and the second feature in step 1024 can be achieved by the following technical solution: performing feature extraction on the fourth conversation data of the third robot in the conversation scenario to obtain the third feature of the fourth conversation data, where the third robot and the first robot are trained using the same type of training samples; determining the third similarity between the first feature and the third feature, and determining the fourth similarity between the second feature and the third feature; and determining the difference between the third similarity and the fourth similarity as the first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data.

[0088] As an example, the fourth session data may be session data of the same type as the first robot, that is, the identities of the trained first robot and the third robot are the same, and the third robot may be regarded as a robot with higher performance, serving as a reference standard for measuring the performance of the first robot. The method for determining the third feature of the fourth session data is consistent with the method for determining the first feature of the first robot described above. For example, the method for determining the third feature is consistent with the method for determining the first feature. For example, first, feature extraction is performed on the word units in the fourth combined data to obtain word features representing each word unit. Then, position features representing the position of each word unit in the fourth combined data are extracted, and the complete sentence included in the fourth combined data is input into a neural network for feature extraction. The neural network extracts sentence features corresponding to the sentence. Finally, the word segmentation features, position features, and sentence features corresponding to the fourth combined data are feature spliced ​​to obtain the third feature. Alternatively, the word segmentation features, position features, and sentence features corresponding to the fourth combined data may be weighted and summed to obtain the fourth feature. It is necessary to first determine the features of each word segment in the fourth session data and the features representing the structure of the fourth session data.

[0089] For example, the third robot type is an agent, and the fourth conversation data can be "Excuse me, what service do you need?". The word units of the fourth conversation data can be data obtained by word segmentation of the fourth conversation data. Continuing with the previous example, the word units can be "Excuse me," "You," "Need," "What," and "Service." The data structure of the fourth conversation data can be adverb, subject, and verb. Therefore, the fourth conversation data can be "Please call me tomorrow." Feature extraction can then be performed on the fourth conversation data to obtain the third feature.

[0090] As an example, if the type of the first robot is an agent, then the first conversation data corresponding to the first feature is the agent's conversation, and similarly, the second conversation data corresponding to the second feature is also the agent's conversation. In this case, the conversation corresponding to the third feature is also the agent's conversation data, and the first similarity between the first feature and the third feature can represent the similarity between conversations of different agents (the first robot and the third robot) in the same conversation scenario. Similarly, the second similarity between the second feature and the third feature can represent the similarity between conversations of different agents (the second robot and the third robot) in the same conversation scenario. Then, by determining the difference between the first similarity and the second similarity, the difference between the conversation of the agent in the first conversation data and the conversation of the agent in the second conversation data can be determined.

[0091] As an example, the similarity between features may be determined by determining the cosine similarity between the two features as the similarity, or by determining the Euclidean distance between the two features as the similarity.

[0092] In some embodiments, determining the second similarity between the semantics of the first session data and the semantics of the second session data in step 102 may be performed as follows: Figure 3C Steps 1025 to 1027 are implemented as shown.

[0093] In step 1025 , semantic recognition is performed on the first session data to obtain a first semantic category of the first session data, and semantic recognition is performed on the second session data to obtain a second semantic category of the second session data.

[0094] For example, a semantic category can represent the intent of conversation data. For example, if conversation data A is "I want a loan," the semantic category of conversation data A is "loan," and if conversation data B is "I have something to do today, I'll contact you tomorrow," the semantic category of conversation data B is "busy."

[0095] As an example, the process of performing semantic recognition on the first session data and the second session data may be inputting the first session data and the second session data into a pre-trained semantic recognition model, and the semantic recognition model outputting semantic categories of the first session data and the second session data.

[0096] As an example, the semantic recognition model can be a model trained based on semantically labeled conversation data. The specific training process of the semantic recognition model can be selected according to actual conditions and is not specifically limited here.

[0097] In step 1026 , when the first semantic category is consistent with the second semantic category, a first semantic feature of the first session data and a second semantic feature of the second session data are determined.

[0098] As an example, feature extraction is performed on the first session data and the second session data of the same semantic category to obtain the first semantic feature and the second semantic feature. For example, the first session data A is "I want a loan today" and the second session data B is "I want a loan", then the semantic categories corresponding to the first session data A and the second session data B are both "loan", so feature extraction can be performed on the first session data A and the second session data B to obtain the first session feature corresponding to the first session data A and the second session feature corresponding to the second session data B.

[0099] As an example, the process of extracting semantic features from the first and second session data can be implemented using a neural network. The neural network can be a convolutional neural network, a recurrent neural network, an autoencoder, a generative adversarial network, or other neural network. The present embodiment does not limit the structure of the neural network.

[0100] In step 1027 , a second similarity between the semantics of the first session data and the semantics of the second session data is determined based on the first semantic feature and the second semantic feature.

[0101] In some embodiments, determining the second similarity between the semantics of the first session data and the semantics of the second session data based on the first semantic feature and the second semantic feature in step 1027 can be achieved by the following technical solution: performing feature extraction on the fifth session data of the fourth robot in the session scenario to obtain the third semantic feature of the fifth session data, the third semantic category of the fifth session data is consistent with the first semantic category, and the fourth robot and the first robot are trained using the same type of training samples; determining the fifth similarity between the first semantic feature and the third semantic feature, and determining the sixth similarity between the second semantic feature and the third semantic feature; and determining the difference between the fifth similarity and the sixth similarity as the second similarity between the semantics of the first session data and the semantics of the second session data.

[0102] As an example, the fifth conversation data may be conversation data of a fourth robot of the same type as the first robot, that is, the identities of the first robot and the fourth robot after training are the same, and the fourth robot may be regarded as a robot with higher performance, serving as a reference standard for measuring the performance of the first robot. For example, the first semantic category is "loan", the type of the first robot is an agent, and the fifth conversation data may be "Do you want to apply for a loan?"

[0103] In actual implementation, the process of extracting features from the fifth session data can be implemented through a neural network, wherein the neural network can be a convolutional neural network, a recurrent neural network, an autoencoder, a generative adversarial network, or other neural network.

[0104] As an example, if the first robot is an agent, then the first conversation data corresponding to the first conversation feature is the agent's conversation, and similarly, the second conversation data corresponding to the second conversation feature is also the agent's conversation. In this case, the conversation corresponding to the third semantic feature is also the agent's conversation data. The fifth similarity between the first conversation feature and the third semantic feature can represent the similarity between the conversation of the agent in the first conversation data and the conversation of the agent in the fifth conversation data within the same semantic category. Similarly, the sixth similarity between the second conversation feature and the third semantic feature can represent the similarity between the conversation of the agent in the second conversation data and the conversation of the agent in the fifth conversation data within the same semantic category. Subsequently, by determining the difference between the fifth and sixth similarities, the difference in the semantic dimension between the conversation of the agent in the first conversation data and the conversation of the agent in the second conversation data can be determined.

[0105] As an example, the semantic similarity between features may be determined by determining the cosine similarity between the two features as the semantic similarity, or by determining the Euclidean distance between the two features as the semantic similarity.

[0106] In step 103 , based on the first similarity and the second similarity, third conversation data adapted to the first robot is filtered out from the second conversation data.

[0107] In some embodiments, the step 103 of filtering out the third session data adapted to the first robot from the second session data based on the first similarity and the second similarity can be achieved by the following technical solution: from the second session data, filtering out the fifth session data whose first similarity exceeds the first similarity threshold; from the fifth session data, filtering out the session data whose second similarity exceeds the second similarity threshold as the third session data adapted to the first robot.

[0108] In actual implementation, when the first similarity is lower than the first similarity threshold, the data structure representing the second session data is not compatible with the type of the first robot, so the data in the second session data whose first similarity is lower than the first similarity threshold can be determined as session data that is not compatible with the first robot; when the second similarity is lower than the second similarity threshold, the semantics representing the second session data is not compatible with the type of the first robot, so the data in the second session data whose first similarity is lower than the first similarity threshold can be determined as session data that is not compatible with the first robot.

[0109] In some embodiments, the following technical solution can also be implemented: for the sixth session data in the second session data that is not compatible with the first robot, the sixth session data is corrected to obtain seventh session data that is compatible with the first robot; a second training sample is constructed based on the seventh session data, and the first robot is trained based on the second training sample.

[0110] In actual implementation, the session data in the second session data that is adapted to the first robot can be directly used as a training sample for training the first robot or the second robot. However, the sixth session data in the second session data that is not adapted to the first robot needs to be corrected and processed to obtain the corrected session data that meets the corresponding session identity. Only then can the corrected session data be used as a training sample for training the first robot or the second robot. This enriches the training samples and can improve the session performance of the trained first robot.

[0111] In some embodiments, the above-mentioned correction of the sixth conversation data to obtain the seventh conversation data adapted to the first robot can be achieved through the following technical solution: extracting words that are not adapted to the first robot from the sixth conversation data, and determining the ratio of the number of words to the total number of words in the sixth conversation data; when the ratio is less than a preset threshold, determining the replacement word corresponding to the word, and replacing the word based on the replacement word to obtain the seventh conversation data adapted to the first robot.

[0112] As an example, in actual applications, the preset threshold value may be 1. If the proportion of words that are incompatible with the first robot is not 1, it indicates that some words in the second conversation data are incompatible with the first robot. In this case, a replacement word for the type of the first robot in the second conversation data is obtained, and the portion of the second conversation data that is incompatible with the first robot is replaced with the replacement word.

[0113] As an example, the process of obtaining replacement words can be performed by extracting conversation data suitable for the first robot from historical conversation data, performing word segmentation on the extracted conversation data to obtain multiple words. Semantic recognition is then performed on the obtained words to obtain words in each semantic category. Subsequently, the words in the second conversation data that are not suitable for the first robot can be replaced with replacement words with the same semantics as the words, thereby obtaining seventh conversation data suitable for the first robot.

[0114] As an example, the preset threshold value can be 1. If the percentage is 1, it indicates that the second session data is completely incompatible with the first robot. In this case, the type of the second session data is changed to the type of the second robot, and the second session data is re-checked to obtain a type detection result. The specific type detection process can be found in steps 102 to 103 above. If the type check result indicates that the second session data is completely compatible with the type of the second robot, the second session data is used as session data of the second robot type. This second session data can then be used as a training sample for training the second robot type.

[0115] As an example, the type of the first robot is an agent, and the type of the second robot is a customer. This indicates that the second session data does not conform to the agent type. The type of the second session data is changed to customer, and the identity check is performed on the second session data again. If the identity check result indicates that the second session data conforms to the customer identity, the second session data is used as the customer's session data. The second session data can then be used as a training sample for a third robot with the customer identity to train the third robot.

[0116] As an example, if the second session data is still not compatible with the second robot after re-detection, the second session data is deleted.

[0117] In step 104 , a first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample.

[0118] First, the conversation samples corresponding to the third conversation data are labeled to obtain a type label for each conversation sample. Then, the conversation samples with the type label are input into the conversation robot to be trained (i.e., the first robot) corresponding to the type label. The conversation robot to be trained outputs a predicted conversation statement. Through a set loss function (such as a cross-entropy loss function, etc.), the parameters of the robot to be trained are updated with a reverse gradient with the goal of minimizing the difference between the predicted conversation statement and the conversation sample, thereby obtaining a trained conversation robot.

[0119] Through the above method, the training samples are enriched. By training the conversational robot with relatively rich training samples, the performance of the trained conversational robot can be improved.

[0120] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.

[0121] In related technologies, natural language processing tasks mainly focus on understanding the basic semantics of language. Taking the Chinese natural language understanding task as an example, the tasks mainly focus on: semantic similarity, short text classification, long text classification, and natural language reasoning.

[0122] Currently, the text recognized by speech recognition technology may contain incorrect roles (i.e., the identities of the two parties in the conversation data mentioned above). At the same time, the roles may be correct, but the content displayed in the text may not match the corresponding roles.

[0123] Based on this, logical linguistics is introduced into the process of matching roles and texts. Through the selection and exclusion of logical models, language fragments that do not match the conversation roles are identified, and language fragment replacement is completed in a possible way to ensure the readability of this part of the data (too many fragments that do not match the role will affect the readability of the sentence and the conversation content) and the quality of the initial text used for subsequent training of various models (text conversation content is mostly manually annotated in this scenario for training models such as intent recognition and named entity recognition. If there are errors in the recognition of words, language blocks, and sentences in the initial text, it will fundamentally affect the text quality of subsequent model training data).

[0124] See also Figure 4 , Figure 4 This is an overall implementation flow chart of the robot training method provided in the embodiment of the present application.

[0125] In step 401, session data and all roles are obtained.

[0126] Get the conversation data and all roles; for example: Agent: text1; Customer: text2; Agent: text3;

[0127] There are two roles: agent and customer.

[0128] In step 402, excellent calls are obtained from historical calls.

[0129] Arrange the call text in the format of single sentences by role (agent / customer);

[0130] For example: Agent: Hello, are you Mr. Liu...?

[0131] Customer: Yes, where are you from?

[0132] Agent: I’m from the… department of… company. I’m calling you mainly because…

[0133] The so-called excellent conversation can be considered from multiple aspects such as fluency, coherence, relevance, consistency, etc., which are explained one by one below.

[0134] 1. Obtain the fluency value of each agent's sentence.

[0135] For example, when obtaining the fluency of a single sentence, the sentence is input into the pre-trained language model and the fluency of the sentence is output. The fluency value is calculated as follows:

[0136] First, determine the first fluency and second fluency, where the first fluency = 1 / perplexity; the second fluency = 5-(number of consecutive identical words * number of consecutive times * 0.1). Finally, add the first fluency and the second fluency to obtain the fluency value.

[0137] 2. Get the continuity value of the agent-only conversation and the customer-agent dual-role conversation.

[0138] The process of determining the coherence of the agent's own conversation can be to select two adjacent sentences in the conversation data with the agent as the agent, calculate the similarity, and determine the average coherence value of all adjacent sentences as the coherence value of the agent's own conversation. If the coherence value is lower than a certain threshold, the agent's own conversation is determined to be incoherent;

[0139] The process of determining the coherence of the customer-agent interaction can include selecting two adjacent sentences in the conversation data, calculating their similarity, and then determining the average coherence value of all adjacent sentences (which can be from the same or different identities) as the coherence value of the customer-agent interaction. If the coherence value falls below a certain threshold, the customer-agent interaction is considered incoherent.

[0140] 3. Obtain the correlation value of the agent-side conversation respectively.

[0141] The conversation data of the agent in the conversation data is input into the intent recognition model (i.e., the semantic recognition model mentioned above) to obtain the intent of each sentence in the conversation data (i.e., the semantics mentioned above). The training process of the intent recognition model can be as follows:

[0142] 1) Build an intent system. The intent system contains m intents (the m intents include one "other intent," which means an intent that is not included in the other intents; each intent contains: intent, intent interpretation, and intent example). The following uses one intent as an example to illustrate.

[0143] See also Figure 5 , Figure 5 Schematic diagram of the intention system provided in the embodiment of this application. Figure 5 In , an intention system can include four parts: classification number, classification, classification interpretation and classification case. Among them, the classification number can be a number used to characterize the intention system, such as Figure 5 The classification number of the intent system shown in is 1; the classification can be the name of the intent used to characterize the intent system, such as Figure 5 The classification of the intent system shown in is three-party identity (with a higher priority than not being the person); the classification can be the interpretation content used to characterize the intent system, such as Figure 5 The classification interpretation of the intention system shown in is that the relationship with the customer is friends, colleagues, relatives, immediate family members and family members; the classification case can be to explain the intention system through examples, such as Figure 5As shown in the above, I am his xxx / I am her friend / I am her father / I am her mother / my mother / I am his sister / I am his brother / You are looking for him / Divorce / He is / He works in our company / He is driving, just tell me / He is not here now / He is not here / He is not here / Not very familiar with each other / Just had dinner together / Met once, not very familiar with each other / No contact / Relatives / In the same town in the same place / I am his boss / I am his client.

[0144] 2) Loading a pre-trained language model, wherein the pre-trained language model can be a robot model.

[0145] 3) Feed the labeled training sample data into the pre-trained language model and set the task type to classification to train the intent recognition model.

[0146] The proportion of text with "other intents" predicted by the intent recognition model is detected. The relevance of the conversation data can then be determined. Specifically, the difference between 1 and the proportion of text with "other intents" is used as the relevance of the conversation data. A lower relevance indicates a higher proportion of agent-irrelevant content and a weaker focus on the agent's business objectives.

[0147] 4. Obtain the consistency value of each agent's representation of the knowledge answer.

[0148] The conversation data of the agent in the conversation data is input into the intent recognition model to obtain the intent of each sentence. The semantic similarity between the intentions of any two sentences of the agent is detected (specifically, the conversation data can be input into a pre-trained language model, and the pre-trained speech model outputs the sentence vector of the conversation data. The cosine value between the sentence vectors is then determined as the semantic similarity mentioned above). If the semantic similarity = -1, it indicates that the intentions are opposite; the consistency value of the agent can be 1-(number of opposite intentions*0.1).

[0149] 5. Obtain the identity loyalty of the agent text (i.e., the identity of the agent and the loyalty to the agent's identity).

[0150] 1) Detect the percentage of words in the agent's text that match their identity and the percentage of words that do not match their identity.

[0151] 2) Determine identity loyalty = the percentage of words that match your identity + (1 - the percentage of words that do not match your identity).

[0152] 3) Call Content Quality Assessment = Fluency + Coherence + Relevance + Consistency + Identity Loyalty. If the call content quality assessment exceeds a certain threshold, the call is considered excellent. (The threshold can be calculated by finding the highest and average scores of all call content quality assessments. The midpoint between the highest and average scores is used as the threshold for excellent calls. Calls above this threshold are considered excellent.)

[0153] In step 403, the text in the historical calls is split and segmented according to roles, and the segmentation results of the two are compared to filter out role-specific vocabulary. The screening method may be to obtain an existing agent historical vocabulary library and a customer historical vocabulary library, determine a first intersection of the agent historical vocabulary library and the customer historical vocabulary library, and then use a set of vocabulary in the agent historical vocabulary library that is different from the first intersection as an agent-specific vocabulary set, and then use a set of vocabulary in the customer historical vocabulary library that is different from the first intersection as a customer-specific vocabulary set.

[0154] In step 404, the text to be detected is subjected to chunk matching and word segmentation.

[0155] In step 405, semantic vectors of the language chunks and word segmentation results of the current sentence are compared with the character-specific words.

[0156] The role distance encoding layer adds role meaning to the text representation by encoding the text in vector form. This allows the understanding and processing of the text to take into account the integration of roles and conversational text. During model training, the hidden layer considers the relationship between the role distance encoded text sentence vector and the role violation probability in the label, which helps model training.

[0157] In step 406, the different role language unit detection model outputs sentences, language chunks, vocabulary lists that do not conform to the role and the role violation probability;

[0158] The training process of the heterogeneous language detection model:

[0159] 1) Load the pre-trained language model (robot model).

[0160] The structure of the pre-trained speech model may include an input layer (used to preprocess the user's text input, including word segmentation, stop word removal, part-of-speech tagging, etc.), an embedding layer (used to convert the preprocessed text into word vectors. A role distance encoding layer may be added at the end of the embedding layer to extract role distance features of the conversation data), an encoding layer (using structures such as recurrent neural networks and long short-term memory networks to process sequence data and extract deep-level features of the text), a fully connected layer (fully connecting the features extracted by the encoding layer for tasks such as classification, regression, or sequence generation), and an output layer (depending on specific business needs, the output layer may include classification labels, sentiment labels, entity recognition labels, generated text, etc.). The embedding layer first performs word segmentation on the conversation data to obtain multiple word units, then performs feature extraction on the word units to obtain word features representing each word unit. Then, positional features representing the position of each word unit in the conversation data are extracted, and the complete sentence included in the conversation data is input into a neural network for feature extraction. The neural network extracts sentence features corresponding to the sentence. Finally, the word segmentation features, positional features, and sentence features corresponding to the second combined data are feature concatenated to obtain the output of the embedding layer.

[0161] 2) Input the labeled data into the pre-trained language model, set the task category to sequence labeling, and start training.

[0162] The format of the labeled data is as follows: the text is "Customer: Our leader asked me to call you"; the label of this text can be [our leader, 0.8, call you, 0.7], where 0.8 represents the role violation probability, that is, the probability that the word "our leader" violates the identity of "customer"; 0.7 represents the role violation probability, that is, the probability that the phrase "call you" violates the identity of "customer"; in the training data, it corresponds to historical calls.

[0163] A loss function is constructed by combining the predicted value of the labeled data predicted by the pre-trained speech model and the labeled value of the labeled data, and the pre-trained speech model is trained based on the loss function to obtain a heterosexual language detection model.

[0164] In step 407, the language unit correction model processes the sentences, language chunks, and vocabulary that do not conform to the role, so that the data conforms to the role and forms a high-quality training set for subsequent training of various classification models.

[0165] Calculate the length of each language unit in the list relative to the entire sentence. If one of them has a length of 1 (in this case, there must be only one in the list), it means that the entire sentence does not match the role identity. It is necessary to further calculate whether the sentence matches another role. If so, the text remains unchanged and the identity tag is changed. If it does not match another role, the entire sentence is deleted.

[0166] If the length of language units in the list of language units that do not match the role is less than 1, a vocabulary competition scheme is required to perform a partial replacement in the sentence. The vocabulary competition scheme can be as follows: first, a vocabulary library corresponding to the identity of the above-mentioned language unit is determined, and within the vocabulary library, a campaign word is determined that has the same number of characters as the above-mentioned language unit, the same applicable identity, and opposite semantic elements in the applicable role as the replaced language unit, but the same semantic elements in other aspects. After the campaign words are determined, the above-mentioned language unit is replaced with all the campaign words, and the role matching value of the replaced sentence is evaluated, and the campaign word with the highest role matching value is selected as the replacement word.

[0167] The following describes a method for obtaining training samples for the model. Figure 6 , Figure 6 This is a flowchart of obtaining training samples provided in an embodiment of the present application.

[0168] In step 601, an agent robot is obtained;

[0169] Obtain historical conversation translation text data of agents of different levels in specific scenarios; feed the above data into the basic large model for fine-tuning training. The trained large model is the professional agent robot.

[0170] In step 602, a client robot is obtained.

[0171] Obtain the translated text data of historical customer conversations in specific scenarios; feed the above data into the basic large model for fine-tuning training. The trained large model is the professional customer robot.

[0172] In step 603, the identities of the agent robot and the customer robot are exchanged, and a conversation is conducted after the identity exchange.

[0173] The agent robot plays the role of the customer, and the customer robot plays the role of the customer; the agent robot is a robot trained with massive agent data, and is good at the agents' usual speech and words; the customer robot is a robot trained with massive customer data, and is good at the customers' usual speech and words; the specific role exchange is achieved by guiding the robot to reverse the role in the prompt content, or by issuing instructions to guide the robot to reverse the role, so that the robot can conduct the conversation based on the reversed role during the conversation.

[0174] In step 604, the conversation data between the agent robot and the customer robot after the identities are exchanged is obtained.

[0175] First, a difference analysis is performed between the real robot and the reverse-role robot (i.e., the robot that performs identity swapping as mentioned above); assuming there are 10 regular agent robots and 1 new reverse-role robot; all the texts to be detected by these 11 robots are input into the intent recognition model to obtain the intent of each text to be detected (i.e., the semantics mentioned above).

[0176] The text to be detected by the conventional agent robot is input into the diversity detection model according to the category of intent, and the diversity value under each intent is determined. Specifically, the list of texts to be detected in each intent category can be input into the language model to obtain the word segmentation result list ([I, am, lender, myself] (that is, the above-mentioned word unit)) and the word combination list ([lender myself] (that is, the above-mentioned first combination data)), and then the sentence vectors of all texts to be detected are obtained (that is, the above-mentioned first feature and third feature); by determining the third similarity between the first feature and the third feature.

[0177] Afterwards, the single sentences of the regular agent robot and the cross-dressing robot can be input into the language model to obtain the second feature and the third feature, and then the fourth similarity between the second feature and the third feature is determined. Finally, the difference between the third similarity and the fourth similarity is used as the diversity value under the intention (that is, the first similarity mentioned above).

[0178] Finally, the conversation data whose first similarity exceeds the first similarity threshold can be used as training samples for the agent robot.

[0179] In the embodiments of the present application, the semantic component analysis method is used to provide reliable evidence for the rationality analysis of intention combination; the rationality analysis of intention combination is used to assist in the discrimination analysis of conversation roles, so as to better identify words, language blocks and sentences that do not conform to the role identity in the conversation; the word competition method is used to realize the replacement of words, language blocks and sentences in the conversation, so as to achieve the purpose of correcting the corpus at the minimum cost, and provide reliable original text data for subsequent various model training; the word competition method is used to realize the replacement of words, language blocks and sentences in the conversation, and to a certain extent realize text correction; the large model hallucination is used to leave traces of different role vocabulary, and the prompt scheme is used for role reversal, so as to realize a novel different role language unit capture scheme.

[0180] It is understandable that in the embodiments of the present application, when user information and other related data are involved, when the embodiments of the present application are applied to specific products or technologies, user permission or consent must be obtained, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards.

[0181] The following continues to describe the exemplary structure of the robot training device 555 provided in the embodiment of the present application implemented as a software module. In some embodiments, such as Figure 2As shown, the software modules stored in the robot training device 555 of the memory 550 may include:

[0182] Determining module 5551, configured to determine first session data of a first robot and second session data of a second robot, where the first session data and the second session data correspond to the same session scenario, and the first robot and the second robot are trained using different types of training samples;

[0183] The determining module 5551 is further configured to determine a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and to determine a second similarity between the semantics of the first session data and the semantics of the second session data;

[0184] A screening module 5552 is configured to screen the second conversation data for third conversation data that is suitable for the first robot based on the first similarity and the second similarity;

[0185] The training module 5553 is used to construct a first training sample based on the third conversation data, and train the first robot based on the first training sample.

[0186] In some embodiments, the determination module 5551 is further used to perform word segmentation on the first conversation data to obtain N first word units, and to perform word segmentation on the second conversation data to obtain M second word units, where N and M are both positive integers; based on the first grammatical structure, combine the N first word units to obtain first combined data having the first grammatical structure, and combine the M second word units to obtain second combined data having the first grammatical structure; perform feature extraction on the first combined data to obtain a first feature, and perform feature extraction on the second combined data to obtain a second feature; and determine a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data based on the first feature and the second feature.

[0187] In some embodiments, the determination module 5551 is also used to perform feature extraction on word units in the first combined data to obtain word features of the word units; perform feature extraction on position information of the word units in the first combined data to obtain position features of the word units; perform feature extraction on sentences in the first combined data to obtain sentence features of the sentences; and fuse the word features, the position features and the sentence features to obtain the first features.

[0188] In some embodiments, the determination module 5551 is also used to perform feature extraction on the fourth conversation data of the third robot in the conversation scenario to obtain a third feature of the fourth conversation data, where the third robot and the first robot are trained using the same type of training samples; determine a third similarity between the first feature and the third feature, and determine a fourth similarity between the second feature and the third feature; and determine the difference between the third similarity and the fourth similarity as the first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data.

[0189] In some embodiments, the determination module 5551 is further used to perform semantic recognition on the first session data to obtain a first semantic category of the first session data, and to perform semantic recognition on the second session data to obtain a second semantic category of the second session data; when the first semantic category is consistent with the second semantic category, determine a first semantic feature of the first session data and a second semantic feature of the second session data; and based on the first semantic feature and the second semantic feature, determine a second similarity between the semantics of the first session data and the semantics of the second session data.

[0190] In some embodiments, the determination module 5551 is also used to perform feature extraction on the fifth conversation data of the fourth robot in the conversation scenario to obtain a third semantic feature of the fifth conversation data, the third semantic category of the fifth conversation data is consistent with the first semantic category, and the fourth robot and the first robot are trained using the same type of training samples; determine the fifth similarity between the first semantic feature and the third semantic feature, and determine the sixth similarity between the second semantic feature and the third semantic feature; and determine the difference between the fifth similarity and the sixth similarity as the second similarity between the semantics of the first conversation data and the semantics of the second conversation data.

[0191] In some embodiments, the filtering module 5552 is further used to filter out fifth session data whose first similarity exceeds a first similarity threshold from the second session data; and to filter out session data whose second similarity exceeds a second similarity threshold from the fifth session data as third session data adapted for the first robot.

[0192] In some embodiments, the screening module 5552 is further configured to modify the sixth session data in the second session data that is incompatible with the first robot to obtain seventh session data that is compatible with the first robot; construct a second training sample based on the seventh session data; and train the first robot based on the second training sample.

[0193] In some embodiments, the screening module 5552 is further used to extract words that are not suitable for the first robot from the sixth conversation data, and determine the ratio of the number of the words to the total number of words in the sixth conversation data; when the ratio is less than a preset threshold, determine the replacement words corresponding to the words, and replace the words based on the replacement words to obtain seventh conversation data that is suitable for the first robot.

[0194] In some embodiments, the determination module 5551 is further configured to send an instruction to the second robot, wherein the instruction is configured to instruct the second robot to switch from the second identity to the first identity during a conversation with the conversation object.

[0195] The present invention provides a computer program product comprising a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the robot training method described in the present invention.

[0196] The present application embodiment provides a computer-readable storage medium having computer-executable instructions stored therein. When the computer-executable instructions are executed by a processor, the processor will be caused to execute the robot training method provided by the present application embodiment, for example, Figure 3A The robot training method is shown.

[0197] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0198] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0199] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0200] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.

[0201] In summary, the following beneficial effects can be achieved through the embodiments of the present application:

[0202] First conversation data of a first robot and second conversation data of a second robot are determined. The first conversation data and the second conversation data correspond to the same conversation scenario, and the first and second robots are trained using different types of training samples. Obtaining conversation data between the robots trained using different types of training samples can increase the diversity of the acquired conversation data. A first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data is then determined, as well as a second similarity between the semantics of the first conversation data and the semantics of the second conversation data. Based on the first and second similarities, third conversation data suitable for the first robot is selected from the second conversation data. A first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample. Because the first training sample is generated through conversations between robots trained using different types of training samples, the first training sample can, to a certain extent, reflect the conversational characteristics of different types of interlocutors, rather than being limited to the conversational characteristics of interlocutors of the same type. Compared to using conversational data of only a single type of interlocutor as training samples, using data that can reflect the conversational characteristics of multiple types of interlocutors as training samples significantly increases the diversity of the training samples. Training the first robot based on diverse training samples is beneficial for improving the adaptability and robustness of the first robot, thereby improving the overall conversational performance of the first robot.

[0203] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.

Claims

1. A robot training method, characterized in that: The method comprises: Determining first session data of a first robot and second session data of a second robot, where the first session data and the second session data correspond to the same session scenario, and the first robot and the second robot are trained using different types of training samples; determining a first similarity between a grammatical structure of the first session data and a grammatical structure of the second session data, and determining a second similarity between semantics of the first session data and semantics of the second session data; Based on the first similarity and the second similarity, filtering out third conversation data adapted to the first robot from the second conversation data; A first training sample is constructed based on the third conversation data, and the first robot is trained based on the first training sample.

2. The method according to claim 1, characterized in that The determining a first similarity between a grammatical structure of the first conversation data and a grammatical structure of the second conversation data includes: Segmenting the first conversation data to obtain N first word units, and segmenting the second conversation data to obtain M second word units, where N and M are both positive integers; Based on the first grammatical structure, the N first word units are combined to obtain first combination data having the first grammatical structure, and the M second word units are combined to obtain second combination data having the first grammatical structure; Performing feature extraction on the first combined data to obtain a first feature, and performing feature extraction on the second combined data to obtain a second feature; Based on the first feature and the second feature, a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data is determined.

3. The method according to claim 2, characterized in that The extracting features from the first combined data to obtain a first feature includes: performing feature extraction on word units in the first combined data to obtain word features of the word units; performing feature extraction on position information of the word unit in the first combined data to obtain position features of the word unit; performing feature extraction on sentences in the first combined data to obtain sentence features of the sentences; The word feature, the position feature and the sentence feature are fused to obtain the first feature.

4. The method according to claim 2, characterized in that The determining, based on the first feature and the second feature, a first similarity between a grammatical structure of the first conversation data and a grammatical structure of the second conversation data includes: performing feature extraction on fourth conversation data of a third robot in the conversation scenario to obtain a third feature of the fourth conversation data, where the third robot and the first robot are trained using the same type of training samples; determining a third similarity between the first feature and the third feature, and determining a fourth similarity between the second feature and the third feature; A difference between the third similarity and the fourth similarity is determined as a first similarity between the grammatical structure of the first conversation data and the grammatical structure of the second conversation data.

5. The method according to claim 1, wherein The determining a second similarity between the semantics of the first session data and the semantics of the second session data includes: performing semantic recognition on the first session data to obtain a first semantic category of the first session data, and performing semantic recognition on the second session data to obtain a second semantic category of the second session data; In a case where the first semantic category is consistent with the second semantic category, determining a first semantic feature of the first session data and a second semantic feature of the second session data; A second similarity between the semantics of the first session data and the semantics of the second session data is determined based on the first semantic feature and the second semantic feature.

6. The method according to claim 5, characterized in that The determining, based on the first semantic feature and the second semantic feature, a second similarity between the semantics of the first session data and the semantics of the second session data includes: performing feature extraction on fifth conversation data of a fourth robot in the conversation scenario to obtain a third semantic feature of the fifth conversation data, wherein the third semantic category of the fifth conversation data is consistent with the first semantic category, and the fourth robot and the first robot are trained using the same type of training samples; determining a fifth similarity between the first semantic feature and the third semantic feature, and determining a sixth similarity between the second semantic feature and the third semantic feature; A difference between the fifth similarity and the sixth similarity is determined as a second similarity between the semantics of the first conversation data and the semantics of the second conversation data.

7. The method according to claim 1, characterized in that The filtering out third conversation data adapted for the first robot from the second conversation data based on the first similarity and the second similarity includes: Filtering out, from the second conversation data, fifth conversation data whose first similarity exceeds a first similarity threshold; From the fifth conversation data, conversation data whose second similarity exceeds a second similarity threshold is screened out as third conversation data adapted for the first robot.

8. The method according to claim 7, characterized in that The method further comprises: For sixth session data in the second session data that is not compatible with the first robot, modify the sixth session data to obtain seventh session data that is compatible with the first robot; A second training sample is constructed based on the seventh conversation data, and the first robot is trained based on the second training sample.

9. The method according to claim 8, characterized in that The modifying the sixth conversation data to obtain seventh conversation data adapted for the first robot includes: extracting words that are not suitable for the first robot from the sixth conversation data, and determining a ratio of the number of the words to the total number of words in the sixth conversation data; When the ratio is less than a preset threshold, a replacement word corresponding to the word is determined, and the word is replaced based on the replacement word to obtain seventh conversation data adapted for the first robot.

10. An electronic device, characterized in that: The electronic device comprises: a memory for storing computer-executable instructions; The processor is configured to implement the robot training method according to any one of claims 1 to 9 when executing the computer-executable instructions stored in the memory.