An intent slot identification method
By introducing slot encoding and intent label encoding information into the human-computer dialogue system, and combining sentence and word vector similarity calculation, the problem of inaccurate multi-intent recognition is solved, and higher recognition and extraction accuracy is achieved.
Patent Information
- Application Number
- CN202011623049.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-30
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2040-12-30
AI Technical Summary
Existing human-computer dialogue systems struggle to accurately identify multiple user intentions when faced with multi-intention or ambiguous statements, leading to inaccurate identification.
By referencing the slot encoding information and intent label encoding information of the text sequence, and combining the similarity calculation of sentence vectors and word vectors, intent labels and slot labels are extracted from the text sequence, thereby improving the accuracy of recognition and extraction.
It improves the accuracy of electronic devices in recognizing multiple intents and extracting slots from text sequences, and enhances the understanding ability of human-computer dialogue systems.
Smart Images

Figure CN114691839B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to an intent slot recognition method. Background Technology
[0002] With the continuous development and breakthroughs in artificial intelligence, human-computer interaction will occur more and more frequently in people's daily work and life. Voice interaction is one of the most convenient interaction methods. Human-computer interaction dialogue systems are widely used in various smart electronic devices, such as mobile phones, televisions, and in-vehicle systems. In human-computer interaction, how electronic devices understand the user's intent is the most crucial aspect.
[0003] Because of the complexity and ambiguity of human language, a single sentence can often express multiple intentions. However, current human-computer dialogue systems can only provide one intention. For a sentence containing multiple intentions, or a sentence with multiple intentions due to ambiguity, the human-computer dialogue system can only provide one intention, which may differ from the intention expressed by the user. Therefore, current methods are inaccurate in recognizing sentences with multiple intentions. Summary of the Invention
[0004] This application provides an intent slot recognition method. When recognizing intent in a text sequence, it references the slot encoding information of the text sequence, reflecting the constraint of slot encoding information on intent recognition. When the electronic device extracts slots from the text sequence, it references intent label encoding information, reflecting the constraint of intent on slot extraction. This improves the accuracy of multi-intent recognition and slot extraction of text sequences by the electronic device.
[0005] In a first aspect, this application provides an intent slot recognition method, comprising: an electronic device receiving a voice signal input by a user; the electronic device recognizing a text sequence in the voice signal; the electronic device extracting sentence vectors and character vectors from the text sequence; the electronic device determining the similarity between the sentence vectors and multiple preset intent tags, and the similarity between the character vectors after multi-head attention calculation and the multiple preset intent tags; the electronic device extracting one or more intent tags from the text sequence based on the similarity between the sentence vectors and the multiple preset intent tags, and the similarity between the character vectors after multi-head attention calculation and the multiple preset intent tags; the electronic device determining the similarity between the character vectors and preset slot tags corresponding to each of the one or more intent tags; the electronic device extracting slot tags corresponding to each of the one or more intent tags from the text sequence based on the similarity between the character vectors and the preset slot tags corresponding to each of the one or more intent tags; and the electronic device executing instructions corresponding to the one or more intent tags according to the slot tags corresponding to each of the one or more intent tags.
[0006] This method references the slot encoding information of the text sequence when recognizing intent, demonstrating the constraint of slot encoding information on intent recognition; when the electronic device extracts slots from the text sequence, it references the intent label encoding information, demonstrating the constraint of intent on slot extraction. This improves the accuracy of multi-intent recognition and slot extraction of text sequences by electronic devices.
[0007] In conjunction with the first aspect, in one possible implementation, before the electronic device determines the similarity between the sentence vector and multiple preset intent tags, and the similarity between the character vector after multi-head attention calculation and the multiple preset intent tags, the method further includes: the electronic device concatenating the sentence vector and the character vector after multi-head self-attention calculation to obtain a first text sequence vector; the electronic device determining the similarity between the sentence vector and multiple preset intent tags, and the similarity between the character vector after multi-head attention calculation and the multiple preset intent tags specifically includes: the electronic device calculating the vector distance between the first text sequence vector and the multiple preset intent tags to obtain the intent probability vector of the text sequence.
[0008] In conjunction with the first aspect, in one possible implementation, after the electronic device calculates the vector distance between the first text sequence vector and the plurality of preset intent tags, and before obtaining the intent probability vector of the text sequence, the method further includes: the electronic device normalizing the vector distance between the first text sequence vector and the plurality of preset intent tags to obtain the intent probability vector of the text sequence.
[0009] In conjunction with the first aspect, in one possible implementation, the electronic device extracts one or more intent tags from the text sequence based on the similarity between the sentence vector and the plurality of preset intent tags, and the similarity between the character vector after multi-head attention calculation and the plurality of preset intent tags. Specifically, the electronic device outputs the intent tags corresponding to one or more intent probabilities greater than a first preset probability from the intent probability vector, thereby determining the one or more intent tags in the text sequence.
[0010] In conjunction with the first aspect, in one possible implementation, the one or more intent tags are all intent tags of the text sequence within a preset domain.
[0011] In conjunction with the first aspect, in one possible implementation, the electronic device determines the similarity between the character vector and the preset slot labels corresponding to each of the one or more intent labels. Specifically, this includes: the electronic device performing multi-head attention calculation on the character vector and the intent label encoding vector to obtain a second text sequence vector; the electronic device concatenating the second text sequence vector, the character vector, and the intent probability vector to obtain a third text sequence vector; and the electronic device calculating the vector distance between the third text sequence vector and the preset slot labels corresponding to each of the one or more intent labels to obtain the similarity between the character vector and the preset slot labels corresponding to each of the one or more intent labels.
[0012] In conjunction with the first aspect, in one possible implementation, after the electronic device calculates the vector distance between the third text sequence vector and the preset slot labels corresponding to the one or more intent tags, the method further includes: the electronic device normalizing the vector distance between the third text sequence vector and the preset slot labels corresponding to the one or more intent tags to obtain a slot probability vector of the text sequence. After the electronic device obtains the slot probability vector of the text sequence, the method further includes: the electronic device outputting the slot labels corresponding to one or more slot probabilities greater than a second preset probability from the slot probability vector, thereby determining the one or more slot labels corresponding to the one or more intent tags in the text sequence.
[0013] In conjunction with the first aspect, in one possible implementation, the electronic device concatenates the sentence vector and the character vector after multi-head self-attention calculation to obtain a first text sequence vector. Specifically, the electronic device adds the sentence vector and the character vector after multi-head self-attention calculation to obtain the first text sequence vector.
[0014] In conjunction with the first aspect, in one possible implementation, the electronic device concatenates the second text sequence vector, the word vector, and the intent probability vector to obtain a third text sequence vector. Specifically, the electronic device adds the second text sequence vector, the word vector, and the intent probability vector to obtain the third text sequence vector.
[0015] In a second aspect, this application provides an electronic device including one or more processors and one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the electronic device to execute an intent slot identification method according to any possible embodiment of the first aspect.
[0016] Thirdly, this application provides a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform an intent slot identification method as described in any possible embodiment of the first aspect.
[0017] This method references the slot encoding information of the text sequence when recognizing intent, demonstrating the constraint of slot encoding information on intent recognition; when the electronic device extracts slots from the text sequence, it references the intent label encoding information, demonstrating the constraint of intent on slot extraction. This improves the accuracy of multi-intent recognition and slot extraction of text sequences by electronic devices. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of this application;
[0019] Figure 2 A software structure block diagram of an electronic device 100 provided in this application embodiment;
[0020] Figure 3 A schematic diagram of intent and slot relationships provided for an embodiment of this application;
[0021] Figure 4 This is a schematic flowchart of a method for classifying intent slots provided in an embodiment of this application;
[0022] Figure 5 A structural diagram of a machine translation multi-label intent classifier provided in an embodiment of this application;
[0023] Figure 6 A schematic diagram illustrating a slot label for a text sequence under different intentions, provided as an embodiment of this application;
[0024] Figure 7 A schematic diagram of slot labels for another text sequence under different intentions provided in the embodiments of this application;
[0025] Figure 8 A schematic diagram of slot labels for another text sequence under different intentions provided in the embodiments of this application;
[0026] Figure 9 A framework diagram of an intent slot recognition method provided in an embodiment of this application;
[0027] Figure 10 A flowchart illustrating an intent slot identification method provided in this application embodiment;
[0028] Figure 11A schematic diagram of a slot label for a text sequence under a single intent, provided as an embodiment of this application;
[0029] Figures 12-14 A set of UI diagrams provided for embodiments of this application;
[0030] Figures 15-16 Another set of UI diagrams provided for embodiments of this application. Detailed Implementation
[0031] The technical solutions in the embodiments of this application will now be described clearly and in detail with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; the word "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0032] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0033] Figure 1 A schematic diagram of the structure of the electronic device 100 is shown.
[0034] The following description uses electronic device 100 as an example to illustrate the embodiment. It should be understood that... Figure 1 The electronic device 100 shown is merely an example, and the electronic device 100 may have more than Figure 1 The more or fewer components shown can be combined into two or more components, or they can have different component configurations. The various components shown in the figure 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.
[0035] Electronic device 100 may include: processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0036] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0037] Processor 110 may include one or more processing units, such as: 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), etc. Different processing units may be independent devices or integrated into one or more processors.
[0038] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0039] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0040] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0041] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C buses. The processor 110 can couple to the touch sensor 180K, charger, flash, camera 193, etc., through different I2C bus interfaces. For example, the processor 110 can couple to the touch sensor 180K through the I2C interface, enabling the processor 110 and the touch sensor 180K to communicate through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0042] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to enable the function of answering phone calls through a Bluetooth headset.
[0043] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via the PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering phone calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0044] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface to enable music playback through Bluetooth headphones.
[0045] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI) and a display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to enable the electronic device 100 to capture images. The processor 110 and the display screen 194 communicate via the DSI interface to enable the electronic device 100 to display images.
[0046] The GPIO interface can be configured via software. It can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to a camera 193, a display screen 194, a wireless communication module 160, an audio module 170, a sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0047] USB port 130 is a USB standard compliant interface, specifically a Mini USB port, Micro USB port, USB Type-C port, etc. USB port 130 can be used to connect a charger to charge electronic device 100, and can also be used for data transfer between electronic device 100 and peripheral devices. It can also be used to connect headphones for audio playback. This interface can also be used to connect other electronic devices, such as AR devices.
[0048] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0049] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0050] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, external memory, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.
[0051] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0052] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 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 tuning switches.
[0053] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 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 150 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 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0054] 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 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0055] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, 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 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0056] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).
[0057] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0058] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may 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 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0059] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0060] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0061] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0062] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0063] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0064] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0065] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.
[0066] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 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.
[0067] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0068] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.
[0069] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A.
[0070] The receiver 170B, also known as the "earpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to listen to the voice.
[0071] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.
[0072] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0073] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, and capacitive pressure sensors. A capacitive pressure sensor may include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the intensity of the touch operation based on pressure sensor 180A. Electronic device 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.
[0074] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.
[0075] The barometric pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates altitude using the air pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
[0076] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip cover. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover using the magnetic sensor 180D. Then, based on the detected opening and closing state of the cover or the flip cover, features such as automatic flip unlocking can be set.
[0077] The 180E accelerometer can detect the magnitude of acceleration of electronic device 100 in various directions (typically three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic devices and applied to applications such as screen orientation switching and pedometers.
[0078] A distance sensor 180F is used to measure distance. Electronic device 100 can measure distance via infrared or laser. In some embodiments, during a shooting scene, electronic device 100 can utilize the distance sensor 180F to measure distance for rapid focusing.
[0079] The proximity sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The LED may be an infrared LED. The electronic device 100 emits infrared light outward through the LED. The electronic device 100 uses the photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 may use the proximity sensor 180G to detect when a user holds the electronic device 100 close to their ear for a call, so as to automatically turn off the screen to save power. The proximity sensor 180G can also be used in holster mode and pocket mode for automatic unlocking and locking of the screen.
[0080] The ambient light sensor 180L is used to sense the brightness of ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 based on the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also work with the proximity sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
[0081] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can utilize the characteristics of the collected fingerprints to achieve fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering calls with fingerprints, etc.
[0082] Temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 uses the temperature detected by temperature sensor 180J to execute a temperature handling strategy. For example, when the temperature reported by temperature sensor 180J exceeds a threshold, electronic device 100 performs thermal protection by reducing the performance of a processor located near temperature sensor 180J to reduce power consumption. In other embodiments, when the temperature is below another threshold, electronic device 100 heats battery 142 to prevent abnormal shutdown of electronic device 100 due to low temperature. In still other embodiments, when the temperature is below yet another threshold, electronic device 100 boosts the output voltage of battery 142 to prevent abnormal shutdown due to low temperature.
[0083] Touch sensor 180K, also known as a "touch panel," can be located on display screen 194. The touch sensor 180K and display screen 194 together form a touchscreen, also known as a "touch screen." Touch sensor 180K detects touch operations applied to or near it. The touch sensor can transmit 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 through display screen 194. In other embodiments, touch sensor 180K may also be located on the surface of electronic device 100, in a different position than display screen 194.
[0084] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals from the vibrating bone segments of the human vocal cords. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure signals. In some embodiments, the bone conduction sensor 180M can also be incorporated into headphones to form bone conduction headphones. The audio module 170 can parse the voice signals from the vibrating bone segments of the vocal cords acquired by the bone conduction sensor 180M to realize voice functionality. The application processor can parse heart rate information from the blood pressure signals acquired by the bone conduction sensor 180M to realize heart rate detection functionality.
[0085] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.
[0086] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.
[0087] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.
[0088] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0089] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This embodiment of the invention uses the layered architecture Android system as an example to exemplify the software structure of electronic device 100.
[0090] Figure 2 This is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.
[0091] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0092] The application layer can include a series of application packages.
[0093] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.
[0094] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0095] like Figure 2 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0096] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.
[0097] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.
[0098] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.
[0099] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).
[0100] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.
[0101] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.
[0102] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for the scheduling and management of the Android system.
[0103] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0104] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of 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.
[0105] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.
[0106] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.
[0107] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
[0108] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0109] A 2D graphics engine is a graphics engine for 2D drawing.
[0110] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0111] The following example, using a scene of capturing a photograph, illustrates the workflow of the software and hardware of the electronic device 100.
[0112] When touch sensor 180K receives a touch operation, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, timestamp of the touch operation, etc.). The raw input event is stored in the kernel layer. The application framework layer retrieves the raw input event from the kernel layer and identifies the control corresponding to the input event. Taking a single touch operation as an example, where the corresponding control is the camera application icon, the camera application calls the interface of the application framework layer to launch the camera application, and then calls the kernel layer to launch the camera driver, capturing still images or videos through camera 193.
[0113] Next, some of the terms and related technologies used in this application will be explained to facilitate understanding by those skilled in the art.
[0114] I. Intent and Slot
[0115] (I) Definition of Intent and Slot:
[0116] Intent refers to what an electronic device identifies as a user's actual or potential need. Essentially, intent is a classifier that categorizes user needs into a predefined type.
[0117] Intent and slot together constitute "user action". Electronic devices cannot directly understand natural language, so the role of intent recognition is to map natural language into a structured semantic representation that machines can understand.
[0118] Intent recognition, also known as Spoken Utterance Classification (SUC), is, as the name suggests, the classification of user-input natural language conversations into categories, with each category corresponding to the user's intent. For example, the intent of "How's the weather today?" is "Inquire about the weather." Naturally, intent recognition can be viewed as a typical classification problem. For example, the classification and definition of intents can refer to the ISO-24617-2 standard, which contains 56 detailed definitions. The definition of intents is highly dependent on the system's own positioning and its knowledge base; that is, the definition of intents has a very strong domain relevance. It is understood that, in the embodiments of this application, the classification and definition of intents are not limited to the ISO-24617-2 standard.
[0119] A slot is a parameter associated with an intent. An intent may correspond to several slots. For example, when asking for bus routes, necessary parameters such as departure point, destination, and time are required. These parameters are the slots corresponding to the intent "ask for bus routes".
[0120] For example, the main goal of semantic slot filling is to extract predefined semantic slot values from an input statement, given a semantic frame with a specific domain or intent. Semantic slot filling can be transformed into sequence labeling, which uses IOB (Inversion of Bounds) tagging to mark a word as the beginning, inside, or outside of a semantic slot. For a system to function correctly, intents and slots must first be designed. Intents and slots inform the system which specific task to perform and specify the types of parameters required to execute that task.
[0121] Taking a specific "ask the weather" requirement as an example, this section introduces the design of intents and slots in a task-oriented dialogue system:
[0122] Example of user input: "What's the weather like in Shanghai today?"
[0123] User intent definition: Ask_Weather (to inquire about the weather);
[0124] Slot definition: Slot 1: Date; Slot 2: Location.
[0125] Figure 3This is a schematic diagram illustrating the intention and slot relationship in an embodiment of this application. For example... Figure 3 As shown in (a), in this example, two necessary slots are defined for the "ask the weather" task: "time" and "location". For a single task, the above definition can solve the task requirements. However, in a real business environment, a system often needs to be able to handle several tasks simultaneously. For example, a weather station should be able to answer not only "ask the weather" questions but also "ask the temperature" questions.
[0126] For complex situations where a single system handles multiple tasks, an optimized strategy is to define higher-level domains, such as classifying both the "ask about the weather" and "ask about the temperature" intents under the "weather" domain. In this case, the domain can be simply understood as a set of intents. The advantage of defining domains and performing domain identification first is that it constrains the scope of domain knowledge, reducing the search space for subsequent intent identification and slot filling. Furthermore, a deeper understanding of each domain, effectively utilizing task- and domain-specific knowledge and features, can often significantly improve the performance of Natural Language Understanding (NLU). Therefore, for... Figure 3 The example in (a) is improved by adding the "weather" field:
[0127] User input example:
[0128] 1. "What's the weather like in Shanghai today?"
[0129] 2. What is the current temperature in Shanghai?
[0130] Domain definition: Weather;
[0131] User intent definition:
[0132] 1. Ask the weather: Ask_Weather;
[0133] 2. Query the temperature using the command `Ask_Temperature`.
[0134] Slot definition: Slot 1: Time, Date;
[0135] Slot 2: Location.
[0136] The improved "Inquire about the weather" request corresponds to the following intents and slots: Figure 3 As shown in (b).
[0137] (ii) Intent recognition and slot filling: After defining the intent and slot, the user intent and the corresponding slot value can be recognized from the user input.
[0138] The goal of intent recognition is to identify user intent from input. A single task can be simply modeled as a binary classification problem, such as the intent "ask the weather," which can be modeled as a binary classification problem of "is asking the weather" or "is not asking the weather." When the system needs to handle multiple tasks, it needs to be able to distinguish between various intents. In this case, the binary classification problem transforms into a multi-class classification problem. Slot filling is the task of extracting information from data and filling it into predefined slots, for example... Figure 3 The intent and corresponding slots have already been defined. When a user inputs "What is the weather like in Shanghai today?", the system should be able to extract "today" and "Shanghai" and fill them into the "time" and "location" slots respectively.
[0139] II. BERT (Bidirectional Encoder Representation from Transformers) Model: The BERT model is an encoder for bidirectional transformers, where a transformer is a method that relies entirely on self-attention to compute input and output representations. BERT achieves bidirectionality in language models using a masked model, demonstrating the importance of bidirectionality for language representation pre-training. The BERT model is a truly bidirectional language model, where each word can simultaneously utilize its contextual information. BERT aims to pre-train deep bidirectional representations by jointly tuning the context across all layers. Therefore, pre-trained BERT representations can be fine-tuned through an additional output layer, making it suitable for building state-of-the-art models across a wide range of tasks.
[0140] After adding a fully connected layer to the BERT model and training it, the BERT model without the fully connected layer can be used for various natural language processing tasks (including sequence labeling, classification, sentence relationship judgment, and generative tasks).
[0141] III. Artificial intelligence (AI) models are a type of machine learning model. Essentially, they are mathematical models comprising a large number of parameters and mathematical formulas (or rules). Their purpose is to learn mathematical expressions that demonstrate the correlation between input values x and output values y. The mathematical expression that demonstrates the correlation between x and y is the trained AI model. Generally, using historical data (x and y), an initial AI model is trained to obtain a new y based on new x, thus achieving predictive analysis. This predictive analysis process is also known as inference.
[0142] like Figure 4 As shown, Figure 4This is a flowchart illustrating a method for classifying intention slots.
[0143] This method is based on a hierarchical neural network model and uses the fusion of multiple small models to classify intent slots.
[0144] First, this method uses a domain discrimination model to classify the sentences to be understood into domains, obtaining a domain label for each character.
[0145] The sentence to be understood is used as input to the domain discrimination model, which outputs a domain label for each character in the sentence. For example, domain labels could be navigation, telephone, radio, weather, command control, etc. For example, if the sentence to be understood has M characters, the domain discrimination model outputs domain labels for those M characters. Domain labels can include: the name of the domain category to which the character belongs and the character's first position information. The first position information is the position information of that character among all characters that satisfy a first condition: characters in the sentence to be understood that belong to the same domain category as that character.
[0146] Secondly, the intent slot classification system uses the intent discrimination model corresponding to the aforementioned domain label model to classify intents and obtain the intent label for each word.
[0147] It is understood that each domain tag includes one or more intent tags. For example, intent tags under the navigation domain may include search, location, navigation, route, etc.; intent tags under the radio domain may include play, favorite, etc.
[0148] Assuming the intent slot classification system has N pre-defined domain categories, each belonging to a different domain, then each domain category corresponds to one intent recognition model, resulting in N intent recognition models. Words with the same domain label in the sentence to be understood are used as input to the corresponding intent discrimination model, which outputs the intent label for each word. Therefore, the intent discrimination model outputs intent labels for M words. The intent label can include: the name of the intent category to which the word belongs and the word's second position information. The second position information is the word's position among all words satisfying a second condition: words in the sentence to be understood belonging to the same domain category and the same intent category as the given word.
[0149] Finally, the intent slot classification system determines the slot label of the sentence to be understood based on the domain label and intent label of each word in the sentence to be understood.
[0150] Because different types of slot labels have their own characteristics, this slot classification system uses different extraction methods to extract slot labels more effectively.
[0151] Method 1: Grammar rule-based approach. This method is suitable for extracting slot tags that are not enumerable and have strong regularity. For example, time, amount, etc. Use the ABNF grammar, i.e., regular expressions, to analyze and extract the slots.
[0152] Method 2: Dictionary approach. This method is suitable for extracting enumerable slot labels. For example, taking city names as an example, the dictionary is list(city) = {Beijing, Shanghai, Guangzhou, Shenzhen, Hangzhou...}.
[0153] Both of the above methods can refer to existing technologies, and will not be elaborated further here.
[0154] Method 3: For slot labels that are not enumerable and have weak regularity, a slot information discrimination model is used.
[0155] The slot information discrimination model can be, but is not limited to, an "embedding + bidirectional LSTM + CRF" neural network model, with one slot information discrimination model corresponding to each domain classification. The input of the slot information discrimination model is the domain label and intent label of each character in the sentence to be understood. The output of the slot information discrimination model is the slot label of the sentence to be understood.
[0156] This technical solution uses multiple simple classification models to model from different dimensions, and merges multiple prediction results to obtain the final intent classification result.
[0157] However, on the one hand, this method only considers the intent discrimination and slot discrimination tasks separately, and the intent-slot relationship in this scheme is weak and has poor generalization; on the other hand, as business increases, the intent-slot classification system will require more and more classification domains and intent discrimination models, which will require retraining the model.
[0158] like Figure 5 As shown, Figure 5 This is a structural diagram of a multi-label intent classifier for machine translation. The multi-label intent classifier includes a logic tree, which is a tree structure composed of a root node 500 and intent nodes 200 at the first, second, third, and even more slot levels derived from the root node. Each intent node corresponds to an intent label 400, and the process of filling the intent slots with intent labels 400 to form intent nodes is called coloring.
[0159] Specifically, the multi-label intent classifier recognizes the user's input voice information as text information 300. Then, it vectorizes the text information 300 into a text vector. Based on the text vector, the multi-label intent classifier outputs intent labels 400 and colors them onto the logic tree as corresponding intent nodes 200. It then finds the intent label sequence corresponding to each intent node 200 under the control of the logic tree. This intent label sequence forms a search tree in the logic tree; that is, the search tree is a subset of the logic tree, and there can be one or more search trees. When there is only one intent label, the multi-label intent classifier directly searches the database based on the intent label sequence and outputs product recommendation information. When there are multiple intent labels, the multi-label intent classifier determines whether the intent node path corresponding to each intent label is unique. If it is, the multi-label intent classifier searches the database based on the intent label and outputs product recommendation information; otherwise, the multi-label intent classifier outputs a query message to the user. After the user replies, the message is re-recognized as text information, and the process continues until the requirements are met, allowing the output of product recommendation information.
[0160] This method uses a machine translation multi-label intent classifier to find the intent label sequence under the control of a logic tree. However, this approach only supports intent classification and cannot support slot filling. Furthermore, it relies on the intent logic tree, which does not support large-scale concurrent operation and is not suitable for large-scale intent slot classification. In other aspects, the applicability of this approach is relatively narrow; it is only applicable to the product recommendation domain, and the cost of large-scale migration to other domains is high.
[0161] The following embodiments of this application provide an intent slot recognition method. This method is applicable to the field of human-computer interaction and specifically includes: an electronic device recognizing a user's speech as a text sequence, and obtaining sentence vectors and character vectors of the text sequence according to an encoding model. Then, the electronic device performs self-attention calculation on the character vectors to obtain the contextual relationship between each character and the remaining characters in the text sequence. The electronic device concatenates the sentence vector and the character vectors after self-attention calculation to obtain a first text sequence vector. The electronic device calculates the similarity between the first text sequence vector and the intent label encoding vector to obtain the intent probability of the text sequence. The electronic device uses intent labels with output intent probabilities greater than a preset threshold as the intent labels of the text sequence. For slot extraction, the electronic device performs multi-head attention calculation on the character vectors and the intent label encoding vector to obtain a second text sequence vector. Then, the electronic device concatenates the second text sequence vector and the intent probability vector to obtain a third text sequence vector. The electronic device calculates the similarity between the third text sequence vector and the intent label encoding vector to obtain the slot probability of the text sequence. The electronic device uses slot labels with output slot probabilities greater than a preset threshold as the slot labels of the text sequence.
[0162] In this way, when the electronic device performs intent recognition based on the first text sequence vector, the first text sequence vector incorporates the slot encoding information of each character in the text sequence, reflecting the constraint of the slot encoding information on the intent recognition of the text sequence. Simultaneously, when the electronic device extracts slots based on the second text sequence vector, the second text sequence vector incorporates the intent label encoding information of each character in the text sequence, reflecting the constraint of the intent label encoding information on the slots of the text sequence. This improves the accuracy of the electronic device in recognizing intent slots.
[0163] Similarly, this method is applicable not only to multi-intent slot extraction but also to single-intent slot extraction. The specific implementation method is the same as that of electronic devices for multi-intent slot extraction of text sequences, and will not be described in detail here.
[0164] As shown in Table 1, Table 1 provides an example of multiple intents under a domain category and the preset slots corresponding to each intent.
[0165] Table 1
[0166]
[0167] For example, when an electronic device identifies the domain of a text sequence as search, the intent corresponding to the "search" domain can include "search for food" and "search for location". When the intent is "search for food", the slots extracted by the electronic device from the text sequence include location and food name (category). When the intent is "search for location", the slots extracted by the electronic device from the text sequence include location.
[0168] When an electronic device identifies the text sequence as belonging to the "play" domain, the intent corresponding to the "play" domain can include "play music," "play ebook," and "play video." When the intent is "play music," the slot extracted by the electronic device from the text sequence includes the music name (music_name). When the intent is "play video," the slot extracted by the electronic device from the text sequence includes the video name (video_name). When the intent is "play ebook," the slot extracted by the electronic device from the text sequence includes the ebook name (voice_name).
[0169] When an electronic device identifies a text sequence as belonging to the command control domain, the intent of the "command control" domain can include "on" and "off". When the intent is "on", the slot extracted by the electronic device from the text sequence includes the name. When the intent is "off", the slot extracted by the electronic device from the text sequence includes the name.
[0170] When an electronic device identifies a text sequence as belonging to the domain "reservation," the intent corresponding to the "reservation" domain can include "book a hotel" and "book a flight." When the intent is "book a hotel," the slots extracted by the electronic device from the text sequence include time (day), location (location), number (number), and hotel name (hotel). When the intent is "book a flight," the slots extracted by the electronic device from the text sequence include date (day), starting point (starting), destination (destination), and ticket name (ticket).
[0171] When an electronic device identifies a text sequence as belonging to the domain "making a phone call," the intent corresponding to the "making a phone call" domain can include "making a phone call." The slots extracted by the electronic device from this text sequence include the name.
[0172] Table 1 is only an example showing the various intents under some preset domain categories and the preset slot labels corresponding to each intent. More domain categories may be included, but they will not be listed here.
[0173] It is understandable that the various intents under some preset domain categories shown in Table 1, and the preset slot labels corresponding to each intent, are all obtained through training with sample data. Electronic devices can identify the domain of the input text data and one or more intent labels under that domain, and extract slots from the text data under each intent label.
[0174] Understandably, each domain can include one or more intents, and the slot labels under each intent are also pre-defined.
[0175] When a text sequence has multiple intents, the electronic device can identify the domain of the text sequence and the multiple intent labels under that domain. Then, the electronic device will apply slot intents to the text sequence under each intent label.
[0176] When the text sequence is a single intent, the electronic device can identify the domain of the text sequence and the intent label under that domain. Then, the electronic device will apply slot intent to the text sequence under that intent label.
[0177] The following examples illustrate several scenarios where text sequences contain multiple intentions.
[0178] For single-intent slot extraction, for example, the text sequence could be "buy a plane ticket to Shanghai tomorrow". The electronic device can recognize the intent of this text sequence as "buy a ticket". The preset slots under the "buy a ticket" intent can include departure point, destination, and time. The electronic device uses a trained model or neural network to extract slots from the text sequence, and the extracted slot labels can be destination "Shanghai" and time "tomorrow".
[0179] In some embodiments, multiple intents may appear in a single text sequence due to multiple intents, entity ambiguity, or ambiguity caused by identical sentence structures. When an electronic device performs multi-intent slot recognition based on a single-intent model, it may output the slot label corresponding to the intent with the highest probability or output no result. However, when the electronic device outputs the slot corresponding to the intent with the highest probability, this intent may not necessarily be the user's expressed intent. Therefore, using a single-intent model to extract intent slots from text sequences containing multiple intents will introduce bias.
[0180] Scenario 1: The text sequence is ambiguous due to the same sentence structure, resulting in the text sequence containing multiple intentions.
[0181] For example, the text sequence is "Search for KFC near Xinjiekou".
[0182] As shown in Table 1, when an electronic device recognizes that the domain of a text sequence is search, the intent corresponding to the search domain can be searching for food, searching for locations, etc.
[0183] When the intent is to search for food, the slots for that intent can include both location and name. When the intent is to search for a location, the slots for that sub-intent can include location.
[0184] The electronic device identifies the domain of the text sequence as search. When the electronic device performs intent recognition on the text sequence "search for KFC near Xinjiekou", it will recognize two kinds of intent. One is that the electronic device 100 regards "KFC near Xinjiekou" as the "search location" intent; the other is that the electronic device regards "KFC" as the "search for food" intent.
[0185] like Figure 6 As shown, Figure 6 An example diagram illustrates the slot labels of the above text sequence under different intentions.
[0186] When the electronic device recognizes that the intent of the text sequence is "search location", it will use "KFC near Xinjiekou" as the location slot. Under the intent of "search location", the annotation results of this text sequence are ""search-O", "search-O", "new-B-Location", "street-I-Location", "mouth-I-Location", "attached-I-Location", "near-I-Location", "of-I-Location", "KFC-I-Location", "Germany-I-Location", "base-I-Location".
[0187] When the electronic device recognizes the intent of the text sequence as "search_cate", it assigns "Xinjiekou" as the location slot and "KFC" as the food slot. Under the intent of "search_cate", the annotation results for this text sequence are ""search-O", "search-O", "new-B-Location", "street-I-Location", "mouth-I-Location", "attached-O", "near-O", "of-O", "KFC-B-cate", "KFC-I-cate", "base-I-cate".
[0188] Scenario 2: The text sequence contains multiple intents due to entity ambiguity.
[0189] For example, the text sequence is "Play Hello Old Times".
[0190] As shown in Table 1, when an electronic device identifies the domain of a text sequence as playback, the intent corresponding to the playback domain can be to play music, play video, play e-book, etc.
[0191] The domain of this text sequence is playback. When the electronic device performs intent recognition on the text sequence "Play Hello Old Times", it will recognize three intents: First, the electronic device recognizes "Hello Old Times" as a song title, then the electronic device recognizes "Play Hello Old Times" as the intent to "play music"; second, the electronic device recognizes "Hello Old Times" as a video title, then the electronic device recognizes "Play Hello Old Times" as the intent to "play video"; third, the electronic device recognizes "Hello Old Times" as an e-book title, then the electronic device recognizes "Play Hello Old Times" as the intent to "play e-book".
[0192] like Figure 7 As shown, Figure 7 An example diagram illustrates the slot labels of the above text sequence under different intentions.
[0193] When the electronic device recognizes the intent of the text sequence as "play music (play_music)," it labels "Hello Old Times" as the music name slot. Under the intent of "play music (play_music)," the labeling result of this text sequence is ""play-O", "release-O", "you-B-music", "good-I-music", "old-I-music", "time-I-music", "light-I-music". The slot label extracted by the electronic device is music name (music_name) - Hello Old Times.
[0194] When the electronic device recognizes the intent of the text sequence as "play video (play_video)", it labels "Hello Old Times" as the video name slot. Under the intent of "play video (play_video)", the labeling result of this text sequence is ""play-O", "release-O", "you-B-video", "good-I-video", "old-I-video", "time-I-video", "light-I-video". The slot label extracted by the electronic device is video name (video_name) - Hello Old Times.
[0195] When the electronic device recognizes the intent of the text sequence as "play ebook (play_voice)", it labels "Hello Old Times" as the ebook name slot. Under the intent of "play ebook (play_voice)", the labeling result of this text sequence is ""play-O", "release-O", "you-B-voice", "good-I-voice", "old-I-voice", "time-I-voice", "light-I-voice". The slot label extracted by the electronic device is ebook name (voice_name) - Hello Old Times.
[0196] Scenario 3: The user's utterance, i.e., the text sequence, contains multiple intentions.
[0197] For example, the text sequence is "I want to book a flight to Beijing tomorrow and a hotel near the Bund in Shanghai".
[0198] As shown in Table 1, when an electronic device identifies the domain of a text sequence as "reservation", the intent corresponding to the reservation domain can be to reserve a flight ticket, a hotel, etc.
[0199] When the electronic device extracts slots from the text sequence within the "reservation" domain, it recognizes two intents related to the "reservation" domain: "book a flight" and "book a hotel." One interpretation is that the electronic device identifies the text sequence as the "book a flight" intent; the other is that it identifies the text sequence as the "book a hotel" intent.
[0200] like Figure 8 As shown, Figure 8 An example diagram illustrates the slot labels of the above text sequence under different intentions.
[0201] When the electronic device recognizes the intent of the text sequence as "book_ticket", it labels the text sequence "I want to book a ticket to Beijing tomorrow and a hotel near the Bund in Shanghai" as the date slot, destination slot, and ticket name slot. Under the intent of "book_ticket", the labeling result of this text sequence is "I-O", "want-O", "pre-O", "book-O", "one-O", "one-on", "tomorrow-day", "day-I-day", "go-O", "Shanghai-Destination", "of-O", "ticket-B-ticket", "ticket-I-ticket", "and-O", "pre-O", "book-O", "Shanghai-O", "Bund-O", "near-O", "of-O", "hotel-O", "one-O", "room-O".
[0202] When the electronic device recognizes the intent of the text sequence as "book_hotel", it labels the first clause "I want to book a flight to Beijing tomorrow" as both a time slot and a location slot. Under the intent "book_hotel", the labeling results for this text sequence are: "I-O", "Want-O", "Book-O", "One-O", "One-O", "Tomorrow-B-day", "Today-I-day", "Go-O", "Shang-B-location", "Shanghai-I-location", "Of-O", "Airplane-O", "Ticket-O". When the electronic device recognizes the intent of the text sequence as "book_hotel", since the labeling results for the text sequence do not include a flight ticket name slot label, it discards the intent "book_hotel" for the first clause and uses "book_ticket" as the intent label for the first clause.
[0203] When the electronic device recognizes the intent of clause two as "book_hotel", it labels the text sequence "I want to book a flight to Beijing tomorrow and a hotel near the Bund in Shanghai" as location slot, hotel name slot, and quantity slot. Under the intent of "book_hotel", the labeling result of this text sequence is "I-O", "want-O", "pre-O", "book-O", "one-O", "one-O", "one-O", "tomorrow-O", "day-O", "go-O", "Shanghai-O", "of-O", "airplane-O", "ticket-O", "and-O", "pre-O", "book-O", "Shanghai-I-location", "outer-I-location", "beach-I-location", "near-O", "of-O", "hotel-B-hotel", "hotel-I-hotel", "one-B-number", "room-I-number".
[0204] The above embodiments exemplify situations where a text sequence contains multiple intents in some scenarios. Electronic devices can identify multiple intents in a text sequence and extract slots from the text sequence under each intent.
[0205] The following description uses multi-intent slot extraction as an example to illustrate the embodiments of this application.
[0206] like Figure 9 As shown, Figure 9 This is a framework diagram of an intent slot recognition method provided in an embodiment of this application.
[0207] This method includes intent recognition and slot extraction.
[0208] Intent recognition can be divided into the following steps:
[0209] Step 1: The electronic device collects the user's voice, converts the voice into a text sequence, and uses the bertembedding model to represent the text sequence as sentence vectors and word vectors.
[0210] For example, the text sequence could be "search for KFC near Xinjiekou".
[0211] Electronic devices input text sequences into the Bert embedding model, which outputs sentence vectors (CLS) and word vectors (sequence output) of the text sequence.
[0212] Before an electronic device inputs a text sequence into the BERT embedding model, the text sequence needs to be preprocessed. Preprocessing includes formatting the text sequence correctly before using it as input to the BERT embedding model.
[0213] The format of the input text sequence is: [CLS]““search”, “new”, “street”, “mouth”, “attached”, “near”, “of”, “ken”, “de”, “ji”.
[0214] The BERT embedding model outputs sentence vectors (CLS) and character vectors (sequenceoutput) for the text sequence. The sentence vector (CLS) is the semantic representation of the text sequence; the character vector (sequenceoutput) is the vector representation of each character in the text sequence.
[0215] Step 2: The electronic device concatenates the sentence vector (CLS) and word vector (sequence output) using an add operation to obtain the first text sequence vector.
[0216] First, the electronic device performs multi-head self-attention calculation on the word vectors (sequence output) to obtain the attention value for each word in the text sequence.
[0217] The electronic device concatenates the word vectors and sentence vectors (CLS) after multi-head self-attention calculation (add operation) to obtain the first text sequence vector.
[0218] The first text sequence vector is a combined representation of the sentence vector and character vector of the text sequence. The first text sequence vector can reflect both the semantic representation of the text sequence and the attention value of each character in the text sequence.
[0219] Step 3: The electronic device performs vector calculations on the first text sequence vector and the intent label encoding vector to obtain intent logits, which represent the similarity between the text sequence and each intent label.
[0220] The electronic device calculates the similarity between the text sequence and each intent label by calculating the vector distance between the text sequence and each intent label.
[0221] The intent label encoding vector is preset. For example, assuming an electronic device can recognize 700 intent labels, the intent label encoding vector represents these 700 intent labels.
[0222] Step 4: The electronic device normalizes the intent logits to obtain the intent probabilities.
[0223] The probability vector represents the probability that the text sequence contains each intent tag. The electronic device normalizes the intent logits, which is to convert the vector distance between the text sequence and each intent tag into the probability of the text sequence to each intent tag, thus obtaining the intent probability vector.
[0224] Step 5: The intent labels corresponding to the electronic device outputting intent probabilities greater than a preset threshold (e.g., 0.5).
[0225] In this way, when the electronic device performs intent recognition on the text sequence using the first text sequence vector, the first text sequence vector takes into account both the sentence vector (CLS) and the word vector (sequence output). When the electronic device performs intent recognition on the text sequence, it refers to the slot encoding information (i.e., word vector (sequence output)) of the text sequence, thereby improving the accuracy of the electronic device's multi-text sequence intent recognition.
[0226] The extraction of slots can be divided into the following steps:
[0227] Step 1: The electronic device performs multi-head attention calculation on the word vector (sequence output) and the slot label embedding to obtain the second text sequence vector, which represents the similarity between each word in the text sequence and each intent label.
[0228] Specifically, the electronic device performs multi-head attention calculation on the word vector (sequence output) and the slot label embedding. This means that the electronic device performs vector calculation on each word in the text sequence and each slot label to obtain the similarity between each word in the text sequence and each slot label, which is to obtain the vector distance between each word in the text sequence and each slot label.
[0229] Step 2: The electronic device concatenates the second text sequence vector, the word vector (sequence output), and the intent probability vector (add operation) to obtain the third text sequence vector.
[0230] The third text sequence vector is a comprehensive representation of the second text sequence vector, word vectors, and intent probability vectors of the text sequence. The third text sequence vector can reflect both the similarity between each word and each slot label in the text sequence, and the probability that the text sequence contains each intent label.
[0231] Step 3: The electronic device performs vector calculations on the third text sequence vector and the slot label encoding vector to obtain the slot logits, which represent the similarity between each word in the text sequence and each slot label.
[0232] The electronic device calculates the similarity between each word in the text sequence and each slot label by calculating the vector distance between each word in the text sequence and each slot label.
[0233] The slot label encoding vector is preset. For example, assuming an electronic device can recognize 300 intent labels, the slot label encoding vector represents these 300 intent labels.
[0234] Step 4: The electronic equipment normalizes the slot logits to obtain the slot probabilities.
[0235] The slot probability vector represents the probability of each word in the text sequence to each slot label. The electronic device normalizes the slot logits, that is, it converts the vector distance between each word in the text sequence and each slot label into the probability of each word in the text sequence to each slot label, thus obtaining the slot probability vector.
[0236] Step 5: The slot labels (intentlabels) corresponding to the probability of the electronic device outputting a slot being greater than a preset threshold (e.g., 0.5).
[0237] In this way, when the electronic device extracts slots from the text sequence using the third text sequence vector, the third text sequence vector considers both the similarity between each word and each intent label in the text sequence and the intent information of the text sequence. The electronic device references the intent information of the text sequence when extracting slots, thereby improving the accuracy of multi-text sequence slot extraction by the electronic device.
[0238] like Figure 10 As shown, Figure 10 This is a flowchart of a method for identifying intent slots provided in an embodiment of this application.
[0239] S1001. The electronic device inputs the text sequence into the BERT embedding model to obtain sentence vectors and character vectors.
[0240] Before the electronic device inputs the text sequence into the BERT embedding model, it recognizes the user's voice and converts it into a text sequence.
[0241] For example, the text sequence could be "search for KFC near Xinjiekou".
[0242] Before electronic devices can input text sequences into a BERT embedding model, the text sequences need to be formatted correctly.
[0243] The format of the input text sequence is: [CLS]““search”, “new”, “street”, “mouth”, “attached”, “near”, “of”, “ken”, “de”, “ji”.
[0244] The BERT embedding model outputs sentence vectors (CLS) and word vectors (sequenceoutput) corresponding to the text sequence. The sentence vector (CLS) is the semantic representation of the text sequence, i.e., the domain to which the text sequence belongs. For example, as shown in Table 1, the sentence vector (CLS) can belong to the search domain, playback domain, command control domain, reservation domain, phone call domain, etc. Electronic devices will perform intent recognition and slot extraction on the text sequence based on the domain to which the sentence vector (CLS) belongs. The word vector (sequence output) is the vector representation of each word in the text sequence.
[0245] For example, consider the text sequence "Search for KFC near Xinjiekou". The sentence vector (CLS) of this text sequence output by the electronic device belongs to the search domain. The electronic device will then perform intent recognition on this text sequence within the search domain.
[0246] For example, consider the text sequence "Play Hello Old Times". The sentence vector (CLS) of this text sequence output by the electronic device belongs to the playback domain. The electronic device will then perform intent recognition on this text sequence within the playback domain.
[0247] Specifically, the electronic device outputs sentence vectors (CLS) and word vectors (sequenceoutput) based on the text sequence. The sentence vector (CLS) can be represented as a matrix [1, hidden], and the word vector (sequenceoutput) can be represented as a matrix [seq_len, hidden].
[0248] Among them, "hidden" represents the number of hidden layers of the BERT model, which is set to x. For example, the BERT model can be the BERT-base model, then hidden = 768. "seq_len" represents the length of the text data. For text data with p words, then seq_len = p.
[0249] Exemplarily, when the text sequence input to the bert embedding model is "[CLS]""Search""New""Street""Mouth""Nearby""KFC"". The text sequence has 11 words, then seq_len = 11. Then the sentence vector (CLS) can be represented as a matrix [1, 768], and the word vectors (sequence output) can be represented as a matrix [11, 768].
[0250] S1002. The electronic device performs multi-head self-attention calculation on the word vectors to obtain the attention value of each word in the text sequence.
[0251] Specifically, the electronic device calculates the similarity between the first word vector in the text sequence and the remaining other words in the text sequence to obtain weights; then, the electronic device normalizes the weights of the first word vector and the remaining other words in the text sequence; finally, the electronic device performs weighted summation on the normalized weights of the first word and the remaining other word vectors in the text sequence to obtain the attention value of the first word vector in the text sequence. Similarly, all the word vectors in the text sequence are subjected to self-attention calculation in the above manner to obtain the attention value of each word vector in the text sequence. Exemplarily, the attention value of each word vector in the text sequence can be represented by a matrix [11, 768].
[0252] S1003. The electronic device obtains the first text sequence vector based on the sentence vector and the word vectors after performing multi-head self-attention calculation.
[0253] The electronic device splices (add operation) the word vectors after performing multi-head self-attention calculation with the sentence vector (CLS) to obtain the first text sequence vector.
[0254] The first text sequence vector is a comprehensive representation of the sentence vector and word vectors of the text sequence. The first text sequence vector can not only reflect the semantic representation of the text sequence but also reflect the attention value of each word in the text sequence.
[0255] Specifically, the electronic device can splice (add operation) the word vectors after performing multi-head self-attention calculation with the sentence vector (CLS) in any of the following ways.
[0256] Method 1: The electronic device performs vector addition on the word vectors and sentence vectors (CLS) after multi-head self-attention calculation to obtain the first text sequence vector.
[0257] First, the electronic device needs to expand the sentence vector (CLS) into a matrix of the same size as the word vector matrix after multi-head self-attention computation. For example, the electronic device expands the sentence vector (CLS) from matrix [1, 768] to matrix [11, 768].
[0258] The electronic device then adds the sentence vector (CLS) matrix to the character vector matrix after multi-head self-attention calculation to obtain the first text sequence vector. For example, the first text sequence matrix can be represented as matrix [11, 768].
[0259] Method 2: The electronic device concatenates the word vectors after multi-head self-attention calculation with the sentence vectors (CLS) to obtain the first text sequence vector.
[0260] The electronic device directly concatenates the character vectors after multi-head self-attention computation to the sentence vector (CLS) or to the beginning to obtain the first text sequence vector. This application does not impose any restrictions on the concatenation order of the character vectors and sentence vectors after multi-head attention computation.
[0261] First, the electronic device needs to expand the sentence vector (CLS) into a matrix of the same size as the word vector matrix after multi-head self-attention computation. For example, the electronic device expands the sentence vector (CLS) from matrix [1, 768] to matrix [11, 768].
[0262] The word vectors after multi-head self-attention computation can be represented as matrices [11, 768], and the sentence vector (CLS) can be represented as matrices [11, 768]. The electronic device concatenates the word vectors after multi-head self-attention computation with the sentence vector (CLS) to obtain the first text sequence vector, which can be represented as matrices [22, 768].
[0263] S1004. The electronic device calculates the similarity between the first text sequence vector and the intent label encoding vector to obtain the intent probability of the text sequence.
[0264] The electronic device calculates the similarity between the first text sequence vector and the intent label encoding vector to obtain the intent probability of the text sequence. Alternatively, the electronic device can determine the similarity between the sentence vector and multiple preset intent labels, as well as the similarity between the character vector after multi-head attention calculation and multiple preset intent labels.
[0265] The intent tag encoding vector is a vector representation of the preset intent tags. For example, when there are 700 preset intent tags, such as "book flight", "book hotel", "play music", "play video", etc. Each intent tag corresponds to a one-hot vector, and the one-hot vector can be represented as a matrix [1, 768]. Therefore, the 700 preset intent tags can be represented as a matrix [700, 768].
[0266] The electronic device calculates the similarity between the first text sequence vector and the intent label encoding vector by calculating the vector distance between the text sequence and each intent label.
[0267] Specifically, the electronic device performs matrix operations on the transpose of the first text sequence vector and the intent tag encoding vector to obtain the vector distance between the text sequence and each intent tag.
[0268] First, for example, when the intent tag encoding vector is represented as a matrix [700, 768], the electronic device transposes the intent tag encoding vector matrix [700, 768] to obtain the intent tag encoding vector matrix [768, 700].
[0269] Then, the electronic device performs matrix operations on the first text sequence vector matrix [11, 768] and the intent label encoding vector matrix [768, 700] to obtain the intent logits, which can be represented as a matrix [11, 700].
[0270] The intent regression vector represents the similarity between the first text sequence vector and the intent label encoding vector, that is, the vector distance between the text sequence and each intent label.
[0271] Electronic devices normalize the intent logits to obtain the intent probability vector. The intent probability vector can be represented as a matrix [11, 700].
[0272] The intent probability vector represents the probability that the text sequence contains each intent tag. Electronic devices normalize the intent logits, which is to convert the vector distance between the text sequence and each intent tag into the probability of the text sequence to each intent tag, thus obtaining the intent probability vector.
[0273] The electronic device outputs intent labels with an intent probability greater than a preset threshold (e.g., 0.5). Intent labels with an intent probability greater than the preset threshold (e.g., 0.5) are intent labels contained in the text sequence recognized by the electronic device.
[0274] This can be understood as follows: each predetermined domain corresponds to multiple intent labels, and the slots under each intent label are pre-defined. When an electronic device extracts multiple intent slots from a text sequence, it knows the domain of the text sequence. The electronic device will output all intent labels of the text sequence under that domain as the intent labels of the text sequence recognized by the electronic device.
[0275] For example, consider the text sequence "Search for KFC near Xinjiekou". This text sequence belongs to the search domain. Within the search domain, the electronic device outputs the intent labels "search location" and "search for food" for this text sequence with an intent probability greater than 0.5. Other preset intent labels, such as "play music", "play video", and "play ebook", have intent probabilities less than 0.5. Therefore, the electronic device uses the intent labels "search location" and "search for food" as the intent labels for this text sequence.
[0276] For example, given the text sequence "Play Hello Old Times," the domain of this text sequence is the playback domain. Within the playback domain, the electronic device outputs the intent labels "Play Music," "Play Video," and "Play E-book" for this text sequence with an intent probability greater than 0.5. Other preset intent labels, such as "Search Location" and "Search Food," have intent probabilities less than 0.5. Therefore, the electronic device uses the intent labels "Play Music," "Play Video," and "Play E-book" as the intent labels for this text sequence.
[0277] S1005. The electronic device performs multi-head attention calculation on the character vector and the intent label embedding to obtain the second text sequence vector.
[0278] The intent tag encoding vector is a vector representation of the preset intent tags. For example, when there are 700 preset intent tags, such as "book flight", "book hotel", "play music", "play video", etc. Each intent tag corresponds to a one-hot vector, and the one-hot vector can be represented as a matrix [1, 768]. Therefore, the 700 preset intent tags can be represented as a matrix [700, 768].
[0279] Specifically, the electronic device calculates the similarity between the first character vector in the text sequence and the intent label embedding to obtain a weight. Then, the electronic device normalizes the first character vector and the intent label embedding. Finally, the electronic device weights the first character vector and the intent label embedding in the normalized text sequence and sums them to obtain the similarity between the first character and all slot labels in the text sequence. Similarly, multi-head attention is calculated for all characters in the text sequence in the above manner to obtain a second text sequence vector, which represents the similarity between each character vector in the text sequence and all intent label vectors. For example, the second text sequence vector can be represented by a matrix [11, 768].
[0280] S1006. The electronic device concatenates the second text sequence vector, the word vector, and the intent probability vector to obtain the third text sequence vector.
[0281] The electronic device concatenates the second text sequence vector, the word vector, and the intent probability vector (using an add operation) to obtain the third text sequence vector.
[0282] The third text sequence vector is a comprehensive representation of the second text sequence vector, word vectors, and intent probability vectors of the text sequence. The third text sequence vector can reflect both the similarity between each word and each slot label in the text sequence, and the probability that the text sequence contains each intent label.
[0283] Specifically, electronic devices can use any of the following methods to concatenate the second text sequence vector with the intent probability vector (add operation).
[0284] Method 1: The electronic device performs vector addition on the second text sequence vector, word vector, and intent probability vector to obtain the third text sequence vector.
[0285] The second text sequence vector can be represented by matrix [11, 768], the word vector can be represented by matrix [11, 768], and the intent probability vector can be represented by matrix [11, 700].
[0286] First, the electronic device expands the intent probability vector matrix from [11, 700] to [11, 768].
[0287] The electronic device adds the second text sequence vector matrix to the intent probability vector matrix to obtain the third text sequence vector. For example, the third text sequence matrix can be represented as matrix [11, 768].
[0288] Method 2: The electronic device concatenates the second text sequence vector, the word vector, and the intent probability vector to obtain the third text sequence vector.
[0289] For example, an electronic device directly concatenates the intent probability vector and the second text sequence vector after or before the word vector to obtain the third text sequence vector. This application does not limit the concatenation order of the intent probability vector, the second text sequence vector, and the word vector.
[0290] The second text sequence vector can be represented by matrix [11, 768], the word vector can be represented by matrix [11, 768], and the intent probability vector can be represented by matrix [11, 700]. First, the electronic device needs to expand the intent probability vector into a matrix of the same size as the second text sequence vector. For example, the electronic device expands the intent probability vector from matrix [11, 700] to matrix [11, 768].
[0291] The electronic device concatenates the second text sequence vector, the word vector, and the intent probability vector to obtain a third text sequence vector, which can be represented as a matrix [33, 768]. This application does not restrict the order in which the second text sequence vector, the word vector, and the intent probability vector are concatenated.
[0292] S1007. The electronic device calculates the similarity between the third text sequence vector and the slot label vector to obtain the slot probability of the text sequence.
[0293] The slot label vector is a vector representation of the preset slot labels. For example, when there are 300 preset slot labels, such as "day", "destination", "location", etc. Each slot label corresponds to a one-hot vector, and the one-hot vector can be represented as a matrix [1, 768]. Therefore, the 300 preset slot labels can be represented as a matrix [300, 768].
[0294] The electronic device calculates the similarity between the third text sequence vector and the slot label encoding vector by calculating the vector distance between each character in the text sequence and each slot label.
[0295] Specifically, the electronic device performs matrix operations on the transpose of the third text sequence vector and the slot label encoding vector to obtain the vector distance between each character in the text sequence and each slot label.
[0296] First, for example, when the slot tag encoding vector is represented as a matrix [300, 768], the electronic device transposes the slot tag encoding vector matrix [300, 768] to obtain the slot tag encoding vector matrix [768, 300].
[0297] Then, the electronic device performs matrix operations on the third text sequence vector matrix [11, 768] and the intent label encoding vector matrix [768, 300] to obtain the slot logits, which can be represented as a matrix [11, 300].
[0298] The intent regression vector represents the similarity between the third text sequence vector and the slot label encoding vector, that is, the vector distance between each word in the text sequence and each slot label.
[0299] The electronic device normalizes the slot logits to obtain the slot probability vector. The slot probability vector can be represented as a matrix [11, 300].
[0300] The slot probability vector represents the probability of each word in the text sequence reaching each slot label. The electronic device normalizes the slot logits, that is, it converts the vector distance between each word vector and each slot label vector in the text sequence into the probability of each word vector reaching each slot label in the text sequence, thus obtaining the slot probability vector.
[0301] The electronic device outputs slot labels with a probability greater than a preset threshold (e.g., 0.5). Slot labels with a probability greater than the preset threshold (e.g., 0.5) are slot labels contained in the text sequence recognized by the electronic device.
[0302] For example, given the text sequence "Search for KFC near Xinjiekou", the electronic device will output the intent labels "Search Location" and "Search Food" based on the search domain. Under the intent label "Search Location", the probability of the slot corresponding to the output slot label "Location" is greater than a preset threshold (e.g., 0.5), while the probability of the output slot labels "Food Name" and / or "Music Name" and other slot labels is less than the preset threshold (e.g., 0.5). Under the intent label "Search Food", the probability of the output slot labels "Location" and "Food Name" is greater than the preset threshold (e.g., 0.5), while the probability of the output slot labels "Time" and / or "Music Name" and other slot labels is less than the preset threshold (e.g., 0.5).
[0303] like Figure 6 As shown, Figure 6 The slot extraction results are used to identify multiple intents of the text sequence "search for KFC near Xinjiekou" for electronic devices.
[0304] When the electronic device recognizes that the intent of the text sequence is "search_location", the electronic device takes "KFC near Xinjiekou" as the location slot. Under the intent of "search_location", the annotation result of this text sequence is ""search - O"" "索 - O" "新 - B - Location" "街 - I - Location" "口 - I - Location" "附 - I - Location" "近 - I - Location" "的 - I - Location" "肯 - I - Location" "德 - I - Location" "基 - I - Location"".
[0305] When the electronic device recognizes that the intent of the text sequence is "search_cate", the electronic device takes "Xinjiekou" as the location slot and "KFC" as the food category slot. Under the intent of "search_cate", the annotation result of this text sequence is ""search - O"" "索 - O" "新 - B - Location" "街 - I - Location" "口 - I - Location" "附 - O" "近 - O" "的 - O" "肯 - B - cate" "德 - I - cate" "基 - I - cate"". After obtaining the annotation result of the text sequence, the electronic device extracts the slot labels according to the annotation result. The slot labels are location - Xinjiekou, food category name (cate) - KFC.
[0306] For example, for the text sequence "Play Hello Old Times", the electronic device will output intent labels "Play Music", "Play Video", and "Play E-book" based on the playback intent. Under the intent label "Play Music", the electronic device will output the slot corresponding to the slot label "Music Name (music_name)" with a probability greater than a preset threshold (e.g., 0.5), and the electronic device will output the slot labels "Food Name (cate)" and / or "Music Name (music_name)" and other slot labels with probabilities less than the preset threshold (e.g., 0.5). Under the intent label "Play Video", the electronic device will output the slot corresponding to the slot label "Video Name (video_name)" with a probability greater than the preset threshold (e.g., 0.5), and the electronic device will output... The probability of the slot corresponding to the slot label "food name (cate)" and / or "music name (music_name)" and other slot labels is less than the preset threshold (e.g., 0.5); under the intent label "play e-book", the probability of the slot corresponding to the slot label "e-book name (voice_name)" output by the electronic device is greater than the preset threshold (e.g., 0.5), and the electronic device will output the probability of the slot corresponding to the slot label "food name (cate)" and / or "music name (music_name)" and other slot labels is less than the preset threshold (e.g., 0.5).
[0307] like Figure 7 As shown, Figure 7 Examples show the slot labels for the text sequence "Play Hello Old Times" under different intentions.
[0308] When the electronic device recognizes the intent of the text sequence as "play music (play_music)," it labels "Hello Old Times" as the music name slot. Under the intent of "play music (play_music)," the labeling result of this text sequence is ""play-O", "release-O", "you-B-music", "good-I-music", "old-I-music", "time-I-music", "light-I-music". After obtaining the labeling result of the text sequence, the electronic device will extract the slot label based on the labeling result. The slot label is the music name (music_name) - Hello Old Times.
[0309] When the electronic device recognizes the intent of the text sequence as "play video (play_video)", it labels "Hello Old Times" as the video name slot. Under the intent of "play video (play_video)", the labeling result of this text sequence is ""play-O", "play-O", "you-B-video", "good-I-video", "old-I-video", "time-I-video", "light-I-video". After obtaining the labeling result of the text sequence, the electronic device will extract the slot label based on the labeling result. The slot label is the video name (video_name) - Hello Old Times.
[0310] When the electronic device recognizes the intent of the text sequence as "play ebook (play_voice)", it labels "Hello Old Times" as the ebook name slot. Under the intent of "play ebook (play_voice)", the labeled text sequence is ""play-O", "release-O", "you-B-voice", "good-I-voice", "old-I-voice", "time-I-voice", "light-I-voice". After obtaining the labeled text sequence, the electronic device will extract the slot label based on the label, and the slot label is the ebook name (voice_name) - Hello Old Times.
[0311] The above embodiments exemplify that a text sequence contains multiple intentions, and an electronic device can identify the multiple intentions in the text sequence and extract slots from the text sequence according to preset slots under each intention.
[0312] This method can also be applied to single-intent slot extraction. When a text sequence has only one intent, the electronic device can identify the intent and extract the slots from the text sequence according to the preset slots under that intent. The principle of single-intent slot extraction is the same as that of multi-intent slot extraction. For specific examples, please refer to the embodiments of multi-intent slot extraction, which will not be repeated here.
[0313] like Figure 11 As shown, Figure 11 A schematic diagram illustrating the slot extraction results for the single intent of recognizing the text sequence "Call Dad" for electronic devices.
[0314] When the electronic device recognizes the intent label of the text sequence as "call", it labels "Dad" as the name slot. Under the intent label "call", the labeling result of this text sequence is "call-O", "electric-O", "phone-O", "give-O", "Dad-B-name", "Dad-I-name". After obtaining the labeling result of the text sequence, the electronic device will extract the slot label based on the labeling result, and the slot label is name-Dad.
[0315] The following section will use a human-computer dialogue application scenario to explain the intent slot recognition method provided by this application.
[0316] In human-computer dialogue applications, electronic devices convert user speech into text sequences and identify one or more intents within the text sequence. When the text sequence contains only one intent, the electronic device executes the instruction corresponding to that intent; when the text sequence contains multiple intents, the electronic device displays the instructions corresponding to each intent to the user, allowing the user to decide which intent's instruction to execute. This method improves the accuracy of human-computer interaction and enhances the user experience.
[0317] The multi-intent slot recognition method provided in the embodiments of this application will be introduced below in conjunction with application scenarios.
[0318] Figures 12-13 An example diagram of a human-computer dialogue scenario is shown.
[0319] like Figure 12 As shown, electronic devices can collect a user's voice and recognize the voice as a text sequence.
[0320] like Figure 13 As shown, the electronic device recognizes the collected user voice as the text sequence "Play Hello Old Times". From the above embodiment, it can be seen that the text sequence "Play Hello Old Times" may have three intentions: "Play music", "Play video", and "Play ebook".
[0321] like Figure 13 As shown, when the electronic device recognizes the instruction "Hello Old Times", it will display a prompt message: "Hello Old Times has been found for you. Do you want to play music, video, or e-book?" In this way, the electronic device presents the user with all possible intents contained in the text sequence, allowing the user to select the intent they want to perform.
[0322] like Figure 13 As shown, after the electronic device displays a prompt message, it can collect the user's voice and recognize the voice as a text sequence, which could be "play music".
[0323] The electronic device will recognize the user's command. In response to the user's command to "play music," the electronic device will display the message "Okay, music 'Hello Old Times' has been played for you." The electronic device will then execute the command to play the music "Hello Old Times."
[0324] like Figure 14 As shown, in response to the command to play the music "Hello, Old Times", the electronic device displays the following... Figure 14The music playback user interface 1401 shown is as follows. The music playback user interface 1401 includes a music name icon 1402, a play / pause control 1403, a previous track control 1404, a next track control 1405, and a favorite control 1406.
[0325] The following section introduces the method for single-intent slot recognition in conjunction with application scenarios.
[0326] like Figure 15 The electronic device recognizes the collected user voice as the text sequence "Call Dad". As can be seen from the above embodiments, the text sequence "Call Dad" contains only one intention, which is "make a phone call".
[0327] The electronic device will recognize the user's command. In response to the user's command "Call Dad," the electronic device will display the message "Okay, dialing Dad's number." The electronic device will then execute the command "Call Dad."
[0328] like Figure 16 As shown, in response to the command "Call Dad," the electronic device displays the following... Figure 16 The call user interface 1600 shown is included. The call user interface 1600 includes a mute control 1601, a dial pad control 1602, an audio control 1603, an add call control 1604, a video call control 1605, a contacts control 1606, and an end call control 1607.
[0329] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. An intention slot recognition method, characterized in that, The method includes; Electronic devices receive voice signals input by users; The electronic device identifies the text sequence in the voice signal; The electronic device extracts sentence vectors and word vectors from the text sequence; The electronic device determines the similarity between the sentence vector and multiple preset intent tags, as well as the similarity between the character vector after multi-head attention calculation and the multiple preset intent tags; The electronic device extracts one or more intent tags from the text sequence based on the similarity between the sentence vector and the multiple preset intent tags, as well as the similarity between the character vector after multi-head attention calculation and the multiple preset intent tags. The electronic device determines the similarity between the word vector and the preset slot label corresponding to each of the one or more intent labels; The electronic device extracts the slot labels corresponding to each of the one or more intent labels from the text sequence based on the similarity between the word vectors and the preset slot labels corresponding to each of the one or more intent labels. The electronic device executes the instructions corresponding to the one or more intent tags according to the slot tags corresponding to each of the one or more intent tags.
2. The method according to claim 1, characterized in that, Before the electronic device determines the similarity between the sentence vector and multiple preset intent tags, and the similarity between the character vector after multi-head attention calculation and the multiple preset intent tags, the method further includes: The electronic device concatenates the sentence vector and the character vector after multi-head self-attention calculation to obtain the first text sequence vector. The electronic device determines the similarity between the sentence vector and multiple preset intent tags, and the similarity between the character vector after multi-head attention calculation and the multiple preset intent tags, specifically including: The electronic device calculates the vector distance between the first text sequence vector and the plurality of preset intent tags to obtain the intent probability vector of the text sequence.
3. The method according to claim 2, characterized in that, After the electronic device calculates the vector distance between the first text sequence vector and the plurality of preset intent tags, and before obtaining the intent probability vector of the text sequence, the method further includes: The electronic device normalizes the vector distance between the first text sequence vector and the multiple preset intent tags to obtain the intent probability vector of the text sequence.
4. The method according to claim 3, characterized in that, The electronic device extracts one or more intent tags from the text sequence based on the similarity between the sentence vector and the multiple preset intent tags, and the similarity between the character vector after multi-head attention calculation and the multiple preset intent tags, specifically including: The electronic device outputs one or more intent tags corresponding to intent probabilities greater than a first preset probability from the intent probability vector, thereby determining the one or more intent tags in the text sequence.
5. The method according to claim 4, characterized in that, The one or more intent tags are all intent tags of the text sequence within a preset domain.
6. The method according to claim 3, characterized in that, The electronic device determines the similarity between the word vector and the preset slot labels corresponding to each of the one or more intent labels, specifically including: The electronic device performs multi-head attention calculation on the word vector and the intent label encoding vector to obtain a second text sequence vector; The electronic device concatenates the second text sequence vector, the word vector, and the intent probability vector to obtain a third text sequence vector; The electronic device calculates the vector distance between the third text sequence vector and the preset slot labels corresponding to the one or more intent labels, and obtains the similarity between the word vector and the preset slot labels corresponding to the one or more intent labels.
7. The method according to claim 6, characterized in that, After the electronic device calculates the vector distance between the third text sequence vector and the preset slot labels corresponding to the one or more intent labels, the method further includes: The electronic device normalizes the vector distance between the third text sequence vector and the preset slot labels corresponding to the one or more intent labels to obtain the slot probability vector of the text sequence. After the electronic device obtains the slot probability vector of the text sequence, the method further includes: The electronic device outputs slot labels corresponding to one or more slot probabilities greater than the second set probability in the slot probability vector, and determines one or more slot labels corresponding to one or more intent labels in the text sequence.
8. The method according to claim 2, characterized in that, The electronic device concatenates the sentence vector and the character vector after multi-head self-attention calculation to obtain a first text sequence vector, specifically including: The electronic device adds the sentence vector and the character vector after multi-head self-attention calculation to obtain the first text sequence vector.
9. The method according to claim 6, characterized in that, The electronic device concatenates the second text sequence vector, the word vector, and the intent probability vector to obtain a third text sequence vector, specifically including: The electronic device adds the second text sequence vector, the word vector, and the intent probability vector to obtain the third text sequence vector.
10. An electronic device, characterized in that, The device includes one or more processors and one or more memories; the one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program code, the computer program code including computer instructions, and the one or more processors invoke the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 9.
11. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on an electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Information retrieval method based on convolutional neural network and related equipment thereof
CN110825949A