Context-related speech processing method, electronic device and storage medium

By binding the context relationship when the task is created and storing it in a public queue, combined with the global label mapping table, dynamic mapping of tasks to threads is achieved, which solves the problems of thread safety and timing confusion in speech processing in the existing technology, and improves concurrent execution. efficiency.

CN115410600BActive Publication Date: 2024-09-10AISPEECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202211041354.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-29
Publication Date
2024-09-10
Estimated Expiration
2042-08-29

AI Technical Summary

Technical Problem

Existing technologies have thread safety issues and timing disorders when processing computing-intensive services such as voice processing. The dynamic expansion of a general thread pool cannot meet the needs of context-related tasks, resulting in insufficient concurrency.

Method used

By binding the context when creating a task and storing it in a public queue to facilitate search and execution, the global label mapping table is maintained to realize dynamic mapping of tasks to execution threads, resolve context dependencies, and concurrently execute non-context dependent services.

Benefits of technology

It effectively solves the search and execution of context dependencies, avoids thread safety issues and timing confusion, and maximizes the amount of concurrent execution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115410600B
    Figure CN115410600B
Patent Text Reader

Abstract

The present invention discloses a context-associated speech processing method, electronic device and storage medium, wherein the method comprises: creating a speech task, confirming whether the speech task is associated with a context, filling a label for the speech task based on whether the context is associated, adding the labeled speech task to a public queue, wherein the speech task is created and assembled by a production thread; searching for a corresponding target speech task in the public queue according to the context association relationship, and executing the target speech task, wherein the target speech task is executed and allocated by a consumption thread. The embodiment of the present invention solves the context dependency relationship by binding the context relationship when creating a task and storing it in a public queue for easy search and execution, and maintains a global label mapping table to realize dynamic mapping of tasks to execution threads, and concurrent execution of services without context dependencies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of speech processing, and in particular relates to a context-related speech processing method, an electronic device and a storage medium. Background Art

[0002] In the prior art, a thread pool is a form of multithreaded processing that adds tasks to a queue during processing and then automatically starts these tasks after a thread is created. Thread pool threads are all background threads. Each thread uses the default stack size, runs at the default priority, and is in a multithreaded unit. If a thread is idle in managed code (such as waiting for an event), the thread pool will insert another auxiliary thread to keep all processors busy. If all thread pool threads are always busy, but the queue contains pending work, the thread pool will create another auxiliary thread after a period of time, but the number of threads will never exceed the maximum. Threads that exceed the maximum value can be queued, but they will not start until other threads are completed.

[0003] Common thread pool technology, such as Java thread pool, is actually a container for storing threads. When calling the thread pool to execute concurrent tasks, threads are taken out from the thread pool to execute tasks. After each thread completes the task, it is not destroyed, but recycled by the thread pool to continue to execute the task next time. This can avoid the performance overhead caused by repeatedly creating thread objects and save system resources.

[0004] The inventors found that although automatic scheduling of tasks is achieved in the prior art, there are thread safety issues and timing disorder problems for context-related services, and additional mechanisms are needed to ensure synchronization and mutual exclusion. For compute-intensive services (such as voice processing), the number of execution threads must match the number of physical execution units to maximize concurrency, and the general thread pool is often dynamically expanded based on the queue blocking situation. Summary of the invention

[0005] The embodiments of the present invention aim to solve at least one of the above technical problems.

[0006] In a first aspect, an embodiment of the present invention provides a context-associated voice processing method, comprising: performing door opening and closing sound detection on the collected external sounds, and determining whether the external sounds are the door opening and closing sounds of the current resident; if the external sounds are the door opening and closing sounds of the current resident, turning on the camera of the current resident to perform context-associated voice processing.

[0007] In a second aspect, an embodiment of the present invention provides an electronic device comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the above-mentioned context-associated speech processing methods of the present invention.

[0008] In a third aspect, an embodiment of the present invention provides a storage medium, in which one or more programs including execution instructions are stored, and the execution instructions can be read and executed by an electronic device (including but not limited to a computer, a server, or a network device, etc.) to execute any of the above-mentioned context-associated speech processing methods of the present invention.

[0009] In a fourth aspect, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes any one of the above-mentioned context-associated speech processing methods.

[0010] The embodiment of the present invention solves the context dependency by binding the context relationship when creating a task and storing it in a public queue for easy search and execution, and maintains a global label mapping table to achieve dynamic mapping of tasks to execution threads and concurrent execution of services without context dependency. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0012] Figure 1 A flowchart of an embodiment of a context-related speech processing method of the present invention;

[0013] Figure 2 A flowchart of another embodiment of the context-related speech processing method of the present invention;

