Conversation-based intention recognition method and device, computer equipment and storage medium
Through the method of dialogue interception and information supplementation in dialogue intention recognition, the encoding structure is simplified, efficiency and accuracy are improved, and the complexity and computational increase caused by multi-coding networks in the prior art are solved.
Patent Information
- Application Number
- CN202411329366.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-09-23
AI Technical Summary
In the prior art, the complexity of the model and the calculation amount increase, and the efficiency is affected due to the need for multiple coding networks to process sentences, role information and round information during the dialogue intention recognition process.
The original dialogue statement is intercepted through dialogue intercept parameters, forming a candidate dialogue statement group, and supplementing the role information and round information into the candidate dialogue statement before encoding to form the target dialogue statement, and then encoding is performed to simplify the encoding structure and reduce intention Identify the calculation amount of the process.
It improves the efficiency and accuracy of dialogue intention recognition, reduces the number of coding networks, simplifies the encoding structure, and reduces the calculation amount.
Smart Images

Figure CN119202254A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and apparatus for conversation-based intent recognition, a computer device, and a storage medium. Background Art
[0002] Conversation intent recognition is the process of identifying the user's intention in each round of a conversation. Conversation intent recognition is usually used in the field of intelligent question answering, so that when the intelligent robot responds, it can quickly output a reply statement that meets the user's intention.
[0003] In related technologies, dialogue intention recognition is affected by role and turn information. Usually, multiple encoding networks are used to encode sentences, role information, and turn information respectively, and then the role representation and turn representation are integrated into the sentence information. However, using multiple encoding networks to complete the encoding process of sentences, role information, and turn information not only increases the complexity of the model, but also increases the amount of calculation in the dialogue intention recognition process, affecting the efficiency of dialogue intention recognition. Therefore, how to improve the efficiency of dialogue intention recognition has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a conversation-based intent recognition method and apparatus, a computer device, and a storage medium, aiming to improve the efficiency of conversation intent recognition.
[0005] To achieve the above objectives, a first aspect of an embodiment of the present application proposes a method for identifying intentions based on a conversation, the method comprising:
[0006] Acquire original dialogue data; wherein the original dialogue data includes: at least two original dialogue sentences and role information and turn information of each original dialogue sentence;
[0007] The at least two original dialogue sentences are intercepted according to preset dialogue interception parameters to obtain at least two candidate dialogue sentence groups; wherein each candidate dialogue sentence group includes at least two candidate dialogue sentences, and there are overlapping candidate dialogue sentences between two adjacent candidate dialogue sentence groups;
[0008] Supplementing the role information and the turn information to the candidate dialogue sentence to obtain a target dialogue sentence;
[0009] Encoding the target dialogue sentence to obtain target dialogue encoding data;
[0010] Performing intention recognition on the target dialogue coded data to obtain candidate dialogue intention information of the target dialogue sentence and recognition probability of the candidate dialogue intention information; wherein the recognition probability represents the recognition accuracy of the candidate dialogue intention information;
[0011] The target dialogue intention information of the target dialogue sentence is filtered out from the candidate dialogue intention information according to the recognition probability.
[0012] In some embodiments, the dialogue interception parameters include: at least one preset sliding window and a preset number of overlapping sentences; the dialogue interception of the at least two original dialogue sentences according to the preset dialogue interception parameters to obtain at least two candidate dialogue sentence groups includes:
[0013] Intercepting the at least two original dialogue sentences according to each of the preset sliding windows to obtain a preliminary dialogue sentence group;
[0014] Adjusting each of the preset sliding windows according to the preset number of overlapping sentences to obtain an updated sliding window;
[0015] Adjusting the preliminary dialogue sentence group according to the updated sliding window to obtain an updated dialogue sentence group;
[0016] The update dialogue sentence groups are concatenated to obtain at least two candidate dialogue sentence groups.
[0017] In some embodiments, after selecting the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability, the method further includes:
[0018] Calculating the loss based on the preset intention verification information and the target conversation intention information to obtain intention recognition loss data;
[0019] Adjusting the preset number of overlapping sentences according to the intention recognition loss data to obtain an updated number of overlapping sentences;
[0020] The candidate dialogue sentence group is adjusted according to the updated number of overlapping sentences to obtain an optimized dialogue sentence group.
[0021] In some embodiments, the step of supplementing the candidate dialogue sentence with the role information and the turn information to obtain the target dialogue sentence includes:
[0022] generating a role identifier according to the role information;
[0023] generating a round identifier according to the round information;
[0024] Insertion positioning is performed on the candidate dialogue sentence to obtain insertion positioning information;
[0025] The role identifier and the turn identifier are added to the candidate dialogue sentence according to the insertion positioning information to obtain the target dialogue sentence.
[0026] In some embodiments, encoding the target dialogue sentence to obtain target dialogue encoding data includes:
[0027] Decomposing the target dialogue sentence to obtain decomposed words;
[0028] Performing encoding processing on each of the decomposed words to obtain preliminary encoding data; wherein the preliminary encoding data includes: role encoding information, round encoding information, context encoding information and word encoding information;
[0029] Fusing the role coding information, the round coding information and the context coding information to obtain target coding information;
[0030] The target coding information and the word coding information are concatenated to obtain the target dialogue coding data.
[0031] In some embodiments, the step of selecting the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability includes:
[0032] Accumulating the recognition probabilities of the same target dialogue sentence to obtain a target probability;
[0033] The target dialogue intention information of the target dialogue sentence is filtered out from the candidate dialogue intention information according to the target probability.
[0034] In some embodiments, the performing intention recognition on the target dialogue coded data to obtain candidate dialogue intention information of the target dialogue sentence and the recognition probability of the candidate dialogue intention information includes:
[0035] Performing intention classification processing based on the target dialogue coding data to obtain the candidate dialogue intention information;
[0036] The recognition accuracy of the candidate dialogue intention information is evaluated to obtain the recognition probability of the candidate dialogue intention information.
[0037] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application proposes a conversation-based intention recognition device, the device comprising:
[0038] A data acquisition module, used to acquire original dialogue data; wherein the original dialogue data includes: at least two original dialogue sentences and role information and turn information of each original dialogue sentence;
[0039] A conversation interception module, configured to intercept the at least two original conversation sentences according to preset conversation interception parameters to obtain at least two candidate conversation sentence groups; wherein each candidate conversation sentence group includes at least two candidate conversation sentences, and there are overlapping candidate conversation sentences between two adjacent candidate conversation sentence groups;
[0040] A supplementing module, used to supplement the role information and the turn information to the candidate dialogue sentence to obtain a target dialogue sentence;
[0041] An encoding module, used for encoding the target dialogue sentence to obtain target dialogue encoding data;
[0042] An intention recognition module, used to perform intention recognition on the target dialogue coded data, and obtain candidate dialogue intention information of the target dialogue sentence and recognition probability of the candidate dialogue intention information; wherein the recognition probability represents the recognition accuracy of the candidate dialogue intention information;
[0043] An information screening module is used to screen out the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability.
[0044] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes a computer device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the method described in the first aspect when executing the computer program.
[0045] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented.
[0046] The present application proposes a method and device for intention recognition based on dialogue, a computer device and a storage medium, which extracts at least two candidate dialogue sentence groups from at least two original dialogue sentences according to preset dialogue interception parameters, and there are overlapping candidate dialogue sentences between adjacent candidate dialogue sentence groups. Intent recognition for each candidate dialogue sentence group can retain the continuity of the context and improve the accuracy of intention recognition. In order to save the number of encoding networks in the encoding process, turn information and role information are first added to the candidate dialogue sentence to form a target dialogue sentence, and then the target dialogue sentence is encoded into target dialogue encoding data, and then the target dialogue encoding data is subjected to intention recognition to obtain candidate dialogue intention information and recognition probability of candidate dialogue intention information, so as to filter out the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability. Therefore, before encoding, the turn information and role information are first added to the candidate dialogue sentence, and then encoded, without setting multiple encoding networks, simplifying the encoding structure, reducing the amount of calculation in the intention recognition process, and improving the efficiency of intention recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 is a flowchart of a method for identifying intentions based on dialogue provided in an embodiment of the present application;
[0048] Figure 2 yes Figure 1 Flow chart of step S102 in FIG.
[0049] Figure 3 is a flowchart of a method for identifying intentions based on dialogue provided by another embodiment of the present application;
[0050] Figure 4 yes Figure 1 Flow chart of step S103 in FIG.
[0051] Figure 5 is an overall flow chart of the conversation-based intent recognition method provided in an embodiment of the present application;
[0052] Figure 6 yes Figure 1 Flow chart of step S104 in FIG.
[0053] Figure 7 yes Figure 1 Flow chart of step S105 in FIG.
[0054] Figure 8 yes Figure 1 Flow chart of step S106 in FIG.
[0055] Fig. 9 is a structural diagram of a conversation-based intention recognition device provided in an embodiment of the present application;
[0056] Fig.10 It is a schematic diagram of the hardware structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0058] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0060] First, some nouns involved in this application are analyzed:
[0061] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0062] Natural language processing (NLP): NLP uses computers to process, understand and apply human languages (such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is often used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.
[0063] Intent Recognition: It is an important task in natural language processing (NLP) that aims to determine the intention or purpose expressed in the sentence input by the user. Simply put, intent recognition is to understand the semantics of the user's words in order to better answer the user's questions or provide related services.
[0064] Pre-trained language model: refers to a language model trained in a certain field or task, which can be used for various natural language processing tasks, such as language modeling, text classification, machine translation, text generation, etc. Pre-trained models are usually obtained through training on large-scale corpora, and the model parameters can be used for different tasks and fields.
[0065] BERT (Bidirectional Encoder Representations from Transformers): is a pre-trained language representation model that has made revolutionary progress in the field of natural language processing (NLP). The core feature of BERT is the bidirectional encoder based on Transformer. Through pre-training on a large amount of unlabeled text data, it learns deep bidirectional language representation. This representation can capture the complex semantic and grammatical information of words, phrases, and sentences, thereby achieving excellent performance in various NLP tasks.
[0066] Intent recognition is to identify the intention expressed in the sentence in order to better answer the user's questions or provide related services. For example, if the user inputs: I want to buy an accident insurance, the intention is recognized as: buy accident insurance. Based on the recognized user intention, the accident insurance service can be provided.
[0067] If intent recognition is applied to dialogue, and there is a certain difference between the intent recognition of dialogue and regular sentences, the intent recognition of dialogue will be affected by the contextual dialogue, role interaction and dialogue turns. Specifically, in a dialogue scenario, there is interaction between dialogue roles, and the previous round of replies of the same role will affect the answer of the next role, so adding turn information and role information during dialogue intent recognition can improve the accuracy of intent recognition. In related technologies, multiple encoding networks are used to encode information such as words, sentences, roles and turns respectively, and then the encoded turn representation and role representation are integrated into the sentence information, and finally the intent recognition is completed. However, this intent recognition requires the setting of multiple encoding networks, which not only increases the complexity of the encoding structure, but also increases the amount of computation for intent recognition, affecting the efficiency of intent recognition.
[0068] Based on this, the embodiment of the present application provides a method and apparatus for intention recognition based on dialogue, a computer device and a storage medium, which is intended to intercept at least two original dialogue sentences according to dialogue interception parameters to form at least two candidate dialogue sentence groups, and there are overlapping candidate dialogue sentences between two adjacent candidate dialogue sentence groups, which can make the context more continuous, so it is more accurate to perform intention recognition on at least two candidate dialogue sentence groups. In addition, before performing intention recognition, the role information and turn information are first added to the candidate dialogue sentence to form a target dialogue sentence, and then the target dialogue sentence is encoded, without setting up multiple encoding networks, simplifying the encoding structure of intention recognition, and improving the efficiency of intention recognition. Intent recognition is performed on the encoded target dialogue encoding data to obtain candidate dialogue intention information and recognition probability, so as to filter out the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability, so as to obtain more accurate intention information.
[0069] The conversation-based intent recognition method and apparatus, computer equipment, and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the conversation-based intent recognition method in the embodiments of the present application is described.
[0070] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0071] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0072] The conversation-based intention recognition method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The conversation-based intention recognition method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements a conversation-based intention recognition method, etc., but is not limited to the above forms.
[0073] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0074] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0075] Figure 1 is an optional flowchart of the conversation-based intention recognition method provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S101 to S106.
[0076] Step S101, obtaining original dialogue data; wherein the original dialogue data includes: at least two original dialogue sentences and role information and turn information of each original dialogue sentence;
[0077] Step S102, performing dialogue interception on at least two original dialogue sentences according to preset dialogue interception parameters to obtain at least two candidate dialogue sentence groups; wherein each candidate dialogue sentence group includes at least two candidate dialogue sentences, and there are overlapping candidate dialogue sentences between two adjacent candidate dialogue sentence groups;
[0078] Step S103, adding role information and turn information to the candidate dialogue sentence to obtain the target dialogue sentence;
[0079] Step S104, encoding the target dialogue sentence to obtain target dialogue encoding data;
[0080] Step S105, performing intention recognition on the target dialogue coded data to obtain candidate dialogue intention information of the target dialogue sentence and recognition probability of the candidate dialogue intention information; wherein the recognition probability represents the recognition accuracy of the candidate dialogue intention information;
[0081] Step S106, filtering out target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability.
[0082] Steps S101 to S106 shown in the embodiment of the present application are obtained by obtaining original dialogue data including at least two original dialogue sentences and the role information and turn information of the original dialogue sentences. Before performing the intention recognition of the dialogue, at least two candidate dialogue sentence groups are first extracted from the at least two original dialogue sentences, and there are overlapping candidate dialogue sentences between adjacent candidate dialogue sentence groups, so when performing the intention recognition for each candidate dialogue sentence group, the continuity of the context can be retained, making the intention recognition more accurate. When starting to perform the intention recognition for each candidate dialogue sentence group, the role information and turn information are first added to the candidate dialogue sentence to form a target dialogue sentence with turn and role information. The target dialogue sentence is first encoded into target dialogue encoding data, and then the target dialogue encoding data is subjected to the intention recognition to obtain the candidate dialogue intention information and the recognition probability of the candidate dialogue intention information, and the target dialogue intention information of each target dialogue sentence is screened out from the candidate dialogue intention information according to the recognition probability. Therefore, before encoding, the turn information and role information are added to the candidate dialogue sentences. During encoding, only one encoding network is needed to encode the target dialogue sentence. There is no need to set up multiple encoding networks. During encoding, the roles and turns of different dialogue sentences can be distinguished, which not only saves the amount of computational complexity in the encoding process, but also improves the accuracy and efficiency of intent recognition.
[0083] In step S101 of some embodiments, the acquisition of original dialogue data may be to acquire the sentences of a dialogue process in real time, or to construct a dialogue database in advance and extract the original dialogue data from the dialogue database. This embodiment does not impose any specific restrictions on the acquisition method of the original dialogue data. It should be noted that the original dialogue data is the data of a complete dialogue process. If it is in the medical field, the original dialogue data may be the dialogue between medical staff and patients; if it is in the financial field, the original dialogue data may be the dialogue between financial business personnel and customers. By collecting the complete dialogue process between multiple roles in different fields as the original dialogue data, more accurate intention recognition can be achieved.
[0084] Specifically, the original dialogue data includes at least two original dialogue sentences and the role information and turn information of each original dialogue sentence. It should be noted that there will be at least one round of dialogue in a complete dialogue process, and each dialogue will have at least two dialogue roles, so the sentences generated between each round of dialogue are used as original dialogue sentences, and the turn information and role information of each original dialogue sentence are obtained to clarify the participants and dialogue order of each dialogue process, so as to make the intention recognition more accurate.
[0085] For example, please refer to Table 1 below. If in the smart medical question-and-answer scenario, this embodiment defines that the user's question in the first round of dialogue between the smart medical butler and the user is: "What are the patients of breast cancer?", and the smart medical butler's reply is: "Hello, the patients of breast cancer are XXXX". The user's question in the second round of dialogue between the smart medical butler and the user is "How many levels are breast cancer mainly divided into?", and the smart medical butler's reply is: "Breast cancer is divided into XXXX". The user's question in the third round of dialogue between the smart medical butler and the user is "What are the treatments for grade 3 breast cancer?", and the smart medical butler's reply is: "The treatments for grade 3 breast cancer are XXXX". It can be seen that this embodiment divides the original dialogue sentences according to the dialogue rounds, and determines the role information and round information of each original dialogue sentence.
[0086]
[0087] Table 1
[0088] In some embodiments, the dialogue interception parameters include: at least one preset sliding window and a preset number of overlapping sentences, and the range of each preset sliding window is different, but the number of sentences in each preset sliding window is the same and continuous. For example, if the first preset sliding window is [0, K], the second preset sliding window is [K, 2K], and the third preset sliding window is [2K, 3K], K is the number of sentences, and the preset number of overlapping sentences is defined as m, and m < K. It should be noted that the traditional dialogue recognition directly intercepts the dialogue sentences according to different preset sliding windows and then performs intent recognition, which will cause discontinuity between the previous intercepted dialogue sentence group and the next intercepted dialogue sentence group, and the accuracy of intent recognition is also affected. In this embodiment, the preset number of overlapping sentences is set, and the preset number of overlapping sentences is used to adjust the preset sliding window, so that there is overlapping content between the dialogue sentence groups intercepted according to the adjusted sliding window, and the dialogue sentences based on the overlapping content are more accurately recognized.
[0089] See also Figure 2 In some embodiments, step S102 may include but is not limited to steps S201 to S204:
[0090] Step S201, intercepting at least two original dialogue sentences according to each preset sliding window to obtain a preliminary dialogue sentence group;
[0091] Step S202, adjusting each preset sliding window according to the preset number of overlapping sentences to obtain an updated sliding window;
[0092] Step S203, adjusting the preliminary dialogue sentence group according to the updated sliding window to obtain an updated dialogue sentence group;
[0093] Step S204: concatenate the updated dialogue sentence groups to obtain at least two candidate dialogue sentence groups.
[0094] In step S201 of some embodiments, a preliminary dialogue sentence group is first extracted from at least two original dialogue sentences according to each preset sliding window. It should be noted that there is no overlapping content between any two preliminary dialogue sentence groups, and they include at least one original dialogue sentence. For example, if the first preset sliding window is [0, K], the second preset sliding window is [K, 2K], and the third preset sliding window is [2K, 3K], then the first preliminary dialogue sentence group includes dialogue sentences from 0 to K, the second preliminary dialogue sentence group includes dialogue sentences from K to 2K, and the third preliminary dialogue sentence group includes dialogue sentences from 2K to 3K.
[0095] In some embodiments, in steps S202 to S203, in order to retain the continuity of the context during the intention recognition process, it is necessary to retain the overlapping parts in each dialogue sentence group. Therefore, each preset sliding window is first adjusted to an updated sliding window according to the preset number of overlapping sentences, and there is an overlapping part between two adjacent updated sliding windows. Specifically, the first preset sliding window does not need to be adjusted, and only the preset sliding windows other than the first one need to be adjusted so that the number of overlapping sentences between two adjacent preset sliding windows is the preset number of overlapping sentences. Therefore, the preliminary dialogue sentence group is adjusted according to the updated sliding window to obtain an updated dialogue sentence group, that is, the number of overlapping sentences between two adjacent updated dialogue sentence groups is the preset number of overlapping sentences.
[0096] For example, if the second preset sliding window is [K, 2K], and the third preset sliding window is [2K, 3K], the second preset sliding window is adjusted to form a second update sliding window of [Km, 2K-m], and the third preset sliding window is adjusted to form a third update sliding window of [2K-2m, 3K-2m], and so on, the nth preset sliding window is [(n-1)K-(n-1)m, nK-(n-1)m]. It should be noted that if K is 8, the preset number of overlapping sentences m is 4, the first update dialogue statement group includes dialogue statements from sentence 0 to sentence 8, the second update dialogue statement group includes dialogue statements from sentence 4 to sentence 12, and the third update dialogue statement group includes dialogue statements from sentence 8 to sentence 16. It can be seen that there are 4 overlapping dialogue statements between two adjacent update dialogue statement groups.
[0097] In step S204 of some embodiments, as disclosed above, after adjusting the preliminary dialogue statement group to form an updated dialogue statement group, and there are at least two updated dialogue statement groups, the at least two updated dialogue statement groups are combined into at least two candidate dialogue statement groups. It should be noted that the content of the first updated dialogue statement group is the same as that of the first preliminary dialogue statement group.
[0098] In the steps S201 to S204 shown in the present embodiment, at least two original dialogue sentences are first intercepted into at least two preliminary dialogue sentence groups according to each preset sliding window, and then the preset sliding window is adjusted according to the preset number of overlapping sentences to form an updated sliding window, and the overlapping part between two adjacent updated sliding windows is the preset number of overlapping sentences. Therefore, the preliminary dialogue sentence group is adjusted according to the updated sliding window to obtain the updated dialogue sentence group, and finally the updated dialogue sentence group is used as the candidate dialogue sentence group, and there are overlapping candidate dialogue sentences between two adjacent candidate dialogue sentence groups, and the number of sentences in the overlapping part is the preset number of overlapping sentences, so according to the candidate dialogue sentence group with overlapping parts, the context of the intention recognition process can be made more continuous, and the accuracy of intention recognition can be improved.
[0099] It should be noted that the preset sliding window and the preset number of overlapping sentences can be adjusted according to the number of original dialogue sentences, or according to the accuracy of intent recognition, so that the adjusted preset sliding window and the preset number of overlapping sentences can improve the accuracy of intent recognition.
[0100] See also Figure 3 In some embodiments, after step S106, the conversation-based intention recognition method may further include but is not limited to steps S301 to S303:
[0101] Step S301, performing loss calculation according to preset intention verification information and target dialogue intention information to obtain intention recognition loss data;
[0102] Step S302, adjusting the preset number of overlapping sentences according to the intention recognition loss data to obtain an updated number of overlapping sentences;
[0103] Step S303, adjusting the candidate dialogue sentence group according to the updated number of overlapping sentences to obtain an optimized dialogue sentence group.
[0104] In step S301 of some embodiments, the intent verification information represents the real intent information of the target dialogue sentence, and the intent verification information of each target dialogue sentence is manually set. The intent recognition loss data represents the accuracy of the intent recognition of the target dialogue sentence, and the model used in the intent recognition process can be adjusted through the intent recognition loss data to improve the accuracy of intent recognition. It should be noted that a loss function is used to calculate the loss of the intent verification information and the target dialogue intent information, and the loss function can be a mean square error loss function, a cross entropy loss function, a logarithmic loss function, an absolute error loss function, etc., and this embodiment does not specifically limit the loss function.
[0105] In steps S302 to S303 of some embodiments, the preset number of overlapping sentences is adjusted according to the intention recognition loss data to obtain an updated number of overlapping sentences. Specifically, the process of adjusting the preset number of overlapping sentences is a cyclic adjustment process, and the candidate dialogue sentence group will be updated after each output of the updated number of overlapping sentences to update the target dialogue intention information and obtain updated intention recognition loss data. If the updated intention recognition loss data becomes smaller, it indicates that the adjustment direction of the preset number of overlapping sentences (adjusting more or less) is correct; if the updated intention recognition loss data becomes larger, it indicates that the adjustment direction of the preset number of overlapping sentences is wrong, and the preset number of overlapping sentences needs to be adjusted according to another adjustment direction until the corresponding updated number of overlapping sentences when the intention recognition loss data converges is used as the optimal number of overlapping sentences. Therefore, the construction of the dialogue sentence group is completed according to the last output updated number of overlapping sentences, which can improve the accuracy of dialogue intention recognition.
[0106] In steps S301 to S303 shown in the present embodiment, the preset number of overlapping sentences is adjusted according to the intention loss data to obtain an optimized number of updated overlapping sentences. Then, the candidate dialogue sentence group is updated with the corresponding updated number of overlapping sentences when the intention recognition is more accurate to obtain an optimized dialogue sentence group. Therefore, the dialogue sentences in the optimized dialogue sentence group are more accurately recognized for the intention.
[0107] As disclosed above, after the candidate dialogue sentence group is constructed, each candidate dialogue sentence group includes at least two candidate dialogue sentences, and the number of overlapping candidate dialogue sentences between two adjacent candidate dialogue sentence groups is the preset number of overlapping sentences. In order to improve the continuity of the context in the intention recognition process, each candidate dialogue sentence group is directly input into the preset intention recognition model, and the intention recognition model will learn the contextual relationship between the candidate dialogue sentences in the candidate dialogue sentence group, and then perform intention recognition on each candidate dialogue sentence in the candidate dialogue sentence group to obtain more accurate intention information. It should be noted that before the candidate dialogue sentence group is input into the intention recognition model, the candidate dialogue sentence needs to be extracted from the candidate dialogue sentence group, and the role information and turn information are filled into each candidate dialogue sentence to form a new target dialogue sentence, and then the target dialogue sentences are combined into a target dialogue sentence group, and the target dialogue sentence group is input into the intention recognition model, so that the intention recognition model can not only learn the contextual relationship between the sentences, but also learn the role information and turn information of the dialogue process, thereby improving the accuracy of intention recognition.
[0108] See also Figure 4 In some embodiments, step S103 may include but is not limited to steps S401 to S404:
[0109] Step S401, generating a role identification according to the role information;
[0110] Step S402, generating a round identifier according to the round information;
[0111] Step S403, inserting and locating the candidate dialogue sentence to obtain insertion location information;
[0112] Step S404: Add the role identifier and the turn identifier to the candidate dialogue sentence according to the insertion positioning information to obtain the target dialogue sentence.
[0113] In some embodiments, in step S401 to step S402, character information is represented by a character identifier and turn information is represented by a turn identifier, which can simplify the recognition of subsequent codes. It should be noted that the order of sentences needs to be carried when generating the character identifier and turn identifier to determine the target dialogue sentence corresponding to each character identifier and turn identifier. Specifically, the character identifier is defined as<role_K> , used to characterize the role of the Kth dialogue sentence, and the round identifier is defined as<turn_K> , which is used to represent the turn information of the Kth dialogue sentence. By setting the role information and turn information in an identified manner, the subsequent intent recognition model can quickly determine the role information and turn information, thereby improving the efficiency of intent recognition.
[0114] In step S403 of some embodiments, the candidate dialogue sentence is positioned, that is, the position in the candidate dialogue sentence that can be inserted is identified as the insertion positioning information. In this embodiment, in order to allow the intention recognition model to more quickly identify the role identifier and the turn identifier, the beginning and end positions of the candidate dialogue sentence are used as the insertion positions, specifically, the beginning position is used as the insertion position of the role identifier, and the end position is used as the insertion position of the turn identifier.
[0115] In step S404 of some embodiments, the role identifier and the turn identifier are added to the candidate dialogue sentence according to the insertion positioning information, that is, the role identifier and the turn identifier are added to the position corresponding to the insertion positioning information in the candidate dialogue sentence to obtain the target dialogue sentence with the role identifier and the turn identifier.
[0116] Specifically, Figure 5 shown, and Figure 5 w1 to wn in are the word information of the candidate dialogue sentence. When each candidate dialogue sentence is input to the input layer, the context information of each candidate dialogue sentence is also obtained, and a context identifier is generated according to the context information. The context identifier is inserted into the beginning of the candidate dialogue sentence, and then the role identifier is inserted after the context identifier. Finally, the turn identifier is inserted into the end of the candidate dialogue sentence to construct the target dialogue sentence. Figure 5 As shown, the target dialogue sentence forming the Kth sentence is [<cls_K> ,<role_K> ,w1,......,wn,<turn_K> ], it can be seen that the target dialogue sentence formed not only contains the word information of the original sentence, but also contains the context information, role information and turn information. Only one encoding network is set to encode the target dialogue sentence, and there is no need to set up multiple encoding networks to encode the context information, role information and turn information as well as the dialogue sentence respectively, which reduces the structural complexity of the encoding process.
[0117] In steps S401 to S404 shown in this embodiment, the role information is converted into a role identifier, the turn information is converted into a turn identifier, and then the role identifier and the turn identifier are added to the candidate dialogue sentence to form a target dialogue sentence with the role information and the turn information. Therefore, in the subsequent encoding operation, only the target dialogue sentence needs to be encoded, and there is no need to set up multiple encoding networks to encode the turn information and the role information respectively, which can reduce the complexity of the encoding process.
[0118] See also Figure 6 In some embodiments, step S104 may include but is not limited to steps S601 to S604:
[0119] Step S601, decomposing the target dialogue sentence to obtain decomposed words;
[0120] Step S602, encoding each decomposed word to obtain preliminary encoding data; wherein the preliminary encoding data includes: role encoding information, round encoding information, context encoding information and word encoding information;
[0121] Step S603, fusing the role coding information, the round coding information and the context coding information to obtain target coding information;
[0122] Step S604, concatenate the target coding information and the word coding information to obtain the target dialogue coding data.
[0123] It should be noted that after constructing the target dialogue sentence, the target dialogue sentence is synthesized into a target dialogue sentence group and then input into the intent recognition model. The intent recognition model includes: a pre-trained language network and an intent recognition network. In this embodiment, the pre-trained language network is BERTS, and BERTS is a BERT-like model. Models representing this BERT series can be used as pre-trained language networks. Therefore, this embodiment uses BERTS to encode the target dialogue sentence group to obtain the encoding information at each position.
[0124] In step S601 of some embodiments, each target dialogue sentence is decomposed by a pre-trained language network to obtain decomposed words. It should be noted that it is easier to use words for encoding.
[0125] In step S602 of some embodiments, as disclosed above, the target dialogue sentence includes a turn identifier, a role identifier, a context identifier, and word information, so the decomposed word can be any one of the turn identifier, the role identifier, the context identifier, and the word information. For each decomposed word, preliminary encoding data is output, and the preliminary encoding data includes turn encoding information corresponding to the turn identifier, role encoding information corresponding to the role identifier, context encoding information corresponding to the context identifier, and word encoding information corresponding to each word information.
[0126] Specifically, Figure 5 As shown, the role coding information, round coding information, and context coding information of this embodiment are represented as follows:
[0127] e <r0le_K> =BERTS(<role_K> );
[0128] e <turn_K> =BERTS(<turn_K> );
[0129] e <cls_K> =BERTS(<cls_K> );
[0130] In the formula, e <role_K> Encode information for the role, e <turn_K> is the round encoding information, e <cls_K> Encodes context information.
[0131] In step S603 of some embodiments, in order to better understand the role information, turn information and context information in the process of intent recognition, it is necessary to fuse the role coding information, turn coding information and context coding information into target coding information. It should be noted that the fusion method of the role coding information, turn coding information and context coding information can be a direct splicing method, or a weighted summation, summation, average value and the like. This embodiment does not specifically limit the fusion method. If in this embodiment, the weighted summation fusion method is adopted, it is necessary to perform an importance evaluation on the role information in each target dialogue sentence to obtain role importance evaluation data, and then set the role weight according to the role importance evaluation data. At the same time, the turn information and context information in each target dialogue sentence are evaluated for importance to obtain turn importance evaluation data and context importance evaluation data, and the turn weight is set according to the turn importance evaluation data, and the context weight is set according to the context importance evaluation tree. Finally, the role coding information, turn coding information and context coding information are fused into target coding information according to the role weight, the turn weight and the context weight. Therefore, we first determine the importance of turns, roles, and contexts in the target dialogue sentence, and then specifically integrate them into target encoding information, so that the target encoding information can more accurately represent the intent in the target dialogue sentence and make intent recognition more accurate.
[0132] Specifically, the target encoding information representation generated by integrating context encoding information, role encoding information and round encoding information is shown as follows:
[0133] e K =e <role_K> +e <turn_K> +e <cls_K> ;
[0134] In the formula, e K Encode information for the target.
[0135] In step S604 of some embodiments, there are at least two word encoding information, and the target encoding information and the word encoding information are concatenated to obtain the target dialogue encoding data. Figure 5 As shown, if the encoding information of the nth word is e <wn_K> , the target dialogue encoding data formed can be s K =e <w1_K> +......e <wn_K> +e K .
[0136] In steps S601 to S604 shown in this embodiment, when encoding each target dialogue sentence, the target dialogue sentence is first decomposed into decomposed words, and then each decomposed word is encoded to obtain role encoding information, turn encoding information, context encoding information, and word encoding information. In order to make the representation of the target dialogue sentence more consistent with the user's intention, the role encoding information, turn encoding information, and context encoding information are first fused into target encoding information, and then the target encoding information and word encoding information are spliced into target dialogue encoding data. Therefore, the constructed target dialogue encoding data incorporates turn information, role information, and context information, and represents the user's intention more specifically, so that the intention recognition based on the target dialogue encoding data is more accurate.
[0137] See also Figure 7 In some embodiments, step S105 includes but is not limited to steps S701 to S702:
[0138] Step S701, performing intent classification processing based on the target dialogue coding data to obtain candidate dialogue intent information;
[0139] Step S702, evaluating the recognition accuracy of the candidate dialogue intention information to obtain the recognition probability of the candidate dialogue intention information.
[0140] As disclosed above, the target dialogue encoding data output by the pre-trained language network is input into the intent recognition network to perform intent recognition on the target dialogue encoding data through the intent recognition network. It should be noted that the intent recognition of the dialogue can be called dialogue behavior classification, so as to analyze the motivation in the target dialogue sentence and realize the classification of the dialogue behavior. Among them, the intent recognition network includes: a classification layer and a recognition accuracy assessment layer. The classification layer is used to perform intent classification on the target dialogue encoding data, also called dialogue behavior classification, and the recognition accuracy assessment layer is used to perform recognition accuracy assessment on the classified intent information.
[0141] In step S701 of some embodiments, the target dialogue coding data is subjected to intent classification by the classification layer to obtain candidate dialogue intent information. It should be noted that the intent information corresponding to the target dialogue coding data is analyzed by the classification layer as candidate dialogue intent information to achieve preliminary intent recognition of the target dialogue coding data. Specifically, the classification layer pre-sets a plurality of original dialogue intent information, and the classification layer performs intent analysis on the target dialogue coding data to obtain intent analysis data, and the candidate dialogue intent information close to the target dialogue sentence is screened out from the plurality of original dialogue intent information according to the intent analysis data.
[0142] Specifically, the pre-set original dialogue intention information includes not only the medical field, but also the financial field, the field of daily life common sense, and so on. In the process of intention analysis, the application field and application scenario corresponding to the target coding data will be identified first, and the preliminary dialogue intention information will be screened out from multiple original dialogue intention information according to the application field, and then the selected dialogue intention information will be screened out from the preliminary dialogue intention information according to the application scenario, and finally, the candidate dialogue intention information will be screened out from the selected dialogue intention information according to the intention analysis data predicted by the target coding data. As disclosed above, if the target dialogue sentence is "User: May I ask about the patient population of breast cancer? Smart Medical Butler: Hello, the patient population of breast cancer is XXXX", first select the preliminary dialogue intention information in the medical field, then obtain the selected dialogue intention information corresponding to the cancer scenario, and finally select the candidate dialogue intention information that is associated with pancreatic cancer.
[0143] In step S702 of some embodiments, in order to more accurately determine the intention information of the target dialogue sentence, the recognition accuracy evaluation layer evaluates the recognition accuracy of the candidate dialogue intention information, that is, the recognition accuracy rate of each candidate dialogue intention information is calculated as the recognition probability. The recognition probability can be used to determine whether each candidate dialogue intention information is closer to the real intention of the target dialogue sentence, so as to select the target dialogue intention information that is more consistent with the target dialogue sentence.
[0144] Specifically, the recognition accuracy evaluation layer of this embodiment uses a normalization function to predict the recognition probability of each candidate dialogue intention information. In this embodiment, the normalization function is a Softmax function. In other embodiments, the normalization function can be a ReLU function, an L2 normalization function, a minimum-maximum normalization function, etc., and this embodiment does not impose specific restrictions on the normalization function. If the Softmax function is used, the recognition probability is represented as follows:
[0145] y′ K =Softmax(W DA S K +b DA );
[0146] In the formula, y′ K is the recognition probability combination of all candidate dialogue intention information in the Kth target dialogue sentence, represented as a sequence, W DA and b DA are the weight and bias of the classification layer, respectively.
[0147] In steps S701 to S702 shown in the present embodiment, candidate dialogue intention information corresponding to the target dialogue encoding data is preliminarily selected, and then the degree of conformity of each candidate dialogue intention information to the target dialogue sentence is evaluated as the recognition probability, so as to judge which candidate dialogue intention information is more consistent with the real intention information of the target dialogue intention according to the recognition probability, thereby achieving more accurate intention recognition of the target dialogue sentence.
[0148] See also Figure 8 In some embodiments, step S106 may include but is not limited to steps S801 to S802:
[0149] Step S801, accumulating and calculating the recognition probabilities of the same target dialogue sentence to obtain a target probability;
[0150] Step S802: Filter out target dialogue intention information of a target dialogue sentence from the candidate dialogue intention information according to the target probability.
[0151] In step S801 of some embodiments, as disclosed above, each target dialogue sentence group is input into the intent recognition model for intent recognition, and there are overlapping dialogue sentences between two adjacent target dialogue sentence groups. The target dialogue sentences in the overlapping part will be recognized at least twice, so there are at least two recognition probabilities for the target dialogue sentences in the overlapping part. Therefore, it is necessary to accumulate the recognition probabilities of the same target dialogue sentence to obtain the target probability. It should be noted that if the target dialogue sentence does not belong to the dialogue sentence in the overlapping part, the target probability is equal to the recognition probability. If the target dialogue sentence belongs to the dialogue sentence in the overlapping part, the target probability is equal to the sum of the recognition probabilities of multiple target dialogue sentences.
[0152] In step S802 of some embodiments, the maximum probability is selected from the target probabilities, and the candidate dialogue intention information corresponding to the maximum probability is used as the target dialogue intention information of the target dialogue sentence to achieve accurate intention recognition of the target dialogue sentence.
[0153] For example, if there are three candidate conversation intention information, namely "breast cancer population", "breast cancer group", and "people suffering from breast cancer", and the target probability corresponding to "breast cancer population" is 0.21, the target probability corresponding to "breast cancer group" is 0.19, and the target probability corresponding to "people suffering from breast cancer" is 0.23, then "people suffering from breast cancer" is used as the target conversation intention information to achieve more accurate intent recognition.
[0154] In steps S801 to S802 shown in this example, more accurate intent recognition is achieved by combining the recognition probabilities of the same target dialogue sentence into a target probability and then selecting the candidate dialogue intention information corresponding to the largest target probability as the target dialogue intention information.
[0155] As disclosed above, after the intent recognition model outputs the target conversation intention information, the parameters of the intent recognition model can be adjusted according to the intent recognition loss data to optimize the intent recognition model. The optimized intent recognition model can perform intent recognition more accurately. In addition, the intent recognition model can be applied to the field of intelligent question and answer, such as medical intelligent question and answer, or insurance intelligent question and answer, etc., by obtaining the intent information of the conversation during the question and answer process, and combining the previous conversation data and the recognized intent information for intelligent reply, so as to output more accurate reply information.
[0156] The embodiment of the present application collects a complete dialogue, splits the dialogue into original dialogue sentences according to the sentence division method, and obtains the turn information and role information in each original dialogue sentence. First, a preliminary dialogue sentence group is intercepted from at least two original dialogue sentences according to a preset sliding window, and then the first preset sliding window is adjusted according to the preset overlapping sentence number to obtain an updated dialogue sentence group. Therefore, the number of overlapping sentences between two adjacent updated dialogue sentence groups is the preset overlapping sentence number. The updated dialogue sentence group is spliced into at least two candidate dialogue sentence groups, and there are also overlapping dialogue sentences between two adjacent candidate dialogue sentence groups. Therefore, by constructing a dialogue sentence group with overlapping parts, the continuity of the context is retained in the subsequent intent recognition, and the accuracy of intent recognition can be improved. In addition to the context continuity problem, the role information and turn information of the dialogue process also have a certain influence on the accuracy of intent recognition, so the role information is converted into a role identifier, and the turn information is converted into a turn identifier, and then the context information of the candidate dialogue sentence in each candidate dialogue sentence group is obtained, and the context information is converted into a context identifier. The context identifier is added to the beginning of the candidate dialogue sentence, the role identifier is added after the context identifier, and the turn identifier is added to the end of the candidate dialogue sentence to form a target dialogue sentence. The target dialogue sentences are combined into a target dialogue sentence group, and then the target dialogue sentence group is input into the intent recognition model, and the intent recognition model includes a pre-trained language network and an intent recognition network. The target dialogue sentence is decomposed into decomposed words through the pre-trained language network, and then the decomposed words are encoded into role encoding information, turn encoding information, context encoding information and word encoding information. The role importance evaluation data is obtained by evaluating the importance of the role information in each target dialogue sentence, and then the role weight is set according to the role importance evaluation data. At the same time, the turn information and context information in each target dialogue sentence are evaluated for importance to obtain turn importance evaluation data and context importance evaluation data, and the turn weight is set according to the turn importance evaluation data, and the context weight is set according to the context importance evaluation tree. The role encoding information, turn encoding information and context encoding information are fused into target encoding information according to the role weight, turn weight and context weight, and finally the target encoding information and word encoding information are spliced to obtain the target dialogue encoding data. Among them, the intent recognition network includes: a classification layer and a recognition accuracy evaluation layer. The classification layer classifies the target dialogue encoding data to obtain candidate dialogue intent information, and the recognition accuracy evaluation layer evaluates the accuracy of each candidate dialogue intent information to obtain the recognition probability representing the candidate dialogue intent information.Because there are overlapping target dialogue sentences between adjacent target dialogue sentence groups, there are at least two recognition probabilities for the same target dialogue sentence. The recognition probabilities of the same target dialogue sentence are accumulated into the target probability, and the candidate dialogue intention information corresponding to the maximum target probability is used as the target dialogue intention information of the target dialogue sentence.
[0157] Therefore, in order to improve the continuity of context during intent recognition, candidate dialogue sentence groups with overlapping dialogue sentences are extracted, and before encoding, the turn information and role information are integrated into the candidate dialogue sentences in the candidate dialogue sentence group to form target dialogue sentences. Only one pre-trained language model is required to encode the target dialogue sentences, and there is no need to set up multiple encoding networks. The structure of the encoding process is simplified, making intent recognition more efficient and accurate.
[0158] See also Fig. 9 The embodiment of the present application further provides a conversation-based intention recognition device, which can implement the above-mentioned conversation-based intention recognition method, and the device includes:
[0159] The data acquisition module 901 is used to acquire original dialogue data; wherein the original dialogue data includes: at least two original dialogue sentences and role information and turn information of each original dialogue sentence;
[0160] A conversation interception module 902 is used to intercept at least two original conversation sentences according to preset conversation interception parameters to obtain at least two candidate conversation sentence groups; wherein each candidate conversation sentence group includes at least two candidate conversation sentences, and there are overlapping candidate conversation sentences between two adjacent candidate conversation sentence groups;
[0161] A supplementing module 903 is used to supplement the role information and turn information to the candidate dialogue sentence to obtain the target dialogue sentence;
[0162] The encoding module 904 is used to encode the target dialogue sentence to obtain the target dialogue encoding data;
[0163] The intention recognition module 905 is used to perform intention recognition on the target dialogue coded data to obtain candidate dialogue intention information of the target dialogue sentence and recognition probability of the candidate dialogue intention information; wherein the recognition probability represents the recognition accuracy of the candidate dialogue intention information;
[0164] The information screening module 906 is used to screen the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability.
[0165] The specific implementation of the conversation-based intention recognition device is basically the same as the specific implementation of the conversation-based intention recognition method described above, and will not be repeated here.
[0166] The embodiment of the present application also provides a computer device, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned conversation-based intention recognition method when executing the computer program. The computer device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0167] See also Fig.10 , Fig.10 The hardware structure of a computer device according to another embodiment is shown, and the computer device includes:
[0168] The processor 1001 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0169] The memory 1002 may be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 may store an operating system and other application programs. When the technical solution provided in the embodiments of this specification is implemented by software or firmware, the relevant program code is stored in the memory 1002, and the processor 1001 calls and executes the conversation-based intention recognition method of the embodiments of this application;
[0170] Input / output interface 1003, used to implement information input and output;
[0171] The communication interface 1004 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0172] A bus 1005 , which transmits information between various components of the device (e.g., the processor 1001 , the memory 1002 , the input / output interface 1003 , and the communication interface 1004 );
[0173] The processor 1001 , the memory 1002 , the input / output interface 1003 and the communication interface 1004 are connected to each other in communication within the device via the bus 1005 .
[0174] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the above-mentioned dialogue-based intent recognition method is implemented.
[0175] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0176] The conversation-based intention recognition method and apparatus, computer equipment and storage medium provided in the embodiments of the present application extract at least two candidate conversation sentence groups from at least two original conversation sentences according to conversation interception parameters, and there are overlapping candidate conversation sentences between two adjacent candidate conversation sentence groups. When performing intention recognition on each candidate conversation sentence, the continuity of the context can be retained, making the intention recognition more accurate. At the same time, the turn information and role information are added to the candidate conversation sentence in advance to form the target conversation sentence, and then the target conversation sentence is encoded. There is no need to set up multiple encoding networks, which simplifies the encoding structure. Intent recognition can be performed through the encoded target conversation encoding data, which can improve the efficiency of intention recognition.
[0177] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0178] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0179] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0180] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0181] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0182] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0183] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0184] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0185] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0186] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0187] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for identifying intentions based on dialogue, characterized in that: The method comprises: Acquire original dialogue data; wherein the original dialogue data includes: at least two original dialogue sentences and role information and turn information of each original dialogue sentence; The at least two original dialogue sentences are intercepted according to preset dialogue interception parameters to obtain at least two candidate dialogue sentence groups; wherein each candidate dialogue sentence group includes at least two candidate dialogue sentences, and there are overlapping candidate dialogue sentences between two adjacent candidate dialogue sentence groups; Supplementing the role information and the turn information to the candidate dialogue sentence to obtain a target dialogue sentence; Encoding the target dialogue sentence to obtain target dialogue encoding data; Performing intention recognition on the target dialogue coded data to obtain candidate dialogue intention information of the target dialogue sentence and recognition probability of the candidate dialogue intention information; wherein the recognition probability represents the recognition accuracy of the candidate intention information; The target dialogue intention information of the target dialogue sentence is filtered out from the candidate dialogue intention information according to the recognition probability.
2. The method according to claim 1, characterized in that The dialogue interception parameters include: at least one preset sliding window and a preset number of overlapping sentences; the dialogue interception of the at least two original dialogue sentences according to the preset dialogue interception parameters to obtain at least two candidate dialogue sentence groups includes: Intercepting the at least two original dialogue sentences according to each of the preset sliding windows to obtain a preliminary dialogue sentence group; Adjusting each of the preset sliding windows according to the preset number of overlapping sentences to obtain an updated sliding window; Adjusting the preliminary dialogue sentence group according to the updated sliding window to obtain an updated dialogue sentence group; The update dialogue sentence groups are concatenated to obtain at least two candidate dialogue sentence groups.
3. The method according to claim 2, characterized in that After selecting the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability, the method further includes: Calculating the loss based on the preset intention verification information and the target conversation intention information to obtain intention recognition loss data; Adjusting the preset number of overlapping sentences according to the intention recognition loss data to obtain an updated number of overlapping sentences; The candidate dialogue sentence group is adjusted according to the updated number of overlapping sentences to obtain an optimized dialogue sentence group.
4. The method according to any one of claims 1 to 3, characterized in that: The step of supplementing the role information and the turn information to the candidate dialogue sentence to obtain a target dialogue sentence includes: generating a role identifier according to the role information; generating a round identifier according to the round information; Insertion positioning is performed on the candidate dialogue sentence to obtain insertion positioning information; The role identifier and the turn identifier are added to the candidate dialogue sentence according to the insertion positioning information to obtain the target dialogue sentence.
5. The method according to any one of claims 1 to 3, characterized in that: The encoding process of the target dialogue sentence to obtain target dialogue encoding data includes: Decomposing the target dialogue sentence to obtain decomposed words; Performing encoding processing on each of the decomposed words to obtain preliminary encoding data; wherein the preliminary encoding data includes: role encoding information, round encoding information, context encoding information and word encoding information; Fusing the role coding information, the round coding information and the context coding information to obtain target coding information; The target coding information and the word coding information are concatenated to obtain the target dialogue coding data.
6. The method according to any one of claims 1 to 3, characterized in that: The step of selecting the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability includes: Accumulating the recognition probabilities of the same target dialogue sentence to obtain a target probability; The target dialogue intention information of the target dialogue sentence is filtered out from the candidate dialogue intention information according to the target probability.
7. The method according to any one of claims 1 to 3, characterized in that: The performing intention recognition on the target dialogue coded data to obtain candidate dialogue intention information of the target dialogue sentence and the recognition probability of the candidate dialogue intention information includes: Performing intention classification processing based on the target dialogue coding data to obtain the candidate dialogue intention information; The recognition accuracy of the candidate dialogue intention information is evaluated to obtain the recognition probability of the candidate dialogue intention information.
8. A conversation-based intention recognition device, characterized in that: The device comprises: A data acquisition module, used to acquire original dialogue data; wherein the original dialogue data includes: at least two original dialogue sentences and role information and turn information of each original dialogue sentence; A conversation interception module, configured to intercept the at least two original conversation sentences according to preset conversation interception parameters to obtain at least two candidate conversation sentence groups; wherein each candidate conversation sentence group includes at least two candidate conversation sentences, and there are overlapping candidate conversation sentences between two adjacent candidate conversation sentence groups; A supplementing module, used to supplement the role information and the turn information to the candidate dialogue sentence to obtain a target dialogue sentence; An encoding module, used for encoding the target dialogue sentence to obtain target dialogue encoding data; An intention recognition module, used to perform intention recognition on the target dialogue coded data, and obtain candidate dialogue intention information of the target dialogue sentence and recognition probability of the candidate dialogue intention information; wherein the recognition probability represents the recognition accuracy of the candidate dialogue intention information; An information screening module is used to screen out the target dialogue intention information of the target dialogue sentence from the candidate dialogue intention information according to the recognition probability.
9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the dialogue-based intention recognition method described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for dialog-based intention recognition described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Service voice intention presentation method and device, medium and electronic equipment
CN115733925A
Artificial intelligence-based intention recognition method and device, computer equipment and medium
CN116383389A
