Text processing method, speech processing method, medium, and electronic device
By recognizing multiple intents in text in parallel and mapping tasks in real time within a human-computer natural language dialogue system, and asynchronously processing the tasks of the NLU and DM components, the problem of excessively long text processing time is solved, and the response speed is improved.
Patent Information
- Application Number
- CN202011231972.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-06
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2040-11-06
AI Technical Summary
In existing technologies, the text processing of human-computer natural language dialogue systems suffers from an imbalance in the time consumed by the recognizer and the trial operation tasks, resulting in excessively long total processing time and affecting response speed.
Parallel recognition of text intents across multiple intent types is employed, and the recognized intents are mapped and executed in parallel in real time. The task trial process of the NLU and DM components is processed asynchronously and in parallel, reducing overall time consumption.
Asynchronous parallel processing significantly reduces the total time spent on text processing and improves the response speed of human-computer interaction.
Smart Images

Figure CN114444495B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, in particular to a text processing method, a speech processing method, a medium and an electronic device. BACKGROUND
[0002] With the increasing intelligence of electronic devices, users have higher and higher requirements for the rapidity of text processing of human-computer interaction systems, such as text processing of human-computer natural language dialogue systems. Specifically, for the text converted from the speech spoken by the user, the text can be processed by a natural language understanding (NLU) component and a dialog management (DM) component.
[0003] Among them, after the text is transmitted to the NLU component, a plurality of recognizers (i.e., models or algorithms) inside the NLU component are used in parallel to perform intent recognition on the text until all the recognizers are executed, then the recognized intents are summarized to obtain an intent list, and the intent list is output. After the intent list is input to the DM component, the DM component internally distributes a trial running task for each intent in the intent list, and then executes all the trial running tasks in parallel. Until all the trial running tasks are executed, all the trial running results are summarized and sorted, and the response task is filtered out, and the execution result of the response task is output to complete the processing of the text.
[0004] Since the above plurality of recognizers are run in parallel, and the time consumption of different recognizers is long or short, the time consumption of the NLU component mainly depends on the longest time-consuming recognizer. Since the above plurality of trial running tasks are run in parallel, and the time consumption of different trial running tasks is long or short, the total time consumption of the above DM component mainly depends on the longest time-consuming trial running task. Further, since the above NLU component and DM component are run in series, the total time consumption of the above text processing process is the sum of the total time consumption of the NLU component and the total time consumption of the DM component, that is, the total time consumption of the process mainly depends on the longest time-consuming recognizer and the longest time-consuming trial running task. In this way, if the time consumption of the above longest time-consuming recognizer is too long, and the time consumption of the above longest time-consuming trial running task is too long, the total process time consumption of the text processing will be too long. SUMMARY
[0005] The embodiments of the present application provide a text processing method, a speech processing method, a medium and an electronic device, which can reduce the total process time consumption of text processing and help improve the response speed of a human-computer natural language dialogue system.
[0006] In a first aspect, an embodiment of the present application provides a text processing method, which comprises: obtaining a to-be-processed text; identifying, in parallel, an intent of the to-be-processed text under a plurality of intent types; in a case where an intent is identified under at least one of the plurality of intent types, performing trial running on a task corresponding to the identified intent in real time and generating a trial running result until the intent identification under the plurality of intent types is completed; and generating a management result corresponding to the to-be-processed text according to the trial running results of the intents under the plurality of intent types. The to-be-processed text can be a text converted from speech of a user in a human-computer interaction system or a text manually input by the user, but is not limited thereto. Specifically, in the embodiment of the present application, whenever an intent under an intent type is identified, the identified intent is mapped and distributed to a task, and the task is then trial run. For example, an intent type can be implemented by an identifier, and each identifier can be a neural network model. Therefore, the time consumption of the text processing process mainly depends on the sum of the time consumption of identifying an intent under the same intent type and the time consumption of trial running the task mapped by the intent, rather than the time consumption of identifying an intent under an intent type with the longest time consumption and the time consumption of trial running the task mapped by the intent with the longest time consumption. In this way, the process of identifying an intent of a to-be-processed text under a plurality of intent types is executed asynchronously and in parallel with the process of trial running a task corresponding to an intent identified in real time, which is beneficial to reducing the time consumption of the overall process of text processing.
[0007] In a possible implementation manner of the first aspect, the "in a case where an intent is identified under a plurality of intent types, performing trial running on a task corresponding to the identified intent in real time and generating a trial running result" comprises: in a case where an intent is identified under a plurality of intent types, performing trial running on a plurality of tasks corresponding to the identified intent in parallel in real time and generating a trial running result. In the embodiment of the present application, one or more intents under one intent type can be identified at the same time, or one or more intents under two or more intent types can be identified. One intent can be mapped to 0, one or more trial running tasks, and the present application does not make any limitation in this regard.
[0008] In a possible implementation manner of the first aspect, the "performing trial running on the tasks corresponding to the identified intents in real time and generating the trial running results in the case that the intents are identified under the plurality of intent types" includes: performing trial running on the tasks corresponding to the intents in the identified intent package in real time and generating the trial running results in the case that the intents are identified under the plurality of intent types; and each intent package includes at least one intent. In the embodiment of the present application, 0, one or more intents of a text can be identified under one intent type, and the intents can form an intent package. For example, an identifier identifies 0, one or more intents in an intent package of a text to be processed.
[0009] In a possible implementation manner of the first aspect, the "performing trial running on the tasks corresponding to the intents in the identified intent package in real time and generating the trial running results in the case that the intents are identified under the plurality of intent types" includes: in the case that the intent package is identified by the first component under the plurality of intent types, sending the identified intent package in real time to the second component by the first component; performing trial running on the tasks corresponding to the intents in the identified intent package in real time and generating the trial running results by the second component; and the first component is configured to identify the intents of the text, and the second component is configured to generate the management result of the text according to the intents of the text. In some embodiments, the first component can start to identify the text to be processed under the plurality of intent types in parallel at the same time, or start to identify the text to be processed under the plurality of intent types in parallel in sequence. It can be understood that, whenever the first component identifies the intents of the text to be processed under one intent type, the identified intents in real time are sent to the second component for processing, without waiting for the identification of the intents of the text to be processed under the plurality of intent types by the first component to be completed, so that the second component can process the identified intents in real time in time.
[0010] In a possible implementation manner of the first aspect, the method further includes: when an intent package of one intent type is identified by the first component, controlling a first counting parameter to count, the first counting parameter being used to count the number of the identified intent packages of the plurality of intent types; when the process of identifying the flow of the text to be processed by the first component in the plurality of intent types is completed, taking the value of the first counting parameter as a target value, the target value being used to indicate the total number of the intent packages received by the second component; if an intent package of the last intent type in the plurality of intent types is identified by the first component, adding the target parameter to the identified intent package of the last intent type; if an intent package of the last intent type is not identified by the first component, sending the target parameter to the second component separately by the first component. It can be understood that the first counting parameter can be a parameter of a counter in the first component, and the counter can be an intent package counter in the following embodiments. In this way, after the target value is obtained by counting the first counting parameter, the first component interacts the target value with the second component, so that the second component and the first component are consistent in the number of the identified intent packages of the text to be processed.
[0011] In a possible implementation manner of the first aspect, the method further includes: when an intent package of one intent type is identified by the first component, controlling a first counting parameter to count, the first counting parameter being used to count the number of the identified intent packages of the plurality of intent types; when the process of identifying the flow of the text to be processed by the first component in the plurality of intent types is completed, taking the value of the first counting parameter as a target value, the target value being used to indicate the total number of the intent packages received by the second component; if an intent package of the last intent type in the plurality of intent types is identified by the first component, adding the target parameter to the identified intent package of the last intent type; if an intent package of the last intent type is not identified by the first component, sending the target parameter to the second component separately by the first component. It can be understood that the first counting parameter can be a parameter of a counter in the first component, and the counter can be an intent package counter in the following embodiments. In this way, after the target value is obtained by counting the first counting parameter, the first component interacts the target value with the second component, so that the second component and the first component are consistent in the number of the identified intent packages of the text to be processed.
[0012] In a possible implementation of the first aspect, the method further includes: when the process of identifying the text to be processed under the plurality of intent types by the first component is all ended, if an intent package is identified under the last intent type in the plurality of intent types, adding a target identifier in the intent package identified under the last intent type by the first component; and wherein the target identifier is used to indicate to the second component that the received intent package is the last intent package to be received. It can be understood that the first component will send the target identifier to the second component along with the last intent package.
[0013] In a possible implementation of the first aspect, before the step of generating the management result of the text to be processed according to the trial running result of the generated intent under the plurality of intent types, the method further includes: when the target identifier is included in the intent package received by the second component in real time, determining that the intent package received by the second component in real time is the last intent package to be received. It can be understood that when the second component receives the last intent package, the target identifier can be obtained, and then it is determined that all the intent packages for the text to be processed are received.
[0014] In a possible implementation of the first aspect, the first component is implemented based on natural language understanding (NLU), and the second component is implemented based on dialog management (DM). It can be understood that in a natural language dialog system, there are other components in series in front of and behind the NLU component and the DM component, for example, the text to be processed can be generated by a component in front of the NLU component (such as an ASR component), and the management result of the text to be processed can be generated by a component behind the DM component (such as an NLG component).
[0015] In a possible implementation of the first aspect, the first component is implemented based on natural language understanding (NLU), and the second component is implemented based on dialog management (DM). It can be understood that in a natural language dialog system, there are other components in series in front of and behind the NLU component and the DM component, for example, the text to be processed can be generated by a component in front of the NLU component (such as an ASR component), and the management result of the text to be processed can be generated by a component behind the DM component (such as an NLG component).
[0016] In a third aspect, the application provides a text processing method applied to an electronic device including a natural language understanding (NLU) component and a dialog management (DM) component, and the method includes: obtaining a to-be-processed text by the NLU component; identifying, by the NLU component and in parallel, intents of the to-be-processed text under multiple intent types by multiple recognizers corresponding to the multiple intent types; in a case where an intent is identified under at least one intent type, performing trial running on tasks corresponding to the identified intent in real time by the DM component and generating trial running results until the intent identification under the multiple intent types is completed; and generating, by the DM component, a management result corresponding to the to-be-processed text according to the generated trial running results of the intents under the multiple intent types. Specifically, in the application, the NLU component runs multiple recognizers in parallel to identify the text, and whenever a recognizer ends running, the NLU component directly outputs an intent package composed of the intent identified by the recognizer to the DM component, so that the DM component immediately maps and distributes tasks for the intents in the intent package and then performs trial running on the tasks in parallel. In this way, the total time for the overall running of the NLU component and the DM component mainly depends on the sum of the time for a single intent to pass through a recognizer in the NLU component and the time for the corresponding trial running task to pass through the DM component. For the same intent (or the intent package in which the intent is located), the prior art usually has a case where the NLU component processes faster and the trial running of the tasks of the DM component is slower, or a case where the NLU component processes slower and the trial running of the tasks of the DM component is faster. Therefore, the asynchronous and parallel processing of the text by the NLU component and the internal trial running of the tasks of the DM component in the application can reduce the total time for the overall text processing of the NLU component and the DM component.
[0017] In a possible implementation manner of the third aspect, the above-mentioned “in a case where an intent is identified under at least one intent type, performing trial running on tasks corresponding to the identified intent in real time by the DM component and generating trial running results” includes: in a case where an intent package is identified under at least one intent type, performing trial running on tasks corresponding to the intents in the identified intent package in real time by the DM component and generating trial running results; and each intent package includes at least one intent.
[0018] In a possible implementation manner of the third aspect, the above-mentioned “in a case where an intent is identified under at least one intent type, performing trial running on tasks corresponding to the identified intent in real time by the DM component and generating trial running results” includes: in a case where an intent package is identified under at least one intent type, performing trial running on tasks corresponding to the intents in the identified intent package in real time by the DM component and generating trial running results; and each intent package includes at least one intent.
[0019] In a possible implementation manner of the third aspect, the method further includes: in a case where the intent package is identified under the at least one intent type, sending, by the NLU component, the identified intent package in real time to the DM component.
[0020] In a possible implementation manner of the third aspect, the method further includes: in a case where the intent package is identified under the one intent type by the NLU component, counting a value of a first counting parameter, the first counting parameter being used to count a number of the identified intent packages under the plurality of intent types; in a case where the process of identifying the text to be processed under the plurality of intent types by the NLU component is all executed, taking the value of the first counting parameter as a target value, the target value being used to indicate a total number of the intent packages received by the DM component; in a case where the intent package under the last one of the plurality of intent types is identified by the NLU component, adding the target parameter to the identified intent package under the last one of the plurality of intent types; and in a case where the intent package under the last one of the plurality of intent types is not identified by the NLU component, sending, by the NLU component, the target parameter to the DM component separately.
[0021] In a possible implementation manner of the third aspect, the method further includes: in a case where the intent package identified under the one intent type is received in real time by the DM component, counting a second counting parameter, the second counting parameter being used to count a number of the intent packages received by the DM component; and before the management result corresponding to the text to be processed is generated according to the trial running result of the generated intents under the plurality of intent types, the method further includes: in a case where the value of the second counting parameter is equal to the target value, stopping counting, by the DM component, the second counting parameter.
[0022] In a possible implementation manner of the third aspect, the method further includes: in a case where the process of identifying the text to be processed under the plurality of intent types by the NLU component is all executed, in a case where the intent package under the last one of the plurality of intent types is identified, adding, by the NLU component, a target identifier to the identified intent package under the last one of the plurality of intent types; and the target identifier is used to indicate, to the DM component, that the received intent package is the last one of the to-be-received intent packages.
[0023] In a possible implementation manner of the third aspect, before the management result corresponding to the text to be processed is generated according to the trial running result of the generated intents under the plurality of intent types, the method further includes: in a case where the target identifier is included in the intent package received in real time by the DM component, determining that the intent package received in real time by the DM component is the last one of the to-be-received intent packages.
[0024] It can be understood that the detailed description of the various possible implementation manners in the third aspect can refer to the related description in the first aspect, and the embodiments of the present application do not repeat the description.
[0025] In a fourth aspect, an electronic device is provided, which includes a natural language understanding (NLU) component and a dialog management (DM) component. The NLU component and the DM component can be implemented based on a processor in the electronic device. The NLU component is configured to obtain a text to be processed, and recognize intents of the text to be processed in multiple intent types in parallel. The DM component is configured to, in a case that an intent is recognized in at least one intent type, perform a trial run on a task corresponding to the intent recognized by the NLU component in real time and generate a trial run result, until the intents in the multiple intent types are all recognized. A management result corresponding to the text to be processed is generated according to the trial run results of the intents in the multiple intent types.
[0026] In a fifth aspect, a readable storage medium is provided, which stores instructions. When the instructions are executed on a computer, the computer performs the text processing method in the first aspect, or the speech processing method in the second aspect, or the text processing method in the third aspect.
[0027] In a sixth aspect, an electronic device is provided, which includes a memory configured to store instructions executed by one or more processors of the electronic device, and a processor configured to perform the text processing method in the first aspect, or the speech processing method in the second aspect, or the text processing method in the third aspect. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 According to some embodiments of the present application, a composition diagram of a human-computer natural language dialogue system is shown.
[0029] Figure 2 According to related prior art, a scene diagram of text processing is shown.
[0030] Figure 3 According to some embodiments of the present application, a scene diagram of text processing is shown.
[0031] Figure 4 According to some embodiments of the present application, a scene diagram of text processing is shown.
[0032] Figure 5 According to some embodiments of the present application, a flow diagram of a text processing method is shown.
[0033] Figure 6 According to some embodiments of the present application, a structure diagram of a text processing device is shown.
[0034] Figure 7 According to some embodiments of the present application, a structural schematic diagram of an electronic device is shown. DETAILED DESCRIPTION
[0035] Illustrative embodiments of the present application include, but are not limited to, a text processing method, a medium and an electronic device.
[0036] The text processing method provided by the present application can be applied to a text processing scene in human-computer interaction, such as a scene in which a natural language dialogue system processes text converted from speech spoken by a user. For text or text recognized from speech, the asynchronous parallel of the intent recognition process in the NLU component and the task trial process in the DM component can be implemented. Specifically, the NLU component runs multiple recognizers in parallel to recognize the text, and whenever a recognizer runs out, the NLU component directly outputs an intent package composed of the intent recognized by the recognizer to the DM component, so that the DM component immediately maps and distributes tasks in the intent package, and then runs the tasks in parallel. In this way, the total time consumed by the overall operation of the NLU component and the DM component mainly depends on the sum of the time consumed by a single intent through a recognizer in the NLU component and the time consumed by the corresponding trial task in the DM component. For the same intent (or the intent package in which the intent is located), the prior art usually has the case that the NLU component processes faster while the task trial of the DM component is slower, or the NLU component processes slower while the task trial of the DM component is faster. Therefore, the asynchronous parallel processing of the text in the NLU component and the task trial in the DM component in the present application can reduce the total time consumed by the overall text processing of the NLU component and the DM component.
[0037] The content related to the text processing method in the present application will be described in detail below in combination with the accompanying drawings.
[0038] As Figure 1 shown, a composition schematic diagram of a human-computer natural language dialogue system provided by an embodiment of the present application is shown. The system first converts audio corresponding to speech spoken by a user into text through an automatic speech recognition (ASR) component, and then outputs the text to an NLU component. In this way, the NLU component and the DM component can process the text to obtain a management result, for example, the DM component executes selected tasks by calling other content services and obtains a management result. In addition, the management result is further converted into natural language text through a natural language generation (NLG) component, and then converted into audio from the natural language text through a text to speech (TTS) component. When the audio is output, the user can hear the response voice.
[0039] It can be understood that in a natural language dialogue system, an intent can be understood as a certain function or process of an electronic device, such as a function of an application (APP) or a system function, to embody a request or purpose of a voice spoken by a user. An intent is a collection of multi-sentence expressions, for example, “I want to watch a movie” and “I want to watch the movie “Return of the Saint” can both belong to the intent of video playing. Specifically, intent recognition can be achieved by recognizing the word slot (Slot) and slot position of the text. The word slot can be understood as what parameters are contained in a sentence, and the slot position refers to how many parameters are in the sentence. For example, for the text “today, how is the weather in Shenzhen”, the weather intent can be divided into “today”, “Shenzhen”, “weather”, and “how” four words, and the weather intent contains four word slots of “time”, “location”, “trigger keyword” (that is, weather), and “nonsense word”.
[0040] As an example, Figure 1 For the voice “today's weather” spoken by a user, the ASR component converts the corresponding audio into text to obtain {text=today's weather} and outputs to the NLU component. Then, the NLU component identifies the result of the text as {intent=query weather, Location=Shenzhen} and outputs to the DM component, that is, the identified intent is “query the weather in Shenzhen today”. The DM component performs a trial run on the query weather task mapped by the intent, such as calling the content service of querying the weather through the tool “qurryWeather” to query the weather of the location “Shenzhen”, and the query result is “sunny, 23 to 31 degrees…”, that is, the management result is {intent=query weather, Result=sunny, 23 to 31 degrees…}. In addition, the NLG component can convert the management result into a natural language text {text=sunny, 23 to 31 degrees…}, and then convert the natural language text into audio through the TTS component, and when the audio is output, the user can hear “sunny, 23 to 31 degrees…”.
[0041] In some embodiments, the natural language dialogue system described above can be implemented based on an electronic device that performs voice interaction with a user. Specifically, the electronic device suitable for the present application has a text processing function, including but not limited to a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a notebook computer, a desktop computer, an ultra-mobile personal computer (UMPC), a netbook, and a cellular phone, a personal digital assistant (PDA), an augmented reality (AR) \ virtual reality (VR) device, a media player, a smart television, a smart speaker, a smart watch, a smart earphone, and the like. Hereinafter, the text processing method provided by the embodiments of the present application will be described taking a mobile phone as an example.
[0042] It can be understood that the user generally requires a shorter time-consuming natural language dialogue between man and machine. For example, after the user says "today's weather", the user requires to quickly hear the response voice "sunny, 23 to 31 degrees…". Therefore, the NLU component and the DM component are required to have a shorter time-consuming text processing.
[0043] However, in the related prior art, the NLU component and the DM component are serially run to implement text processing. That is, only after the entire process of the NLU component performing intent recognition on the input text is completed, the DM component can perform processes such as task trial running on the intent recognition results, thereby completing text processing, resulting in a longer time-consuming text processing. First, the text processing process of the related art will be described below, and specifically, the processing process of text 1 of the related art will be described as an example.
[0044] Figure 2 A scene diagram of text processing in the related art is shown. As shown in Figure 2 For the input text 1, the NLU component in the related art uses the recognizers 1-4 in parallel to recognize the text 1, the recognizers 1-3 all recognize the intent of the text 1, and the recognizer 4 does not recognize any intent of the text 1, and then the intents recognized by the recognizers 1-3 are summarized to obtain an intent list. Further, the DM component distributes the mapped tasks 1-3 to the intents in the intent list, and then performs trial running on these tasks in parallel. Obviously, the NLU component and the DM component are serially run as a whole.
[0045] It can be understood that in some embodiments, a recognizer is a model or algorithm for intent recognition, and of course it can also be named as other names such as "recognition model" in other embodiments, and the embodiments of the present application do not make any limitation thereon.
[0046] Continuing to refer to Figure 2, the time consumption of the recognizers 1-4 is 2 ms, 10 ms, 100 ms and 25 ms respectively, the time consumption of the trial runs of the tasks 1-3 is 450 ms, 12 ms and 3 ms respectively, the time consumption of the sorting selection is 1 ms, and the time consumption of the subsequent processing is 20 ms. Then, since the NLU component and the DM component are serially operated as a whole, the total time consumption of the NLU component and the DM component depends on the time consumption of the recognizer 3 and the trial run of the task 1, and thus the total time consumption of the NLU component and the DM component is the sum of the time consumption of the recognizer 3, the time consumption of the task 1, the time consumption of the sorting selection and the time consumption of the subsequent processing, i.e. 571 ms. However, since the time consumption of the recognizer 3 and the time consumption of the trial run of the task 1 are both long, the total time consumption of the NLU component and the DM component is too long, i.e. the total time consumption of the above text processing is too long. That is, in the related art, if the time consumption of the recognizer with the longest time consumption is too long, and the time consumption of the trial run task with the longest time consumption is also too long, the total process of the above text processing will have a too long time consumption.
[0047] Figure 3 Fig. 1 shows a text processing scenario provided by an embodiment of the present application. As shown in Fig. 1, the text processing scenario includes an NLU component and a DM component. Figure 2 Similarly, for the input text 1, Figure 3 In the NLU component, the recognizers 1-4 are used in parallel to recognize the input text, and the recognizers 1-3 respectively recognize the intent and obtain the intent package, while the recognizer 4 does not recognize any intent of the text. Moreover, the time consumption of the recognizers 1-4 is 2 ms, 10 ms, 100 ms and 25 ms respectively, i.e. the recognizers 1, 2, 4 and 3 complete the intent recognition step of the text 1 in turn.
[0048] Continuing to refer to Figure 3 In the embodiment of the present application, when the NLU component identifies the intent package of the input text by the recognizer 1, the NLU component can transmit the intent package corresponding to the recognizer 1 to the DM component, while continuing to use the recognizers 2-4 in parallel to recognize the intent of the text 1. Subsequently, after the DM component receives the intent package corresponding to the recognizer 1, the DM component can distribute the mapped task 1 to the intent in the intent package and start the trial run of the task 1. In this way, the NLU component identifies the intent packages corresponding to the recognizers 2 and 3 in turn, and then transmits the two intent packages to the intent package receiver in the DM component, so that the DM component can distribute the tasks 2 and 3 to the intents in the two intent packages in turn, and perform the trial run of the tasks 2 and 3.
[0049] In some embodiments, one recognizer in the NLU component can recognize 0, one or more intents of the text, and these intents can constitute an intent package. For example, in the above Figure 2 and Figure 3The text processing method is described by taking an example of only one intention being identified by each of the recognizers 1-3 respectively.
[0050] In addition, in some embodiments, one intention in the DM component can be mapped to 0, one or more trial tasks, and the embodiments of the present application do not make any limitation in this regard. For example, the above-mentioned Figure 2 and Figure 3 The text processing method is described by taking an example of only one intention being identified by each of the recognizers 1-3 respectively.
[0051] Further, continuing to refer to Figure 3 When the time consumption of the trial of the tasks 1-3 is 450ms, 12ms and 3ms respectively, the sum of the time consumption of the recognizer 1 and the task 1 is 452ms, the sum of the time consumption of the recognizer 2 and the task 2 is 22ms, the sum of the time consumption of the recognizer 3 and the task 3 is 103ms, and the time consumption of the recognizer 4 running alone is 25ms. In addition, the time consumption of the sorting selection in the DM component is 1ms, and the time consumption of the subsequent processing is 20ms. Therefore, the total time consumption of the NLU component and the DM component mainly depends on the sum of the time consumption of the longest two of the recognizers and the corresponding trial tasks, and the sum of the time consumption of the recognizer 1 and the task 1 (452ms) is the longest time consumption of the serial branch. Then, the total time consumption of the NLU component and the DM component is the sum of the time consumption of the recognizer 1, the time consumption of the task 1, the time consumption of the sorting selection (1ms) and the time consumption of the subsequent processing (20ms), i.e. 473ms. Obviously, for the text processing process of the text 1, the total time consumption (452ms) in the present application is 20% shorter than the total time consumption (571ms) in the related art, which significantly shortens the human-computer voice dialogue time delay.
[0052] Therefore, compared with the related art, the text processing scenario provided by the present application is different in that Figure 3 In the present application, the DM component can receive the intentions in the intention package identified by each of the recognizers one by one, instead of receiving the intention list in which all the intentions are integrated in the NLU component. Therefore, the process of the NLU component using the recognizers to identify the intentions of the input text and the process of the DM component to perform the trial of the tasks mapped by the intentions in the intention package are asynchronously and in parallel. Therefore, the text processing method provided by the embodiments of the present application is that, for the text or the text recognized by voice, whenever the running of one of the recognizers in the NLU component ends, the NLU component directly outputs the intention identified by the recognizer to the DM component, so that the DM component distributes the tasks mapped by the intentions as soon as it receives one of the intentions identified by the recognizer, and then performs the trial of the tasks in parallel. Therefore, the total time consumption of the NLU component and the DM component for the text processing is reduced.
[0053] As Figure 4As shown, a text processing scenario provided by the embodiment of the present application is shown, in which the text 1 input to the NLU component and the DM component is "Da Sheng returns", and the NLU component further includes an intent package counter, and the DM component further includes an intent package receiver.
[0054] The following is based on Figure 4 The text processing scenario shown is used to describe the scheme of the embodiment of the present application. Figure 5 The text processing steps shown are used to describe the scheme of the embodiment of the present application.
[0055] Step 501, the mobile phone 100 acquires the text to be processed, such as the text "Da Sheng returns".
[0056] For example, the text "Da Sheng returns" can be the text converted from the voice spoken by the user.
[0057] Step 502, for the text to be processed, the mobile phone 100 controls the multiple recognizers in the NLU component to start intent recognition on the text to be processed in a parallel manner, and initializes the first counting parameter of the intent package counter.
[0058] Specifically, the NLU component can activate the four recognizers 1-4 in parallel.
[0059] It can be understood that each recognizer is used to recognize one type of intent, and different recognizers recognize different types of intents. For example, the NLU component includes recognizers of "video", "audio", "weather", "news", "browser", "shopping", etc.
[0060] Among them, one recognizer can recognize 0, 1 or multiple intents of the text, and multiple intents can form an intent package. For example, Figure 4 In the scenario shown, the text "Da Sheng returns" is recognized as three intent packages, each of which includes one intent. That is, each recognizer recognizes one intent for the same text. Specifically, referring to Figure 4 , the text "Da Sheng returns" is recognized by the "browser" recognizer (i.e. recognizer 1) as a "browser" intent (such as a "encyclopedia" intent), recognized by the "audio" recognizer (i.e. recognizer 2) as an "audio" intent, recognized by the "video" recognizer (i.e. recognizer 3) as a "video" intent, and the "book" recognizer (i.e. recognizer 4) does not recognize any intent. Of course, the above intent recognition process is also achieved through the word slot and slot position of the text, and the specific process is not described here.
[0061] In some other embodiments, the same recognizer may recognize multiple intents for the same text. For example, the text "The Monkey King Returns" may be recognized as the TV drama "The Monkey King Returns" and the movie "The Monkey King Returns". Additionally, the same recognizer may recognize different texts as the same intent. For example, both the text "The Monkey King Returns" and "I want to watch the movie The Monkey King Returns" may be recognized as the intent of video playback, i.e., the "video" intent. The embodiments of the present application do not impose any restrictions on this.
[0062] In addition, in the embodiments of the present application, the first counting parameter of the intent packet counter is used to count the number of intent packets recognized according to multiple recognizers in the NLU component, that is, the number of intent packets recognized by multiple intent types activated by the NLU component. Initialize the first counting parameter of the intent packet counter so that the value of the first counting parameter is 0.
[0063] It can be understood that in some embodiments, after the text is input into the NLU component, the NLU component needs to first activate one or more recognizers, and then use these activated recognizers to perform intent recognition on the text. However, the NLU component may first activate some recognizers, and then activate other recognizers as the intents of these recognizers run. Therefore, the NLU component cannot know the specific total number of recognizers in advance. For example, the NLU component first activates the "encyclopedia" recognizer, and then activates the "audio" recognizer according to the recognition result of the "encyclopedia" recognizer subsequently. Furthermore, the total number of intent packets recognized by each recognizer in the NLU component cannot be known in advance. In this way, in the embodiments of the present application, the intent packet counter provided by the NLU component can be used to determine the total number of intent packets recognized for the text to be processed in real time.
[0064] Step 503: The mobile phone 100 determines whether each recognizer has completed the intent recognition of the text to be processed.
[0065] If the mobile phone 100 determines that a recognizer has completed the intent recognition step of the text to be processed, but the recognizer has not recognized any intent, then the mobile phone 100 continues to determine the recognition result of the next recognizer, that is, repeats step 503.
[0066] If the mobile phone 100 determines that a recognizer has completed the intent recognition step of the text to be processed and has recognized an intent packet of the text to be processed, then the following step 504 can be executed.
[0067] Step 504: Whenever a recognizer in the NLU component recognizes an intent packet of the text to be processed, the mobile phone 100 sends the currently recognized intent packet to the DM component and increments the first counting parameter of the intent packet counter in the NLU component by 1.
[0068] Step 505, whenever the intent package receiver in the DM component receives an intent package from the NLU component, the mobile phone 100 controls the intent package receiver to distribute the mapped tasks for each intent in the received intent package, and then runs the tasks in parallel to obtain the running results, and adds 1 to the second counting parameter of the intent package receiver.
[0069] In the embodiments of the present application, the intent package receiver can map 0, 1 or more tasks for each received intent. For example, Figure 4 In the illustrated scenario, each of the "encyclopedia" intent, the "audio" intent and the "video" intent maps one task, which are the "encyclopedia" task, the "audio" task and the "video" task respectively. Specifically, the DM component executes the "encyclopedia" query, the "audio" running and the "video" running in sequence, and the time consumption is 450ms, 12ms and 3ms respectively.
[0070] It can be understood that the running result of some tasks is the intermediate process of the actual execution of the task, and the running result of some tasks is the same as the actual execution result of the task.
[0071] For example, the running of the above-mentioned "encyclopedia" task is to directly query the text (such as "the return of the great saint") in the "encyclopedia" browser, at which time the running result of the task is the same as the actual running result of the task, that is, both are the query result of the text in the "encyclopedia". In some embodiments, if the text "the return of the great saint" does not query any result in the "encyclopedia" browser, it is considered that the "encyclopedia" task running fails, and the running result will not be involved in the subsequent processing, or the result is taken as the running result parameter for subsequent processing.
[0072] For example, the running of the above-mentioned "audio" task is to perform the slot filling processing and part of the intermediate processing steps on the text "the return of the great saint". For example, the "audio" intent of the text "the return of the great saint" adds the word slot "play" and the word slot "music APP 1", etc.; and queries the audio "the return of the great saint" in the music APP 1 to obtain the query result. Similarly, the description of the running of the above-mentioned "video" task is similar to that of the "audio" running, which will not be described here.
[0073] Of course, the running of the task in the embodiments of the present application includes but is not limited to the above-mentioned examples, which can be determined according to the specific implementation of the scheme.
[0074] Step 506, after the last recognizer in the NLU component completes the step of performing intent recognition on the text to be processed, the mobile phone 100 controls the NLU component to stop counting the first counting parameter of the intent package counter, and sends the value of the first counting parameter as a target value to the DM component, which is used to indicate the total number of the received intent packages of the DM component.
[0075] For example, in the illustrated scenario, the value of the first counting parameter of the intent package counter (i.e. the target value) is 3. Figure 4 In the illustrated scenario, the value of the first counting parameter of the intent package counter (i.e. the target value) is 3.
[0076] In some embodiments, if the last intent package identified by the NLU component is the intent package identified by the last recognizer (i.e. the recognizer with the longest processing time), the NLU component can send the target value to the DM component together with the last intent package, such as carrying the target value in the last intent package or sending the target value as a separate data packet.
[0077] In other embodiments, if the last intent package identified by the NLU component is not the intent package identified by the last recognizer, the NLU component can send the target value to the DM component as a separate data packet.
[0078] It can be understood that, for the convenience of description, Figure 5 In the illustrated scenario, the NLU component sends the target value to the DM component as a separate data packet, but the method of the embodiments of the present application is not limited thereto.
[0079] In addition, in some other embodiments, when the last recognizer of the NLU component completes the intent recognition step for the text to be processed and identifies the last intent package in step 506, the mobile phone 100 can also control the NLU component to add a target identifier (such as an isLast flag) in the last intent package, which is used to indicate to the DM component that the current intent package is the last intent package.
[0080] It can be understood that, in the embodiments of the present application, the execution timing of steps 504-506 is not specifically limited, including but not limited to the following examples: steps 504, 505 and 506 are started to be executed at different times, wherein step 505 can be started to be executed after step 504 is started to be executed, so that step 504 and step 505 are in the execution state at the same time, and step 506 is started to be executed after step 504 is executed.
[0081] Step 507, after the intent package receiver in the DM component receives the target value, the mobile phone 100 controls the intent package receiver to determine whether the value of the second counting parameter is the same as the target value.
[0082] The intent package receiver has a counting function, i.e. can include a counter, and the counting parameter of the counting function is the second counting parameter.
[0083] For example, in the illustrated scenario, the value of the first counting parameter of the intent package counter (i.e. the target value) is 3. Figure 4In the scenario shown, the "Received" value in the intent packet receiver is 3, meaning that the number of intent packets currently received by the DM component, as counted by the second counting parameter, is 3. Furthermore, the "Total" value in the intent packet receiver is 3, indicating that the target value for the total number of intent packets that the DM component needs to receive is 3.
[0084] Understandably, if the value of the second counting parameter is less than the target value, then the above step 507 is repeated, that is, the mobile phone 100 controls the intent packet receiver to continue waiting to receive and process intent packets until the value of the second counting parameter is equal to the target value, that is, all intent packets have been received.
[0085] If the value of the second counting parameter is equal to the target value, it means that the intent packet receiver in the DM component has received the last intent packet or has completed receiving the last intent packet, that is, all intent packets have been received. Then, the following step 508 can be executed.
[0086] In other embodiments, in step 507 above, if the value of the second counting parameter is equal to the target value, and the intent packet received by the current intent packet receiver carries a target identifier (such as the isLast flag), it indicates that the intent packet receiver has received the last intent packet, and step 508 can be executed subsequently.
[0087] Step 508: Mobile phone 100 controls the second counting parameter of the intent packet receiver to stop counting and stops receiving intent packets.
[0088] It is understandable that the intent packet receiver in the DM component may include a counter, namely the counter corresponding to the second counting parameter mentioned above, to count the number of intent packets received by the DM component.
[0089] Specifically, refer to Figure 4 In the scenario shown, for the processing timing of intent packets in each step of the NLU component and DM component, the above steps 504-508 can be achieved through the following steps (1)-(4):
[0090] Step (1): Recognizer 1 identifies the "Encyclopedia" intent within 2ms. The first counting parameter of the intent packet counter is incremented by 1 to 1, and the "Encyclopedia" intent is immediately sent to the DM component. After receiving the first intent packet, the intent packet receiver in the DM component initializes the receiver and sets the number of received packets (i.e., the second counting parameter) to 1. The total number (i.e., the target value) is unknown.
[0091] Step (2), the recognizer 2 identifies the "audio" intent in 10 ms, the first counting parameter of the intent package counter is added by 1 and becomes 2, and the "audio" intent is sent to the DM component immediately. After the DM component receives the intent package, the number of received packages (i.e., the second counting parameter) is added by 1 and becomes 2, and the total number (i.e., the target value) is unknown.
[0092] Step (3), the recognizer 4 completes the intent identification in 25 ms, and no intent is identified.
[0093] Step (4), the recognizer 3 identifies the "video" intent in 100 ms, the first counting parameter of the intent package counter is added by 1 and becomes 3, and it is determined that the "video" intent is the last intent package. Then, the NLU component sends the data of the "video" intent, the isLast identifier, and the total number of intent packages 3 (i.e., the target value) to the DM component. Subsequently, after the DM component receives the last intent package, the number of received packages (i.e., the second counting parameter) is added by 1 and becomes 3, it is determined that the total number (i.e., the target value) is 3, and the intent package receiver is closed (i.e., the reception of the intent package is stopped).
[0094] It can be seen that, after the NLU component starts to use the recognizers to identify the intents of the text, the NLU component directly outputs the intent package composed of the intent identified by each recognizer to the DM component when the operation of each recognizer ends, until the operation of the last activated recognizer in the NLU component is completed, without the need to wait until all activated recognizers are operated to transmit the intent list obtained by aggregating all intents to the DM component. Correspondingly, the DM component immediately maps and distributes the tasks in each received intent package, and then performs the trial operation of these tasks in parallel, until the last received intent package is processed. Subsequently, after the trial operation of all distributed tasks is completed, the DM component can obtain the management result of the text according to all trial operation results. In this way, when the slower recognizer in the NLU component has not started to operate or has not completed the operation, the tasks mapped by the intents obtained by the faster recognizer have been tried and even completed by the DM component.
[0095] Step 509, the mobile phone 100 controls the DM component to obtain the candidate task list according to all obtained trial operation results, sorts all tasks in the candidate task list to select at least one target task, and performs subsequent processing on the at least one target task to obtain the management result of the text to be processed.
[0096] In some embodiments, the trial result of one task can correspond to a confidence, which is used to represent the possibility of the user demand to perform the task on the input text and the possibility of the successful execution of the task. In turn, the DM component sorts all tasks in the candidate task list in the order of confidence from high to low, and takes the tasks other than the tasks with confidence less than a certain threshold (denoted as the first threshold) or the tasks with confidence greater than or equal to another threshold (denoted as the second threshold) as at least one target task. Wherein, the first threshold is less than the second threshold, and the specific values of the two thresholds can be determined according to actual needs, and the embodiments of the present application do not make any limitation on this.
[0097] Further, if the number of the target tasks is 1, the mobile phone 100 can directly execute the target task, and take the execution result of the task as the management result of the to-be-processed text, or prompt the user through the user interaction interface whether to execute the target task and execute the target task under the triggering of the user. For example, when the target task is the "audio" task corresponding to the text "the return of the great saint", the mobile phone 100 can directly play the music "the return of the great saint" sung by Zhang San through the "music APP 1". Or, the mobile phone 100 displays the prompt information "whether to play the music "the return of the great saint" sung by Zhang San?" through the user interaction interface, and after the user determines the operation on the prompt information, the mobile phone 100 plays the music "the return of the great saint" sung by Zhang San through the "music APP 1".
[0098] In addition, in some embodiments, when the DM component obtains multiple target tasks, the mobile phone 100 can also provide a user interaction interface to support the user to select one task from the multiple target tasks as the final task corresponding to the to-be-processed text, and then trigger the mobile phone 100 to execute the task selected by the user and take the processing result of the task as the management result of the to-be-processed text. For example, when the at least one target task includes the "audio" task and the "video" task corresponding to the text "the return of the great saint", the mobile phone 100 displays a task list including the two tasks through the user interaction interface to support the user to select one task as the final task of the text "the return of the great saint", and then execute the task.
[0099] In addition, continuing to refer to the scenario shown in Figure 4 , the time consumption of the subsequent processing is 20ms. Thus, Figure 4 , the total time consumption of the NLU component DM component in the scenario shown is 473ms.
[0100] In summary, in the embodiments of the present application, the total time consumption of the overall operation of the NLU component and the DM component depends on the time consumption of the process with the longest time consumption in the overall process of intent recognition by the NLU component and task trial operation by the DM component. For the same intent (or the intent package in which the intent is located), there are usually cases that the NLU component processes faster while the task trial operation of the DM component is slower, or the NLU component processes slower while the task trial operation of the DM component is faster, so that the asynchronous and parallel processing of the text by the task trial operation inside the NLU component and the DM component can reduce the total time consumption of the overall text processing of the NLU component and the DM component.
[0101] The embodiments of the present application can divide the above-mentioned electronic device into one or more modules according to the above-mentioned method examples. For example, each module can be divided according to each function, or two or more functions can be integrated in one processing module. The above-mentioned integrated module can be realized in the form of hardware or in the form of a software module. It should be noted that the division of the modules in the embodiments of the present application is illustrative, and is only a logical function division. When actually implemented, there can be another division manner.
[0102] Figure 6 A possible structural schematic diagram of the text processing apparatus provided in the above-mentioned embodiments is shown. The text processing apparatus can be an electronic device such as a mobile phone or a camera with a text processing function, or a CPU of the electronic device, or a control module in the electronic device for executing the above-mentioned text processing method.
[0103] As shown in Figure 6 The text processing apparatus 60 includes: an acquisition module 601 configured to acquire a text to be processed; an identification module 602 configured to identify, in parallel, intents of the text to be processed acquired by the acquisition module 601 under a plurality of intent types; a trial operation module 603 configured to, in a case that there is an identified intent under at least one intent type, perform a trial operation on a task corresponding to the identified intent identified by the identification module 602 in real time and generate a trial operation result until the intent recognition under the plurality of intent types is completed; and a management module 604 configured to generate a management result corresponding to the text to be processed according to the trial operation results of the intents under the plurality of intent types generated by the trial operation module 603. For example, the above-mentioned acquisition module 601 and identification module 602 can be realized by an NLU component, and the trial operation module 603 and the management module 604 can be realized by the above-mentioned DM component.
[0104] It can be understood that, Figure 6 The text processing apparatus 60 shown in Figure 6The text processing device 60 shown is described in detail above and will not be repeated here.
[0105] Similarly, in the embodiments of this application, the description of the speech processing apparatus that performs the speech processing method can refer to the above description of the text processing apparatus, and will not be described in detail here. For example, the speech processing apparatus may include some functional modules or units, such as a functional module for acquiring the speech to be processed.
[0106] According to embodiments of this application, an electronic device is provided. This electronic device may be a mobile phone, tablet, wearable device, or the like with text processing capabilities.
[0107] like Figure 7 The diagram shown is a structural schematic of an electronic device 100 provided in an embodiment of this application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0108] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0109] The processor 110 can include one or more processing units such as: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices or integrated in one or more processors.
[0110] The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.
[0111] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can store instructions or data that have just been used or are in a loop by the processor 110. If the processor 110 needs to use the instructions or data again, it can directly call from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system. For example, the processor 110 is used to execute the functions of the NLU component and the DM component described above, that is, to implement the asynchronous parallel execution of the text processing process of the intent recognition process in the NLU component and the task trial run process in the DM component.
[0112] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.
[0113] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example: the antenna 1 can be multiplexed as a diversity antenna of a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0114] The mobile communication module 150 can provide a solution including 2G / 3G / 4G / 5G, etc. wireless communication applied to the electronic device 100. The mobile communication module 150 can include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive an electromagnetic wave by the antenna 1, and perform filtering, amplification, etc. on the received electromagnetic wave, and transfer to a modem processor for demodulation. The mobile communication module 150 can also amplify a signal modulated by the modem processor, and radiate as an electromagnetic wave through the antenna 1. In some embodiments, at least part of the function modules of the mobile communication module 150 can be disposed in the processor 110. In some embodiments, at least part of the function modules of the mobile communication module 150 can be disposed in the same device as at least part of the modules of the processor 110.
[0115] The electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.
[0116] The display screen 194 is used to display images, videos, etc., such as a user interface in the above text processing process, which includes prompt information prompting the user to perform a target task, and task list information supporting the user to select a final executed task corresponding to the text to be processed, etc. The display screen 194 includes a display panel.
[0117] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor, etc.
[0118] The ISP is used to process data fed back by the camera 193. For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. The ISP can also optimize the algorithm of the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature, etc. of the shooting scene. In some embodiments, the ISP can be disposed in the camera 193.
[0119] The camera 193 is configured to capture still images or videos. An object projects an optical image through a lens to a photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into a standard RGB, YUV, or the like format image signal. In some embodiments, the electronic device 100 can include one or N cameras 193, where N is a positive integer greater than one.
[0120] The external memory interface 120 can be configured to connect an external memory card, such as a Micro SD card, to extend the storage capability of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, music, video, and the like files can be saved in the external memory card.
[0121] The internal memory 121 can be configured to store computer executable program codes including instructions, such as the NLU component intent recognition result in the above text processing process, and the trial run result of each task in the DM component, and the like. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, and the like), and the like. The data storage area can store data (such as audio data, a phonebook, and the like) created during the use of the electronic device 100, and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can further include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like. The processor 110 executes various function applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory disposed in the processor.
[0122] The electronic device 100 can implement an audio function through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. For example, music playing, recording, and the like.
[0123] The audio module 170 is configured to convert digital audio information into an analog audio signal output, and to convert an analog audio input into a digital audio signal, for example, outputting an audio corresponding to the text "Da Sheng Gui Lai" when the text "Da Sheng Gui Lai" is processed. The audio module 170 can also be configured to encode and decode audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some of the functions of the audio module 170 can be disposed in the processor 110.
[0124] The speaker 170A, also referred to as a "loudspeaker", is configured to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A. For example, the speaker 170A is configured to output an audio corresponding to the text "Da Sheng Gui Lai".
[0125] The receiver 170B, also referred to as a "earpiece", is configured to convert an audio electrical signal into a sound signal. When the electronic device 100 receives a call or a voice message, the receiver 170B can be placed close to a user's ear to receive the voice.
[0126] The microphone 170C, also referred to as a "microphone", "microphone", is configured to convert a sound signal into an electrical signal. When making a call or sending a voice message, a user can speak into the microphone 170C by placing the user's mouth close to the microphone 170C to input a sound signal into the microphone 170C, for example, supporting the user to speak a voice corresponding to the text processing process, such as the voice "Da Sheng Gui Lai". The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, in addition to collecting sound signals, it can also achieve noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C, which can collect sound signals, reduce noise, and also identify the source of the sound, and achieve directional recording function, etc.
[0127] The earphone interface 170D is configured to connect a wired earphone. The earphone interface 170D can be a USB interface 130, or a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0128] The keys 190 include a power key, a volume key, etc. The keys 190 can be mechanical keys. They can also be touch keys. The electronic device 100 can receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0129] The motor 191 can generate a vibration prompt.
[0130] The indicator 192 can be an indicator light, which can be used to indicate the charging status, the power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0131] The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into or pulled out of the SIM card interface 195 to realize contact and separation with the electronic device 100.
[0132] Embodiments of the mechanisms disclosed herein can be implemented in hardware, software, firmware, or any combination thereof. Embodiments of the application can be implemented as computer programs or program code on programmable systems that include at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0133] Program code can be applied to input instructions to perform the functions described herein and generate output information. The output information can be applied to one or more output devices, which can be known. For the purposes of this application, a processing system includes any system that has a processor, such as a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0134] Program code can be implemented in a high-level programming language or an object-oriented programming language to communicate with a processing system. When necessary, program code can also be implemented in assembly or machine language. In fact, the mechanisms described herein are not limited to any specific programming language. In any case, the language can be a compiled or interpreted language.
[0135] In some cases, the disclosed embodiments can be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments can also be implemented as instructions carried by or stored on a transitory or non-transitory machine-readable (e.g., computer-readable) medium, which can be read and executed by one or more processors. For example, the instructions can be downloaded from a network or by way of another computer readable medium. Thus, a machine-readable medium can include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer), including without limitation floppy disks, optical disks, optical disks, compact discs, read-only memory (CD-ROMs), magnetic disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic or optical cards, flash memory, or a tangible, machine-readable storage used in the transmission of information over the Internet with a propagated signal in electronic, electromagnetic, or optical form, such as carrier waves, infrared signals digital signals, etc. Accordingly, a machine-readable medium includes any type of medium suitable for storing or transmitting electronic instructions or information in a form readable by a machine (e.g., a computer).
[0136] In the drawings, some of the structural or methodological features can be shown in particular arrangements and / or orders. However, it should be understood that such particular arrangements and / or orders can not be required. Instead, these features can be arranged in a different manner and / or order than shown in the illustrative figures, in some embodiments. Additionally, the inclusion of a structural or methodological feature in a particular figure is not meant to imply that such feature is required in all embodiments, and in some embodiments, these features can not be included or can be combined with other features.
[0137] It should be noted that each unit / module mentioned in the device embodiments of the present application is a logical unit / module, in physical, one logical unit / module can be one physical unit / module, also can be a part of one physical unit / module, also can be realized in combination of multiple physical unit / modules, the physical realization of these logical units / modules is not the most important, the combination of the functions realized by these logical units / modules is the key to solve the technical problems proposed in the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce the units / modules which are not closely related to solving the technical problems proposed in the present application, which does not mean that the above-mentioned device embodiments do not have other units / modules.
[0138] It has to be noted that, in the description of the application and in the claims the terms "including" and "having" and the like are used in the sense of "including at least the recited entity or entities, but not excluding others". Furthermore, the terms "first", "second" and the like are used merely as labels, i.e. they are used to distinguish between two entities that have the same or similar characteristics, but do not necessarily indicate a particular order or sequence. Moreover, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a", "comprising", or "comprises" does not, without more constraints, preclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0139] While the application has been illustrated and described in detail in the drawings and foregoing description, such illustration and description are to be considered illustrative or exemplary and not restrictive; the application is not limited to the disclosed embodiments.
Claims
1. A text processing method characterized by, The method comprises: acquiring a text to be processed; identifying intents of the text to be processed in multiple intent types in parallel; in a case where an intent is identified in at least one intent type, performing a trial run on a task corresponding to the identified intent in real time and generating a trial run result until intent identification in the multiple intent types is completed, wherein the intent in the at least one intent type is identified by a first component, the identified intents in each intent type form an intent package, the identified intent package is received, the task trial run and the management result generation are performed by a second component, the first component is implemented based on natural language understanding (NLU), and the second component is implemented based on dialogue management (DM); controlling a value of a first counting parameter to be counted when an intent package is identified in one intent type by the first component; stopping counting of the second counting parameter by the second component in a case where a value of the second counting parameter is equal to a target value, and generating a management result corresponding to the text to be processed according to the trial run results of the intents in the multiple intent types, wherein the target value is used to indicate a total number of the intent packages received by the second component, the first counting parameter is used to indicate a number of the intent packages identified in real time by the text to be processed, and the second counting parameter is used to count a number of the intent packages received by the second component.
2. The method of claim 1, wherein, The method comprises: in a case where an intent is identified in the at least one intent type, performing a trial run on multiple tasks corresponding to the identified intent in real time and generating a trial run result in parallel.
3. The method of claim 2, wherein, The method comprises: in a case where an intent package is identified in the at least one intent type, performing a trial run on multiple tasks corresponding to the intents in the identified intent package in real time and generating a trial run result; wherein each intent package comprises at least one intent.
4. The method of claim 3, wherein, The method comprises: in a case where an intent package is identified in the at least one intent type by the first component, sending the identified intent package to the second component by the first component; performing a trial run on the tasks corresponding to the intents in the identified intent package in parallel by the second component and generating a trial run result; wherein the first component is used to identify intents of a text, and the second component is used to generate a management result of the text according to the intents of the text.
5. The method of claim 4, wherein, The method further comprises: when the process of identifying the text to be processed in the multiple intent types by the first component is completed, setting a value of the first counting parameter as the target value. If an intent package under the last one of the plurality of intent types is identified through the first component, the target value is added to the identified intent package under the last one of the plurality of intent types; If an intent package under the last one of the plurality of intent types is not identified through the first component, the target value is sent to the second component through the first component.
6. The method of claim 5, wherein, Further comprising: controlling a second counting parameter to count when an identified intent package under one of the plurality of intent types is received in real time through the second component.
7. The method of claim 6, wherein, Further comprising: when the process of identifying the text to be processed under the plurality of intent types through the first component is completed, if an intent package under the last one of the plurality of intent types is identified, adding a target identifier to the identified intent package under the last one of the plurality of intent types through the first component; wherein the target identifier is used to indicate to the second component that the received intent package is the last one of the to-be-received intent packages.
8. The method of claim 7, wherein, Before generating the management result corresponding to the text to be processed according to the trial run results of the generated intents under the plurality of intent types, further comprising: when the target identifier is included in the intent package received in real time through the second component, determining that the intent package received in real time through the second component is the last one of the to-be-received intent packages.
9. A voice processing method, characterized by, Comprising: obtaining a to-be-processed voice; converting the to-be-processed voice into text; processing the text according to the text processing method of any one of claims 1 to 8 to obtain a management result of the text; responding to the to-be-processed voice based on the management result of the text.
10. A text processing method applied to an electronic device including a Natural Language Understanding (NLU) component and a Dialogue Management (DM) component, characterized in that, Comprising: obtaining a to-be-processed text through the NLU component; identifying intents of the to-be-processed text under a plurality of intent types through a plurality of recognizers running in parallel through the NLU component, the plurality of recognizers corresponding to the plurality of intent types one by one; in the case that an intent is identified under at least one of the plurality of intent types, performing trial run on a task corresponding to the identified intent in real time through the DM component and generating a trial run result until the intent identification under the plurality of intent types is completed, the intent under the at least one of the plurality of intent types being identified by the NLU component, the identified intent under each of the plurality of intent types forming an intent package, and the intent package in which the identified intent is located being received, task trial run and management result generation by the DM component; controlling a value of a first counting parameter to count when an intent package under one of the plurality of intent types is identified through the NLU component; stopping counting the second counting parameter through the DM component when a value of the second counting parameter determined through the DM component is equal to a target value, and generating a management result corresponding to the to-be-processed text according to trial run results of the generated intents under the plurality of intent types through the DM component, wherein the target value is used to indicate a total number of intent packages received by the DM component, the first counting parameter is used to indicate a number of intent packages identified in real time by the to-be-processed text, and the second counting parameter is used to count a number of intent packages received by the DM component.
11. The method of claim 10, wherein, the running, by the DM component, the tasks corresponding to the identified intents in real time and generating the running results comprises: the running, by the DM component, the tasks corresponding to the identified intents in real time and generating the running results comprises:
12. The method of claim 11, wherein, the running, by the DM component, the tasks corresponding to the identified intents in real time and generating the running results comprises: the running, by the DM component, the tasks corresponding to the identified intents in real time and generating the running results comprises: wherein each of the intent packages includes at least one intent.
13. The method of claim 12, wherein, further comprising: the sending, by the NLU component, the intent package identified in real time to the DM component when the intent package is identified in the at least one intent type.
14. The method of claim 13, wherein, further comprising: the adding the target value to the intent package identified in the last intent type when the intent package in the last intent type is identified by the NLU component; the sending, by the NLU component, the target value to the DM component separately when the intent package in the last intent type is not identified by the NLU component. further comprising:
15. The method of claim 14, wherein, the counting, by the second counting parameter, when the intent package is received by the DM component in real time. further comprising:
16. The method of claim 15, wherein, the adding, by the NLU component, the target identifier in the intent package identified in the last intent type when the intent package in the last intent type is identified by the NLU component. wherein the target identifier is used to indicate to the DM component that the received intent package is the last one to be received. the generating the management result corresponding to the text to be processed according to the running results of the intents in the generated intent types further comprises:
17. The method of claim 16, wherein, the determining that the intent package received by the DM component in real time is the last one to be received when the target identifier is included in the intent package received by the DM component in real time. the electronic device includes a natural language understanding (NLU) component and a dialog management (DM) component.
18. An electronic device, comprising: The NLU component is configured to obtain the to-be-processed text, and identify intents of the to-be-processed text in multiple intent types in parallel, wherein the intents in at least one intent type are identified by the first component, the identified intents in each intent type form an intent package, and the intent package in which the identified intents are located is received, task trial operation, and management result generation by the second component; when the intent package in one intent type is identified by the NLU component, the value of the first counting parameter is controlled to be counted; The DM component is configured to, in a case where the intents in at least one intent type are identified, perform trial operation on the task corresponding to the intents identified by the NLU component in real time and generate a trial operation result until the intent identification of the multiple intent types is completed; and in a case where the value of the second counting parameter is equal to a target value by the DM component, stop counting the second counting parameter, and generate a management result corresponding to the to-be-processed text according to the generated trial operation result of the intents in the multiple intent types, wherein the target value is used to indicate the total number of the intent packages received by the DM component, the first counting parameter is used to indicate the number of the intent packages identified in real time by the to-be-processed text, and the second counting parameter is used to count the number of the intent packages received by the DM component.
19. A readable storage medium, characterized by, The readable storage medium has instructions stored thereon, and the instructions, when executed on a computer, cause the computer to perform the text processing method in any one of claims 1 to 8, or the speech processing method in claim 9, or the text processing method in any one of claims 10 to 17.
20. An electronic device, comprising: The readable storage medium has instructions stored thereon, and the instructions, when executed on a computer, cause the computer to perform the text processing method in any one of claims 1 to 8, or the speech processing method in claim 9, or the text processing method in any one of claims 10 to 17. The readable storage medium has instructions stored thereon, and the instructions, when executed on a computer, cause the computer to perform the text processing method in any one of claims 1 to 8, or the speech processing method in claim 9, or the text processing method in any one of claims 10 to 17. The readable storage medium has instructions stored thereon, and the instructions, when executed on a computer, cause the computer to perform the text processing method in any one of claims 1 to 8, or the speech processing method in claim 9, or the text processing method in any one of claims 10 to 17.
Citation Information
Patent Citations
Semantic decision method and system
CN109408799A