Voice interaction method and device, electronic equipment and medium

By using the Q&A knowledge base and emotional information for the target user group in voice interaction, personalized responses are generated, and the problem that the existing technology cannot provide professional information is solved, and the accuracy and professionalism of voice interaction are improved.

CN119296526APending Publication Date: 2025-01-10PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411419635.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-10
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing voice interaction methods cannot combine professional knowledge in specific application scenarios, resulting in poor performance when dealing with highly professional problems and unable to meet users' needs for information in professional fields.

Method used

By receiving the voice data of the target user, converting it into text data, and determining the associated Q&A statement data in the Q&A knowledge base for the target user group, generating Q&A instructions, inputting the language Q&A model to obtain the answer text data, and finally converting it into voice Output, personalized responses based on user's emotions and historical information.

Benefits of technology

It has achieved professional improvement in the process of voice interaction, can quickly and accurately locate professional responses that meet the needs of target users, provide interactive feedback based on professional knowledge, and solves the shortcomings of the existing technology that cannot provide professional field information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119296526A_ABST
    Figure CN119296526A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a voice interaction method and device, electronic equipment and a medium, and belongs to the technical field of artificial intelligence. The method comprises: receiving voice data of a target user, and converting the voice data into text data, the target user being a user belonging to a target user group; according to the text data, at least one associated question and answer statement data is determined in a question and answer knowledge base, and the question and answer knowledge base comprises question and answer statement data for the target user group; generating a question-answer instruction by using the at least one associated question-answer statement data and the text data; inputting the question-answer instruction into a language question-answer model, so that the language question-answer model determines answer text data in a question-answer knowledge base or at least one associated question-answer statement data according to the question-answer instruction; and converting the response text data into response voice data and outputting the response voice data. Therefore, the accuracy and specialty of voice interaction can be improved, and the defect that professional field information cannot be provided in the prior art is overcome.
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, and in particular to a voice interaction method, device, electronic device and medium. Background Art

[0002] At present, in the relevant technologies, when electronic devices interact with users through voice, they usually interact based on preset rules or existing general language models, and cannot combine professional knowledge in specific application scenarios. They can only provide users with interactions based on general knowledge or general information. That is, the existing voice interaction methods perform poorly when dealing with highly professional problems and cannot meet users' needs for information in professional fields. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to propose a voice interaction method, device, electronic device and medium, aiming to improve the professionalism of the voice interaction process.

[0004] To achieve the above-mentioned purpose, a first aspect of an embodiment of the present application proposes a voice interaction method, the method comprising:

[0005] Receiving voice data of a target user and converting the voice data into text data, wherein the target user is a user belonging to a target user group;

[0006] Determining at least one associated question and answer statement data in a question and answer knowledge base according to the text data, wherein the question and answer knowledge base includes question and answer statement data for the target user group;

[0007] generating a question-and-answer instruction using the at least one associated question-and-answer sentence data and the text data;

[0008] Inputting the question-answering instruction into a language question-answering model, so that the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction;

[0009] The response text data is converted into response voice data for output.

[0010] In some implementations, before generating a question-and-answer instruction using the at least one associated question-and-answer sentence data and the text data, the method further includes:

[0011] Performing voiceprint recognition on the voice data to obtain emotional information of the target user, where the emotional information is used to represent the current emotion of the user;

[0012] The step of generating a question-and-answer instruction by using the at least one associated question-and-answer sentence data and the text data includes:

[0013] A question and answer instruction is generated using the at least one associated question and answer sentence data, the text data, and the emotion information.

[0014] In some implementations, before the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction, the method further includes:

[0015] Performing voiceprint recognition on the voice data to obtain identity information of the user;

[0016] Determining a historical emotion record of the user according to the identity information, wherein the historical emotion record is obtained by recording emotion information of the user obtained in history;

[0017] After the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction, the method further includes:

[0018] The response text data is updated according to the historical emotion record.

[0019] In some implementations, determining at least one associated question and answer statement data in a question and answer knowledge base according to the text data includes:

[0020] Determine the similarity between each question and answer statement data in the question and answer knowledge base and the text data;

[0021] Sorting the similarity between the text data and each of the question-answer sentence data to obtain a sorting result;

[0022] The at least one associated question and answer sentence data is determined according to the sorting result.

[0023] In some implementations, the question-answering statement data in the question-answering knowledge base is in vector form, and before determining the similarity between each question-answering statement data in the question-answering knowledge base and the text data, the method further includes:

[0024] Performing vectorization encoding on the text data to obtain vectorized text data;

[0025] Determining the similarity between each question and answer statement data in the question and answer knowledge base and the text data includes:

[0026] Determine the Euclidean distance and the cosine distance between each question and answer statement data in the question and answer knowledge base and the vectorized text data;

