A question answering method and apparatus
By performing semantic and keyword retrieval in intelligent agent devices, and combining semantic similarity and keyword similarity, the problem of inaccurate intelligent agent memory retrieval is solved, enabling fast and accurate response text output, thus improving user experience and response accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2024-12-31
- Publication Date
- 2026-06-30
AI Technical Summary
Existing methods for retrieving memories from intelligent agents, especially text storage and semantically related vector storage in relational databases, cannot accurately retrieve memories according to user intent, resulting in low response accuracy.
By acquiring the target question text input by the user from the intelligent agent device, semantic retrieval and keyword retrieval are performed. By combining semantic similarity and keyword similarity, historical dialogue records are identified, and corrective text is output when responses are inconsistent, thereby improving the accuracy of responses.
It achieves fast and accurate response text output, improves user experience and response text accuracy, and avoids the problem of excessively long response time.
Smart Images

Figure CN122309645A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a question-answering method and apparatus. Background Technology
[0002] An intelligent agent is an entity possessing intelligence; it is a crucial concept in the field of artificial intelligence. Any independent entity capable of thought and interaction with its environment can be abstracted as an intelligent agent, such as an intelligent question-answering system. When a user issues a command to an intelligent agent, the agent can retrieve the corresponding information from its stored memory based on the command and respond accordingly.
[0003] Currently, agent memory storage methods include text storage in relational databases and semantically related vector storage. Text storage in relational databases stores information chronologically according to the historical dialogue between the user and the agent, while semantically related vector storage stores information based on the semantic similarity of these dialogues. However, both text storage in relational databases and semantically related vector storage may fail to retrieve memories according to the user's intent, resulting in low accuracy and hindering accurate responses.
[0004] Therefore, improving the accuracy of memory retrieval is a technical problem that urgently needs to be solved. Summary of the Invention
[0005] This application provides a question-answering method and apparatus to improve the accuracy of memory retrieval.
[0006] In a first aspect, embodiments of this application provide a question-and-answer method, which can be applied to an electronic device in a question-and-answer system. The electronic device can be an intelligent agent device, a server, or a fusion memory component for generating response text, etc. The method includes: the electronic device acquiring a target question text input by a user; the electronic device retrieving a first historical question text with the highest semantic similarity to the target question text from at least one set of saved historical dialogue records, and outputting a first response text corresponding to the first historical question text; wherein any set of historical dialogue records contains historical question text and corresponding response text; the electronic device acquiring at least one target keyword of the target question text, and acquiring keywords corresponding to at least one set of historical dialogue records; the electronic device calculating the similarity between at least one target keyword and the keywords corresponding to each set of historical dialogue records; the electronic device determining a target historical dialogue record with the highest similarity between the corresponding keyword and at least one target keyword, and acquiring a second response text from the target historical dialogue record; when the first response text and the second response text are inconsistent, the electronic device outputting a correction text based on the second response text.
[0007] Using this method, an electronic device can perform semantic retrieval on at least one set of historical dialogue records based on the target question text to obtain a first historical question text, and output a first response text based on the first historical question text. Because semantic retrieval is highly efficient, it can quickly identify first historical question texts semantically similar to the target question text, thus rapidly outputting the first response text and avoiding excessively long response times for the intelligent agent to the target question text, thereby improving user experience. Simultaneously, the electronic device can perform keyword retrieval based on keywords of the target question text to obtain a second response text. When the first and second response texts are inconsistent, a corrective text can be output based on the second response text. Because keyword retrieval has high accuracy, the accuracy of the corrective text output based on the second response text is also high. Therefore, this method can improve the accuracy of the output response text.
[0008] In one possible design, the electronic device stores a first historical dialogue record; wherein, when the first response text matches the second response text, the first historical dialogue record includes the target question text and the corresponding first response text; or when the first response text does not match the second response text, the first historical dialogue record includes the target question text and the corresponding second response text.
[0009] Optionally, when the first response text is consistent with the second response text, keywords corresponding to the first historical dialogue record are generated based on at least one target keyword and the keyword corresponding to the first response text; the keywords corresponding to the first historical dialogue record are saved.
[0010] Optionally, when the first response text is inconsistent with the second response text, keywords corresponding to the first historical dialogue record are generated based on at least one target keyword and the keywords corresponding to the second response text; the keywords corresponding to the first historical dialogue record are saved.
[0011] This design allows for the generation of semantic information and keyword information based on the target question text and its corresponding response text after obtaining the response text. The semantic information can be used for semantic retrieval, and the keyword information can be used for keyword retrieval. This enables rapid retrieval of the semantic information using semantic retrieval and precise retrieval of the keyword information using keyword retrieval.
[0012] In one possible design, after retrieving the second response text from the target's historical dialogue record, the method further includes:
[0013] Determine the similarity between the keywords corresponding to the first response text and the keywords corresponding to the second response text;
[0014] When the similarity is greater than or equal to the set threshold, the first response text is determined to be consistent with the second response text.
[0015] When the similarity is less than a set threshold, the first response text is determined to be inconsistent with the second response text.
[0016] This design allows for setting different thresholds to meet different business needs, increasing the flexibility in determining whether the first response text and the second response text are consistent.
[0017] In one possible design, at least one target keyword includes at least one of the following: topic words, intent words, and entity words.
[0018] In one possible design, the target session identifier created for the user is obtained; at least one set of historical dialogue records containing the target session identifier is identified from multiple sets of historical dialogue records.
[0019] Secondly, embodiments of this application provide a question-answering device. This device has the functionality to implement various possible methods of the first aspect described above. This functionality can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more units or modules corresponding to the aforementioned functionality.
[0020] Thirdly, an electronic device is provided, comprising: a memory for storing computer program instructions; and a processor for executing the computer program instructions to support the electronic device in implementing the methods provided in any of the first aspects above.
[0021] Fourthly, this application also provides a computer-readable storage medium storing instructions that, when executed on a device, cause the device to perform the method of any possible design of the first aspect.
[0022] Fifthly, this application also provides a computer program product that, when run on a device, causes the device to perform any possible design of any aspect of the first aspect of the embodiments of this application.
[0023] The technical effects brought about by the second to fifth aspects above can be found in the description of the beneficial effects of the corresponding solutions in the first aspect above, and will not be repeated here. Attached Figure Description
[0024] Figure 1 This application provides a schematic diagram of a question-and-answer system architecture.
[0025] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0026] Figure 3 A schematic diagram of the software structure of an electronic device provided in an embodiment of this application;
[0027] Figure 4 A flowchart illustrating a question-and-answer method provided in this application embodiment;
[0028] Figure 5A A schematic diagram of a user's historical dialogue information provided in an embodiment of this application;
[0029] Figure 5B This is another schematic diagram of a user's historical dialogue information provided in an embodiment of this application;
[0030] Figure 6A This is a schematic diagram of the structure of a question-and-answer system provided in an embodiment of this application;
[0031] Figure 6B A flowchart illustrating another question-answering method provided in an embodiment of this application;
[0032] Figure 7 An exemplary block diagram of a question-and-answer device provided in an embodiment of this application;
[0033] Figure 8 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0034] To make the objectives, technical solutions, and advantages of this application clearer, a further detailed description of this application will be provided below in conjunction with the accompanying drawings. The specific operating methods and functional descriptions in the method embodiments can also be applied to the device embodiments or system embodiments.
[0035] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.
[0036] 1) Large language models (LLMs) are deep learning models trained on large amounts of text data that can generate natural language text or understand the meaning of language text. LLMs can handle various natural language tasks, such as text classification, question answering, and dialogue, and are an important pathway to artificial intelligence.
[0037] 2) Prompt information: In large language models, prompt information is a piece of text used to guide the large language model to generate specific types of output. By designing and optimizing a set of prompt information, the large language model can perform specific tasks.
[0038] 3) Dialogue refers to a question-and-answer session, i.e., a single-turn dialogue.
[0039] 4) A conversation refers to a series of dialogues that occur in order to complete a certain task. It may include multiple question-and-answer matches, i.e., multiple rounds of dialogue.
[0040] 5) Memory refers to the dynamic and personalized information accumulated by the model during interaction with the user. This memory information can be stored and updated during dialogue or interaction, and retrieved and utilized in future interactions. Memory information is dynamic and updates with each user interaction. It possesses characteristics such as dynamism and personalization. Dynamism means that memory is constantly updated over time and through interaction, adapting to changes in the user and new information. Personalization typically includes specific user information, historical dialogue content, user preferences, etc., enabling the provision of a personalized experience for the user.
[0041] Memory information can be divided into short-term memory and long-term memory. Short-term memory refers to the immediate context of a conversation, while long-term memory refers to user preferences and historical information stored over a long period.
[0042] In this embodiment of the application, the memory information can be recorded and / or stored in an electronic device and can be provided to the user for viewing and use.
[0043] 6) Intent refers to the purpose of the user's query, such as whether to inform someone of certain information or to confirm certain information.
[0044] 7) An entity is a word or phrase in text that has a clear meaning and is independent. Examples include names of people, places, organizations, proper nouns, time, quantity, currency, and numerical ratios. Entity recognition technology can extract entities from text. For example, the entity corresponding to "What is an OLT?" is OLT; the entities corresponding to "How are OLT and ONU connected?" are OLT, ONU, and the connection relationship; the entity corresponding to "How is optical power measured?" is optical power; and the entity corresponding to "How is the optimal connection ratio designed?" is the connection relationship.
[0045] It should be understood that in the embodiments of this application, "at least one" means one or more, and "more than one" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, or B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer 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, b, and c, where a, b, and c can be single or multiple. Furthermore, the terms "first," "second," etc., used in the embodiments of this application are only for descriptive purposes and should not be construed as indicating or implying relative importance or order.
[0046] The solutions provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0047] The question-and-answer method provided in this application can be applied to question-and-answer scenarios, such as personal assistants and intelligent customer service. A question-and-answer scenario may include at least one intelligent agent device. The intelligent agent device may have a certain computing power to generate corresponding response text based on the question text. The intelligent agent device may be an electronic device with intelligent functions, such as a mobile phone, tablet computer, personal computer (PC), or smartwatch.
[0048] Optionally, the question-and-answer scenario may include at least one intelligent agent device and a server. The server can provide the intelligent agent device with corresponding computing power. For example, the intelligent agent device can acquire the question text input by the user and send the question text to the server. The server can generate a corresponding answer text based on the question text and send the answer text to the intelligent agent device so that the intelligent agent device can display the answer text to the user. The server can be deployed in the cloud or locally; this application does not limit this. The following description, in conjunction with the scenarios provided in the accompanying drawings, exemplifies the applicable scenarios for the embodiments of this application.
[0049] Taking a question-and-answer scenario that includes at least one intelligent agent device and a server as an example, Figure 1 This is a schematic diagram of a question-and-answer system architecture provided in an embodiment of this application. Figure 1As shown, the problem-solving system architecture may include a server 101 and at least one intelligent agent device (electronic device 1021, electronic device 1022, electronic device 1023, and electronic device 1024 as shown in the figure). Among them, electronic device 1021 and electronic device 1022 are smartphones, and electronic device 1023 and electronic device 1024 are laptops.
[0050] Intelligent agent devices can be used to acquire text information input by users and send it to a server. For example, if a user enters text information in a dialog box, the intelligent agent device can acquire that text information and send it to the server; if a user enters voice information in a dialog box, the intelligent agent device can use speech recognition technology to convert the speech into text information and then send the text information to the server.
[0051] The server can be used to handle various calculations required by the question-and-answer system, such as question-and-answer matching, which involves searching a database based on the user's input question text to obtain the corresponding answer text. The database can include a question library and a corresponding answer library. The question library contains multiple preset question texts, and the answer library contains multiple corresponding answer texts for these preset question texts. The server can compare the user's request information with these preset request information and then feed back the answer text corresponding to the preset question text with the highest similarity to the user's question text from the question-and-answer library to the intelligent agent device, which then presents it to the user. The intelligent agent device may present the answer text in various ways, and this application does not impose any specific limitations.
[0052] Taking intelligent customer service as an example, when engaging in dialogue with a user, the intelligent customer service can return a response text that matches the user's expectations based on the user's question text. However, because language expression is highly flexible, and the intelligent customer service can only understand the semantics of the text entered by the user based on preset rules, it may misunderstand the semantics of the question text, resulting in an inaccurate response text being output by the intelligent customer service. For example, the user's input question text may show similarities to the semantic similarity analysis of question texts in the database, but the actual question asked by the user is not a question in the database, leading to the intelligent customer service providing an incorrect response text.
[0053] Based on this, embodiments of this application provide a question-and-answer method. Through this method, an electronic device can perform semantic retrieval on at least one set of historical dialogue records based on the target question text to obtain a first historical question text, and output a first response text based on the first historical question text. Since semantic retrieval is highly efficient, it can quickly identify first historical question texts semantically similar to the target question text, thereby quickly outputting the first response text and avoiding excessively long response times from the intelligent agent to the target question text, thus improving user experience. Furthermore, the electronic device can perform keyword retrieval based on keywords of the target question text to obtain a second response text. When the first response text and the second response text are inconsistent, a corrective text can be output based on the second response text. Since keyword retrieval has a high accuracy rate, the accuracy of the corrective text output based on the second response text is also high. Therefore, this method can improve the accuracy of the response text output by the intelligent agent device.
[0054] This application provides an electronic device that implements the problem-solving method provided in this application. See below for reference. Figure 2 The structure of the electronic device provided in the embodiments of this application will be described.
[0055] like Figure 2 As shown, the electronic device 200 may include: a processor 210, an external memory interface 220, an internal memory 221, a USB interface 230, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone jack 270D, a sensor module 280, buttons 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a SIM card interface 295, etc.
[0056] Understandable, Figure 2 The electronic device shown is merely an example and does not constitute a limitation on the electronic device. The electronic device may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. Figure 2 The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.
[0057] Processor 210 may include one or more processing units, such as a central processing unit (CPU), application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). Different processing units may be independent devices or integrated into one or more processors. The controller may serve as the central nervous system and command center of electronic device 200. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution.
[0058] The processor 210 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. This memory can store instructions or data that the processor 210 has just used or that are used repeatedly. If the processor 210 needs to use the instruction or data again, it can retrieve it directly from this memory. By providing a memory, the number of times the processor 210 accesses data in the internal memory 221 can be reduced, thus reducing the processor 210's waiting time and improving system efficiency.
[0059] The question-and-answer method provided in this application embodiment can be controlled by the processor 210 or invoked by other components, such as invoking the processing program of this application embodiment stored in the internal memory 221 to control the wireless communication module 260 to communicate with the server. The processor 210 may include different devices. For example, when integrating a CPU and a GPU, the CPU and GPU can cooperate to execute the question-and-answer method provided in this application embodiment. For instance, some algorithms in the question-and-answer method are executed by the CPU, while other algorithms related to displaying a message interface to the user are executed by the GPU, in order to achieve faster processing efficiency.
[0060] Display screen 294 is used to display images, videos, etc. Display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 200 may include one or N displays screens 294, where N is a positive integer greater than 1. Display screen 294 can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces (GUIs).
[0061] In this embodiment, the display screen 294 can be a single flexible display screen, or it can be a spliced display screen composed of two rigid screens and a flexible screen located between the two rigid screens. When the processor 210 runs the question-and-answer method provided in this embodiment, the processor 210 can control the display screen 294 to display the relevant results.
[0062] Camera 293 is used to capture still images or videos. Optionally, electronic device 200 may include 1 to N cameras 293. For example, camera 293 may include a front-facing camera or a rear-facing camera, or a single camera 293 may function as both a front-facing and a rear-facing camera. Typically, camera 293 may include a photosensitive element such as a lens assembly and an image sensor. The lens assembly includes multiple lenses (convex or concave lenses) for collecting light signals reflected from the object to be photographed and transmitting the collected light signals to the image sensor. The image sensor generates a raw image of the object to be photographed based on the light signals.
[0063] Internal memory 221 can be used to store computer executable program code, which includes instructions. Processor 210 executes various functional applications and data processing of electronic device 200 by running the instructions stored in internal memory 221. Internal memory 221 may include a program storage area and a data storage area. The program storage area may store the operating system, program code for at least one application, etc. The operating system may include, but is not limited to, […]. The data storage area can store data created during the use of the electronic device 200, etc.
[0064] The internal memory 221 may also store one or more computer programs for performing the question-and-answer method provided in the embodiments of this application. These one or more computer programs, stored in the internal memory 221 and configured to be executed by one or more processors 210, include instructions that can be used to perform the various steps in the following embodiments.
[0065] In addition, the internal memory 221 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0066] The sensor module 280 may include a fingerprint sensor, a touch sensor, a pressure sensor, a magnetic sensor, an ambient light sensor, a barometric pressure sensor, a bone conduction sensor, etc.
[0067] A touch sensor, also known as a "touch panel," can be located on the display screen 294. The touch sensor detects touch operations applied to or near it. It transmits the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided via the display screen 294. In other embodiments, the touch sensor may also be located on the surface of the electronic device 200, in a different position than the display screen 294.
[0068] The wireless communication function of electronic device 200 can be implemented through antenna 1, antenna 2, mobile communication module 250, wireless communication module 260, modem processor, and baseband processor.
[0069] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 200 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with a tuning switch.
[0070] The mobile communication module 250 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 200. The mobile communication module 250 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 250 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 250 may be housed in the processor 210. In some embodiments, at least some functional modules of the mobile communication module 250 and at least some modules of the processor 210 may be housed in the same device.
[0071] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 270A, receiver 270B, etc.) or displays images or videos through the display screen 294. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 210 and may be housed in the same device as the mobile communication module 250 or other functional modules.
[0072] The wireless communication module 260 can provide solutions for wireless communication applications on the electronic device 200, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 260 can be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to processor 210. The wireless communication module 260 can also receive signals to be transmitted from processor 210, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2. In this embodiment, the electronic device 200 can establish a wireless communication connection with a server device through the wireless communication module 260 for data interaction, or the electronic device 200 can access an access point through the wireless communication module 260, thereby sending instructions and data to network devices or other electronic devices through the access point. For example, electronic device 200 can establish a device collaboration channel with server device through wireless communication module 260, and receive response text from server device through wireless communication module 260, and send data to server device through wireless communication module 260.
[0073] In addition, the electronic device 200 can implement audio functions through an audio module 270, a speaker 270A, a receiver 270B, a microphone 270C, a headphone jack 270D, and an application processor, such as music playback and recording. The electronic device 200 can receive input from buttons 290, generating key signal inputs related to user settings and function control. The electronic device 200 can use a motor 291 to generate vibration alerts. The indicator 292 in the electronic device 200 can be an indicator light, used to indicate charging status, battery level changes, messages, missed calls, notifications, etc. The SIM card interface 295 in the electronic device 200 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 295 to achieve contact and separation with the electronic device 200.
[0074] It should be understood that in practical applications, Figure 2The electronic device 200 shown is merely an example, and it may have more or fewer components than those shown, may combine two or more components, or may have different component configurations. The various components shown may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits. For example, when the electronic device 200 is a PC, it may not include components such as the motor 291 and the SIM card interface 295.
[0075] In the electronic device 200 provided in this application embodiment, its software system can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses a layered Android system as an example to exemplify the software structure of the electronic device. Figure 3 As shown.
[0076] Layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. For example... Figure 3 As shown, this software architecture can be divided into four layers, from top to bottom: the application layer, the application framework layer (FWK), the Android runtime and system libraries, and the kernel layer. Additionally, electronic devices or external storage devices may also include a hardware layer.
[0077] The application layer is the top layer of the operating system, including native operating system applications such as camera, gallery, calendar, Bluetooth, messaging, and smart assistant, as well as third-party applications. The applications discussed in this application embodiment are referred to as applications (APPs), which are software programs capable of performing one or more specific functions.
[0078] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer can include predefined functions. It may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0079] The window manager provides window management services. It can obtain the screen size, determine the presence of a status bar, lock the screen, and capture the screen. The window manager offers various management functions to control parameters such as the transparency, position, and size of windows or interfaces on the screen.
[0080] Content providers are used to store and retrieve data, and make that data accessible to applications. This data may include files (e.g., documents, videos, images, audio), text, and other information.
[0081] A view system includes visual controls, such as controls that display text, images, documents, and other content. View systems can be used to build applications. The interface in a display window can consist of one or more controls. For example, a display interface showing a file icon can include controls for displaying text and controls for displaying images.
[0082] The phone manager provides communication functionality for terminal devices. The notification manager allows applications to display notification information in the status bar; it can be used to convey informative messages and can disappear automatically after a short pause without user interaction.
[0083] The Android runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.
[0084] The core libraries of the Android system consist of two parts: one part contains the functionalities that Java calls, and the other part is the core libraries of the Android system. The application layer and application framework layer run in a virtual machine. Taking Java as an example, the virtual machine executes the Java files in the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0085] The system library can include multiple functional modules. For example: a surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), and 2D graphics engines (e.g., SGL). The surface manager manages the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The media libraries support playback and recording of various common audio and video formats, as well as still image files. The media libraries support various audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D graphics processing libraries are used to implement 3D graphics drawing, image rendering, compositing, and layer processing. The 2D graphics engine is the drawing engine for 2D graphics.
[0086] The kernel layer provides the core system services of the operating system, such as security, memory management, process management, network protocol stack, and driver model, all of which are implemented based on the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer contains many drivers related to electronic devices, including: display drivers; keyboard drivers as input devices; Flash drivers for memory-based devices; camera drivers; audio drivers; Bluetooth drivers; and WiFi drivers.
[0087] In some embodiments, the kernel layer may also include an input driver service for acquiring and reporting operation information from external input devices (e.g., mouse, keyboard, touchpad, etc.), sensors (e.g., touch screen, touch sensor, etc.) or other electronic devices on the interface or window displayed on the display screen.
[0088] The hardware layer can include various sensors, displays, cameras, etc.
[0089] To output accurate response text and thus improve the accuracy of memory retrieval, this application provides a question-and-answer method. The method is described below with reference to the accompanying drawings. This method can be applied to an electronic device in a question-and-answer system, which can be an intelligent agent device, a server, or a fusion memory component for generating response text, etc. See also... Figure 4 As shown, the method includes:
[0090] S401: Electronic device acquires target question text input by user.
[0091] When the electronic device is an intelligent agent device, the user can input the target question text through the intelligent agent device's input device or touch screen. For example, if the intelligent agent device is a PC, such as... Figure 1 Devices 1023 and / or 1024 are included. Users can access the webpage for deploying the intelligent agent via a browser on their PC and can enter the target question text in a dialog box via an input device (such as a keyboard) on the PC.
[0092] Alternatively, users can input voice information into the smart agent device, which can then convert the voice information into text using voice recognition technology. For example, the smart agent device could be a smartphone. Figure 1 Devices 1021 and / or 1022 are included. The smartphone's application includes a smart assistant. Users can input a voice question into the smart assistant, which can then perform speech recognition to obtain the text of the question.
[0093] When the electronic device is a non-intelligent agent device, it can receive target question text from intelligent agent devices.
[0094] S402: The electronic device retrieves the first historical question text with the highest semantic similarity to the target question text from at least one set of saved historical dialogue records.
[0095] Among them, at least one set of historical dialogue records contains a historical question text and a corresponding response text. Each set of historical dialogue records can be a single-turn dialogue (i.e., a question and answer). For example, Figure 5A The historical dialogue record 1. Alternatively, each group of historical dialogue records can be a record of dialogues that include multiple rounds of conversation (i.e., multiple question-and-answer matches). For example, single-round conversations with intervals less than a set value can be considered as a group of historical dialogue records. Figure 5A Historical Dialogue Records 2 and 3.
[0096] In this step, at least one set of historical dialogue records can be pre-saved in a storage module or device, and the electronic device can retrieve the at least one set of historical dialogue records saved through the storage module or device.
[0097] The electronic device can calculate the semantic similarity between the question text and the target question text in each set of historical dialogue records, and determine the first historical question text with the highest semantic similarity. For example, the electronic device can process the question text to generate a semantic vector of the question text, and determine the semantic similarity based on the semantic vector of the question text in each set of historical dialogue records and the semantic vector of the target question text. Since determining the semantic similarity between multiple question texts is existing technology, this application does not impose specific limitations.
[0098] S403: The electronic device outputs the first response text corresponding to the first historical question text.
[0099] Optionally, the first response text can be the response text from the historical dialogue record to which the first historical question text belongs. For example, such as... Figure 5A As shown, the first historical question text is "What is an OLT?", the historical dialogue record to which the first historical question text belongs is historical dialogue record 1, and the response text in historical dialogue record 1 is "OLT (Optical Line Terminal) is a device located at the end of an optical fiber communication network". Therefore, the first response text corresponding to the first historical question text is "OLT (Optical Line Terminal) is a device located at the end of an optical fiber communication network".
[0100] Optionally, the first response text can be a regenerated response text based on the first historical question text. That is, the first response text can be a response text regenerated by the large model device based on the first historical question text. Alternatively, the first response text can be a response text generated based on the first historical question text and the target question text. For example, when the electronic device is an intelligent agent device, and the server provides computing power to the intelligent agent device, after determining the first historical question text, the intelligent agent device can generate a first prompt message based on the first historical question text and the target question text, and send the first prompt message to the server. Correspondingly, the server can generate a first response text based on the first prompt message and send the first response text to the intelligent agent device, so that the intelligent agent device outputs the first response text.
[0101] In this step, when the electronic device is an intelligent agent device, after obtaining the first response text, it can directly output the first response text to quickly respond to the user's target question text and improve the user experience. For example, as... Figure 3 As shown, after obtaining the first response text, the intelligent agent device can send the first response text to the content provider of the application framework layer, so that the intelligent assistant in the application can obtain the first response text and then display the first response text to the user through the display screen.
[0102] When the electronic device is a non-smart agent device, after obtaining the first response text, the electronic device can send the first response to the smart agent device, and the smart agent device will output the first response text.
[0103] S404: The electronic device acquires at least one target keyword of the target question text, and acquires at least one set of keywords corresponding to historical dialogue records.
[0104] In this step, the electronic device can perform text processing on the target question text to obtain at least one target keyword. Alternatively, the electronic device can receive at least one target keyword from other devices. That is, at least one target keyword is obtained by other devices processing the target question text. The text processing methods may include semantic recognition, entity recognition, etc.
[0105] Optionally, keywords may include at least one of subject terms, intent terms, and entity terms. Subject terms and intent terms may be obtained by processing the text using semantic recognition technology. Entity terms may be obtained by processing the text using entity recognition technology. For example, when the electronic device is an intelligent agent device, the intelligent agent device uses semantic recognition technology to process the target question text to obtain the subject terms and / or intent terms corresponding to the target question text; the intelligent agent device uses entity recognition technology to process the target question text to obtain the entity terms corresponding to the target question text.
[0106] Similarly, electronic devices can acquire at least one set of keywords corresponding to historical dialogue records by using the same method as acquiring at least one target keyword of the target question text.
[0107] Alternatively, at least one set of keywords corresponding to historical dialogue records can be pre-stored in a storage module or device, and the electronic device can retrieve the keywords corresponding to at least one set of historical dialogue records stored in the storage module or device. For example, Figure 2 As shown, at least one set of keywords corresponding to historical dialogue records can be pre-stored in internal memory 221 or in memory connected through external memory interface 220.
[0108] S405: The electronic device calculates the similarity between at least one target keyword and the keyword corresponding to each set of historical dialogue records.
[0109] Optionally, the keywords corresponding to each set of historical dialogue records can be keywords from the historical question text within that historical dialogue record, or keywords from both the historical question text and the historical response text, or keywords resulting from combining the keywords from the historical question text and the historical response text. For example, if there are incorrect keywords in the historical question text of a historical dialogue record, the incorrect keywords can be corrected based on the keywords in the historical response text. Alternatively, if there are duplicate keywords between the historical question text and the historical response text, keyword deduplication can be performed.
[0110] In this step, the similarity between the keywords in the target question text and the keywords in the historical dialogue records can be determined based on the semantic similarity of the keywords, or it can be determined based on the proportion of repeated keywords in the target question text and the historical dialogue records. Alternatively, other methods can be used to determine keyword similarity, and this application does not impose specific limitations on this method.
[0111] S406: The electronic device determines the target historical dialogue record with the highest similarity between the corresponding keyword and at least one target keyword.
[0112] Optionally, when the keywords corresponding to multiple sets of historical dialogue records all have the same similarity to at least one target keyword, and all have the highest similarity, the electronic device can determine the target historical dialogue record from the multiple sets of historical dialogue records based on a set rule. The set rule could be, for example, selecting the most recent historical dialogue record from the multiple sets as the target historical dialogue record, or selecting the historical dialogue record with the most keywords from the multiple sets as the target historical dialogue record, or selecting any one historical dialogue record from the multiple sets as the target historical dialogue record, etc.
[0113] S407: Electronic device acquires the second response text from the target's historical dialogue record.
[0114] Optionally, when the target historical dialogue record is a multi-turn dialogue record (i.e., the response text of the target historical dialogue record consists of multiple response texts), the second response text may include all the response texts in the target historical dialogue record. Alternatively, the second response text may include response texts that are relevant to the topic of the target historical dialogue record. For example, if the multiple response texts in the target historical dialogue record include greetings, polite expressions, etc. (such as "Thank you for using the smart assistant"), these response texts can be deleted when obtaining the second response text to reduce information irrelevant to the topic of the target historical dialogue record. Alternatively, the second response text may be a summary of the multiple response texts.
[0115] Optionally, when the target historical dialogue record is a single-turn dialogue record (i.e., the response text of the target historical dialogue record includes only one response text), the second response text can be the original text of the response text of the target historical dialogue record, or it can be a text that summarizes the response text of the target historical dialogue record.
[0116] In this step, the electronic device can process the target historical dialogue record in the above manner to obtain the second response text. Alternatively, the second response text can be pre-stored in a storage module or device, and the electronic device can read the storage module or device to obtain the second response text.
[0117] S408: When the first response text and the second response text are inconsistent, the electronic device outputs a correction text based on the second response text. When the first response text and the second response text are consistent, the electronic device does not perform any other actions.
[0118] In this step, the electronic device can compare the first response text with the second response text to determine whether they match. If the first response text does not match the second response text, the electronic device can generate and output correction text based on the second response text. If the first response text matches the second response text, the electronic device may not perform any other actions.
[0119] In one implementation, when the first response text and the second response text are inconsistent, the electronic device can generate a second prompt message based on the second response text, and then generate an error correction text based on the second prompt message. Alternatively, the electronic device can generate the second prompt message based on the target question text and the second response text, and then generate an error correction text based on the second prompt message. For example, when the electronic device is an intelligent agent device and the server provides computing power to the intelligent agent device, the intelligent agent device can generate the second prompt message based on the target question text and the second response text, and send the second prompt message to the server. Accordingly, the server generates an error correction text based on the second prompt message and sends the error correction text back to the intelligent agent device, so that the intelligent agent device can provide the error correction text to the user.
[0120] In addition, when the electronic device is a non-smart agent device, after generating the error correction text, the electronic device can send the error correction text to the smart agent device, which will then output the error correction text.
[0121] Optionally, the correction text can be a response text that corrects errors in the first response text. That is, when the first response text is not an accurate response to the target question text, the electronic device can generate correction text based on the second response text to correct the erroneous description in the first response text, thereby ensuring the accuracy of the response text.
[0122] Alternatively, the corrective text can also be a supplementary explanation of the first response text. That is, when the content of the first response text is not comprehensive enough, or when a more comprehensive response text is retrieved, the electronic device can generate corrective text based on the second response text to supplement the first response text, thereby ensuring the comprehensiveness of the response text.
[0123] Optionally, the correction text may include pre-defined correction statements to instruct the user's smart agent device on the purpose of outputting the correction text. Different correction texts may correspond to different correction statements. For example, when the correction text is used to correct an error in the first response text, the correction statement may indicate to the user that the first response text is an incorrect answer and the correction text is the correct answer. Figure 5B As shown, the corrective text can be response text 2, where the corrective wording is "I've reconsidered, and the optimal ratio is the OLT and ONU related solutions, not the optical power; therefore, you might want the following answer." Similarly, when the corrective text is used to supplement the first response text, the corrective wording can be used to instruct the user that the corrective text is supplementary to the first response text.
[0124] Through steps S401-S408 above, the electronic device can perform semantic retrieval on at least one set of historical dialogue records based on the target question text to obtain a first historical question text, and output a first response text based on the first historical question text. Because semantic retrieval is highly efficient, it can quickly identify first historical question texts semantically similar to the target question text, thereby quickly outputting the first response text and avoiding excessively long response times from the intelligent agent device to the target question text, thus improving user experience. Simultaneously, the electronic device can perform keyword retrieval based on the keywords of the target question text to obtain a second response text. When the first response text and the second response text are inconsistent, a corrective text can be output based on the second response text. Because keyword retrieval has high accuracy, the accuracy of the corrective text output based on the second response text is also high. Therefore, this method can improve the accuracy of the output response text.
[0125] Understandably, this application does not limit the execution order of steps S401-S408. For example, steps S402-S403 and steps S404-S407 can be executed asynchronously. That is, the electronic device can execute steps S404-S407 after executing steps S402-S403, without waiting for step S403 to be completed before executing step S404.
[0126] The following example uses an electronic device as an intelligent agent to illustrate the acquisition of at least one set of historical dialogue records in step S402.
[0127] In one implementation, the smart agent device can acquire a target session identifier created for the user.
[0128] For example, when a user initiates an initial session, the agent device can create a target session identifier for that user. Alternatively, the agent device can receive a session identifier created for that user from another device.
[0129] Intelligent agent devices can identify at least one set of historical dialogue records containing the target session identifier from multiple sets of historical dialogue records.
[0130] In one implementation, the intelligent agent device can acquire a user identifier and identify at least one set of historical dialogue records containing that user identifier from multiple sets of historical dialogue records.
[0131] The intelligent agent device can obtain the user's identification information. For example, the conversation between the user and the intelligent agent includes the user's identification information, which the intelligent agent device can obtain from the conversation. Optionally, the target question text may include the user's identification information. Accordingly, the intelligent agent device can determine the user's identification information based on the target question text. For example, if the first two bytes of the target question text's data packet are the user's identifier, the intelligent agent device can obtain the user's identifier from the target question text's data packet.
[0132] Intelligent agent devices can identify at least one set of historical dialogue records from multiple stored sets based on the user's identification information. In other words, at least one set of historical dialogue records represents the user's entire history. Therefore, searching based on this at least one set of historical dialogue records allows the intelligent agent device to provide responses that better match the user's expectations, thus improving the user experience.
[0133] In one implementation, at least one set of historical dialogue records can be multiple sets of historical dialogue records that are related to the target question text. These multiple sets of historical dialogue records can be historical dialogue records from different users, or historical dialogue records within a certain time period.
[0134] Historical dialogue records relevant to the target question text can refer to those semantically similar to the target question text, or they can include keywords from the target question text. For example, an intelligent agent device can perform a preliminary search on multiple sets of historical dialogue records based on the semantics and / or keywords of the target question text to obtain at least one set of historical dialogue records. Understandably, the preliminary search is fast but less accurate; therefore, the preliminary search can filter out at least one set of historical dialogue records from multiple sets, improving the efficiency of subsequent precise searches on that at least one set of historical dialogue records.
[0135] Understandably, when an electronic device is a non-intelligent agent device, it can obtain at least one set of historical dialogue records through the above-mentioned method by an intelligent agent device.
[0136] The following is an exemplary description of determining the consistency between the first response text and the second response text in step S408.
[0137] In one implementation, after acquiring the first response text and the second response text, the electronic device can compare the first response text with the second response text to determine whether they are consistent. When the first response text and the second response text are consistent, the first response text can be considered a correct response to the target question text. When the first response text and the second response text are inconsistent, the first response text can be considered an incorrect or incomplete response to the target question text. In other words, the accuracy of the first response text can be verified by determining the consistency between the first response text and the second response text, thereby ensuring the accuracy of the response text output by the intelligent agent.
[0138] Optionally, the electronic device can determine the similarity between keywords in the first response text and keywords in the second response text, and determine whether the first response text and the second response text are consistent based on the keyword similarity. That is, when the keyword similarity is greater than or equal to a set threshold (such as 90%, 95%, etc., which can be arbitrarily set), the first response text and the second response text are determined to be consistent. When the keyword similarity is less than the set threshold, the first response text and the second response text are determined to be inconsistent.
[0139] Understandably, the keywords in the response text are obtained through text processing, and the keywords have a high degree of relevance to the response text. Therefore, this method can improve the accuracy of determining whether the first response text and the second response text are consistent.
[0140] Optionally, the electronic device can determine the semantic similarity between the first response text and the second response text, and determine whether the first response text and the second response text are consistent based on the semantic similarity. That is, when the semantic similarity meets a set threshold, the first response text and the second response text are determined to be consistent. When the semantic similarity does not meet the set threshold, the first response text and the second response text are determined to be inconsistent.
[0141] Understandably, this method can improve the efficiency of determining whether the first response text and the second response text are consistent, since the computational cost of semantic similarity is relatively low.
[0142] In this application, after the electronic device has completed the above steps S401-S408, it can also perform the following actions.
[0143] In one implementation, the electronic device can generate and save a first historical dialogue record based on the target question text and the corresponding response text. The first historical dialogue record can be divided into semantic information and / or keyword information of the first historical dialogue record, so that semantic retrieval and / or keyword retrieval can be performed subsequently based on the historical dialogue record. That is, the target question text and the corresponding response text are converted into a set of historical dialogue records, and the historical dialogue record is stored.
[0144] Optionally, when the first response text and the second response text are identical, the first historical dialogue record may include the target question text and the corresponding first response text. In this case, the electronic device can generate semantic information for the first historical dialogue record based on the semantics of the target question text and the first response text. For example, the electronic device generates semantic information for the first historical dialogue record based on the semantic vector determined by the target question text and the first response text. The electronic device can generate keywords for the first historical dialogue record based on the keywords of the target question text and the keywords of the first response text. For example, the electronic device uses the set of keywords of the target question text and the keywords of the first response text as the keywords for the first historical dialogue record. Alternatively, the electronic device can generate keywords for the first historical dialogue record based on the keywords of the target question text, the keywords of the first response text, and the keywords of the second response text. For example, when the keywords of the first response text and the keywords of the second response text are not completely identical, the electronic device uses the set of keywords of the target question text, the keywords of the first response text, and the keywords of the second response text as the keywords for the first historical dialogue record.
[0145] Optionally, when the first response text and the second response text are inconsistent, the first historical dialogue record may include the target question text and the corresponding second response text. In this case, the electronic device can generate semantic information of the first historical dialogue record based on the semantics of the target question text and the second response text. For example, the electronic device can generate semantic information of the first historical dialogue record based on the semantic vector determined by the target question text and the second response text. The electronic device can generate keyword information of the first historical dialogue record based on the keywords of the target question text and the keywords of the second response text. For example, the electronic device can use the set of keywords of the target question text and the keywords of the second response text as the keyword information of the first historical dialogue record.
[0146] In one implementation, since the electronic device has not yet verified the accuracy of the first response text based on the second response text (i.e., determined whether the first response text and the second response text are consistent) before outputting the first response text, the electronic device can identify the first response text as a response to be evaluated and store the first response text so that the accuracy of the first response text can be verified later.
[0147] The following describes, in conjunction with an embodiment, Figure 4 The question-and-answer method shown is illustrated by example.
[0148] Figure 6A This is a schematic diagram of the structure of a question-and-answer system provided in an embodiment of this application. Figure 6A As shown, the question-and-answer system includes an intelligent agent device, a fusion memory component, and a large model device. The fusion memory component performs text analysis, storage, retrieval, and consistency evaluation. The large model device provides computing power to the intelligent agent device, generating an answer based on the prompts provided by the question text. The large model device can be deployed on a server, in the cloud, or as a standalone device. The intelligent agent device and the fusion memory component can be integrated into a single entity, or the intelligent agent device can include the fusion memory component. Alternatively, the fusion memory component can be a separate device or apparatus from the intelligent agent device, a component within a separate device, a device or apparatus within a server, or a device or apparatus deployed in the cloud. In this case, the intelligent agent device and the fusion memory component can establish a communication connection via a wired and / or wireless interface. The browser can be an application within the intelligent agent device; the user can input the question text into the browser's input box, allowing the intelligent agent device to retrieve the question text through the browser.
[0149] This embodiment uses an electronic device as the fused memory component, and the intelligent agent device and the fused memory component as independent devices, as an example. (See attached document.) Figure 6B As shown, this embodiment may include the following steps:
[0150] S601: The browser opened in the smart agent device obtains the target question text entered by the user.
[0151] Among them, the browser is displayed on the screen of the smart device (such as...) Figure 2 The display screen 294) shows the user a question and answer interface. This interface, generated by the system with a session identifier when the user enters the system, includes input boxes. The user can then input the target question text into these boxes using an input device, allowing the browser to retrieve the entered text.
[0152] S602: The browser sends the target question text to the agent device. Correspondingly, the agent receives the target question text from the browser.
[0153] S603: The agent device sends a request to the fusion memory component to create a target question dialogue. Correspondingly, the fusion memory component receives the request from the agent device to create a target question dialogue. This request includes the target question.
[0154] S604: The fusion memory component creates a dialogue based on the target question and sets a dialogue identifier for the target question text.
[0155] The dialogue identifier for the target question can be used to identify the response text corresponding to that target question.
[0156] For example, such as Figure 6A As shown, the fusion memory component can call the dialogue management module to create a dialogue corresponding to the target question text and set a dialogue identifier for the dialogue of the target question text.
[0157] S605: The fusion memory component processes the target question text to generate dialogue fragments.
[0158] Dialogue segments can include keywords corresponding to the target question text, such as topic, intent, entity, relation, semantic vector (embedding), etc.
[0159] Understandably, a dialogue segment can be an example of a keyword in step S404.
[0160] For example, after generating the dialogue segment corresponding to the target question text, the fusion memory component can temporarily cache the dialogue segment in the fusion memory storage module.
[0161] S606: The intelligent agent device sends a request to the fusion memory component to retrieve historical dialogues. Correspondingly, the fusion memory component receives the request from the intelligent agent device. The request includes the user's identification information.
[0162] S607: The fusion memory component retrieves the historical dialogue table based on the historical dialogue retrieval request.
[0163] Specifically, the fusion memory component retrieves the user's identification information carried in the historical dialogue retrieval request to obtain the historical dialogue table corresponding to that user. This historical dialogue table includes at least one set of historical dialogue records for that user.
[0164] Understandably, a history dialogue table can be an example of retrieving at least one set of history dialogue records in step S402.
[0165] For example, such as Figure 6AAs shown, all historical dialogue lists can be pre-stored in the fusion memory storage module. The fusion memory component can retrieve the fusion memory storage module based on the user's identification information in the historical dialogue retrieval request to obtain the historical dialogue list corresponding to that user.
[0166] S608: The intelligent agent device sends a retrieval request to the fusion memory component. Correspondingly, the fusion memory component receives the retrieval request from the intelligent agent device. Retrieval can be divided into semantic retrieval and keyword retrieval. Semantic retrieval refers to searching based on the semantics of the question text. Because semantic retrieval is faster, it is also called fast retrieval. Keyword retrieval refers to searching based on keywords in the question text. Because keyword retrieval has higher accuracy but is slower, it is also called precise delayed retrieval.
[0167] S609A: The fusion memory component performs semantic retrieval based on the retrieval request to obtain vector similarity dialogue.
[0168] Among them, the fusion memory component performs semantic retrieval on the historical dialogue table based on the semantic vector of the target question to obtain vector similarity dialogues.
[0169] Understandably, vector similarity dialogue can be an example of a historical dialogue record containing the first historical question text in step S402.
[0170] For example, such as Figure 6A As shown, the fusion memory component can invoke the fusion memory retrieval module to perform semantic retrieval on the historical dialogue table based on the semantics of the target question text, obtaining the dialogue with the highest vector similarity to the target question text. The semantic vectors of the historical dialogue table can be stored in the vector memory within the fusion memory storage module.
[0171] In this embodiment, the semantic vector of the text is a vector used to describe the semantics of the text.
[0172] S609B: The fusion memory component retrieves the target historical dialogue based on the search request using keywords, and sends the target historical dialogue to the intelligent agent device.
[0173] Among them, the fusion memory component retrieves the target historical dialogue by searching the historical dialogue table based on the keywords corresponding to the target question text.
[0174] Understandably, the target history dialogue can be an example of the target history dialogue record in step S406.
[0175] For example, such as Figure 6AAs shown, the fusion memory component can invoke the fusion memory retrieval module to perform keyword retrieval on the historical dialogue table based on the keywords of the target question text, obtaining the target historical dialogue with the highest similarity to the keywords (i.e., topic, intent, entity / relationship) of the target question text. The keywords in the historical dialogue table can be stored in the keyword memory of the fusion memory module. Keyword memory can also be called symbolic memory.
[0176] In this embodiment, steps S609A and S609B can be executed asynchronously. That is, when step S609A is executed, step S609B can also be executed, without waiting for step S609A to be completed before executing step S609B.
[0177] S610: The fusion memory component sends a vector similarity dialogue to the agent device. Correspondingly, the agent device receives the vector similarity dialogue from the fusion memory component.
[0178] S611: The intelligent agent device generates the first prompt information based on the similarity between the target question text and vectors.
[0179] The initial prompt information may include the initial question, historical dialogue, role-playing, instructions, and examples. The initial question can be the target question text. Alternatively, the initial question can be the initial question of a dialogue that contains the target question text. For example, such as... Figure 5A As shown, the initial question in historical dialogue information 2 is "What is ONU?".
[0180] S612: The intelligent agent device sends the first prompt message to the large model device.
[0181] S613: The large model device generates the first answer based on the first prompt information.
[0182] S614: The large model device sends its first response to the intelligent agent device. Correspondingly, the intelligent agent device receives the first response from the large model device.
[0183] S615A: The intelligent agent device sends its first response to the browser. Correspondingly, the browser receives the first response from the intelligent agent device.
[0184] S615B: The browser pushes the first answer.
[0185] S616: The intelligent agent device sends a dialogue with a first response to the fusion memory component so that the fusion memory component stores the dialogue.
[0186] Before sending the conversation, the intelligent agent device can also mark it as a conversation to be evaluated.
[0187] S617: The fusion memory component performs consistency evaluation on vector similarity dialogues based on the target historical dialogue and generates evaluation results.
[0188] The fusion memory component compares the target historical dialogue with the vector similar dialogue to determine whether the target historical dialogue and the vector similar dialogue are consistent.
[0189] For example, such as Figure 6A As shown, the fusion memory component can invoke a consistency evaluator to perform consistency evaluation on the retrieval results corresponding to semantic retrieval and the retrieval results corresponding to keyword retrieval, generating evaluation results. That is, the fusion memory component can use a consistency evaluator to perform consistency evaluation on vector-similar dialogues and target historical dialogues, generating evaluation results.
[0190] S618: The fusion memory component sends the evaluation results to the intelligent agent device. Correspondingly, the intelligent agent device receives the evaluation results from the fusion memory component.
[0191] For example, such as Figure 6A As shown, after the consistency evaluator generates the evaluation result, it can send the evaluation result to the dialogue management module, which in turn sends the result to the intelligent agent device.
[0192] If the evaluation results are inconsistent, proceed to step S619. If the evaluation results are consistent, proceed to step S620.
[0193] S619A: The intelligent agent device sends a second response to the browser based on the target's historical dialogue.
[0194] When the evaluation result is inconsistent, the intelligent agent device generates a second prompt based on the target's historical dialogue and sends this second prompt to the large model device. The large model device can then generate a second response based on the second prompt and send it to the intelligent agent device. This second response may include clarification statements. For example, Figure 5B As shown, the clarification could be in response text 2: "I've reconsidered, and the best ratio is the OLT and ONU related solutions, not the optical power; therefore, you might want the following answer."
[0195] S619B: The browser pushes the second answer.
[0196] S620: The fusion memory component stores the target question text and the corresponding response text. When the evaluation result is consistent, the response text corresponding to the target question text is the first answer. At this time, the fusion memory component can summarize the target question text and the first answer to obtain vector memory and keyword memory, and store these. Vector memory can be obtained by semantic processing of the target question text and the first answer to obtain corresponding semantic vectors. Keyword memory can include the keywords corresponding to the target question text and the keywords corresponding to the first answer.
[0197] When the evaluation results are inconsistent, the response text corresponding to the target question text is the first answer. At this point, the fusion memory component can summarize the target question text and the second answer to obtain vector memory and keyword memory, and store these. Vector memory can be obtained by semantically processing the target question text and the second answer to obtain corresponding semantic vectors. Keyword memory can include keywords corresponding to the target question text and keywords corresponding to the second answer.
[0198] Furthermore, vector memory can be used to indicate semantic information in a dialogue. For example... Figure 6A As shown, vector memory includes memory summaries and dialogue summaries, as well as memory vectors corresponding to the memory summaries and dialogue vectors corresponding to the dialogue summaries. In other words, vector memory stores the semantic information of the dialogue in the form of storage vectors, enabling rapid retrieval using vector retrieval methods later.
[0199] Keyword memorization can be represented by keyword information in a dialogue. For example... Figure 6A As shown, keyword memory includes topics, intentions, entities, or relationships. In other words, keyword memory stores the keyword information of a dialogue in the form of topics, intentions, entities, or relationships, so that it can be accurately retrieved later using keyword retrieval.
[0200] For example, such as Figure 6A As shown, the fusion memory component can summarize and obtain vector memory and keyword memory based on the target question text and the corresponding response text, and store the vector memory and keyword memory in the fusion memory storage module in the form of memory fragments.
[0201] In addition, the fusion memory module can also manage stored memory fragments, including memory generation, memory aging, memory merging, and establishing memory relationships. Memory generation refers to the dynamic generation of long-term memories. Memory aging refers to deleting or transferring memory fragments, such as storing long-unused memory fragments in another location or deleting them. Memory merging refers to combining multiple identical or similar memory fragments into one. Establishing memory relationships refers to creating connections between multiple related memory fragments to improve retrieval efficiency.
[0202] In this embodiment, steps S619 and S620 can be executed asynchronously. That is, when step S619 is executed, step S620 can also be executed, without waiting for step S619 to be completed before executing step S620.
[0203] Table 1 below further describes the content provided in this embodiment. Table 1 includes the interaction message, initiator, receiver, details, and parameters. The initiator refers to the party that initiates the interaction message, the receiver refers to the party that receives the interaction message, the details include the purpose of the interaction message and / or the method of generating the interaction message, and the parameters refer to the parameters used to generate the interaction message.
[0204] Table 1
[0205]
[0206]
[0207] Based on Table 1, we can obtain the initiator, receiver, method of determining the interaction message, purpose of the interaction message, and parameters for generating the interaction message. For example, when the interaction message is a target question, the initiator of the target question is the user, the receiver of the target question is the browser, the target question is generated based on the user's question, and it is entered into the browser through the browser's input box.
[0208] The above primarily describes the solution provided in this application from the perspective of interaction between various devices. It is understood that, in order to achieve the aforementioned functions, each device includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.
[0209] When using integrated units, Figure 7 This diagram illustrates a possible exemplary block diagram of the apparatus involved in an embodiment of this application. The apparatus 700 may exist in software form. The apparatus 700 may include an acquisition unit 701 and a processing unit 702. The processing unit 702 is used to control and manage the operation of the apparatus 700. The acquisition unit 701 and / or the output unit 703 are used to support communication between the apparatus 700 and other devices (such as user-side client devices). The apparatus 700 may also include a storage unit 704 for storing the program code and data of the apparatus 700.
[0210] The processing unit 702 can be a processor or controller, such as a general-purpose central processing unit (CPU), a general-purpose processor, a digital signal processing unit (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this invention. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc. The acquisition unit 701 and / or the output unit 703 can be a communication interface, a transceiver, or a transceiver circuit, etc., wherein the communication interface is a general term, and in a specific implementation, the communication interface may include multiple interfaces. The storage unit 704 can be a memory.
[0211] The device 700 can be the intelligent agent device in the above embodiments, or it can be a functional module set in the intelligent agent device. The acquisition unit 701 and / or the output unit 703 can support communication between the device 700 and the user-side client device, and the processing unit 702 can support the device 700 to execute the actions of the intelligent agent device in the method examples above; for example, the acquisition unit 701 is used to support the device 700 to execute Figure 4 S401, S404, and S407 are mentioned. Processing unit 702 is used to support device 700 in execution. Figure 4 S402, S405, and S406 are mentioned above. Output unit 703 is used to support the execution of device 700. Figure 4 S403 and S408 in the example.
[0212] Specifically, in one embodiment, the acquisition unit 701 is used to acquire the target question text input by the user. The processing unit 702 is used to retrieve the first historical question text with the highest semantic similarity to the target question text from at least one set of saved historical dialogue records. The output unit 703 is used to output the first response text corresponding to the first historical question text. Each set of historical dialogue records contains historical question text and corresponding response text. The acquisition unit 701 is also used to acquire at least one target keyword of the target question text, and to acquire keywords corresponding to at least one set of historical dialogue records. The processing unit 702 is also used to calculate the similarity between at least one target keyword and the keywords corresponding to each set of historical dialogue records. The processing unit 702 is also used to determine the target historical dialogue record with the highest similarity between the corresponding keyword and at least one target keyword. And it acquires the second response text in the target historical dialogue record. When the first response text and the second response text are inconsistent, the output unit 703 is also used to output correction text based on the second response text.
[0213] In one possible design, the processing unit 702 is used to generate a first historical dialogue record; the storage unit 704 is used to save the first historical dialogue record.
[0214] Wherein, when the first response text is consistent with the second response text, the first historical dialogue record includes the target question text and the corresponding first response text; or when the first response text is inconsistent with the second response text, the first historical dialogue record includes the target question text and the corresponding second response text.
[0215] In one possible design, the processing unit 702 is specifically used to generate keywords corresponding to the first historical dialogue record based on the at least one target keyword and the keyword corresponding to the first response text when the first response text is consistent with the second response text; or to generate keywords corresponding to the first historical dialogue record based on the at least one target keyword and the keyword corresponding to the second response text when the first response text is inconsistent with the second response text.
[0216] Storage unit 70 is used to store the keywords corresponding to the first historical dialogue record.
[0217] In one possible design, after obtaining the second response text from the target historical dialogue record, the processing unit 702 is further configured to:
[0218] Determine the similarity between the keywords corresponding to the first response text and the keywords corresponding to the second response text;
[0219] When the similarity is greater than or equal to a set threshold, it is determined that the first response text and the second response text are consistent.
[0220] When the similarity is less than a set threshold, it is determined that the first response text and the second response text are inconsistent.
[0221] In one possible design, at least one target keyword includes at least one of the following: topic words, intent words, and entity words.
[0222] In one possible design, the acquisition unit 701 is further configured to acquire a target session identifier created for the user;
[0223] The processing unit 702 is further configured to determine, among multiple sets of historical dialogue records, the at least one set of historical dialogue records containing the target session identifier.
[0224] Based on the same concept, embodiments of this application also provide an electronic device, such as... Figure 8 As shown, the device includes a processor 801, a memory 802, a communication module 803, and a display screen 804. For example, the aforementioned devices can be connected via one or more communication buses. The one or more computer programs are stored in the memory 802 and configured to be executed by the processor 801. These computer programs include instructions that can be used to cause the electronic device to perform the steps executed by the intelligent agent device or the fused memory component in the methods of the above embodiments.
[0225] For example, the processor 801 described above can specifically be... Figure 2 The processor 210 shown. The memory 802 described above can specifically be... Figure 2 The internal memory 221 shown is and / or an external memory connected to the electronic device. The communication module 803 described above includes a transceiver or communication interface, wherein the transceiver can be... Figure 2 The mobile communication module 250 and / or wireless communication module 260 shown may have a communication interface that can be Figure 2 The external memory interface 220 and / or USB interface shown are examples of such interfaces. The aforementioned display screen 804 can specifically be... Figure 2 The display screen 294 shown is not limited in any way in this embodiment of the application.
[0226] As used in the above embodiments, depending on the context, the terms "when..." or "after..." can be interpreted as meaning "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrases "when..." or "if (the stated condition or event) is detected" can be interpreted as meaning "if...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".
[0227] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)). Where there is no conflict, the solutions in the above embodiments can be combined.
[0228] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0229] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0230] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0231] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0232] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A question-and-answer method, characterized in that, include: Obtain the target question text input by the user; Retrieve the first historical question text with the highest semantic similarity to the target question text from at least one set of saved historical dialogue records, and output the first response text corresponding to the first historical question text; wherein, any set of historical dialogue records contains the historical question text and the corresponding response text; Obtain at least one target keyword from the target question text, and obtain the keywords corresponding to the at least one set of historical dialogue records; Calculate the similarity between the at least one target keyword and the keywords corresponding to each group of historical dialogue records; Identify the target historical dialogue record whose corresponding keyword has the highest similarity to the at least one target keyword; and obtain the second response text from the target historical dialogue record; When the first response text is inconsistent with the second response text, a correction text is output based on the second response text.
2. The method as described in claim 1, characterized in that, The method further includes: Generate and save the first historical dialogue record; Wherein, when the first response text is consistent with the second response text, the first historical dialogue record includes the target question text and the corresponding first response text; or when the first response text is inconsistent with the second response text, the first historical dialogue record includes the target question text and the corresponding second response text.
3. The method as described in claim 2, characterized in that, The method includes: When the first response text matches the second response text, keywords corresponding to the first historical dialogue record are generated based on the at least one target keyword and the keyword corresponding to the first response text; or When the first response text is inconsistent with the second response text, keywords corresponding to the first historical dialogue record are generated based on the at least one target keyword and the keyword corresponding to the second response text. Save the keywords corresponding to the first historical dialogue record.
4. The method according to any one of claims 1-3, characterized in that, After obtaining the second response text from the target historical dialogue record, the method further includes: Determine the similarity between the keywords corresponding to the first response text and the keywords corresponding to the second response text; When the similarity is greater than or equal to a set threshold, it is determined that the first response text and the second response text are consistent. When the similarity is less than a set threshold, it is determined that the first response text and the second response text are inconsistent.
5. The method according to any one of claims 1-4, characterized in that, The at least one target keyword includes at least one of the following: topic words, intent words, and entity words.
6. The method according to any one of claims 1-5, characterized in that, The method further includes: Obtain the target session identifier created for the user; Identify at least one set of historical dialogue records containing the target session identifier from multiple sets of historical dialogue records.
7. A question-and-answer device, characterized in that, include: The acquisition unit is used to acquire the target question text input by the user. The processing unit is configured to retrieve, from at least one set of saved historical dialogue records, the first historical question text with the highest semantic similarity to the target question text; The output unit is used to output the first response text corresponding to the first historical question text; wherein, any set of historical dialogue records contains the historical question text and the corresponding response text. The acquisition unit is further configured to acquire at least one target keyword of the target question text, and to acquire keywords corresponding to the at least one set of historical dialogue records; The processing unit is also used to calculate the similarity between the at least one target keyword and the keywords corresponding to each group of historical dialogue records; The processing unit is further configured to determine the target historical dialogue record with the highest similarity between the corresponding keyword and the at least one target keyword; and to obtain the second response text in the target historical dialogue record; The output unit is further configured to output a correction text based on the second response text when the first response text is inconsistent with the second response text.
8. The apparatus as claimed in claim 7, characterized in that, The processing unit is also used for: Generate and save the first historical dialogue record; Wherein, when the first response text is consistent with the second response text, the first historical dialogue record includes the target question text and the corresponding first response text; or when the first response text is inconsistent with the second response text, the first historical dialogue record includes the target question text and the corresponding second response text.
9. The apparatus as claimed in claim 8, characterized in that, The processing unit is specifically used for: When the first response text is consistent with the second response text, keywords corresponding to the first historical dialogue record are generated based on the at least one target keyword and the keyword corresponding to the first response text. or When the first response text is inconsistent with the second response text, keywords corresponding to the first historical dialogue record are generated based on the at least one target keyword and the keyword corresponding to the second response text. Save the keywords corresponding to the first historical dialogue record.
10. The apparatus as described in any one of claims 7-9, characterized in that, After obtaining the second response text from the target historical dialogue record, the processing unit is further configured to: Determine the similarity between the keywords corresponding to the first response text and the keywords corresponding to the second response text; When the similarity is greater than or equal to a set threshold, it is determined that the first response text and the second response text are consistent. When the similarity is less than a set threshold, it is determined that the first response text and the second response text are inconsistent.
11. The apparatus according to any one of claims 7-10, characterized in that, The at least one target keyword includes at least one of the following: topic words, intent words, and entity words.
12. The apparatus according to any one of claims 7-11, characterized in that, The acquisition unit is further configured to acquire the target session identifier created for the user; The processing unit is further configured to determine, among multiple sets of historical dialogue records, the at least one set of historical dialogue records containing the target session identifier.
13. An electronic device, characterized in that, The electronic device includes: Memory is used to store computer program instructions; A processor for executing the computer program instructions to support the electronic device in implementing the method as described in any one of claims 1-6.
14. A computer-readable storage medium, characterized in that, The storage medium stores a computer program or instructions, and when the computer program or instructions are executed by a communication device, the method as described in any one of claims 1-6 is implemented.
15. A computer program product, characterized in that, When the computer program product is executed by a computer, the computer executes the method as described in any one of claims 1-6.