Instruction stream generation method, apparatus, and electronic device
By encoding and repeatedly decoding text data to generate an instruction stream, the problem of incomplete instructions in the control of intelligent devices is solved, and the degree of control automation is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SMART DYNAMICS CO LTD
- Filing Date
- 2021-08-16
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies struggle to generate complete and complex operating instructions in the control of intelligent devices, resulting in insufficient automation.
By encoding text data to generate feature vectors and performing iterative decoding to generate an instruction stream, the Transformer model is used for encoding and decoding to generate a complete instruction stream.
It enables the generation of complete and complex instructions, improving the level of automation in the control of intelligent devices.
Smart Images

Figure CN115705845B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of data processing technology, and in particular relates to a method for generating an instruction stream, an apparatus for generating an instruction stream, an electronic device, and a computer-readable storage medium. Background Technology
[0002] With the development of natural language processing technology, the control of smart devices has become more diversified. For example, devices can be controlled via voice commands to perform different operations, or certain actions can be triggered through text chat with AI assistants. However, in controlling smart devices, only relatively simple operation commands can often be generated, while for complex operations, the generated operation commands may be incomplete. Summary of the Invention
[0003] This application provides a method for generating instruction streams, an apparatus for generating instruction streams, an electronic device, and a computer-readable storage medium, which can generate complete complex instructions and improve the automation of intelligent device control.
[0004] Firstly, this application provides a method for generating an instruction stream, comprising:
[0005] Obtain the text data to be processed;
[0006] The above text data is encoded to obtain the feature vector of the above text data;
[0007] The aforementioned feature vectors are cyclically decoded to generate an instruction stream corresponding to the aforementioned feature vectors. The cyclic decoding includes at least one decoding operation, and each decoding operation obtains an instruction code corresponding to at least one key semantic in the aforementioned text data. The instruction stream is composed of the aforementioned instruction codes.
[0008] Secondly, this application provides an instruction stream generation apparatus, comprising:
[0009] The first acquisition module is used to acquire the text data to be processed.
[0010] The encoding module is used to encode the above text data to obtain the feature vector of the above text data;
[0011] The decoding module is used to perform cyclic decoding on the above feature vectors to generate the instruction stream corresponding to the above feature vectors. The cyclic decoding includes at least one decoding operation. Each decoding operation obtains an instruction code corresponding to at least one key semantic in the above text data. The instruction stream is composed of the above instruction codes.
[0012] Thirdly, this application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described in the first aspect.
[0013] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described in the first aspect above.
[0014] Fifthly, this application provides a computer program product comprising a computer program that, when executed by one or more processors, implements the steps of the method described in the first aspect.
[0015] The advantages of this application compared to existing technologies are as follows: This application encodes the text data to be processed to obtain the corresponding feature vector, and then generates an instruction stream by iteratively decoding the feature vector. Each decoding operation yields an instruction code corresponding to at least one key semantic element in the text data. After completing the iterative decoding, an instruction stream composed of instruction codes is obtained. The control instructions generated by this method can perform complex control operations, thereby improving the automation of intelligent device control. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the method for generating an instruction stream provided in an embodiment of this application;
[0018] Figure 2 This is a schematic diagram of the structure of the instruction stream generation device provided in the embodiments of this application;
[0019] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0020] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0021] The instruction stream generation method provided in this application embodiment can be applied to electronic devices such as mobile phones, tablets, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). This application embodiment does not impose any restrictions on the specific type of electronic device.
[0022] To illustrate the technical solution proposed in this application, specific embodiments are described below.
[0023] Figure 1 A schematic flowchart of the instruction stream generation method provided in this application is shown. It is an example and not a limitation. The method can be applied to any of the above-mentioned electronic devices.
[0024] Step 101: Obtain the text data to be processed.
[0025] Before generating the command stream, it is necessary to obtain the corresponding text data, i.e., the text data to be processed. The text data can be the text chat content sent by the user in the chat interface; or the text content obtained by processing the user's voice data after receiving it.
[0026] In some embodiments, to improve the user experience, the text data can be obtained through the following steps before acquiring the text data to be processed:
[0027] A1. Obtain the speech to be recognized.
[0028] A2. Preprocess the speech to be recognized.
[0029] A3. Perform speech recognition on the preprocessed speech to be recognized to obtain text data.
[0030] In the process of obtaining text data from voice data, the voice to be recognized can be acquired first. This voice can be real-time captured voice data or voice data sent by the user through a terminal device in a chat interface. After acquiring the voice to be recognized, preprocessing can be performed to improve the accuracy and efficiency of speech recognition. This preprocessing includes operations such as pre-emphasis, framing, windowing, and endpoint detection. After preprocessing, the voice to be recognized can be used for speech recognition to obtain the corresponding text data, which is the text data to be processed in the subsequent instruction stream.
[0031] Step 102: Encode the text data to obtain the feature vector of the text data.
[0032] After obtaining the text data, to improve the efficiency of subsequent instruction stream generation, the text data can be encoded to obtain the corresponding feature vector. This process is the conversion of text data into a continuous representation. Optionally, the encoder in the Transformer model can be used to encode the text data.
[0033] Step 103: Perform loop decoding on the feature vector to generate the instruction stream corresponding to the feature vector.
[0034] After obtaining the feature vector, iterative decoding can be performed on the feature vector to generate the corresponding instruction stream. The iterative decoding operation includes at least one decoding operation, and each decoding operation yields an instruction code corresponding to at least one key semantic element in the data text. After completing the iterative decoding, an instruction stream composed of these instruction codes is obtained. Optionally, the decoder in the Transformer model can be used during the iterative decoding of the feature vector.
[0035] This application embodiment encodes the text data to be processed to obtain a feature vector corresponding to the text data. Then, it generates an instruction stream by iteratively decoding the feature vector. Through each decoding operation, an instruction code corresponding to at least one key semantic in the text data can be obtained. After the iterative decoding is completed, an instruction stream composed of instruction codes is obtained. The control instructions generated by this method can perform more complex control operations, thereby improving the automation of intelligent device control.
[0036] In some embodiments, to improve the efficiency and accuracy of instruction stream generation, the above generation method further includes the following steps before step 102:
[0037] B1. Detect whether the text data contains numeric characters.
[0038] B2. If the text data contains numeric characters, replace the numeric characters with preset numeric slots.
[0039] During the decoding of feature vectors, text data may contain numbers. When numbers appear irregularly in the text data, decoding errors are highly likely. That is, the model decoding the feature vectors may fail to learn the corresponding patterns, leading to errors in the instruction stream obtained from loop decoding. To solve this problem, the expression of numbers can be simplified, i.e., the numeric characters in the text data can be desensitized. Specifically, preset numeric slots can be used to replace numeric characters in the text data, and the value of the numeric slot is the replaced numeric character. For ease of understanding, an example is given: Suppose the text data is "Red ball selection 1 2 3 4 5 6 7". After replacing the numbers in the text data with numeric slots, we can get "Red ball selection [0][1][2][3][4][5][6]", and the corresponding values of each numeric slot are "[0]=1, [1]=2, [2]=3, [3]=4, [4]=5, [5]=6, [6]=7". It should be noted that in this example, the preset numbering of the number slots starts from 0. Other numbering methods can also be used for the numbering of the number slots, and no restrictions are imposed here.
[0040] In some embodiments, to avoid performing invalid loop decoding operations multiple times when the content in the text data is casual conversation, the generation method further includes the following steps before step 102:
[0041] Text data is input into a trained classification model to classify intent, and the intent classification result is obtained.
[0042] Whether the text content is obtained through a chat interface or through recognizing user voice data, most text data may not contain the key semantics for generating a command stream. In other words, the obtained text data does not contain control intent. In this case, even if the text data is encoded and decoded, a command stream cannot be obtained. Therefore, to improve decoding efficiency and avoid unnecessary decoding operations, the text data can be input into a trained classification model before encoding to perform intent classification and obtain the corresponding intent classification results. The classification process using a trained classification model is a multi-task classification process, meaning the classification results are diverse. For ease of understanding, consider the application scenario of lottery purchase; the corresponding intent classification results could include no intent, voting, and selecting a ball, etc.
[0043] Optionally, intent classification can be set before digit slot replacement. This is because if digit slot replacement is set before intent classification, the replacement may introduce unnecessary noise into the classification, causing some semantic loss. For ease of understanding, let's take an example. Suppose the data text is "I am the same as you". After digit slot replacement, we get "I am the same as you [0], [0] = 1". When the resulting text is input into the classification model for intent classification, [0] is noise, and the presence of [0] makes it impossible to correctly express the semantics of the whole sentence. Therefore, directly inputting the text into the classification model for intent classification first, and then replacing the digit slots of the digit characters in the text, can make the whole process efficient and simple, making full use of the advantages of intent classification and instruction decoding.
[0044] In some embodiments, to improve the accuracy of intent classification results, the classification model can be trained through the following steps:
[0045] C1. Obtain training samples, which are labeled with the true intent.
[0046] C2. Input the training samples into the classification model to be trained to obtain the training classification results.
[0047] C3. Optimize the model parameters of the classification model based on the training classification results and the true intent to obtain the trained classification model.
[0048] For training the classification model, online logs can be collected and manually labeled to form corresponding training samples. Manual labeling refers to annotating the text with the intended meaning based on its content. After obtaining the training samples, they can be input into the classification model for classification, yielding the training classification results. Finally, the model parameters are optimized based on the training classification results and the intended meaning, resulting in the trained classification model. After training, some bad or difficult samples can be selected from the collected text data for daily iteration, continuously improving the classification model and making the classification results more accurate.
[0049] Accordingly, after obtaining the intent classification result, step 103 above can be specifically manifested as follows:
[0050] Based on the intent classification results, the feature vectors are cyclically decoded to generate the instruction stream corresponding to the feature vectors.
[0051] After obtaining the intent classification result, in order to improve decoding efficiency, the feature vector can be cyclically decoded in combination with the intent classification result to generate the instruction stream corresponding to the feature vector.
[0052] In some embodiments, to improve decoding efficiency, the intent classification result specifically affects the generation of the instruction stream in the following ways:
[0053] D1. Detect whether the intent classification results contain a preset intent.
[0054] D2. If the intent classification result contains a preset intent, then the feature vector is cyclically decoded to generate the instruction stream corresponding to the feature vector.
[0055] D3. If the target instruction is not included in the instruction classification results, send the corresponding reply information based on the text data.
[0056] Before encoding, the intent classification results are first detected based on a preset intent. When the preset intent is detected in the intent classification results, it means that the text data contains a control intent, which means that the text data can be encoded and decoded to obtain an instruction stream. Therefore, after detecting this result, encoding and loop decoding operations can begin.
[0057] If the instruction classification result does not contain the target instruction, it means that the text data does not contain control intent, i.e., the feature vector corresponding to the text data does not require further encoding and loop decoding. In this case, the response information can be further matched based on the text content, and the matched response can be sent in the form of text or voice to improve the user experience.
[0058] In some embodiments, to further improve the accuracy of instruction stream generation, step 103 specifically includes:
[0059] F1. Based on the feature vectors, the key semantics in the text data are decoded sequentially to obtain the instruction code corresponding to each decoding operation;
[0060] F2. The initial instruction stream is composed based on the instruction code corresponding to each decoding operation;
[0061] F3. Delete irrelevant instruction codes from the initial instruction stream and generate the instruction stream corresponding to the feature vector. Irrelevant instruction codes are instruction codes that are unrelated to the preset intent.
[0062] Text data contains at least one key semantic element. Different key semantic elements can correspond to different instruction codes, thus forming an instruction code set. Taking the lottery purchase scenario as an example, the instruction code set is shown in Table 1 below:
[0063] Table 1
[0064]
[0065]
[0066] By combining a pre-defined set of instruction codes and sequentially performing decoding operations on key semantics in the text data based on feature vectors, each decoding operation yields an instruction code corresponding to a key semantic. After decoding all key semantics in the text data, instruction codes corresponding to the key semantics in the text data are obtained. Based on the instruction codes corresponding to each decoding operation, an initial instruction stream can be generated. To further improve the accuracy of instruction stream generation, irrelevant instruction codes can be removed from the initial instruction stream after obtaining it, thus obtaining the instruction stream corresponding to the feature vectors. Irrelevant instruction codes refer to those unrelated to the pre-defined intent; for example, start or end markers for decoding are unrelated to the pre-defined intent and can be removed to improve the accuracy of instruction stream generation.
[0067] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0068] To facilitate understanding, the following uses a practical application scenario to illustrate the instruction stream generation method proposed in this application. Assume the obtained text data 1 is "Don't buy 2 tickets, buy 5 tickets" and text data 2 is "How much is one scratch-off ticket?". First, classify the text data by intent, obtaining the intent as a vote intention. Next, the text data can be encoded and decoded. Since text data 1 involves numbers, the text data 1 can first be replaced with number slots, i.e., obtaining "Don't buy [0], buy [1]; [0] = 2, [1] = 5"; then, "Don't buy [0], buy [1]" is encoded and decoded using a model, specifically:
[0069] Text data: Don't buy 2 tickets, buy 5 tickets.
[0070] After model encoding, intent is classified: vote intent.
[0071] Text data number slot replacement: Do not buy [0] cards, buy [1] cards.
[0072] Loop encoding and decoding to generate instruction stream: [SELPN][1].
[0073] Specifically, the loop decoding process is as follows:
[0074] Step 1:
[0075] Input for the coding section: Do not buy [0] tickets, buy [1] tickets
[0076] Decoding input: [SOS]
[0077] Final decoded output: [SELPN]
[0078] (Note: [SOS] is the decoding start marker)
[0079] Step 2:
[0080] Input for the coding section: Do not buy [0] tickets, buy [1] tickets
[0081] Decoding input: [SOS][SELPN]
[0082] Final decoded output: [1]
[0083] Step 3:
[0084] Input for the coding section: Do not buy [0] tickets, buy [1] tickets
[0085] Decoding input: [SOS][SELPN][1]
[0086] Final decoded output: [EOS]
[0087] When the decoding end marker [EOS] is seen, decoding stops, and the final result is [SOS][SELPN][1][EOS]. The valid part is [SELPN][1].
[0088] By encoding and decoding text data, the corresponding instruction stream can be obtained, thereby improving the integrity of instruction generation and further enhancing the automated control of intelligent devices.
[0089] As for text data 2, after encoding and intent classification, it can be seen that the text data does not contain a preset intent. Therefore, the matching answer "scratch-off lottery ticket 2 yuan each" can be matched according to the feature vector of the text data, thereby answering the user's question and improving the user experience.
[0090] Corresponding to the instruction stream generation method described in the above embodiments, Figure 2 A structural block diagram of the instruction stream generation apparatus 2 provided in the embodiments of this application is shown. For ease of explanation, only the parts related to the embodiments of this application are shown.
[0091] Reference Figure 2 The generating apparatus 2 includes:
[0092] The first acquisition module 201 is used to acquire text data to be processed;
[0093] The encoding module 202 is used to encode the text data to obtain the feature vector of the text data;
[0094] The decoding module 203 is used to perform cyclic decoding on the feature vector to generate the instruction stream corresponding to the feature vector. The cyclic decoding includes at least one decoding operation. Each decoding operation obtains an instruction code corresponding to at least one key semantic in the text data. The instruction stream consists of instruction codes.
[0095] Optionally, the generating apparatus 2 may further include:
[0096] The detection module is used to detect whether text data contains numeric characters;
[0097] The slot replacement module is used to replace numeric characters in text data with preset numeric slots, where the value of the numeric slot is the numeric character to be replaced.
[0098] Optionally, the generating apparatus 2 may further include:
[0099] The classification module is used to input text data into a trained classification model to classify intent and obtain the intent classification result;
[0100] Accordingly, the aforementioned decoding module 203 is specifically used to perform cyclic decoding on the feature vector based on the intent classification result, and generate the instruction stream corresponding to the feature vector.
[0101] Optionally, the decoding module 203 may include:
[0102] The detection unit is used to detect whether the intent classification result contains a preset intent;
[0103] The instruction stream decoding unit is used to perform loop decoding on the feature vector to generate the instruction stream corresponding to the feature vector if the intent classification result contains a preset intent.
[0104] Optionally, the decoding module 203 may further include,
[0105] The information response unit is used to send corresponding response information based on text data if the instruction classification result does not contain the target instruction after detecting whether the preset intent is included in the intent classification result.
[0106] Optionally, the decoding module 203 may include:
[0107] The decoding unit is used to perform decoding operations on the key semantics in the text data sequentially based on the feature vector, and obtain the instruction code corresponding to each decoding operation.
[0108] The combination unit is used to assemble an initial instruction stream based on the instruction code corresponding to each decoding operation;
[0109] The generation unit is used to delete irrelevant instruction codes in the initial instruction stream and generate an instruction stream corresponding to the feature vector. Irrelevant instruction codes are instruction codes that are unrelated to the preset intent.
[0110] Optionally, the generating apparatus 2 may further include:
[0111] The second acquisition module is used to acquire the speech to be recognized before acquiring the text data to be processed;
[0112] The preprocessing module is used to preprocess the speech to be recognized;
[0113] The speech recognition module is used to perform speech recognition on the preprocessed speech to obtain text data.
[0114] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0115] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 3 As shown, the electronic device 3 of this embodiment includes: at least one processor 30 ( Figure 3 (Only one is shown) a processor, a memory 31, and a computer program 32 stored in the memory 31 and executable on at least one processor 30. When the processor 30 executes the computer program 32, it implements the steps in the above-described embodiments of the method for generating any instruction stream, for example... Figure 1 Steps 101-103 are shown.
[0116] The processor 30 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0117] In some embodiments, memory 31 may be an internal storage unit of electronic device 3, such as a hard disk or memory of electronic device 3. In other embodiments, memory 31 may also be an external storage device of electronic device 3, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 3.
[0118] Furthermore, the memory 31 may include both internal storage units and external storage devices of the electronic device 3. The memory 31 is used to store operating devices, application programs, bootloaders, data, and other programs, such as program code for computer programs. The memory 31 can also be used to temporarily store data that has been output or will be output.
[0119] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0120] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.
[0121] This application provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the above-described method embodiments.
[0122] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0123] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0124] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0125] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0126] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0127] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. 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 spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for generating an instruction stream, characterized in that, The generation method includes: Obtain the text data to be processed; The text data is encoded to obtain a feature vector of the text data; The feature vector is cyclically decoded to generate an instruction stream corresponding to the feature vector. The cyclic decoding includes at least one decoding operation. Each decoding operation obtains an instruction code corresponding to at least one key semantic in the text data. The instruction stream is composed of the instruction code. Before encoding the text data to obtain its feature vector, the generation method further includes: Detect whether the text data contains numeric characters; If the text data contains the numeric character, then the numeric character is replaced with a preset numeric slot, wherein the value of the numeric slot is the numeric character being replaced; Before encoding the text data to obtain its feature vector, the generation method further includes: The text data is input into a trained classification model to classify intent, and the intent classification result is obtained. Accordingly, the step of cyclically decoding the feature vector to generate the instruction stream corresponding to the feature vector includes: Based on the intent classification result, the feature vector is cyclically decoded to generate the instruction stream corresponding to the feature vector; The step of replacing the numeric characters with preset numeric slots is performed after obtaining the intention classification result.
2. The generation method as described in claim 1, characterized in that, The step of cyclically decoding the feature vector based on the intent classification result to generate the instruction stream corresponding to the feature vector includes: Detect whether the intent classification result contains a preset intent; If the intent classification result contains a preset intent, then the feature vector is cyclically decoded to generate the instruction stream corresponding to the feature vector.
3. The generation method as described in claim 2, characterized in that, After detecting whether the intent classification result contains a preset intent, the generation method further includes: If the instruction classification result does not contain the target instruction, then the corresponding reply information is sent based on the text data.
4. The generation method as described in claim 2 or 3, characterized in that, The step of performing cyclic decoding on the feature vector to generate the instruction stream corresponding to the feature vector includes: Based on the feature vector, the key semantics in the text data are decoded sequentially to obtain the instruction code corresponding to each decoding operation; An initial instruction stream is formed based on the instruction code corresponding to each decoding operation; Remove irrelevant instruction codes from the initial instruction stream to generate an instruction stream corresponding to the feature vector. The irrelevant instruction codes are those that are unrelated to the preset intent.
5. The generation method as described in claim 4, characterized in that, Before acquiring the text data to be processed, the process also includes: Acquire the speech to be recognized; The speech to be recognized is preprocessed; The preprocessed speech to be recognized is subjected to speech recognition to obtain the text data.
6. An instruction stream generation apparatus, characterized in that, The generating apparatus includes: The first acquisition module is used to acquire the text data to be processed. An encoding module is used to encode the text data to obtain a feature vector of the text data; A decoding module is used to perform cyclic decoding on the feature vector to generate an instruction stream corresponding to the feature vector. The cyclic decoding includes at least one decoding operation, and each decoding operation obtains an instruction code corresponding to at least one key semantic in the text data. The instruction stream is composed of the instruction code. The generating apparatus further includes: The detection module is used to detect whether the text data contains numeric characters; The slot replacement module is used to replace the numeric characters in the text data with preset numeric slots if the text data contains the numeric characters, wherein the value of the numeric slot is the numeric character to be replaced. The classification module is used to input the text data into a trained classification model to perform intent classification and obtain the intent classification result; Accordingly, the decoding module is specifically used to perform cyclic decoding on the feature vector based on the intent classification result to generate the instruction stream corresponding to the feature vector; The slot replacement module is triggered after the classification module is executed.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the instruction stream generation method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the instruction stream generation method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Intelligent voice control oriented intent recognition method and device
CN109741751A
Voice control instruction generation method, device and electronic equipment
CN110232923A
Translation model training method, translation method, electronic equipment and storage medium
CN112699690A