[0027] The similarity between each question and answer statement data and the text data is determined according to the Euclidean distance and the cosine distance between each question and answer statement data and the vectorized text data.

[0028] In some implementations, determining the response text data in the question-and-answer knowledge base or the at least one associated question-and-answer statement data according to the question-and-answer instruction includes:

[0029] Determining the similarity between each of the associated question and answer sentence data and the text data;

[0030] Determining, based on the similarity between each of the associated question and answer sentence data and the text data, whether the similarity between the at least one associated question and answer sentence data and the text data is greater than a first similarity threshold;

[0031] In a case where the similarity between the at least one associated question and answer sentence data and the text data is greater than a first similarity threshold, determining the answer text data in the at least one associated question and answer sentence data;

[0032] In a case where the similarity between the at least one associated question and answer sentence data and the text data is not all greater than a first similarity threshold, answer text data is determined in the question and answer knowledge base.

[0033] In some implementations, determining the response text data in the question-and-answer knowledge base or the at least one associated question-and-answer statement data according to the question-and-answer instruction includes:

[0034] Performing keyword extraction on the text data to obtain at least one keyword in the text data;

[0035] Determine the similarity between each of the keywords and the names of each classification item in the question-answer knowledge base;

[0036] Determining whether the text data contains a clear keyword based on the similarity between each keyword and the name of each classification item of the question-answer knowledge base, wherein the clear keyword is a keyword whose similarity with the name of any classification item is greater than a second similarity threshold;

[0037] In the case where the text data contains explicit keywords, determining the response text data in the at least one associated question and answer sentence data;

[0038] When the text data does not include a clear keyword, answer text data is determined in the question-answer knowledge base.

[0039] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a voice interaction device, the device comprising:

[0040] A voice receiving module, used for receiving voice data of a target user and converting the voice data into text data, wherein the target user is a user belonging to a target user group;

[0041] A data determination module, configured to determine at least one associated question and answer statement data in a question and answer knowledge base according to the text data, wherein the question and answer knowledge base includes question and answer statement data for the target user group;

[0042] An instruction generation module, used to generate a question-answering instruction using the at least one associated question-answering sentence data and the text data;

[0043] A response determination module, used for inputting the question-answering instruction into a language question-answering model, so that the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction;

[0044] The response output module is used to convert the response text data into response voice data for output.

[0045] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, the memory stores a computer program, and the processor implements the voice interaction method described in the first aspect when executing the computer program.

[0046] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the voice interaction method described in the first aspect above.

[0047] The voice interaction method, device, electronic device and medium proposed in the present application, the electronic device first receives the voice data of the target user and converts it into text data, so that the electronic device can accurately obtain the user's intention. The electronic device then determines at least one associated question and answer statement data in the question and answer statement knowledge base based on the text data. The question and answer statement knowledge base contains question and answer statement data for the target user group, so it can ensure that professional information closely related to the needs of the target user can be retrieved from it. Then, the electronic device generates a question and answer instruction using at least one associated question and answer statement data and text data, and inputs the question and answer instruction into a language question and answer model so that the language question and answer model determines the answer text data in the question and answer statement knowledge base or the associated question and answer statement data, and finally, converts the answer text data into answer voice data for output. Through the above process, the electronic device can quickly and accurately locate the professional answer that meets the needs of the target user, so that the target user can obtain interactive feedback based on professional knowledge, thereby improving the accuracy and professionalism of voice interaction, and solving the problem that the existing technology cannot provide professional field information. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 It is a flowchart of the voice interaction method provided in the embodiment of the present application;

[0049] Figure 2 It is a flowchart of the question-and-answer instruction generation process provided in an embodiment of the present application;

[0050] Figure 3 This is a flowchart of another question-and-answer instruction generation process provided in an embodiment of the present application.

[0051] Figure 4 This is a flowchart of the process of determining the response text data provided by the embodiment of the present application.

[0052] Figure 5 is a schematic diagram of the structure of a voice interaction device provided in an embodiment of the present application;

[0053] Figure 6 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0054] 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.

[0055] 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.

[0056] 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.

[0057] First, some nouns involved in this application are analyzed:

[0058] Language question answering model: The language question answering model is a natural language processing (NLP) technology that aims to generate appropriate answers based on the text (questions) input by the user. The model understands the user's intention and provides accurate answers by analyzing the semantic structure of the input sentence, contextual information, and related content in the database. First, the model parses the question raised by the user and identifies the core information and context in the question. NLP technology is used for lexical analysis, grammatical parsing, and semantic understanding. The model determines the relevant answer information based on the semantics of the question. This process may include fuzzy matching, keyword retrieval, semantic similarity calculation, etc. After obtaining relevant information, the model generates a reasonable answer.