[0014] Figure 3 A flowchart of another embodiment of the context-related speech processing method of the present invention;

[0015] Figure 4 Creating a flow chart for the tasks of the context-related speech processing method of the present invention;

[0016] Figure 5A task execution flow chart of the context-related speech processing method of the present invention;

[0017] Figure 6 A schematic diagram of a tag queue generated by a production thread of the context-related speech processing method of the present invention;

[0018] Figure 7 A schematic diagram of possible processing timing of a consumer thread of the context-related speech processing method of the present invention;

[0019] Figure 8 It is a schematic structural diagram of an embodiment of an electronic device of the present invention. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application may be combined with each other.

[0022] The present invention may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0023] In the present invention, "module", "device", "system" and the like refer to related entities applied to computers, such as hardware, a combination of hardware and software, software or software in execution, etc. In detail, for example, an element can be, but is not limited to, a process, a processor, an object, an executable element, an execution thread, a program and / or a computer running on a processor. In addition, an application or script program running on a server, a server can all be an element. One or more elements can be in an execution process and / or thread, and an element can be localized on a computer and / or distributed between two or more computers, and can be operated by various computer-readable media. An element can also communicate through local and / or remote processes according to a signal with one or more data packets, for example, a signal from a data that interacts with another element in a local system, a distributed system, and / or a network on the Internet through a signal to interact with other systems.

[0024] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include" and "comprise" include not only those elements, but also other elements that are not explicitly listed, or also include elements inherent to such processes, methods, articles or equipment. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the existence of other identical elements in the process, method, article or equipment that includes the elements.

[0025] The embodiment of the present invention provides a context-related speech processing method, which can be applied to electronic devices. The electronic devices can be computers, servers, or other electronic products, etc., which are not limited in the present invention.

[0026] Please refer to Figure 1 , which shows a context-associated speech processing method provided by an embodiment of the present invention.

[0027] like Figure 1 As shown, in step 101, a voice task is created, it is confirmed whether the voice task is associated with a context, a label is filled in the voice task based on whether the context is associated, and the voice task with the label is added to a public queue, wherein the voice task is created and assembled by a production thread;

[0028] In step 102, according to the context association relationship, the corresponding target voice task is searched in the public queue, and the target voice task is executed, wherein the target voice task is executed and allocated by the consumer thread;

[0029] In this embodiment, for step 101, a new voice task is created, and a tag is added to the voice task to mark it. When the voice task is created, the context relationship is bound to determine whether the created voice task is associated with the context, and the tag is filled in the voice task according to whether it is associated with the context. After the tag is filled in, the voice task is stored in a public queue. The public queue has multiple voice tasks to be executed, and the voice tasks are executed by searching for voice tasks in the public queue, which facilitates the execution end to perform query operations. The voice task is created and assembled by the production thread. The number of production threads is generated by actual business needs. The production threads are generated by the business party based on the business to be processed, and the number is determined by the user based on the specific business volume, which can be dynamically expanded.

[0030] Afterwards, for step 102, the voice task determines the context relationship through the production thread. After the context relationship is determined, the corresponding target voice task is searched in the public queue voice tasks. After the target voice task is found, the target voice task is executed through the consumer thread. The target voice task is executed and assigned through the consumer thread. The consumer thread obtains the target task and executes it according to the context relationship.

[0031] The method of the embodiment of the present application solves the context dependency relationship by binding the context relationship when creating the task and storing it in a public queue for easy search and execution, and maintains a global label mapping table to realize dynamic mapping of tasks to execution threads, and concurrent execution of services without context dependencies.

[0032] Please refer to Figure 2 , which shows another context-related speech processing method provided by an embodiment of the present invention. Figure 1 A flowchart of the steps further defined in step 101 of "confirming whether the speech task is associated with the context, and filling in a label for the speech task based on whether the context is associated".

[0033] like Figure 2 As shown, in step 201, when the speech task is associated with the context, the same tag associated with the context and cached is filled in for the speech task, wherein one speech task corresponds to one tag, the one tag is used by at least one speech task, and different speech tasks corresponding to the same tag are arranged in the order of generation time;

[0034] In step 202, when the voice task is not associated with a context, a new label is applied for the voice task, and the new label is cached.

[0035] In this embodiment, for step 201, it is determined whether the voice task is associated with the context. When the voice task is associated with the context, the voice task is filled with the label corresponding to the voice task associated with the context, and the label is cached. One voice task corresponds to one label, and one label is used by at least one voice task. Different voice tasks corresponding to the same label are arranged in the order of generation time. For example, each task must have a label, and the same label may be used in multiple tasks, which belongs to a one-to-many mapping relationship. Multiple tasks with the same label need to ensure sequential execution (context-related), and tasks with different labels do not need to ensure sequential execution; for step 202, it is determined whether the voice task is associated with the context. When the voice task is not associated with the context, it is necessary to apply for a new label for the voice task, and the new label is cached.

