Insertion method and device of decoding network, electronic equipment and storage medium
By reusing candidate word nodes and introducing empty arc connections in the decoding network, the problems of slow word insertion speed and large memory usage are solved, and a more efficient word insertion process is achieved.
Patent Information
- Application Number
- CN202411940606.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-12-26
AI Technical Summary
In the existing technology, the word insertion speed of the decoding network is slow and occupies a large amount of memory. Especially when the slot to be inserted appears repeatedly, the existing method needs to repeatedly construct candidate words, resulting in increased time overhead and memory usage.
When the slot to be inserted appears repeatedly, multiple candidate words corresponding to the same slot are reused as the same candidate word node, and connected through the common first and last nodes and empty arcs to construct a decoding network after word insertion, reducing the number of candidate word construction times and the number of newly added arcs.
The time overhead of word insertion is reduced, the additional memory usage is reduced, and the efficiency and flexibility of word insertion are improved, thus solving the problems of slow word insertion speed and large memory usage in the prior art.
Smart Images

Figure CN119785771B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular to a word insertion method and device for decoding network, electronic equipment and storage medium. BACKGROUND
[0002] With the advent of the mobile Internet era, speech recognition as an important interface of human-computer interaction has been valued by more and more companies and manufacturers, especially in the field of embedded application, speech interaction has become a necessary function.
[0003] End-to-end speech recognition directly converts an audio sequence into a text sequence, and usually needs some decoding strategies when composing text, such as greedy decoding, beam decoding, etc. Since end-to-end speech recognition directly converts audio into text, there is no special language model, and the recognition result is uncontrollable. For personalized content such as contact person and other proper nouns, the recognition effect is poor, at which time a command word network is introduced in the decoding process.
[0004] The generation of the command word network needs to go through a compilation process, which is tedious and time-consuming. In order to reduce the time-consuming of resource loading and compilation, a part of general main content is usually compiled offline, and only the compiled network needs to be directly loaded when the user uses it. However, the content related to the user's personalization needs to be inserted into the function, that is, a word insertion method of the command word network needs to be provided. SUMMARY
[0005] The present application provides a word insertion method and device for decoding network, electronic equipment and storage medium, to solve the defects of slow word insertion speed and large memory occupation of the decoding network in the prior art.
[0006] The present application provides a word insertion method for decoding network, comprising:
[0007] determining a to-be-inserted slot and a corresponding candidate word thereof;
[0008] in the case that the to-be-inserted slot comprises a plurality of same slots that repeatedly appear, reusing the candidate words corresponding to the plurality of same slots as a same candidate word node;
[0009] connecting the candidate word node with endpoints of the plurality of same slots to obtain a word-inserted decoding network.
[0010] According to the word insertion method for decoding network provided by the present application, the candidate word node is connected with the endpoints of the plurality of same slots to obtain a word-inserted decoding network, comprising:
[0011] in the case that the number of candidate words corresponding to the to-be-inserted slot is multiple, combining the candidate words into a sub-network, and taking the sub-network as the candidate word node;
[0012] adding a common head node and a common tail node to the sub-network;
[0013] connecting the common head node and the common tail node with the end points of the plurality of same slots respectively to obtain a word-inserted decoding network.
[0014] According to the word-inserting method of the decoding network provided by the application, the common head node and the common tail node are connected with each candidate word in the sub-network through solid arcs and connected with the end points of the plurality of same slots through empty arcs to obtain the word-inserted decoding network.
[0015] According to the word-inserting method of the decoding network provided by the application, the common head node and the common tail node are connected with each candidate word in the sub-network through solid arcs and connected with the end points of the plurality of same slots through empty arcs to obtain the word-inserted decoding network.
[0016] According to the word-inserting method of the decoding network provided by the application, the method further comprises:
[0017] determining a common head node of the sub-network connected with the slot to be unloaded;
[0018] traversing each node from the common head node until an empty arc exists in the out-arc of any node, and taking the any node as the common tail node of the sub-network;
[0019] deleting all arcs and nodes in the traversing process and releasing memory to unload the sub-network.
[0020] According to the word-inserting method of the decoding network provided by the application, the determination of the common head node of the sub-network connected with the slot to be unloaded comprises:
[0021] determining a left end point of the slot to be unloaded;
[0022] finding an empty arc in the out-arc of the left end point and taking the first node connected with the empty arc as the common head node of the sub-network.
[0023] According to the word-inserting method of the decoding network provided by the application, the method further comprises:
[0024] in the case that two different nodes with the same out-arc exist in the sub-network, merging the sub-network.
[0025] According to the word-inserting method of the decoding network provided by the application, in the case that two different nodes with the same out-arc exist in the sub-network, the sub-network is merged.
[0026] In the case that there are nodes with the same outgoing arc in the current terminal node of the sub-network, the nodes with the same outgoing arc are merged, and the outgoing arc information of the pointing node pointing to the current terminal node is updated;
[0027] The current terminal node of the sub-network is updated based on the updated outgoing arc information, and the node merging and the outgoing arc information updating are repeatedly performed until all nodes of the sub-network are traversed.
[0028] The application further provides a word insertion device of a decoding network, comprising:
[0029] A determination unit is configured to determine a to-be-inserted slot and a corresponding candidate word thereof;
[0030] A multiplexing unit is configured to multiplex the candidate words corresponding to the multiple same slots into one candidate word node in the case that the to-be-inserted slot comprises multiple same slots.
[0031] A word insertion unit is configured to connect the candidate word node and endpoints of the multiple same slots to obtain a decoding network after word insertion.
[0032] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the word insertion method of the decoding network according to any one of the above-mentioned methods when executing the computer program.
[0033] The application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program is executable by a processor to implement the word insertion method of the decoding network according to any one of the above-mentioned methods.
[0034] The application further provides a computer program product comprising a computer program, wherein the computer program is executable by a processor to implement the word insertion method of the decoding network according to any one of the above-mentioned methods.
[0035] The word insertion method, device, electronic device, and storage medium of the decoding network provided by the application multiplex the candidate words corresponding to the multiple same slots into one candidate word node in the case that the to-be-inserted slot comprises multiple same slots, that is, the candidate word needs to be constructed only once, which reduces the time cost of word insertion and the newly added memory occupation compared with the prior art in which the candidate word needs to be inserted for each slot and constructed multiple times. BRIEF DESCRIPTION OF DRAWINGS
[0036] In order to make the technical solutions in the present application or the prior art clearer, the accompanying drawings needed in the embodiments or the prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description are only some embodiments of the present application, and other accompanying drawings can be obtained by those of ordinary skill in the art without any creative effort based on these accompanying drawings.
[0037] Figure 1 is a schematic diagram of the position of the command word network in the end-to-end recognition system in the related art.
[0038] Figure 2 is a schematic diagram of the pre-compilation and use process of the command word network in the related art.
[0039] Figure 3 is one of the schematic diagrams of the word insertion method in the related art.
[0040] Figure 4 is another schematic diagram of the word insertion method in the related art.
[0041] Figure 5 is one of the schematic diagrams of the word insertion method of the decoding network provided by the present application.
[0042] Figure 6 is a schematic diagram of the candidate word multiplexing provided by the present application.
[0043] Figure 7 is a schematic diagram of the sub-network provided by the present application.
[0044] Figure 8 is a schematic diagram of the word-level modeling personalized candidate word provided by the present application.
[0045] Figure 9 is a schematic diagram of the sub-network with head and tail nodes provided by the present application.
[0046] Figure 10 is a schematic diagram of the sub-network connected by empty arcs provided by the present application.
[0047] Figure 11 is a schematic diagram of the sub-network unloading method provided by the present application.
[0048] Figure 12 is a schematic diagram of the sub-network merging provided by the present application.
[0049] Figure 13 is a schematic diagram of the word insertion device of the decoding network provided by the present application.
[0050] Figure 14 is a schematic diagram of the structure of the electronic device provided by the present application. DETAILED DESCRIPTION
[0051] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in conjunction with the drawings in the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the protection scope of the present application.
[0052] End-to-end speech recognition is a framework that distinguishes traditional speech recognition. Traditional speech recognition is generally composed of two parts of an acoustic model and a language model. The acoustic model is responsible for converting an audio sequence into a phoneme sequence, such as a common Chinese pinyin, English phonetic symbol, and other phoneme groups such as bigram, trigram, etc. The language model is responsible for converting the phoneme sequence into a character sequence. The two parts do not need to be coupled and can be trained independently. The disadvantage of this traditional speech recognition is that the model training process is tedious, and the effect of speech recognition is influenced by the two parts, and the improvement of a single model does not necessarily bring the overall effect. Therefore, it is gradually replaced by an end-to-end model.
[0053] End-to-end speech recognition directly converts an audio sequence into a character sequence, and usually needs some decoding strategies such as greedy decoding, beam decoding, etc. Since end-to-end speech recognition directly converts audio into text, and there is no special language model, the recognition result is uncontrollable, and the recognition effect is poor for personalized content such as contact person and other proper nouns. At this time, a command word network is introduced in the decoding process.
[0054] Figure 1 is a schematic diagram of the position of the command word network in the end-to-end recognition system in the related art, as shown in Figure 1 The command word network is a finite state transducer, and its input is a decoding state and its output is a recognition result. It is composed of some pre-set general content + personalized content. In the process of beam decoding, the Viterbi algorithm is used to find the decoding path with the highest score in the network, which can constrain the result of beam decoding and make it more inclined to the expected recognition result.
[0055] The generation of the command word network needs to go through a compilation process, which is tedious and time-consuming. In order to reduce the time-consuming of resource loading and compilation, a part of the general main content will be compiled offline, and only the compiled network needs to be directly loaded when the user uses it. The content related to the user's personalization needs to be implemented by the word insertion function.
[0056] The user can upload personalized content in the network by inserting words, such as when the user uses the phone function, the contacts in his phone book do not exist in the original network compiled offline, the user needs to upload the contacts and insert them into the original network through the word insertion function. In this way, for each user, as long as a general original network is provided, the user's personalized content can be uploaded and inserted by the user-defined word insertion function to realize the personalized command word network.
[0057] Figure 2 is a schematic diagram of the pre-compilation and use process of the command word network in the related art, as shown in Figure 2 the pre-compilation phase, the compiled command word file is compiled into a program usable command word network, and is converted into a binary file for storage. The command word file is composed of written sentence patterns, slots and candidate words. The sentence pattern generally contains multiple candidate slots, and each slot generally has multiple candidate words. The arrangement combination of the sentence pattern, the slot and the candidate word can constitute multiple command words. In the user use process, the command word network is loaded from the binary file, and the user can customize the candidate words of the slot, which is called the user's personalized file, and is expanded into a new command word network through the word insertion method.
[0058] Figure 3 is one of the word insertion methods in the related art, as shown in Figure 3 the existing command word network word insertion method is to connect the front and rear endpoints of the slot to be inserted with new personalized candidate words by adding an arc connection according to the recorded front and rear endpoints of the slot in the pre-compiled command word network. If the user has multiple personalized candidate words, the above method is repeated to realize the dynamic word insertion of the command word network. The defect of the related art word insertion method is slow insertion speed and large memory occupation.
[0059] The reason for slow word insertion speed is that the existing technical solution will sequentially insert the personalized candidate words to be inserted into the slot to be inserted. If the slot to be inserted has and only has one in the command word network, it only needs to be inserted according to the above method. But the reality is that the command word network is usually responsible, and the same slot may appear repeatedly in the sentence pattern. Figure 4 is a second schematic diagram of the word insertion method in the related art, as shown in Figure 4 the sentence pattern contains multiple same slots to be inserted, that is, the sentence pattern contains 2 same slots to be inserted B. In order to enable all repeated places to be inserted with the personalized candidate word A, it is necessary to insert the word at each occurrence, which will greatly increase the time cost of word insertion.
[0060] The reason for occupying large memory is that: when there are multiple same slots to be inserted, each slot needs to insert a candidate word once, so that the command word network increases M*N new candidate words and at least 2*M*N arcs, wherein M is the number of times of the slot to be inserted, and N is the number of candidate words to be inserted in the slot. Because a large number of candidate words are added, the memory occupied by the command word network is greatly increased.
[0061] In view of the problems of slow insertion speed and large memory occupation of the existing word insertion method, the embodiment of the present application provides a word insertion method for a decoding network, in which, in the case that the slot to be inserted includes multiple same slots that repeatedly appear, that is, the same slot repeatedly appears in the sentence pattern, the method reuses the candidate words corresponding to the multiple same slots that repeatedly appear as a same candidate word node, and then connects the same candidate word node with the endpoints of the multiple same slots to obtain the decoding network after word insertion.
[0062] Compared with the prior art in which the insertion of candidate words needs to be performed once for each slot and multiple candidate words need to be repeatedly constructed, the embodiment reuses the candidate words corresponding to the multiple same slots that repeatedly appear as a same candidate word node, that is, only needs to construct the candidate words once, so that the time cost of word insertion is reduced, and the newly added memory occupation is reduced.
[0063] The embodiment of the present application can be applied to a scene in which the decoding network needs to be inserted with words. The execution subject of the method can be an electronic device such as a terminal device, a computer, a server, a server cluster or a specially designed decoding network word insertion device, or a word insertion device arranged in the electronic device, and the word insertion device can be realized by software, hardware or a combination of both.
[0064] In the description of the embodiment of the present application, the meaning of "multiple" is two or more than two, unless otherwise explicitly specified.
[0065] Figure 5 is one of the flowcharts of the word insertion method for a decoding network provided by the present application, as shown in Figure 5 The method comprises the following steps:
[0066] Step 510, determining the slot to be inserted and the corresponding candidate word;
[0067] Step 520, in the case that the slot to be inserted includes multiple same slots that repeatedly appear, reusing the candidate words corresponding to the multiple same slots as a same candidate word node;
[0068] Step 530, connecting the same candidate word node with the endpoints of the multiple same slots to obtain the decoding network after word insertion.
[0069] Specifically, the decoding network refers to a network used for decoding audio features in a speech recognition process, and the decoding network can include a command word network. The slots to be inserted refer to slots in which candidate words need to be inserted, each slot has a corresponding candidate word, and the number of candidate words corresponding to each slot can be one or multiple, which is not limited in the embodiments of the present application.
[0070] Referring to Figure 4 , in the case that the slots to be inserted in the sentence B include multiple same slots (slot B) that repeatedly appear, when the personalized candidate word A needs to be inserted into the slot B to be inserted, in order to enable all the repeatedly appearing slot B to be inserted with the personalized candidate word A, the prior art needs to insert the word at each occurrence, and at this time, two nodes of the personalized candidate word A need to be constructed, and the personalized candidate word A is sequentially inserted into the slot B.
[0071] Figure 6 is a schematic diagram of candidate word multiplexing provided by the present application, referring to Figure 6 , the embodiments of the present application multiplex the candidate words corresponding to the multiple same slots, i.e., the personalized candidate word A, into a same candidate word node. When inserted, only one candidate word node is constructed in the network, and the candidate word node is connected to the front and rear endpoints of all the repeatedly appearing slot B, so as to obtain the decoding network after the word insertion.
[0072] Then, for the slot B appearing M times in the original personalized network, the personalized candidate word A originally needs to be repeatedly constructed M times, and now only needs to be constructed once, so that the newly added memory occupation caused by the newly inserted candidate word is reduced to 1 / M of the original.
[0073] In addition, multiplexing the candidate words corresponding to the multiple same slots into a same candidate word node can simultaneously reduce the time overhead of word insertion.
[0074] The method provided by the embodiments of the present application, in the case that the slots to be inserted include multiple same slots that repeatedly appear, multiplexes the candidate words corresponding to the multiple same slots that repeatedly appear into a same candidate word node, i.e., only needs to construct the candidate word once, compared to the prior art in which the word insertion of the candidate word needs to be performed once for each slot, and the candidate word needs to be repeatedly constructed multiple times, the time overhead of word insertion is reduced, and the newly added memory occupation is reduced.
[0075] Based on any of the above embodiments, the candidate word node is connected with the endpoints of the multiple same slots, and a decoding network after the word insertion is obtained, i.e., step 530 specifically includes:
[0076] Step 531, in the case that the number of candidate words corresponding to the slots to be inserted is multiple, combining the candidate words into a sub-network, and taking the sub-network as a candidate word node;
[0077] Step 532, adding a common head node and a common tail node to the sub-network;
[0078] Step 533, connecting the common head node and the common tail node with the endpoints of the plurality of same slots respectively to obtain a decoding network after inserting words.
[0079] Specifically, it can be found in the above embodiment that the number of arcs for connecting the slot and the personalized candidate word does not change, and 2*M arcs still need to be newly added for the personalized candidate word A. However, in the case that the candidate word corresponding to the slot to be inserted is multiple, that is, the number of candidate words corresponding to the slot to be inserted is multiple (assuming N), 2*M*N arcs need to be newly added, which is still a considerable memory overhead.
[0080] To solve the problem, the embodiment combines the multiple candidate words into a sub-network, and takes the sub-network as a candidate word node. Figure 7 is a schematic diagram of the sub-network provided by the application, as shown in Figure 7 The candidate words include personalized candidate word 1, personalized candidate word 2, personalized candidate word 3,..., personalized candidate word n, and at this time all the personalized candidate words are combined into a separate sub-network.
[0081] At this time, all the personalized candidate words in the sub-network have their own separate entry arcs and exit arcs, and these entry arcs and exit arcs are related to the head information of the candidate word, and therefore cannot be reused. Figure 8 is a schematic diagram of the word-level modeling personalized candidate word provided by the application, as shown in Figure 8 Taking a word-level modeling unit as an example, if two personalized candidate words “Zhang San” and “Li Si” are added, different word information is stored on these arcs, and therefore cannot be reused.
[0082] In the embodiment, a common head node and a tail node are added to each candidate word in the sub-network, that is, a common head node and a common tail node are added. Figure 9 is a schematic diagram of the sub-network with head and tail nodes provided by the application, as shown in Figure 9 The common head node and the common tail node are connected with the endpoints of the plurality of same slots respectively, so that each candidate word originally needs 2 arcs to connect the head and tail nodes of the slot, and after introducing the common head and tail nodes, only the head and tail nodes need 2 arcs to connect. For M slots, 2*M newly built arcs are needed. All N candidate words are connected with the common head and tail endpoints, and 2*N newly built arcs are needed.
[0083] Therefore, this word insertion mode needs to increase 2*M+2*N newly built arcs in total, compared with the 2*M*N newly built arcs required by the existing scheme, the number of newly built arcs can be greatly reduced, thereby reducing the memory occupied by the network.
[0084] The method provided by the embodiment of the application, in the case that the number of candidate words to be inserted into the slot is multiple, combines the multiple candidate words into a sub-network, and adds a common head node and a common tail node to the sub-network, so that the sub-network can be reused while the number of newly created arcs is greatly reduced, thereby further reducing the memory occupied by the network.
[0085] Based on any of the above embodiments, the common head node and the common tail node are connected with the endpoints of the multiple same slots respectively to obtain a decoding network after inserting the words, that is, step 533 specifically includes:
[0086] The common head node and the common tail node are connected with each candidate word in the sub-network through real arcs, and the common head node and the common tail node are connected with the endpoints of the multiple same slots through empty arcs to obtain a decoding network after inserting the words.
[0087] Specifically, the inventors have found through research that the candidate word sub-network with the common head and tail nodes has a problem that the topology is not equivalent to the way of directly inserting the candidate words, for one of the candidate words, the topological distance from the left and right nodes of the slot is changed from 1 arc to 2 arcs, and the extra one is the arc connected to the common head and tail nodes. In the finite state transducer (FST), there is an empty arc (epsilon) concept, that is, the arc with empty input and output, which realizes unconditional jump. Figure 10 is a schematic diagram of using an empty arc to connect the sub-network provided by the application, as Figure 10 shown, the slot and the common head and tail nodes are connected using an empty arc, that is, the candidate word and the endpoints of the slot are separated by one empty arc and one real arc, which is equivalent to one real arc in topology. Therefore, the decoding network obtained by the new word insertion method after introducing the empty arc remains unchanged in topology. At this point, only 2*M empty arcs and 2*N real arcs need to be constructed to complete the network construction.
[0088] The method provided by the embodiment of the application can greatly reduce the number of newly created arcs while keeping the topology unchanged, thereby further reducing the memory occupied by the network.
[0089] Based on any of the above embodiments, considering that the prior art solution will use arcs to connect the candidate word to be inserted with the front and rear endpoints of the slot to be inserted, the candidate word to be inserted becomes part of the network after connection, and cannot be separated from the command word network, but only new candidate words can be continuously added to the existing network. When the user needs to delete a personalized candidate word inserted in a slot, the network must be restored to the original binary file, and the candidate words of other slots that do not need to be deleted are reinserted, which greatly reduces the flexibility of the command word network.
[0090] In view of the defect that the command word network is difficult to unload, Figure 11is a flowchart of a subnetwork unloading method provided by the present application, as shown in Figure 11 The method further includes:
[0091] Step 1110, determining the common head node of the subnetwork connected with the slot to be unloaded;
[0092] Step 1120, traversing each node from the common head node until an empty arc exists in the out-arc of any node, and taking the node as the common tail node of the subnetwork;
[0093] Step 1130, deleting all arcs and nodes in the traversal process and releasing the memory to unload the subnetwork.
[0094] Specifically, the decoding network after the word insertion is constructed according to the above-mentioned manner, in which there are two kinds of arcs, i.e., empty arcs and real arcs. Therefore, the original network and the added personalized candidate word subnetwork can be simply distinguished by distinguishing the empty arcs and the real arcs.
[0095] Firstly, the common head node of the subnetwork connected with the slot to be unloaded is determined, including:
[0096] Determining the left end point of the slot to be unloaded. According to the information recorded during the pre-compilation, all left end points of the slot to be unloaded can be found. Starting from each left end point, all empty arcs in the out-arc of the left end point are searched, and the first node connected by the empty arc is taken as the common head node of the subnetwork.
[0097] Then, each node is traversed from the common head node until an empty arc exists in the out-arc of a certain node, and the node is taken as the common tail node of the subnetwork.
[0098] All arcs and nodes in the traversal process are deleted, and the memory is released to unload the subnetwork.
[0099] The method provided by the embodiment of the present application can simply distinguish the original network and the added personalized candidate word subnetwork by distinguishing the empty arcs and the real arcs, so as to flexibly unload the subnetwork, greatly reduce the difficulty of subnetwork unloading, and improve the flexibility.
[0100] Based on any of the above-mentioned embodiments, in order to further reduce the memory, the method further includes:
[0101] In the case that two different nodes with the same out-arc exist in the subnetwork, the subnetwork is merged.
[0102] Specifically, in the case that two different nodes with the same out-arc exist in the subnetwork, the two nodes can be regarded as the same node in topology, so the two nodes can be merged, thereby reducing the number of nodes in the subnetwork and further reducing the memory.
[0103] Figure 12 is a schematic diagram of subnetwork merging provided by the present application, as shown in Figure 12 In (a) of FIG. 1, node 3 and node 5 have the same outgoing arc d, so node 3 and node 5 can be regarded as the same node in topology. The subnetwork obtained after merging the two nodes is shown in Figure 12 In (b) of FIG. 1, node 2 and node 4 have the same outgoing arc c, so node 2 and node 4 can be regarded as the same node in topology. The subnetwork obtained after merging the two nodes is shown in Figure 12 In (c) of FIG. 1.
[0104] The method provided by the embodiments of the present application can further reduce the number of nodes in the subnetwork and thus reduce the memory in the case that there are two different nodes with the same outgoing arc in the subnetwork.
[0105] Based on any of the above embodiments, the subnetwork is merged in the case that there are two different nodes with the same outgoing arc in the subnetwork, including:
[0106] In the case that there are nodes with the same outgoing arc in the current terminal node of the subnetwork, the nodes with the same outgoing arc are merged, and the outgoing arc information of the pointing node pointing to the current terminal node is updated;
[0107] The current terminal node of the subnetwork is updated based on the updated outgoing arc information, and the node merging and the outgoing arc information updating are repeatedly performed until all nodes of the subnetwork are traversed.
[0108] Specifically, the subnetwork merging can be implemented by the following method: regarding the subnetwork as a directed acyclic graph (DAG), finding out the node with out-degree 0 in the DAG in the order of its inverse topological sorting each time, where the current terminal node is the node with out-degree 0 in the current subnetwork. If there are nodes with the same outgoing arc in the current terminal node, the nodes with the same outgoing arc are merged.
[0109] Meanwhile, the outgoing arc information of all nodes with arcs pointing to the current terminal node is updated. Here, the pointing node is the node pointing to the current terminal node. After the outgoing arc information is updated, the current terminal node is also updated, where the updated current terminal node does not include the terminal node of the last time, i.e., the current terminal node is the node with out-degree 0 after the node with out-degree 0 of the last time is removed.
[0110] After the updated current terminal node is obtained, the node merging operation is repeatedly performed until all nodes are accessed.
[0111] In some embodiments, the specific algorithm design of the subnetwork merging is as follows:
[0112] 1. Traverse the node vector to find all nodes with out-degree 0, and add all the nodes to the queue.
[0113] 2. All nodes are dequeued from the queue, and the hash value is calculated to determine whether the nodes can be merged.
[0114] 3. Merge the nodes that can be merged at this time.
[0115] 4. Add the nodes recorded in step 2 to the queue.
[0116] 5. Repeat steps 2-4 until the queue is empty.
[0117] The method provided by the embodiment of the application can improve the efficiency and accuracy of subnetwork merging by regarding the subnetwork as a directed acyclic graph and merging the subnetworks in the order of their reverse topological sorting.
[0118] Based on any of the above embodiments, a method for inserting words in a decoding network is provided, comprising:
[0119] 1. Reusing personalized candidate words. In the case that the to-be-inserted slot includes multiple identical slots that repeatedly appear, the candidate words corresponding to the multiple identical slots are reused as a same candidate word node; the candidate word node is connected with the endpoints of the multiple identical slots to obtain the decoding network after word insertion.
[0120] 2. In the case that the number of candidate words corresponding to the to-be-inserted slot is multiple, a personalized candidate word subnetwork is constructed. The candidate words are combined into a subnetwork, and the subnetwork is taken as a candidate word node; a common head node and a common tail node are added to the subnetwork; the common head node and the common tail node are respectively connected with the endpoints of the multiple identical slots to obtain the decoding network after word insertion.
[0121] 3. Introducing empty arcs. The common head node and the common tail node are respectively connected with each candidate word in the subnetwork through real arcs, and the common head node and the common tail node are respectively connected with the endpoints of the multiple identical slots through empty arcs, to obtain the decoding network after word insertion.
[0122] 4. Unloading the subnetwork. The common head node of the subnetwork connected with the to-be-unloaded slot is determined; each node is traversed from the common head node, until any node is traversed and an empty arc exists in the out-arc of the node, and the node is taken as the common tail node of the subnetwork; all the arcs and nodes in the traversal process are deleted, and the memory is released to unload the subnetwork.
[0123] 5. Sub-network merging. In the case that there are nodes with the same outgoing arc in the current termination node of the sub-network, the nodes with the same outgoing arc are merged, and the outgoing arc information of the pointing node pointing to the current termination node is updated; the current termination node of the sub-network is updated based on the updated outgoing arc information, and the node merging and the outgoing arc information updating are repeatedly performed until all nodes of the sub-network are traversed.
[0124] The method provided by the embodiment of the application changes the word insertion from word-by-word insertion to sub-network insertion after the sub-network is constructed, and the word insertion is no longer repeated, so that the time cost of the word insertion can be greatly reduced. The sub-network can be reused in the repeatedly appearing slots, the number of newly added nodes is reduced to 1 / M required in the prior art, and the number of newly added arcs is reduced from 2*M*N to 2*(M+N), where M is the number of slots, and N is the number of word entries. The sub-network and the empty arc are introduced, and the problem that the command word network in the prior art solution is difficult to unload personalized command words can be solved by using a related unloading algorithm.
[0125] The word insertion device of the decoding network provided by the application is described below, and the word insertion device of the decoding network described below can be correspondingly referred to the word insertion method of the decoding network described above.
[0126] Based on any of the above embodiments, Figure 13 is a structural schematic diagram of the word insertion device of the decoding network provided by the application, as Figure 13 indicated, the device comprises:
[0127] The determining unit 1310 is configured to determine a slot to be inserted and a corresponding candidate word of the slot;
[0128] The multiplexing unit 1320 is configured to, in the case that the slot to be inserted comprises a plurality of same slots that repeatedly appear, multiplex the candidate words corresponding to the plurality of same slots into a same candidate word node.
[0129] The word insertion unit 1330 is configured to connect the candidate word node and endpoints of the plurality of same slots to obtain the decoding network after the word insertion.
[0130] The device provided by the embodiment of the application, in the case that the slot to be inserted comprises a plurality of same slots that repeatedly appear, multiplexes the candidate words corresponding to the plurality of same slots that repeatedly appear into a same candidate word node, that is, the candidate word needs to be constructed only once, compared with the prior art in which the candidate word needs to be inserted once for each slot and the candidate word needs to be repeatedly constructed many times, so that the time cost of the word insertion is reduced, and the newly added memory occupation is reduced.
[0131] Based on any of the above embodiments, the word insertion unit is specifically configured to:
[0132] In a case where the number of candidate words corresponding to the slot to be inserted is multiple, the candidate words are combined into a sub-network, and the sub-network is taken as the candidate word node;
[0133] A common head node and a common tail node are added to the sub-network;
[0134] The common head node and the common tail node are connected with the endpoints of the multiple same slots respectively, to obtain a decoding network after the word insertion.
[0135] Based on any of the above embodiments, the word insertion unit is specifically configured to:
[0136] The common head node and the common tail node are connected with each candidate word in the sub-network through solid arcs, and the common head node and the common tail node are connected with the endpoints of the multiple same slots through empty arcs, to obtain a decoding network after the word insertion.
[0137] Based on any of the above embodiments, the device further comprises an unloading unit, which is specifically configured to:
[0138] Determine a common head node of a sub-network connected with the slot to be unloaded;
[0139] From the common head node, traverse each node backward until an empty arc exists in the out-arc of any node, and take the any node as a common tail node of the sub-network;
[0140] Delete all arcs and nodes in the traversal process, and release memory to unload the sub-network.
[0141] Based on any of the above embodiments, the unloading unit is further configured to:
[0142] Determine a left endpoint of the slot to be unloaded;
[0143] Find an empty arc in the out-arc of the left endpoint, and take a first node connected with the empty arc as a common head node of the sub-network.
[0144] Based on any of the above embodiments, the device further comprises a merging unit, which is specifically configured to:
[0145] In a case where two different nodes with the same out-arc exist in the sub-network, the sub-network is merged.
[0146] Based on any of the above embodiments, the merging unit is further configured to:
[0147] In a case where a node with the same out-arc exists in a current terminal node of the sub-network, the node with the same out-arc is merged, and the out-arc information of a pointing node pointing to the current terminal node is updated;
[0148] Update the current terminal node of the sub-network based on the updated arc-out information, and repeatedly perform the node merging and arc-out information updating until all nodes of the sub-network are traversed.
[0149] Figure 14 An example of a schematic diagram of a physical structure of an electronic device is shown in Figure 14 As shown, the electronic device can include a processor 1410, a communications interface 1420, a memory 1430, and a communications bus 1440, wherein the processor 1410, the communications interface 1420, and the memory 1430 complete mutual communication through the communications bus 1440. The processor 1410 can invoke a logical instruction in the memory 1430 to perform a word insertion method for a decoding network, the method including: determining a to-be-inserted slot and a corresponding candidate word thereof; in a case where the to-be-inserted slot includes a plurality of same slots that repeatedly appear, multiplexing candidate words corresponding to the plurality of same slots as a same candidate word node; and connecting the candidate word node with endpoints of the plurality of same slots to obtain a decoding network after word insertion.
[0150] In addition, the logical instruction in the memory 1430 described above can be implemented in the form of a software functional unit and sold or used as an independent product, and can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0151] On the other hand, the present application also provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, when the computer program is executed by a processor, the computer can execute the word insertion method for a decoding network provided by the above-mentioned method, the method includes: determining a to-be-inserted slot and a corresponding candidate word thereof; in a case where the to-be-inserted slot includes a plurality of same slots that repeatedly appear, multiplexing candidate words corresponding to the plurality of same slots as a same candidate word node; and connecting the candidate word node with endpoints of the plurality of same slots to obtain a decoding network after word insertion.
[0152] In yet another aspect, the present application also provides a non-transitory computer readable storage medium having stored thereon a computer program, which, when executed by a processor, implements a method for inserting words into a decoding network provided by any of the above methods, the method comprising: determining slots to be inserted and corresponding candidate words thereof; in a case where the slots to be inserted comprise a plurality of identical slots that occur repeatedly, multiplexing the candidate words corresponding to the plurality of identical slots into a same candidate word node; and connecting the candidate word node with endpoints of the plurality of identical slots to obtain a decoding network after word insertion.
[0153] The apparatus embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, i.e., may be located in one place, or may be distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0154] From the above description of the embodiments, those skilled in the art can clearly understand that the embodiments can be implemented by means of software plus necessary universal hardware platforms, and of course can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0155] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements to some technical features thereof; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A word insertion method for a decoding network, characterized in that: include: Determine the slot to be inserted and its corresponding candidate word; In the case where the slots to be inserted include multiple identical slots that appear repeatedly, reusing the candidate words corresponding to the multiple identical slots into a same candidate word node; The candidate word node is connected to the endpoints of the multiple identical slots to obtain a decoding network after word insertion.
2. The word insertion method of the decoding network according to claim 1, characterized in that The step of connecting the candidate word node with the endpoints of the plurality of identical slots to obtain a decoding network after word insertion includes: In the case where there are multiple candidate words corresponding to the slot to be inserted, the candidate words are combined into a sub-network, and the sub-network is used as the candidate word node; Adding a public first node and a public tail node to the subnetwork; The common first node and the common tail node are respectively connected to the endpoints of the multiple identical slots to obtain a decoding network after word insertion.
3. The word insertion method of the decoding network according to claim 2, characterized in that The method of connecting the common first node and the common tail node to the endpoints of the plurality of identical slots to obtain a decoding network after word insertion includes: The common first node and the common tail node are respectively connected to each candidate word in the sub-network through a solid arc, and the common first node and the common tail node are respectively connected to the endpoints of the multiple identical slots through an empty arc to obtain a decoding network after word insertion.
4. The word insertion method of the decoding network according to claim 3, characterized in that The method further comprises: Determine the common head node of the sub-network connected to the slot to be unloaded; Starting from the common first node, traversing each node backward until a vacant arc is found in the outgoing arcs of any node, and taking the any node as the common end node of the sub-network; Delete all arcs and nodes in the traversal process and release memory to unload the subnetwork.
5. The word insertion method of the decoding network according to claim 4, characterized in that The determining of the public head node of the sub-network connected to the to-be-unloaded slot includes: Determine the left endpoint of the unloading slot; Find the empty arc in the arc outgoing from the left endpoint, and use the first node connected by the empty arc as the common first node of the sub-network.
6. The word insertion method of a decoding network according to any one of claims 2 to 5, characterized in that: The method further comprises: In the case that there are two different nodes with the same outgoing arc in the sub-network, the sub-networks are merged.
7. The word insertion method of the decoding network according to claim 6, characterized in that: When there are two different nodes with the same outgoing arc in the sub-network, merging the sub-networks comprises: In the case where there are nodes with the same outgoing arc in the current terminating node of the subnetwork, the nodes with the same outgoing arc are merged, and outgoing arc information of the pointing node pointing to the current terminating node is updated; The current termination node of the sub-network is updated based on the updated arc information, and node merging and arc information updating are repeated until all nodes of the sub-network are traversed.
8. A word insertion device for a decoding network, characterized in that: include: A determination unit, used to determine the slot to be inserted and its corresponding candidate word; A multiplexing unit, configured to reuse the candidate words corresponding to the multiple identical slots into a same candidate word node when the slot to be inserted includes multiple identical slots that appear repeatedly; The word insertion unit is used to connect the candidate word node with the endpoints of the multiple identical slots to obtain a decoding network after word insertion.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the word insertion method of the decoding network according to any one of claims 1 to 7 is implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the word insertion method of the decoding network according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Word inserting method, device and facility of decoding network and storage medium
CN110322884A
Command word recognition method and device
CN111477217A