[0059] Commonly used language question answering models include:

[0060] BERT (Bidirectional Encoder Representations from Transformers): BERT is a bidirectional Transformer-based model that excels at question-answering tasks. It uses a bidirectional encoder to understand the context of a sentence at the same time, thereby better grasping the meaning of the question. BERT is widely used in machine reading comprehension, question-answering systems, and other tasks.

[0061] GPT-3 (Generative Pretrained Transformer 3): GPT-3 is a generative language model based on the Transformer architecture with 175 billion parameters. It can not only answer user questions, but also generate natural and fluent conversations and articles.

[0062] T5 (Text-to-Text Transfer Transformer): T5 is a model that converts all NLP tasks into text-to-text tasks. Question-answering problems are converted into text generation tasks, which generates answers based on questions.

[0063] Chat-GLM: Chat-GLM is a generative language model, similar to the GPT model. It can generate dialogues and answers based on user input and is good at question-answering tasks in Chinese and multilingual environments.

[0064] At present, in the relevant technology, when electronic devices interact with users through voice, they usually interact based on preset rules or the above-mentioned general and existing language question-and-answer models, and cannot combine the professional knowledge in specific application scenarios, and can only provide users with interactions based on general knowledge or general information. That is, the existing voice interaction methods perform poorly when dealing with highly professional questions and cannot meet users' needs for information in professional fields.

[0065] Based on this, the embodiments of the present application provide a voice interaction method, device, electronic device and medium, aiming to improve the professionalism in the voice interaction process.

[0066] The voice interaction method, device, electronic device and medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the voice interaction method in the embodiments of the present application is described.

[0067] 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.

[0068] 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.

[0069] The voice interaction method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The voice interaction method provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the 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 it can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as 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 the voice interaction method, etc., but is not limited to the above forms.

[0070] 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.

[0071] 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.

[0072] See also Figure 1 , Figure 1 It is a flow chart of the voice interaction method provided in the embodiment of the present application. The first aspect of the embodiment of the present application provides a voice interaction method, including the following steps S110 to S150.

[0073] Step S110: receiving voice data of a target user and converting the voice data into text data, wherein the target user is a user belonging to a target user group.

[0074] The electronic device first receives the voice input of the target user. The target user is a user belonging to the target user group of the voice interaction method (such as the elderly group). The received voice data is converted into text data through voice recognition technology for further processing.

[0075] For example, an elderly user says to the electronic device: "I feel a little tired today, what should I do?" The electronic device converts the speech into text data through voice recognition: "I feel a little tired today, what should I do?".

[0076] Step S120: Determine at least one associated question and answer statement data in a question and answer knowledge base according to the text data, wherein the question and answer knowledge base includes question and answer statement data for a target user group.

[0077] The electronic device enters a question-and-answer knowledge base specially constructed for the target user group according to the text data obtained in step S110, and matches at least one question-and-answer statement data associated with the text data. The question-and-answer knowledge base pre-stores question-and-answer statement data for the target user group.

[0078] The combination of the question-answering knowledge base and the language question-answering model can be achieved through the Langchain framework, which is a framework for combining language models (such as GPT, Chat-GLM, etc.) and knowledge bases. It can help technicians combine language models with external knowledge sources (such as databases, documents or other information sources) to achieve more accurate and professional answers based on context and knowledge bases. Through Langchain, relevant information from the knowledge base can be embedded into the reasoning process of the generative language model, so that when answering questions, the model not only relies on the knowledge of the model itself, but also can refer to external professional data or documents.

[0079] Langchain can extract relevant information from external knowledge bases or documents and provide it to the language model through context. This allows the model to not only rely on built-in knowledge, but also dynamically access the latest and professional external data to answer. At the same time, Langchain allows developers to dynamically generate prompt templates through templates or contexts (prompt template is a templated language used as a guide input when using a large language model. The template contains a framework or context for the model to generate appropriate responses or outputs. For example, if an elderly person says to an electronic device, "I feel a little lonely today", then the electronic device can generate a prompt template based on sentiment analysis, such as "The elderly said: I mentioned that I feel a little lonely today. Combined with the mental health knowledge base, generate a paragraph of comfort and encouragement."), combine the input text with the content in the knowledge base, and guide the model to generate personalized and customized answers.

[0080] For example, the electronic device searches for questions related to "fatigue" and "tiredness" in a question-and-answer knowledge base for the elderly. The question-and-answer knowledge base stores a large amount of elderly companionship corpus, elderly mental health books, elderly care books, and a large number of real tender conversations. The electronic device searches the question-and-answer knowledge base to obtain multiple related question-and-answer sentence data, such as: "Old people need to rest more when they are tired and pay attention to replenishing water."