[0036] The method of the embodiment of the present application can solve the problem of time sequence disorder by filling or applying for corresponding tags for voice tasks and arranging different voice tasks corresponding to the same tag in the order of generation time.

[0037] Please refer to Figure 3 , which shows another context-related speech processing method provided by an embodiment of the present invention. Figure 1 A flowchart of the steps further defined in step 102 of “searching for a corresponding target voice task in the public queue and executing the target voice task”.

[0038] like Figure 3 As shown, in step 301, the consumer thread obtains the cached tag, and searches for the target voice task corresponding to the cached tag according to the cached tag;

[0039] In step 302, when the target voice task corresponding to the cached tag is found, it is registered in the global tag table, the target voice task corresponding to the tag is taken out and the voice task is executed, wherein the global tag table is used to register tasks that have been taken away by the consumer thread.

[0040] In this embodiment, for step 301, the cached label is obtained through the consumer thread, and the task corresponding to the cached label is searched. The number of consumer threads is fixed and limited by the specific execution unit (created by the system on the DSP). The cached label is first obtained through the consumer thread, and the corresponding target voice task is searched according to the cached label. Then, for step 302, when the target voice task corresponding to the cached label is found, the cached label is registered in the global label table, and the target voice task corresponding to the cached label is extracted from the public queue, and the target voice task is executed by the consumer thread, wherein the global label table is used to register the tasks that have been taken away by the consumer thread. For example, if the target task is reached, it is first registered in the global registration table, the task representing the target label is taken away, the target task is taken out from the public queue, and the target task is executed.

[0041] The method of the embodiment of the present application can achieve no blocking when searching and executing the target task in the public queue by searching for the target voice task corresponding to the cached tag and registering it in the global tag table.

[0042] In some optional embodiments, a new target voice task with the same label as the target voice task that has been executed is searched again in the public queue according to the generation sequence of voice tasks with the same label. If a new target voice task with the same label is found in the public queue, it is registered in the global label table, and the target voice task corresponding to the label is extracted and executed. For example, according to the label corresponding to the executed target voice task, the target voice task corresponding to the label is searched again in the public queue. If a target voice task with the corresponding label is found, it is first registered in the global registration table, the target voice task corresponding to the label is extracted, and the target voice task is executed.

[0043] In some optional embodiments, if a new target voice task with the same label is not found in the public queue, the target voice task corresponding to the label that is not registered in the global label table is searched again in the public queue. If the target voice task corresponding to the label that is not registered in the global label table is not found in the public queue, the consumer thread is put into a waiting state until a new target voice task appears in the public queue. For example, if the target voice task with the corresponding label is not found in the public queue, the target voice task corresponding to the label that is not registered in the global registration table is searched again in sequence from the public queue. If the target voice task with the corresponding label is not found in the public queue, the consumer thread is put into a waiting state until a new target voice task arrives in the public queue.

[0044] In some optional embodiments, after adding a tagged voice task to a public queue, the voice task is set to a pending state, waiting for the corresponding voice task to be extracted and executed, and the voice task is extracted and executed through a consumer thread, wherein the tagged voice task can activate any consumer thread.

[0045] In some optional embodiments, voice tasks corresponding to the same tag can be executed in different consumer threads and voice tasks corresponding to the same tag can only be executed in one consumer thread at the same time according to the generation sequence of the voice tasks. The target voice tasks corresponding to the same tag may not always be executed in the same consumer thread, but the target voice tasks corresponding to the same tag are guaranteed to be executed in the same consumer thread at the same time, so as to maximize concurrent execution while ensuring context association.

[0046] It should be noted that another alternative solution is provided in the technical solution of the present application. In the early stage, a decentralized scheduling strategy is adopted, that is, each consumer thread maintains a queue. When the production thread creates a label, the consumer thread busyness is evaluated based on the queue depth of the consumer thread, so as to determine the binding relationship and determine the binding relationship in advance. The advantage is that the logic and implementation are simple, and the disadvantage is that it is not flexible enough and lacks versatility; because the busyness of the thread cannot be effectively evaluated by the queue depth alone, the processing time of the task cannot be accurately estimated, and the evaluation basis is not very accurate. This will result in some consumer threads whose queues are not very deep, but they are all allocated time-consuming services, and the services at the end of the queue may need to wait for a long time, which will affect the concurrency of the entire system.