[0081] Step S130: Generate a question-and-answer instruction using at least one associated question-and-answer sentence data and text data.

[0082] The electronic device combines at least one related question and answer statement data found in step S120 with the user's original text data to generate a question and answer instruction (i.e., the prompt template mentioned above), which is used to further interact with the language question and answer model to determine the final response content. At least one related question and answer statement can be used as the answer domain of the language question and answer model for the language question and answer model to determine the response text data in the answer domain.

[0083] Exemplarily, the electronic device combines the user's text data and the related question and answer sentence data obtained by searching the question and answer database to generate a question and answer instruction: "The old man said: I mentioned that I felt a little lonely today. The related question and answer sentence data found in the question and answer database are as follows: 1. The elderly need to rest more when they are tired and pay attention to replenishing water; 2. It is recommended to undergo some necessary physical examinations; 3. You can try to do some relaxing activities outdoors and breathe fresh air. Please answer according to what the old man said."

[0084] Step S140: input the question-answering instruction into the language question-answering model, so that the language question-answering model determines the response text data in the question-answering knowledge base or at least one associated question-answering sentence data according to the question-answering instruction.

[0085] The electronic device inputs the generated question-answering instructions into the language question-answering model, and the model further determines the most appropriate response text data in the question-answering knowledge base or related question-answering sentence data based on the instructions. The language question-answering model has the ability to understand semantics and can give more personalized answers based on the context.

[0086] Exemplarily, the electronic device inputs the above question and answer instructions into the language question and answer model, and the language question and answer model determines the response text data from the three related question and answer sentence data as follows: The elderly need to rest more when they are tired and pay attention to replenishing water.

[0087] Step S150: Convert the response text data into response voice data for output.

[0088] Finally, the electronic device converts the response text data generated in step S140 into voice data, and can output it to the user in the form of voice through voice synthesis technology.

[0089] Exemplarily, the electronic device converts the generated text response "You can try to rest for a while and drink some water. If you continue to feel unwell, it is recommended to consult a doctor" into voice, and the voice assistant plays the suggestion to the user in a gentle tone.

[0090] Through the above steps S110-S150, the electronic device first receives the voice data of the target user and converts it into text data, so that the electronic device can accurately obtain the user's intention. The electronic device then determines at least one associated question and answer statement data in the question and answer statement knowledge base based on the text data. The question and answer statement knowledge base contains question and answer statement data for the target user group, so it can ensure that professional information closely related to the needs of the target user can be retrieved therefrom. Then, the electronic device generates a question and answer instruction using at least one associated question and answer statement data and text data, and inputs the question and answer instruction into a language question and answer model so that the language question and answer model determines the answer text data in the question and answer statement knowledge base or the associated question and answer statement data, and finally, converts the answer text data into answer voice data for output. Through the above process, the electronic device can quickly and accurately locate the professional answer that meets the needs of the target user, so that the target user can obtain interactive feedback based on professional knowledge, thereby effectively improving the accuracy and professionalism of voice interaction, and solving the problem that the prior art cannot provide information in professional fields.

[0091] In some implementations, before generating a question-and-answer instruction using at least one associated question-and-answer sentence data and text data, the method may further include:

[0092] Perform voiceprint recognition on speech data to obtain the target user's emotional information, which is used to represent the user's current emotion;

[0093] Generating a question-answer instruction using at least one associated question-answer sentence data and text data may include:

[0094] A question-and-answer instruction is generated using at least one associated question-and-answer sentence data, text data, and sentiment information.

[0095] See also Figure 2 , Figure 2 It is a flowchart of the question-and-answer instruction generation process provided in an embodiment of the present application. In this embodiment, the electronic device first performs voiceprint recognition on the voice data of the target user (execute step S210) and obtains the emotional information of the target user (execute step S220). Emotional information reflects the user's current emotional state, such as happiness, loss, or anxiety. When generating question-and-answer instructions, not only at least one associated question-and-answer sentence data extracted from the text data is used, but also the identified emotional information is combined (execute step S230), so as to generate more personalized and emotionally sensitive question-and-answer instructions.

[0096] In this way, this method allows the electronic device to adjust the answer content according to the user's current mood to provide a response that is more considerate and in line with the user's emotional needs.

[0097] For example, the target user's voice data is identified as "I am a little unhappy today." Through voiceprint recognition, the electronic device detects that the user's emotion is "lost." The electronic device finds related question-and-answer statements in the knowledge base, such as "How to deal with low mood?" At this time, the electronic device not only generates instructions based on the text data, but also takes the user's emotional state into consideration. After combining emotional information, the question-and-answer instructions generated by the electronic device may be biased towards emotional care, such as recommending some suggestions to soothe your mood. The electronic device finally replied: "I understand your mood. Maybe you can try to go out for a walk or listen to some relaxing music."

[0098] In some implementations, before the language question-answering model determines the response text data in the question-answering knowledge base or at least one associated question-answering sentence data according to the question-answering instruction, the method may further include:

[0099] Perform voiceprint recognition on voice data to obtain the user's identity information;

[0100] Determine the user's historical emotion record based on the identity information, wherein the historical emotion record is obtained by recording the user's emotion information obtained in history;

[0101] After the language question-answering model determines the answer text data in the question-answering knowledge base or at least one associated question-answering sentence data according to the question-answering instruction, the method may further include:

[0102] Update the response text data based on historical sentiment records.

[0103] See also Figure 3 , Figure 3 It is a flow chart of another question-and-answer instruction generation process provided by an embodiment of the present application. In this embodiment, before the electronic device uses the language question-and-answer model to determine the answer text data in the question-and-answer knowledge base or at least one associated question-and-answer statement data according to the question-and-answer instruction, the electronic device first performs voiceprint recognition on the user's voice data (execute step S310) to obtain the user's identity information (execute step S320, this step can be completed by the electronic device using the language question-and-answer model). Through the identity information, the electronic device can access the user's historical emotional records (execute step S330, this step can be completed by the electronic device using the language question-and-answer model), these records are summarized and stored based on the user's emotional information obtained in the past, and the emotional information obtained by the electronic device by executing step S220 can also be recorded in real time into the historical emotional record. After the language question-and-answer model generates the answer text data (execute step S340), the electronic device further uses the user's historical emotional records to update the answer text data (execute step S350, this step can be completed by the electronic device using the language question-and-answer model). In this way, the final answer is more in line with the user's emotional state and background.

[0104] For example, the user says through voice: "I feel very stressed recently." The electronic device first determines the user's identity through voiceprint recognition, and consults the user's historical emotional records, and finds that the user has recorded the emotion of "anxiety" many times in the past few days. Then, the language question-answering model queries the question-answering knowledge base according to the question-answering instructions and generates a preliminary response text: "There are many ways to relieve stress, such as exercise or relaxation exercises." On this basis, the electronic device updates the response text in combination with the historical emotional records, and finally outputs: "I noticed that you have been feeling a little anxious recently. Maybe you can try some deep breathing exercises, or go out for a walk to relax." In this way, the updated response not only conveys information, but also shows understanding and care for the user's emotional state.

[0105] In some implementations, determining at least one associated question and answer statement data in a question and answer knowledge base based on the text data may include:

[0106] Determine the similarity between each question and answer statement data and the text data in the question and answer knowledge base;

[0107] Sort the similarity between the text data and each question-answer statement data to obtain a sorting result;

[0108] At least one associated question and answer statement data is determined according to the sorting result.

[0109] In this embodiment, the electronic device determines at least one associated question and answer statement data in the question and answer knowledge base based on the text data. First, the electronic device evaluates the similarity between each question and answer statement data in the question and answer knowledge base and the input text data. By calculating the similarity, the electronic device can determine which question and answer statement data are most relevant to the user's request. Next, the electronic device sorts the similarity between the text data and each question and answer statement data to obtain a sorting result. Finally, based on the sorting result, the electronic device selects at least one associated question and answer statement data to ensure that the generated answer can accurately meet the user's needs.

[0110] For example, the user inputs by voice: "I want to know about common health problems of the elderly." The electronic device first calculates the similarity between this text data and various question and answer statement data in the question and answer knowledge base. After sorting these similarities, the electronic device determines the three related question and answer statement data that are most relevant to the user's needs (with the highest similarity): "Common health problems of the elderly include...", "Mental health of the elderly needs to pay attention to...", and "The elderly need to pay attention to diet...".

[0111] In some implementations, the question-answering statement data in the question-answering knowledge base is in vector form. Before determining the similarity between each question-answering statement data in the question-answering knowledge base and the text data, the method may further include:

[0112] Performing vectorization encoding on the text data to obtain vectorized text data;

[0113] Determining the similarity between each question and answer statement data and the text data in the question and answer knowledge base may include:

[0114] Determine the Euclidean distance and cosine distance between each question-answering statement data and the vectorized text data in the question-answering knowledge base;

[0115] The similarity between each question and answer statement data and the text data is determined based on the Euclidean distance and cosine distance between each question and answer statement data and the vectorized text data.

[0116] In this embodiment, the question and answer statement data in the question and answer knowledge base is stored in the form of vectors. Before determining the similarity between each question and answer statement data and the text data in the question and answer knowledge base, the electronic device first vectorizes and encodes the input text data to obtain vectorized text data. This process converts the text data into a vector format suitable for calculation. Next, the electronic device calculates the Euclidean distance and cosine distance between each question and answer statement data and the vectorized text data in the question and answer knowledge base to evaluate the similarity between them. The electronic device can assign a weight of 0.5 to the Euclidean distance and cosine distance between each question and answer statement data and the vectorized text data to calculate the similarity between each question and answer statement data and the vectorized text data. Finally, the electronic device determines the similarity between each question and answer statement data and the text data based on these distance values, thereby identifying the question and answer statement data related to the user request as associated question and answer statement data.