[0047] It should be noted that the present application is not limited to the processing of speech recognition models, but is also applicable to the processing of context-related services on specific processing units such as DSP, as well as the processing of context-related services on general-purpose processors.

[0048] It should be noted that this application involves two concepts: a speech task is a packaged executable code snippet used to complete a specific business (such as the recognition of N frames of audio); a label is a globally unique mark used to mark a task. Each task must have a label, and the same label may be used in multiple speech tasks, which is a one-to-many mapping relationship. Multiple speech tasks with the same label need to ensure sequential execution (context-related); speech tasks with different labels do not need to ensure sequential execution.

[0049] Please refer to Figure 4 , which shows a task creation flow chart of the context-associated speech processing method of the present invention.

[0050] like Figure 4As shown, the relationship between production threads and consumption threads is X to N (X is a dynamic value, N is a fixed value). Producer threads are generated by the business party based on the business to be processed. The number is determined by the user based on the specific business volume and can be dynamically expanded. In a certain system, the number of consumer threads is fixed and is limited by the execution unit of the physical chip. For example, the DSP component of (Qualcomm 8155P chip) has 2 physical execution units, that is, 2 consumer threads.

[0051] Step 1: The number of production threads is determined by actual business needs ( Figure 4 The example contains two threads), the number is uncertain.

[0052] Step 2: The producer determines whether the speech task is context-related. Context-related speech tasks share the same label.

[0053] Step 3: The voice task is added to a public message queue and is in a pending state, activating any consumer thread.

[0054] Step 4: The speech tasks are stored in the order of their generation time.

[0055] Please refer to Figure 5 , which shows the task execution flow chart of the context-associated speech processing method of the present invention.

[0056] like Figure 5 As shown, step 1: the number of consumer threads is determined and is limited by the specific execution unit (created by the system on the DSP).

[0057] Step 2: The consumer thread first obtains the cached tag (empty for the first time), and searches for the corresponding target voice task based on the tag.

[0058] Step 3: If the target voice task is found, it is first registered in the global registration table, and the target voice task with the target tag tag is taken away.

[0059] Step 4: Take the target speech task from the queue and execute the target speech task.

[0060] Step 5: Search for the target voice task from the queue again based on the tag corresponding to the executed target voice task.

[0061] Step 6: If the target speech task task with the corresponding tag tag is found, continue to step 3. If not found, proceed to step 7.

[0062] Step 7: Re-search the queue for the target voice task corresponding to the tag tag that is not registered in the global registration table.

[0063] Step 8: If a target speech task that meets the conditions is found, continue to step 3.

[0064] Step 9: If not found, the thread enters the waiting state, waiting for new tasks to arrive in the queue.

[0065] Please refer to Figure 6 , which shows a schematic diagram of a tag queue generated by a production thread of the context-associated speech processing method of the present invention.

[0066] like Figure 6 As shown in the figure, the target speech task corresponding to the same tag is not necessarily always executed in the same thread, but it is guaranteed that the target speech task corresponding to the same tag is only executed in the same thread at the same time (such as Figure 6 The processing of tag2 can ensure that when thread X processes tag2, thread Y has already processed all target voice tasks marked by tag2, thus maximizing concurrent execution while ensuring context relevance.

[0067] like Figure 6 The figure shows the mapping relationship between three production threads and two consumer threads. The tags are (0, 1, 2, M, N) respectively. Some tags contain multiple subtasks (subtasks are context-dependent).

[0068] Please refer to Figure 7 , which shows a possible processing timing diagram of the consumer thread of the context-related speech processing method of the present invention.

[0069] like Figure 7 As shown, the processing sequence is not fixed. Figure 7 This is just one possible processing sequence. Due to concurrent execution, the execution threads and task execution order bound to the voice task are not fixed, but are dynamically adjusted in real time.

[0070] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of combined actions, but those skilled in the art should be aware that the present invention is not limited by the described order of actions, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention. In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0071] In some embodiments, an embodiment of the present invention provides a non-volatile computer-readable storage medium, which stores one or more programs including execution instructions, and the execution instructions can be read and executed by an electronic device (including but not limited to a computer, a server, or a network device, etc.) to execute any of the above-mentioned context-associated speech processing methods of the present invention.

[0072] In some embodiments, an embodiment of the present invention further provides a computer program product, which includes a computer program stored on a non-volatile computer-readable storage medium, and the computer program includes program instructions, which, when executed by a computer, enable the computer to execute any of the above-mentioned context-associated speech processing methods.

[0073] In some embodiments, an embodiment of the present invention also provides an electronic device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute a context-associated speech processing method.