[0117] In this way, the electronic device improves the accuracy of similarity assessment between text data and sentence data in the question-and-answer knowledge base through vectorized encoding and distance calculation, thereby ensuring that users receive more relevant and personalized answers.

[0118] For example, the user asks by voice: "How can I improve my sleep quality?" The electronic device first vectorizes and encodes this text data to generate corresponding vectorized text data. Then, the Euclidean distance and cosine distance between each question and answer statement data and the vectorized text data in the electronic device question and answer knowledge base are calculated, and a weight of 0.5 is assigned to each of the Euclidean distance and cosine distance to calculate the similarity between each question and answer statement data and the vectorized text data. After calculation, it is found that "create a comfortable sleeping environment" has a high similarity with the user's text data, that is, "create a comfortable sleeping environment" is taken as one of the associated question and answer statement data.

[0119] See also Figure 4 , Figure 4 : is a flowchart of a process for determining answer text data provided by an embodiment of the present application. In some implementations, determining answer text data in a question and answer knowledge base or at least one associated question and answer statement data according to a question and answer instruction may include:

[0120] Step S410: Determine the similarity between each associated question and answer statement data and the text data;

[0121] Step S420: determining, based on the similarity between each associated question and answer statement data and the text data, whether the similarity between at least one associated question and answer statement data and the text data is greater than a first similarity threshold;

[0122] Step S430: when the similarity between at least one associated question and answer statement data and the text data is greater than a first similarity threshold, determining the answer text data in the at least one associated question and answer statement data;

[0123] Step S440: When the similarity between at least one associated question and answer statement data and the text data is not all greater than the first similarity threshold, determine the response text data in the question and answer knowledge base.

[0124] In this embodiment, the electronic device determines the answer text data in the question and answer knowledge base or at least one associated question and answer statement data according to the question and answer instruction. First, the electronic device calculates the similarity between each associated question and answer statement data and the text data. Then, the electronic device checks whether these similarities are all greater than a preset first similarity threshold. If so, the answer text data is selected from these associated question and answer statement data; if not, the electronic device turns to the question and answer knowledge base to find the answer text data to ensure that the electronic device can provide accurate answers in different situations.

[0125] In this way, the electronic device dynamically evaluates the similarity of related question and answer statement data, flexibly selects the source of the response, and ensures that the user obtains accurate and relevant answers, thereby improving the response quality and user experience of the question and answer electronic device.

[0126] Exemplarily, the user inputs by voice: "How can I improve my sleep quality?" The electronic device first calculates the similarity between the related question and answer statement data and it, such as "maintain a regular schedule", "reduce distractions" and "reduce caffeine intake". The electronic device determines that the similarities between the above three related question and answer statement data and it are 0.8, 0.6 and 0.9 respectively, among which the similarity with "reduce distractions" is 0.6, which does not reach the first similarity threshold. Since the similarities between the three related question and answer statement data and the text data are not all greater than the first similarity threshold, the electronic device searches for the response text data in the question and answer knowledge base, and the answer finally generated can be: "An effective way to improve sleep quality is to make sure your bedroom is quiet, dark and comfortable." In this way, the user gets practical suggestions.

[0127] In some implementations, determining the response text data in the question-and-answer knowledge base or at least one associated question-and-answer statement data according to the question-and-answer instruction may include:

[0128] Performing keyword extraction on the text data to obtain at least one keyword in the text data;

[0129] Determine the similarity between each keyword and the name of each classification entry in the question-answer knowledge base;

[0130] Determine whether the text data contains a clear keyword based on the similarity between each keyword and the name of each classification item in the question-answer knowledge base, where the clear keyword is a keyword whose similarity with the name of any classification item is greater than a second similarity threshold;

[0131] In the case where the text data contains a clear keyword, determining the response text data in at least one of the associated question and answer sentence data;

[0132] When the text data does not contain a clear keyword, answer text data is determined in the question-answer knowledge base.

[0133] In this embodiment, the electronic device dynamically determines the response text data by processing the question and answer instructions. In this process, the electronic device first extracts keywords from the input text data to obtain at least one keyword. Then, the electronic device calculates the similarity between each keyword and the name of each classification item in the question and answer knowledge base to evaluate whether the text data contains clear keywords. If the similarity between a keyword and a classification item exceeds a preset second similarity threshold, the electronic device considers that the text data contains clear keywords, and then determines the response text data in at least one associated question and answer statement data; otherwise, the response text data is searched in the question and answer knowledge base to ensure that the user gets a targeted and accurate answer.

[0134] In this way, the electronic device dynamically evaluates whether the text data is a clear statement and flexibly selects the source of the response to ensure that the user obtains accurate and relevant answers, thereby improving the response quality and user experience of the question-and-answer electronic device.

[0135] For example, if a user asks by voice: "How should I improve my diet?" the electronic device first extracts the keywords "improvement" and "diet". Subsequently, the electronic device calculates the similarity between "improvement" and "diet" and the names of various classification items in the question-and-answer knowledge base, and finds that the similarity between "diet" and the item "diet choice" is 0.85, which exceeds the second similarity threshold and is a clear keyword. Since the clear keyword is identified, the electronic device determines the response text data in the associated question-and-answer statement data that has been searched, and the final generated answer can be: "To improve the diet, it is recommended to increase the intake of vegetables and fruits and maintain proper water intake." In this way, the user gets practical health advice.

[0136] If the user inputs by voice: "I feel a little uncomfortable." The electronic device first extracts the keyword "uncomfortable". Subsequently, the electronic device calculates the similarity between "uncomfortable" and the name of the classification item in the question-and-answer knowledge base, and finds that no classification item has a similarity with "uncomfortable" greater than the second similarity threshold, that is, there is no clear keyword, indicating that the voice input sentence does not have a clear direction, and the related question-and-answer sentence data searched in advance may be difficult to meet the targeted needs of the question and answer. Therefore, the language question-and-answer model will conduct a wider search in the entire question-and-answer knowledge base. The answer finally generated by the language question-and-answer model can be: "There may be many reasons for discomfort. It is recommended that you measure your body temperature and pay attention to whether there are other symptoms. If the discomfort persists, please consult a doctor."

[0137] See also Figure 5 , Figure 5 is a structural diagram of a voice interaction device provided in an embodiment of the present application. The embodiment of the present application also provides a voice interaction device 500, which can implement the above-mentioned voice interaction method. The device 500 includes:

[0138] A voice receiving module 510 is used to receive voice data of a target user and convert the voice data into text data, wherein the target user is a user belonging to a target user group;

[0139] A data determination module 520, configured to determine at least one associated question and answer statement data in a question and answer knowledge base according to the text data, wherein the question and answer knowledge base includes question and answer statement data for a target user group;

[0140] An instruction generation module 530, for generating a question-answering instruction using at least one associated question-answering sentence data and text data;

[0141] A response determination module 540 is used to input the question-answering instruction into the language question-answering model so that the language question-answering model determines the response text data in the question-answering knowledge base or at least one associated question-answering sentence data according to the question-answering instruction;

[0142] The response output module 550 is used to convert the response text data into response voice data for output.

[0143] The specific implementation of the voice interaction device 500 is basically the same as the specific implementation of the above-mentioned voice interaction method, and will not be repeated here.

[0144] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned voice interaction method when executing the computer program. The electronic device can be any smart terminal including a tablet computer, a car computer, etc.

[0145] See also Figure 6 , Figure 6 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:

[0146] The processor 601 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an 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;

[0147] The memory 602 can 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 602 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 602, and the processor 601 calls and executes the voice interaction method of the embodiment of this application;

[0148] Input / output interface 603, used to implement information input and output;

[0149] Communication interface 604, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0150] Bus 605 , which transmits information between various components of the device (e.g., processor 601 , memory 602 , input / output interface 603 , and communication interface 604 );

[0151] The processor 601 , the memory 602 , the input / output interface 603 and the communication interface 604 are connected to each other in communication within the device via a bus 605 .

[0152] 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 voice interaction method is implemented.

[0153] 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.

[0154] The voice interaction method, device, electronic device and medium provided by the embodiment of the present application, the electronic device first receives the voice data of the target user and converts it into text data, so that the electronic device can accurately obtain the user's intention. The electronic device then determines at least one associated question and answer statement data in the question and answer statement knowledge base based on the text data. The question and answer statement knowledge base contains question and answer statement data for the target user group, so it can ensure that professional information closely related to the needs of the target user can be retrieved from it. Then, the electronic device generates a question and answer instruction using at least one associated question and answer statement data and text data, and inputs the question and answer instruction into a language question and answer model so that the language question and answer model determines the answer text data in the question and answer statement knowledge base or the associated question and answer statement data, and finally, converts the answer text data into answer voice data for output. Through the above process, the electronic device can quickly and accurately locate the professional answer that meets the needs of the target user, so that the target user can obtain interactive feedback based on professional knowledge, thereby effectively improving the accuracy and professionalism of voice interaction, and solving the problem that the prior art cannot provide information in the professional field.