[0074] Figure 8 is a schematic diagram of the hardware structure of an electronic device for executing a context-related speech processing method provided by another embodiment of the present application, such as Figure 8 As shown, the device includes:

[0075] One or more processors 810 and memory 820, Figure 7 A processor 810 is taken as an example.

[0076] The device for executing the context-related speech processing method may further include: an input device 830 and an output device 840 .

[0077] The processor 810, the memory 820, the input device 830 and the output device 840 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.

[0078] The memory 820, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the context-associated speech processing method in the embodiment of the present application. The processor 810 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 820, that is, the context-associated speech processing method in the above method embodiment is implemented.

[0079] The memory 820 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the context-related speech processing device, etc. In addition, the memory 820 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 820 may optionally include a memory remotely arranged relative to the processor 810, and these remote memories may be connected to the context-related speech processing device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0080] The input device 830 can receive input digital or character information and generate signals related to user settings and function control of the context-related speech processing device. The output device 840 can include a display device such as a display screen.

[0081] The one or more modules are stored in the memory 820, and when executed by the one or more processors 810, the context-associated speech processing method in any of the above method embodiments is executed.

[0082] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.

[0083] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to:

[0084] (1) Mobile communication equipment: This type of equipment is characterized by having mobile communication functions and its main purpose is to provide voice and data communications. This type of terminal includes: smart phones, multimedia phones, functional phones, and low-end phones.

[0085] (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have mobile Internet access features. These terminals include: PDA, MID and UMPC devices, etc.

[0086] (3) Portable entertainment devices: These devices can display and play multimedia content. They include audio and video players, handheld game consoles, e-books, smart toys, and portable car navigation devices.

[0087] (4) Other onboard electronic devices with data interaction functions, such as on-board devices installed in vehicles.

[0088] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0089] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A context-related speech processing method, comprising: Creating a voice task, confirming whether the voice task is associated with a context, filling a tag for the voice task based on whether the context is associated, and adding the voice task with the tag to a public queue, wherein the voice task is created and assembled by a production thread; According to the context association relationship, searching for a corresponding target speech task in the public queue, and executing the target speech task; The target voice task is executed and allocated by the consumer thread, which specifically includes: The target voice tasks corresponding to the same tag can be executed in different consumer threads, and the target voice tasks corresponding to the same tag can only be executed in one consumer thread at the same time according to the generation time sequence of the target voice tasks.

2. The method according to claim 1, wherein: The determining whether the voice task is associated with the context and filling a label for the voice task based on whether the context is associated includes: When the voice task is associated with the context, the same label associated with the context and cached is filled in for the voice task, wherein one voice task corresponds to one label, one label is used by at least one voice task, and different voice tasks corresponding to the same label are arranged in a chronological order of generation; When the voice task is not associated with the context, a new label is applied for the voice task, and the new label is cached.

3. The method according to claim 1, wherein: The searching for the corresponding target voice task in the public queue and executing the target voice task includes: The consumer thread obtains the cached tag, and searches for the target voice task corresponding to the cached tag according to the cached tag; When the target voice task corresponding to the cached tag is found, it is registered in the global tag table, the target voice task corresponding to the tag is taken out and the voice task is executed, wherein the global tag table is used to register tasks that have been taken away by the consumer thread.

4. The method according to claim 3, wherein: The method further comprises: Searching the public queue for a new target voice task having the same label as the target voice task that has been completed according to the generation time sequence of the voice tasks having the same label; If the new target voice task with the same label is found in the public queue, it is registered in the global label table, and the target voice task corresponding to the label is taken out and executed at the same time.

5. The method according to claim 4, wherein: The method further comprises: If the new target speech task with the same label is not found in the public queue, the target speech task corresponding to the label not registered in the global label table is searched again in the public queue.

6. The method according to claim 5, wherein: The method further comprises: If the target voice task corresponding to the tag not registered in the global tag table is not found in the public queue, the consumer thread is put into a waiting state until a new target voice task appears in the public queue.

7. The method according to claim 1, wherein: The task of searching for the corresponding target voice in the public queue further includes: The voice task with the tag is added to the public queue and set to a pending state, wherein the voice task with the tag can activate any consumption thread.

8. An electronic device, comprising: At least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the method described in any one of claims 1 to 7.

9. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method and system for processing nested stream events

    CN103559014A

  • Task scheduling method and device and method and device for computing node to execute task

    CN110262888A

  • Asynchronous task processing method and device based on multiple threads, equipment and medium

    CN112559535A

  • Task processing method and device, electronic equipment, storage medium and program product

    CN114371939A

  • Task processing method and device, electronic equipment and storage medium

    CN114490123A