[0155] 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.

[0156] 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.

[0157] 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.

[0158] 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.

[0159] 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.

[0160] 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.

[0161] 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.

[0162] 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.

[0163] 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.

[0164] 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.

[0165] 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 voice interaction method, characterized in that: The method comprises: Receiving voice data of a target user and converting the voice data into text data, wherein the target user is a user belonging to a target user group; Determining at least one associated question and answer statement data in a question and answer knowledge base according to the text data, wherein the question and answer knowledge base includes question and answer statement data for the target user group; generating a question-and-answer instruction using the at least one associated question-and-answer sentence data and the text data; Inputting the question-answering instruction into a language question-answering model, so that the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction; The response text data is converted into response voice data for output.

2. The method according to claim 1, characterized in that Before generating a question-and-answer instruction using the at least one associated question-and-answer sentence data and the text data, the method further includes: Performing voiceprint recognition on the voice data to obtain emotional information of the target user, where the emotional information is used to represent the current emotion of the user; The step of generating a question-and-answer instruction by using the at least one associated question-and-answer sentence data and the text data includes: A question and answer instruction is generated using the at least one associated question and answer sentence data, the text data, and the emotion information.

3. The method according to claim 2, characterized in that Before the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction, the method further includes: Performing voiceprint recognition on the voice data to obtain identity information of the user; Determining a historical emotion record of the user according to the identity information, wherein the historical emotion record is obtained by recording emotion information of the user obtained in history; After the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction, the method further includes: The response text data is updated according to the historical emotion record.

4. The method according to claim 1, characterized in that Determining at least one associated question and answer statement data in a question and answer knowledge base according to the text data includes: Determine the similarity between each question and answer statement data in the question and answer knowledge base and the text data; Sorting the similarity between the text data and each of the question-answer sentence data to obtain a sorting result; The at least one associated question and answer sentence data is determined according to the sorting result.

5. The method according to claim 4, characterized in that The question and answer statement data in the question and answer knowledge base is in vector form. Before determining the similarity between each question and answer statement data in the question and answer knowledge base and the text data, the method further includes: Performing vectorization encoding on the text data to obtain vectorized text data; Determining the similarity between each question and answer statement data in the question and answer knowledge base and the text data includes: Determine the Euclidean distance and the cosine distance between each question and answer statement data in the question and answer knowledge base and the vectorized text data; The similarity between each question and answer statement data and the text data is determined according to the Euclidean distance and the cosine distance between each question and answer statement data and the vectorized text data.

6. The method according to claim 1, characterized in that The step of determining the answer text data in the question and answer knowledge base or the at least one associated question and answer statement data according to the question and answer instruction comprises: Determine the similarity between each of the associated question and answer sentence data and the text data; Determining, based on the similarity between each of the associated question and answer sentence data and the text data, whether the similarity between the at least one associated question and answer sentence data and the text data is greater than a first similarity threshold; In a case where the similarity between the at least one associated question and answer sentence data and the text data is greater than a first similarity threshold, determining the answer text data in the at least one associated question and answer sentence data; In a case where the similarity between the at least one associated question and answer sentence data and the text data is not all greater than a first similarity threshold, answer text data is determined in the question and answer knowledge base.

7. The method according to claim 1, characterized in that The step of determining the answer text data in the question and answer knowledge base or the at least one associated question and answer statement data according to the question and answer instruction comprises: Performing keyword extraction on the text data to obtain at least one keyword in the text data; Determine the similarity between each of the keywords and the names of each classification item in the question-answer knowledge base; Determining whether the text data contains a clear keyword based on the similarity between each keyword and the name of each classification item of the question-answer knowledge base, wherein the clear keyword is a keyword whose similarity with the name of any classification item is greater than a second similarity threshold; In the case where the text data contains explicit keywords, determining the response text data in the at least one associated question and answer sentence data; When the text data does not include a clear keyword, answer text data is determined in the question-answer knowledge base.

8. A voice interaction device, characterized in that: The device comprises: A voice receiving module, used for receiving voice data of a target user and converting the voice data into text data, wherein the target user is a user belonging to a target user group; A data determination module, configured to determine at least one associated question and answer statement data in a question and answer knowledge base according to the text data, wherein the question and answer knowledge base includes question and answer statement data for the target user group; An instruction generation module, used to generate a question-answering instruction using the at least one associated question-answering sentence data and the text data; A response determination module, used for inputting the question-answering instruction into a language question-answering model, so that the language question-answering model determines the response text data in the question-answering knowledge base or the at least one associated question-answering sentence data according to the question-answering instruction; The response output module is used to convert the response text data into response voice data for output.

9. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the voice interaction 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 voice interaction method described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • system

    JP2026155765A