A voice processing method, electronic device and storage medium
By performing natural language processing after the silence duration reaches the preset pause duration, and determining the validity of the processing results when the silence ends, the problem of low voice processing efficiency in the existing technology is solved and a faster response is achieved.
Patent Information
- Application Number
- CN202110505349.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-10
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-05-10
AI Technical Summary
In the existing technology, voice processing efficiency is low, resulting in a long time response to the user's voice, which reduces the user experience. This is mainly because it takes a long time to detect the end of the user's voice, and natural language processing also requires a certain amount of time.
Continuous collection of voice data is used, and natural language processing is performed after the silence duration reaches the preset voice pause duration. If the silence duration reaches the preset voice end duration, the processing result is determined to be valid. Otherwise, the processing result is considered invalid, thus saving natural language processing. time consuming.
It improves the efficiency of voice processing, reduces the processing time for voice responses issued by users, and improves the user experience.
Smart Images

Figure CN113241071B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a speech processing method, electronic equipment and storage medium. Background Art
[0002] In human-computer interaction scenarios, users can send control instructions, service requests, etc. to interactive devices through voice, and the interactive devices can respond to the voices issued by users, thereby improving the convenience of human-computer interaction.
[0003] In the related art, the voice data of the user's voice can be collected, and the collected voice data can be subjected to voice recognition to obtain text data. After detecting that the user has finished speaking, natural language processing is performed on the text data, and then the processing result is used to respond to the user's voice.
[0004] Although the above solution can respond to the voice of the user, natural language processing will not start until it is detected that the user has finished speaking. It takes a long time to detect that the user has finished speaking, and it takes time to perform natural language processing after detecting that the voice has ended. As a result, it takes a long time to respond to the voice of the user, the voice processing efficiency is low, and the user experience is reduced. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a speech processing method, an electronic device and a storage medium to improve speech processing efficiency. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a speech processing method, the method comprising:
[0007] Continuously collecting voice data and obtaining text data obtained by performing voice recognition on the continuously collected voice data;
[0008] Perform silence detection on continuously collected voice data;
[0009] After the silence duration reaches a preset voice pause duration, natural language processing is performed on the obtained text data to obtain a processing result;
[0010] In the case where the silence duration reaches the preset voice pause duration and does not reach the preset voice end duration, if the silence end is detected, determining that the processing result is invalid, wherein the preset voice end duration is greater than the preset voice pause duration;
[0011] After the silence duration reaches the preset voice end duration, the processing result is determined as a response result for the continuously collected voice data.
[0012] In one embodiment of the present application, if the end of silence is detected, determining that the processing result is invalid includes: if the end of silence is detected, and the next text data is different from the reference text data, determining that the processing result is invalid, wherein the next text data is: the text data obtained by performing speech recognition on the continuously collected voice data when the silence duration is detected to reach the preset voice pause duration next time, and the reference text data is: the text data based on which the processing result is obtained;
[0013] After the silence duration reaches a preset voice pause duration, natural language processing is performed on the obtained text data to obtain a processing result, including: after the silence duration reaches a preset voice pause duration, if the next text data is inconsistent with the reference text data, natural language processing is performed on the obtained text data to obtain a processing result.
[0014] In one embodiment of the present application, the natural language processing of the obtained text data to obtain the processing result includes: detecting whether the obtained text data is complete; if the obtained text data is complete, performing natural language processing on the obtained text data to obtain the processing result.
[0015] In one embodiment of the present application, the detection of whether the obtained text data is complete includes: for each character in the text data, obtaining the probability of occurrence of the character, wherein the probability of occurrence of each character is: the probability of the character appearing after a reference character and appearing at the current position, and the reference character is: a preset number of characters before the character; based on the probability of occurrence of each character in the text data, obtaining the probability of occurrence of the text data; when the probability of occurrence of the text data reaches a preset probability threshold, determining that the text data is complete.
[0016] In one embodiment of the present application, for each character in the text data, obtaining the occurrence probability of the character includes: for each character in the text data, determining the first number of occurrences of a first consecutive character in a preset text corpus, and determining the second number of occurrences of a second consecutive character in the text corpus; based on the first number and the second number, calculating the occurrence probability of the character, wherein the second consecutive characters include: the preset number of characters before the character in the text data, and the first consecutive characters include: the second consecutive characters and the character.
[0017] In one embodiment of the present application, when the probability of occurrence of the text data reaches a preset probability threshold, determining that the text data is complete includes: determining a target number of characters of the text data; determining the probability threshold corresponding to the target number of characters from a preset correspondence between the number of characters and the probability threshold; and determining that the text data is complete when the probability of occurrence of the text data reaches the determined probability threshold.
[0018] In one embodiment of the present application, obtaining the occurrence probability of the text data according to the occurrence probability of each character in the text data includes: calculating the product of the occurrence probabilities of each character in the text data as the occurrence probability of the text data.
[0019] In one embodiment of the present application, the performing silence detection on the continuously collected voice data includes:
[0020] Detect low-amplitude data in the continuously collected voice data, and record the duration of the detected low-amplitude data, wherein the low-amplitude data is: voice data with a signal amplitude lower than a preset amplitude threshold.
[0021] In a second aspect, an embodiment of the present application provides an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement any method step described in the first aspect when executing the program stored in the memory.
[0022] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.
[0023] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any of the above-mentioned speech processing methods.
[0024] Beneficial effects of the embodiments of the present application:
[0025] In the speech processing scheme provided by the embodiment of the present application, speech data is continuously collected, and text data obtained by speech recognition of the continuously collected speech data is obtained; silence detection is performed on the continuously collected speech data; after the silence duration reaches the preset speech pause duration, natural language processing is performed on the obtained text data to obtain a processing result; when the silence duration reaches the preset speech pause duration and does not reach the preset speech end duration, if the silence ends, the processing result is determined to be invalid, wherein the preset speech end duration is greater than the preset speech pause duration; after the silence duration reaches the preset speech end duration, the processing result is determined as a response result for the continuously collected speech data. In this way, after the silence duration reaches the preset speech pause duration, natural language processing can be performed on the text data corresponding to the collected speech data, and the above-mentioned natural language processing result can be obtained in the process of waiting for the silence duration to reach the preset speech end duration. After the silence duration reaches the preset speech end duration, it is considered that the speech ends. In this case, since the processing result has been obtained, the speech data can be directly responded to based on the above-mentioned processing result, saving the time of natural language processing. It can be seen that the application of the solution provided in the embodiment of the present application can improve the efficiency of speech processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0027] Figure 1 A flowchart of a speech processing method provided in an embodiment of the present application;
[0028] Figure 2 A schematic diagram of the amplitude of a voice data signal provided in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of the amplitude of another voice data signal provided in an embodiment of the present application;
[0030] Figure 4 A flowchart of a text data detection method provided in an embodiment of the present application;
[0031] Figure 5 A flowchart of another speech processing method provided in an embodiment of the present application;
[0032] Figure 6 A schematic diagram of a signaling interaction for natural language processing provided in an embodiment of the present application;
[0033] Figure 7 Another signaling interaction diagram of natural language processing provided in an embodiment of the present application;
[0034] Figure 8 A schematic diagram of a speech processing time node provided in an embodiment of the present application;
[0035] Fig. 9 A schematic diagram of the structure of a speech processing device provided in an embodiment of the present application;
[0036] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0038] In order to improve the efficiency of speech processing, the embodiments of the present application provide a speech processing method, an electronic device and a storage medium, which are respectively introduced in detail below.
[0039] See also Figure 1 , Figure 1 The following is a flow chart of a speech processing method provided in an embodiment of the present application. The method can be applied to speech interaction devices, such as mobile phones, platform computers, electronic computers, vehicle-mounted computers and other electronic devices. The above-mentioned speech processing method can include the following steps S101-S105:
[0040] S101, continuously collecting voice data, and obtaining text data obtained by performing voice recognition on the continuously collected voice data.
[0041] The voice data may be the user's voice data or the voice data emitted by an electronic device.
[0042] Specifically, a voice collection device may be used to continuously collect voice data, and then voice recognition may be performed on the collected voice data to obtain text data. The voice collection device may be a microphone, a pickup, or the like.
[0043] In one embodiment of the present application, when collecting voice data, a voice collection device can be driven to collect voice.
[0044] When collecting voice data, the voice data can be collected according to preset voice collection parameters.
[0045] The above-mentioned voice acquisition parameters may include sampling rate, bit width, number of channels, etc. The above-mentioned sampling rate indicates: the number of times voice data is collected per unit time, for example, it can be 16000Hz, 20000Hz, 30000Hz, etc. The bit width indicates the number of bits of the collected voice data, for example, it can be 8bit, 16bit, etc. The number of channels indicates the number of channels when collecting voice data, which can be understood as the number of voice acquisition devices used when collecting voice data, for example, it can be single channel, dual channels, four channels, etc.
[0046] In one embodiment of the present application, when performing speech recognition on speech data, a statistical model can be used to implement speech recognition, and the above model can be a statistical model based on GMM-HMM (Gaussian Mixed Model-Hidden Markov Model);
[0047] Speech recognition can also be achieved using a neural network model, and the above model can be a network model based on DNN-HMM (Deep Neural Networks-Hidden Markov Model).
[0048] In one embodiment of the present application, voice data can be collected continuously; or voice data can be collected continuously after receiving a voice collection instruction. For example, voice data can be collected continuously after detecting that a user selects a voice collection button, or after detecting a wake-up voice clip. The above wake-up voice clip can be "hey, siri", "Xiaoyi Xiaoyi", etc.
[0049] Correspondingly, after receiving the voice stop command, the continuous collection of voice data can be stopped. For example, the continuous collection of voice data can be stopped after detecting that the user selects the voice stop button, or the continuous collection of voice data can be stopped after detecting a stop voice segment. The above-mentioned stop voice segment can be "end", "over", etc.
[0050] S102: Perform silence detection on the continuously collected voice data.
[0051] Specifically, VAD (Voice Activity Detection) silence detection may be continuously performed on the collected voice data to obtain the silence duration of continuous silence of the collected voice data.
[0052] In one embodiment of the present application, low-amplitude data in continuously collected voice data may be detected, and the duration of the detected low-amplitude data may be recorded.
[0053] Among them, low amplitude data refers to speech data whose signal amplitude is lower than a preset amplitude threshold. The preset amplitude threshold may be a value set based on experience or experiment. The value of the preset amplitude threshold is related to the application scenario. When the noise in the application scenario is large, the value of the preset amplitude threshold is high. When the noise in the application scenario is small, the value of the preset amplitude threshold is low.
[0054] Specifically, the amplitude of the signal of the collected voice data can be obtained, see Figure 2 , Figure 2 A schematic diagram of the amplitude of a voice data signal provided in an embodiment of the present application, in the case of speaking, the signal amplitude of the collected voice data is higher, and in the case of stopping speaking, the signal amplitude of the collected voice data is lower. When the amplitude of the voice data signal is lower than the preset amplitude threshold, it can be understood that it is currently in a silent state, so the low-amplitude data whose signal amplitude in the collected voice data is lower than the preset amplitude threshold can be detected, and the duration of the above low-amplitude data is determined as the silent duration.
[0055] In addition, in one embodiment of the present application, silence detection can also be performed based on the signal strength and energy of the collected voice data. For example, when the signal energy of the collected voice data is lower than a preset energy threshold, it is considered to be in a silent state.
[0056] S103, after the silence duration reaches a preset voice pause duration, natural language processing is performed on the obtained text data to obtain a processing result.
[0057] The preset voice pause time is used to determine the time when the suspected voice ends. The preset voice pause time may be 50 milliseconds, 100 milliseconds, 200 milliseconds, etc.
[0058] Specifically, when the silence duration obtained by silence detection reaches the above-mentioned preset speech pause duration, it is considered that the speech may have ended, so natural language processing can be performed on the obtained text data.
[0059] Among them, natural language processing includes intent recognition, word slot extraction and subsequent business processing. The above-mentioned intent recognition refers to the service request expected by the collected voice data based on text data recognition, word slot extraction refers to the keywords of the above-mentioned service request, and business processing refers to obtaining the processing results for responding to the request based on the above-mentioned keywords.
[0060] For example, assuming that the text data obtained by voice recognition of the collected voice data is "Today's weather in Shanghai", then through intent recognition, it can be concluded that the service request expected by the above voice data is to query the weather, and the word slot extraction can obtain the time keyword "today" and the location keyword "Shanghai", and the business processing can query the weather in Shanghai today, and use the query result as the processing result for responding to the above voice data. In addition, the above business processing can also encapsulate the processing result into a format acceptable to the user, so as to facilitate the subsequent feedback of the processing result to the user.
[0061] S104: When the silence duration reaches the preset voice pause duration and does not reach the preset voice end duration, if the silence end is detected, it is determined that the processing result is invalid.
[0062] The preset voice end time is greater than the preset voice pause time. The preset voice end time is used to determine the duration of voice end. The preset voice end time can be 650 milliseconds, 700 milliseconds, 800 milliseconds, etc.
[0063] Specifically, when the silence duration reaches the above-mentioned preset voice pause duration and does not reach the preset voice end duration, if the end of silence is detected, it means that the user has resumed speaking after the pause. In this case, it means that the text data obtained in S101 is incomplete, and thus the processing result of the self-recognized language processing obtained based on the incomplete text data in S103 is also inaccurate, and it is necessary to continue voice recognition. Therefore, it can be determined that the above-mentioned inaccurate processing result is invalid, and no response will be made based on the processing result in the future. And based on S101, the voice data can continue to be collected, and the text data corresponding to the collected and continuous voice data can be obtained. When it is detected again that the silence duration reaches the preset voice pause duration, the text data corresponding to the collected and continuous voice data can be re-processed with natural language, and the content in the text data based on which the natural language processing is based this time includes the content in the previous text data.
[0064] In one embodiment of the present application, when the silence duration reaches a preset voice pause duration and does not reach a preset voice end duration, if the end of silence is detected, the silence duration can be reset to zero, so as to facilitate subsequent re-detection of the duration of silence.
[0065] S105, after the silence duration reaches the preset voice end duration, determining the processing result as a response result for the continuously collected voice data.
[0066] Specifically, when the silence time reaches the end of the voice, it can be considered that the user has finished speaking. The previously collected voice data contains the user's complete speech content, and since the natural language processing result has been obtained based on the text data corresponding to the collected voice, the above processing result can be directly used as the response result of the collected voice data.
[0067] See also Figure 3 , Figure 3 A schematic diagram of the amplitude of another voice data signal provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, when the amplitude of the signal of the voice data is detected to be less than the preset amplitude threshold, it can be considered to be in a silent state, and the silence duration of the silent state is determined. When the silence duration does not reach the preset voice end duration, it can be considered that a pause has occurred in the continuous voice, but it has not ended. Only when the silence duration reaches the above-mentioned preset voice end duration, the voice is considered to have ended.
[0068] In the speech processing scheme provided in the above embodiment, speech data is continuously collected, and text data obtained by speech recognition of the continuously collected speech data is obtained; silence detection is performed on the continuously collected speech data; after the silence duration reaches the preset speech pause duration, natural language processing is performed on the obtained text data to obtain a processing result; when the silence duration reaches the preset speech pause duration and does not reach the preset speech end duration, if the silence ends, the processing result is determined to be invalid, wherein the preset speech end duration is greater than the preset speech pause duration; after the silence duration reaches the preset speech end duration, the processing result is determined as a response result for the continuously collected speech data. In this way, after the silence duration reaches the preset speech pause duration, natural language processing can be performed on the text data corresponding to the collected speech data, and the above natural language processing result can be obtained in the process of waiting for the silence duration to reach the preset speech end duration. After the silence duration reaches the preset speech end duration, it is considered that the speech ends. In this case, since the processing result has been obtained, the speech data can be directly responded to based on the above processing result, saving the time of natural language processing. It can be seen that the application of the solution provided by the above embodiment can improve the efficiency of speech processing.
[0069] In one embodiment of the present application, for the above step S104, when determining that the processing result is invalid, it may be: if the end of silence is detected and the next text data is different from the reference text data, the processing result is determined to be invalid.
[0070] Among them, the next text data is: the text data obtained by voice recognition of the continuously collected voice data when the silence duration reaches the preset voice pause duration next time, and the reference text data is: the text data based on which the processing result is obtained.
[0071] In the above case, after the silence duration reaches the preset voice pause duration, if the next text data is inconsistent with the reference text data, natural language processing is performed on the obtained text data to obtain a processing result.
[0072] Specifically, when the silence duration reaches a preset voice pause duration and does not reach a preset voice end duration, if the end of silence is detected, the currently obtained processing result may be temporarily determined to be invalid, but voice data continues to be collected and silence detection is performed, and when the silence duration reaches the preset voice pause duration next time, the next text data obtained by performing voice recognition on the continuously collected voice data is obtained, and it is determined whether the next text data is consistent with the reference text data based on which the current processing result is obtained;
[0073] If they are inconsistent, natural language processing can be performed based on the next text data to obtain a new processing result, and the current processing result is no longer needed, so it can be determined that the current processing result is invalid;
[0074] If they are consistent, it means that the speech data collected later may be noise data, and the natural language processing result obtained based on the next text data is the same as the natural language processing result obtained based on the reference text data. Therefore, there is no need to perform natural language processing on the next text data again. Instead, the current processing result can be used directly. Therefore, it can be determined that the current processing result is invalid.
[0075] In the above scheme, when the silence duration reaches the preset speech pause duration and does not reach the preset speech end duration, the current text data can be compared with the text data obtained based on the continuous speech data. If the comparison is consistent, the natural language processing result corresponding to the current text data can be directly used without repeating the natural language processing, thereby saving computing resources.
[0076] In one embodiment of the present application, when performing natural language processing on text data, it can be detected whether the obtained text data is complete; if the obtained text data is complete, natural language processing is performed on the obtained text data to obtain a processing result.
[0077] Specifically, before performing natural language processing on the text data corresponding to the collected speech data, it is possible to first detect whether the above-mentioned text data is complete. If it is complete, it indicates that the text data obtained based on the collected speech data can reflect the user's intention, and a complete word slot can be extracted based on this text data. Therefore, natural language processing can continue to be performed on this text data, and the processing result of natural language processing can be obtained by using the above-mentioned intention and word slot.
[0078] In one embodiment of the present application, in the case where the above-mentioned text data is incomplete, the text data can be discarded without performing natural language processing on the text data.
[0079] In addition, a prompt message can be generated to prompt the user that the text data is incomplete and to start speaking again.
[0080] See Figure 4 , Figure 4 FIG.
[0081] S401. For each character in the text data, obtain the occurrence probability of the character.
[0082] Among them, the occurrence probability of each character is: the probability that the character appears after the reference character and at the current position. The above-mentioned reference character is: a preset number of characters before the character. The above-mentioned preset number can be 1, 2, 3, 5, etc.
[0083] In one embodiment of the present application, the above-mentioned reference character can be: a preset number of adjacent characters before the character in the text data.
[0084] The occurrence probability of each character Xn can be expressed as P(Xn丨Xn-m……Xn-2,Xn-1), where m represents the preset number, and Xn-m……Xn-2,Xn-1 represents: a preset number of characters before Xn and adjacent to Xn.
[0085] Specifically, in a complete sentence, there is an association relationship between each character before and after. Based on the above-mentioned association relationship, the occurrence probability of each character can be calculated. The greater the occurrence probability of each character, the more reasonable the appearance of the character.
[0086] S402. According to the occurrence probabilities of the characters in the text data, obtain the occurrence probability of the text data.
[0087] In one embodiment of the present application, the product of the occurrence probabilities of each character in the text data can be calculated as the occurrence probability of the text data. The greater the occurrence probability of the text data, the more reasonable the text data is, and thus the higher the possibility that the text data is complete.
[0088] Among them, the probability of occurrence of text data P(x1,x2,x3,...,x n ) can be expressed as:
[0089] P(x1,x2,x3,...,x n )=P(x1)*P(x2)*P(x3)...*P(x n )
[0090] =P(x1)*P(x2|x1)*P(x3|x1,x2)...*P(x n |x n-m ...x n-2 ,x n-1 )
[0091] Among them, P(x1) represents the probability of occurrence of the first character x1 in the text data, which can be understood as the ratio of the number of occurrences of character x1 to the total number of occurrences of all characters. Correspondingly, P(x2) represents the probability of occurrence of character x2, P(x3) represents the probability of occurrence of character x3, and P(x n ) represents the character x n The probability of occurrence;
[0092] P(x2|x1) represents the probability that character x2 appears after reference character x1 and appears at the current position, that is, the probability of x1 appearing.
[0093] P(x3|x1,x2) represents the probability that character x3 appears after reference characters x1,x2 and at the current position, that is, the probability of occurrence of x3.
[0094] m represents the preset number. Assuming that the value of m is 2, the probability of occurrence of text data P(x1,x2,x3,...,x n ) can be expressed as:
[0095] P(x1,x2,x3,...,x n )=P(x1)*P(x2)*P(x3)...*P(x n )
[0096] =P(x1)*P(x2|x1)*P(x3|x1,x2)...*P(x n |x n-2 ,X n-1 )
[0097] The above P(x n |x n-2 ,X n-1 ) represents: the probability that the character x n appears after the reference character x n-2 ,X n-1 and at the current position, that is, the appearance probability of x n .
[0098] In one embodiment of the present application, when obtaining the appearance probability of text data, the arithmetic mean, maximum value, median value, etc. of the appearance probabilities of each character in the text data can also be determined as the appearance probability of the text data, and the embodiments of the present application do not limit this.
[0099] S403. When the appearance probability of the text data reaches a preset probability threshold, it is determined that the text data is complete.
[0100] Specifically, when the appearance probability of the text data reaches the above probability threshold, it is considered that the rationality of the text data is relatively high, and then it can be determined that the text data is complete.
[0101] In one embodiment of the present application, when obtaining the appearance probability of a character, for each character in the text data, the first number of times that a preset first consecutive character appears in a preset text corpus can be determined, and the second number of times that a second consecutive character appears in the text corpus can be determined; the appearance probability of the character is calculated according to the first number of times and the second number of times.
[0102] Among them, the above text corpus can be public text, such as novels, journals, papers, etc.
[0103] The second consecutive character includes: a preset number of characters before the character in the text data, and the first consecutive character includes: the second consecutive character and the character. In one embodiment of the present application, the above second consecutive character can be: a preset number of adjacent characters before the character in the text data. For example, assuming that the text data is "Excuse me, how do I get to the Forbidden City", and the preset number is 3, for the character "zen" in the above text data, the second consecutive character is the 3 adjacent characters "to the Forbidden City" before "zen", and the first consecutive character is "to the Forbidden City zen".
[0104] Specifically, for each character, the number of times that the character and a preset number of consecutive first consecutive characters before the character appear in the text corpus can be obtained as the first number of times, and the number of times that a preset number of consecutive second consecutive characters before the character appear can be obtained as the second number of times, and then the quotient obtained by dividing the first number of times by the second number of times is used as the appearance probability of the character.
[0105] In one embodiment of the present application, the number of times any preset number of consecutive characters appear in the text corpus can be obtained in advance, and the number of times any preset number + 1 consecutive characters appear can be obtained in advance. In this way, when obtaining the first number and the second number, the first number and the second number of occurrences of the first consecutive character and the second consecutive character can be respectively searched from the number of times obtained in advance above.
[0106] Assume that the total number of times all characters appear in the text corpus is N, and among them, the character x i appears n i times, then the probability of the character appearing is: n i / N. Assume that the character x j appears n j times, then the probability of the character appearing is n j / N. Assume that the number of times the character x j appears after the character x i is n z times. Then, in the case where x i appears, the probability P(x j |x i ) that x j appears after x i and appears at the current position is n z / n i .
[0107] Assume that the above preset number is 1. In the text corpus, there are characters such as "I", "dear", "motherland", "mother", etc. The number of occurrences of each of the above characters is shown in Table 1 below:
[0108] Table 1
[0109] character I relative like of Ancestor country mother Occurrence 2533 927 2417 746 158 1093 341
[0110] As shown in Table 1 above, the character "I" appears 2533 times, the character "dear" appears 927 times, and so on. The character "mother" appears 341 times.
[0111] Furthermore, the number of times each of the above characters appears together with any other character can be counted, and the number of times two characters appear together as shown in Table 2 below can be obtained:
[0112] Table 2
[0113]
[0114]
[0115] Among them, the value of each item in Table 2 above represents: the number of times the current character appears after the previous character appears.
[0116] As shown in Table 2 above, the character "我" appears 827 times before the character "亲", that is, "我亲" appears 827 times; for another example, the character "亲" appears 608 times before the character "爱", that is, "亲爱" appears 608 times.
[0117] After obtaining the number of times the two characters appear together as shown in Table 2 above, the probability that each character appears in the case where the previous character appears, after the previous character and at the current position can be calculated, that is, the appearance probability.
[0118] Among them, the appearance probability P(w i |w i ) of the character w i-1 ) can be calculated using the following formula:
[0119] P(w i |w i-1 ) = C(w i w i-1 ) / C(w i-1 )
[0120] Among them, w i-1 represents the previous character of the character w i , C(w i w i-1 ) represents the number of times the consecutive characters w i w i-1 appear, and C(w i-1 ) represents the number of times the character w i-1 appears.
[0121] Taking the character "爱" in Table 2 above as an example, the consecutive characters "亲爱" appear 608 times, that is, the first number is 608 times, and the character "亲" appears alone 927 times, that is, the second number is 927 times. Then the appearance probability P(爱|亲) of the character "爱" appearing after the character "亲" and at the current position is:
[0122] P(爱|亲) = 608 / 927 = 0.66
[0123] Taking the character "国" in Table 2 above as an example, the consecutive characters "祖国" appear 82 times, that is, the first number is 82 times, and the character "亲" appears alone 158 times, that is, the second number is 158 times. Then the appearance probability P(国|祖) of the character "国" appearing adjacent after the character "祖" is:
[0124] P(国|祖) = 82 / 158 = 0.52.
[0125] Based on the times shown in Table 2 above, the appearance probabilities corresponding to each character as shown in Table 3 below can be obtained:
[0126] Table 3
[0127]
[0128] Among them, the value of each item in the above Table 3 represents: the occurrence probability of the current character after the previous character appears.
[0129] In an embodiment of the present application, for the start character and end character in the text data, the probability of the above start character as the start and the probability of the end character as the end can also be obtained respectively according to the text corpus.
[0130] For example, assuming the text data is "My dear motherland", after adding the start identifier " <s> " and the end identifier "< / s> ", the above text data can be expressed as " <s> My dear motherland< / s> ".
[0131] Assume that the probabilities of the following characters as the start or end in the text corpus are respectively:
[0132] The probability of the character "我" as the start: P(我| <s>) = 0.25
[0133] Probability that the character "Qin" is at the end: P(< / s> |亲) = 0.058
[0134] The probability of the character "亲" as the start: P(亲| <s>) = 0.058
[0135] Probability that the character "country" is at the end: P(< / s> |国) = 0.01
[0136] The probability of the character "国" as the start: P(国|) = 0.01
[0137] The probability of the character "祖" as the end: P(|祖) = 0.01
[0138] The probability of the character "祖" as the start: P(祖|) = 0.01
[0139] Then the occurrence probability of the text data " <s> My dear motherland< / s> " can be expressed as:
[0140] P( <s> My dear motherland,< / s> )
[0141] = P(我| <s> )*P(darling|me)*P(love|darling)*P(of|love)*P(ancestor|of)*P(country|ancestor)*P(mother|country)*P(darling|mother)*P(< / s> |亲)
[0142] = C( <s>I) / C( <s> )*C(my dear) / C(I)*C(dear) / C(dear)*C(loved) / C(love)*C(ancestor) / C(of)*C(motherland) / C(ancestor)*C(mother of the country) / C(country)*C(mother) / C(mother)*C(mother< / s> ) / C(dear)
[0143] = 0.25 * 0.33 * 0.66 * 0.28 * 0.021 * 0.52 * 0.091 * 0.293
[0144] = 4.439e-6
[0145] Assume the text data is "dear motherland", and the occurrence probability of this text data is:
[0146] P( <s> My dear motherland,< / s> )
[0147] = P(dear| <s> )*P(love|dear)*P(love)*P(ancestor|of)*P(country|ancestor)*P(< / s> |motherland)
[0148] = C( <s>Parent) / C( <s> )*C(Dear) / C(Dear)*C(Loved) / C(Love)*C(Ancestor) / C(of)*C(Motherland) / C(Ancestor)*C(Country< / s> ) / C(Country)
[0149] = 0.058 * 0.66 * 0.28 * 0.021 * 0.52 * 0.01
[0150] = 1.17e-6
[0151] Correspondingly, assuming the text data is the ungrammatical "Dear Country Ancestor", the occurrence probability of this ungrammatical text data is:
[0152] P( <s> My dear country,< / s> )
[0153] = P(Parent| <s> )*P(love|dear)*P(love)*P(country|of)*P(motherland|country)*P(< / s> |Ancestor)
[0154] = C( <s>C( <s> )*C(Dear) / C(Dear)*C(Love) / C(Love)*C(Country) / C(Of)*C(National Ancestor) / C(Country)*C(Ancestor< / s> ) / C(ancestor)
[0155] =0.058*0.66*0.28*0.0027*0.00092*0.01
[0156] =2.662e-10
[0157] It can be seen that the probability of occurrence of the relatively fluent text data "Dear Motherland" is 1.17e-6, and the probability of occurrence of the incoherent text data "Dear Grandfather" is 2.662e-10. This shows that the probability of occurrence of a reasonable and fluent text is greater than that of an unreasonable and fluent text, and a reasonable and fluent text is usually a complete text. Therefore, the probability of occurrence of text data can be calculated. When the above probability is large, it is determined that the text data is complete.
[0158] In one embodiment of the present application, a language model may be used to calculate the occurrence probability of text data, and the language model may be a Hidden Markov Model.
[0159] The above hidden Markov model is a language model based on the probability relationship between characters before and after. The hidden Markov model assumes that the probability of each character appearing in the text is related to the preset number m of characters before the character, that is, the probability of the nth character x n The probability of occurrence is the same as the previous m characters x n-m ,...,x n-2 ,x n-1 The probability of occurrence of text data can be calculated using a joint probability chain. Each character is affected by the previous m characters, that is, the probability of each character is a conditional probability, and the probability of occurrence of text data is the product of the probability of occurrence of each character.
[0160] The value of the preset threshold m may be 2. In this case, the language model is a 3-gram (3rd order language model), and the occurrence probability of each character is only related to the 2 characters before the character.
[0161] In one embodiment of the present application, a text corpus can be used to perform statistical training on a third-order hidden Markov model to generate a 3-gram language model, and the 3-gram language model is used to perform joint probability calculation on the text data to obtain the occurrence probability of the text data.
[0162] The above-mentioned occurrence probability can reflect the completeness of the text data. When the occurrence probability of the text data reaches a preset probability threshold, the text data can be considered complete. Otherwise, the text data can be considered incomplete and there is no need to perform natural language processing on the text data, thereby saving computing resources.
[0163] The above probability threshold can be obtained based on experience or experiments, and a smaller probability threshold can be set to improve the coverage of text data for natural language processing.
[0164] In one embodiment of the present application, when judging whether text data is complete, the target number of characters of the text data can be determined; the probability threshold corresponding to the target number of characters can be determined from the preset correspondence between the number of characters and the probability threshold; and when the probability of occurrence of the text data reaches the determined probability threshold, the text data is determined to be complete.
[0165] Specifically, a preset correspondence between the number of characters and the probability threshold can be pre-set, so that when judging whether the text data is complete, the number of characters in the text data can be obtained, and then the probability threshold corresponding to the number of characters can be found from the above preset correspondence, as the probability threshold for judging whether the text data is complete, and then the calculated probability of occurrence of the text data is compared with the above-determined probability threshold. When the probability of occurrence of the text data reaches the determined probability threshold, it can be determined that the text data is complete.
[0166] In one embodiment of the present application, in the preset corresponding relationship, the number of characters may be negatively correlated with the probability threshold, that is, the more characters there are, the smaller the probability threshold; the fewer characters there are, the larger the probability threshold.
[0167] In addition, the above preset corresponding relationship can also be set according to experiments or experience. See Table 4 below, which is a schematic table of a preset corresponding relationship provided in an embodiment of the present application:
[0168] Table 4
[0169]
[0170] As shown in Table 4 above, when the number of characters in the text data is 7, the probability threshold for determining whether the text data is complete may be 3.00e-10.
[0171] See also Figure 5 , Figure 5 A flow chart of another speech processing method provided in an embodiment of the present application. Figure 5 As shown, the method includes the following steps S501-S509:
[0172] S501, continuously collecting voice data, and obtaining text data obtained by performing voice recognition on the continuously collected voice data.
[0173] S502: Perform silence detection on the continuously collected voice data.
[0174] S503, determine whether the silence duration reaches a preset voice pause duration, if yes, execute S504.
[0175] S504, checking whether the obtained text data is complete, if yes, executing S505, otherwise executing S509.
[0176] S505, performing natural language processing on the obtained text data to obtain a processing result.
[0177] S506, determining whether the silence duration reaches the preset voice end duration, if yes, executing S507, otherwise executing S508.
[0178] S507: Determine the processing result as a response result for the continuously collected voice data.
[0179] S508, determining that the processing result is invalid.
[0180] S509, discard the text data.
[0181] In one embodiment of the present application, an ASR (Automatic Speech Recognition) module can be used to drive a voice collection device to continuously collect voice data, and perform voice recognition on the collected voice data to obtain text data. In addition, the above-mentioned ASR module can also perform silence detection on the voice data.
[0182] In addition, a NLP (Natural Language Processing) module may be used to perform natural language processing on the text data recognized by the ASR module.
[0183] See also Figure 6 , Figure 6 A signaling interaction diagram of natural language processing provided in an embodiment of the present application. Figure 6 As shown:
[0184] Users can make voice calls;
[0185] The ASR module can continuously process voice data, and then perform speech recognition on the voice data to obtain text data;
[0186] The ASR module can also continuously perform silence detection. When it detects that the silence duration reaches the preset voice pause duration, the text data corresponding to the collected voice data can be sent to the NLP module.
[0187] After receiving the above text data, the NLP module can perform natural language processing on the text data to obtain a processing result;
[0188] In the above process, the ASR module continues to perform silence detection. If it detects that the silence duration reaches the preset speech end duration, it can notify the NLP module that the speech has ended.
[0189] After determining that the speech has ended, the processing result obtained by NLP natural language processing can be used to respond.
[0190] See also Figure 7 , Figure 7 Another signaling interaction diagram for natural language processing provided in an embodiment of the present application. Figure 7 As shown:
[0191] Users can make voice calls;
[0192] The ASR module can continuously process voice data, and then perform voice recognition on the voice data to obtain text data A;
[0193] The ASR module can also continuously perform silence detection. When it detects that the silence duration reaches the preset voice pause duration, the text data A corresponding to the collected voice data can be sent to the NLP module.
[0194] After receiving the above text data A, the NLP module can perform natural language processing on the text data A to obtain a processing result A;
[0195] In the above process, the ASR module continues to perform silence detection. If the silence ends when the silence duration does not reach the preset speech end duration, the ASR module can continue to perform speech recognition on the collected speech data.
[0196] When the silence duration reaches the preset voice pause duration again, the text data B corresponding to the collected continuous voice data is sent to the NLP module, and the content of the text data B includes the content of the text data A sent to the NLP module last time;
[0197] The NLP module can determine whether text data B is consistent with text data A. If they are inconsistent, the processing result A obtained by the previous natural language processing is discarded, and the natural language processing is performed again on the newly received text data B to obtain the processing result B;
[0198] In the above process, the ASR module continues to perform silence detection. If it detects that the silence duration reaches the preset speech end duration, it can notify the NLP module that the speech has ended.
[0199] After determining that the speech has ended, the processing result B obtained by NLP natural language processing can be used to respond.
[0200] In the speech processing solution provided in the above embodiment, speech data is continuously collected, and text data obtained by speech recognition of the continuously collected speech data is obtained; silence detection is performed on the continuously collected speech data; after the silence duration reaches the preset speech pause duration, natural language processing is performed on the obtained text data to obtain a processing result; when the silence duration reaches the preset speech pause duration and does not reach the preset speech end duration, if the silence ends, it is determined that the processing result is invalid, wherein the preset speech end duration is greater than the preset speech pause duration; after the silence duration reaches the preset speech end duration, the processing result is determined as a response result for the continuously collected speech data. Figure 8 , Figure 8 A schematic diagram of a speech processing time node provided in an embodiment of the present application. Figure 8 As shown, after the silence duration reaches the speech pause duration, the text data corresponding to the collected speech data can be processed by natural language. During the process of waiting for the silence duration to reach the speech end duration, the above natural language processing result can be obtained. After the silence duration reaches the speech end duration, it is considered that the speech ends. In this case, since the processing result has been obtained, the speech data can be directly responded to based on the above processing result, saving the time of natural language processing. It can be seen that the solution provided by the above embodiment can improve the efficiency of speech processing.
[0201] See also Fig. 9 , Fig. 9 A schematic diagram of the structure of a speech processing device provided in an embodiment of the present application, the device comprising:
[0202] The voice collection module 901 is used to continuously collect voice data and obtain text data obtained by performing voice recognition on the continuously collected voice data;
[0203] A silence detection module 902 is used to perform silence detection on the continuously collected voice data;
[0204] The language processing module 903 is used to perform natural language processing on the obtained text data after the silence duration reaches a preset voice pause duration to obtain a processing result;
[0205] A voice pause processing module 904 is used to determine that the processing result is invalid if the end of silence is detected when the silence duration reaches the preset voice pause duration and does not reach the preset voice end duration, wherein the preset voice end duration is greater than the preset voice pause duration;
[0206] The voice end processing module 905 is used to determine the processing result as a response result for the continuously collected voice data after the silence duration reaches the preset voice end duration.
[0207] In one embodiment of the present application, the voice pause processing module 904 is specifically used to: when the silence duration reaches the preset voice pause duration and does not reach the preset voice end duration, if the silence ends and the next text data is different from the reference text data, determine that the processing result is invalid, wherein the next text data is: the text data obtained by performing voice recognition on the continuously collected voice data when the silence duration is detected to reach the preset voice pause duration next time, and the reference text data is: the text data based on which the processing result is obtained;
[0208] The language processing module 903 is specifically used to: after the silence duration reaches a preset voice pause duration, if the next text data is inconsistent with the reference text data, perform natural language processing on the obtained text data to obtain a processing result.
[0209] In one embodiment of the present application, the language processing module 903 includes:
[0210] A complete detection unit, used to detect whether the obtained text data is complete after the silence duration reaches a preset voice pause duration;
[0211] The language processing unit is used to perform natural language processing on the obtained text data when the obtained text data is complete to obtain a processing result.
[0212] In one embodiment of the present application, the complete detection unit comprises:
[0213] A first probability obtaining subunit is used to obtain the occurrence probability of each character in the text data, wherein the occurrence probability of each character is: the probability of the character appearing after a reference character and appearing at a current position, and the reference character is: a preset number of characters before the character;
[0214] A second probability obtaining subunit, used to obtain the occurrence probability of the text data according to the occurrence probability of each character in the text data;
[0215] The complete detection subunit is used to determine that the text data is complete when the occurrence probability of the text data reaches a preset probability threshold.
[0216] In one embodiment of the present application, the first probability acquisition subunit is specifically used to: for each character in the text data, determine the first number of occurrences of the first consecutive character in a preset text corpus, and determine the second number of occurrences of the second consecutive character in the text corpus; calculate the probability of occurrence of the character based on the first number and the second number, wherein the second consecutive characters include: the preset number of characters before the character in the text data, and the first consecutive characters include: the second consecutive characters and the character.
[0217] In one embodiment of the present application, the complete detection subunit is specifically used to: determine the target number of characters in the text data; determine the probability threshold corresponding to the target number of characters from a preset correspondence between the number of characters and the probability threshold; and determine that the text data is complete when the probability of occurrence of the text data reaches the determined probability threshold.
[0218] In one embodiment of the present application, the second probability obtaining subunit is specifically used to: calculate the product of the occurrence probabilities of each character in the text data as the occurrence probability of the text data.
[0219] In one embodiment of the present application, the silence detection 902 is specifically used to: detect low-amplitude data in the continuously collected voice data, and record the duration of the detected low-amplitude data, wherein the low-amplitude data is: voice data with a signal amplitude lower than a preset amplitude threshold.
[0220] In the speech processing scheme provided in the above embodiment, speech data is continuously collected, and text data obtained by speech recognition of the continuously collected speech data is obtained; silence detection is performed on the continuously collected speech data; after the silence duration reaches the preset speech pause duration, natural language processing is performed on the obtained text data to obtain a processing result; when the silence duration reaches the preset speech pause duration and does not reach the preset speech end duration, if the silence ends, the processing result is determined to be invalid, wherein the preset speech end duration is greater than the preset speech pause duration; after the silence duration reaches the preset speech end duration, the processing result is determined as a response result for the continuously collected speech data. In this way, after the silence duration reaches the preset speech pause duration, natural language processing can be performed on the text data corresponding to the collected speech data, and the above natural language processing result can be obtained in the process of waiting for the silence duration to reach the preset speech end duration. After the silence duration reaches the preset speech end duration, it is considered that the speech ends. In this case, since the processing result has been obtained, the speech data can be directly responded to based on the above processing result, saving the time of natural language processing. It can be seen that the application of the solution provided by the above embodiment can improve the efficiency of speech processing.
[0221] The present application also provides an electronic device, such as Fig.10 As shown, it includes a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002, and the memory 1003 communicate with each other through the communication bus 1004, and the memory 1003 is used to store computer programs; the processor 1001 is used to implement the speech processing method when executing the program stored in the memory 1003.
[0222] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0223] The communication interface is used for communication between the above electronic device and other devices.
[0224] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0225] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0226] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned speech processing methods are implemented.
[0227] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any of the speech processing methods in the above embodiments.
[0228] In the speech processing scheme provided in the above embodiment, speech data is continuously collected, and text data obtained by speech recognition of the continuously collected speech data is obtained; silence detection is performed on the continuously collected speech data; after the silence duration reaches the preset speech pause duration, natural language processing is performed on the obtained text data to obtain a processing result; when the silence duration reaches the preset speech pause duration and does not reach the preset speech end duration, if the silence ends, the processing result is determined to be invalid, wherein the preset speech end duration is greater than the preset speech pause duration; after the silence duration reaches the preset speech end duration, the processing result is determined as a response result for the continuously collected speech data. In this way, after the silence duration reaches the preset speech pause duration, natural language processing can be performed on the text data corresponding to the collected speech data, and the above natural language processing result can be obtained in the process of waiting for the silence duration to reach the preset speech end duration. After the silence duration reaches the preset speech end duration, it is considered that the speech ends. In this case, since the processing result has been obtained, the speech data can be directly responded to based on the above processing result, saving the time of natural language processing. It can be seen that the application of the solution provided by the above embodiment can improve the efficiency of speech processing.
[0229] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0230] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0231] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, electronic device embodiment, computer-readable storage medium embodiment, and computer program product embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0232] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.< / s> < / s> < / s>
Claims
1. A speech processing method, characterized in that: The method comprises: Continuously collecting voice data and obtaining text data obtained by performing voice recognition on the continuously collected voice data; Perform silence detection on continuously collected voice data; After the silence duration reaches a preset voice pause duration, natural language processing is performed on the obtained text data to obtain a processing result; In the case where the silence duration reaches the preset voice pause duration and does not reach the preset voice end duration, if the silence end is detected, determining that the processing result is invalid, wherein the preset voice end duration is greater than the preset voice pause duration; After the silence duration reaches the preset voice end duration, determining the processing result as a response result for the continuously collected voice data; The performing silence detection on the continuously collected voice data includes: Detect low-amplitude data in the continuously collected voice data, and record the duration of the detected low-amplitude data as the silence duration, wherein the low-amplitude data refers to voice data whose signal amplitude is lower than a preset amplitude threshold; If the end of silence is detected, determining that the processing result is invalid includes: If the end of silence is detected, and the next text data is different from the reference text data, it is determined that the processing result is invalid, wherein the silence duration is reset when the silence ends, and the next text data is: the text data obtained by performing speech recognition on the continuously collected voice data when the silence duration reaches the preset voice pause duration next time, and the reference text data is: the text data based on which the processing result is obtained; The method further comprises: If the end of silence is detected and the next text data is consistent with the reference text data, the processing result obtained based on the reference text data is maintained valid.
2. The method according to claim 1, characterized in that After the silence duration reaches the preset voice pause duration, natural language processing is performed on the obtained text data to obtain a processing result, including: After the silence duration reaches a preset voice pause duration, if the next text data is inconsistent with the reference text data, natural language processing is performed on the obtained text data to obtain a processing result.
3. The method according to claim 1, characterized in that The natural language processing is performed on the obtained text data to obtain the processing result, including: Check whether the obtained text data is complete; When the obtained text data is complete, natural language processing is performed on the obtained text data to obtain a processing result.
4. The method according to claim 3, characterized in that The step of detecting whether the obtained text data is complete includes: For each character in the text data, the occurrence probability of the character is obtained, wherein the occurrence probability of each character is: the probability of the character appearing after a reference character and appearing at the current position, and the reference character is: a preset number of characters before the character; Obtaining the occurrence probability of the text data according to the occurrence probability of each character in the text data; When the occurrence probability of the text data reaches a preset probability threshold, it is determined that the text data is complete.
5. The method according to claim 4, characterized in that The step of obtaining the occurrence probability of each character in the text data includes: For each character in the text data, determine the first number of occurrences of the first consecutive character in a preset text corpus, and determine the second number of occurrences of the second consecutive character in the text corpus; calculate the occurrence probability of the character based on the first number and the second number, wherein the second consecutive characters include: the preset number of characters before the character in the text data, and the first consecutive characters include: the second consecutive characters and the character.
6. The method according to claim 4, characterized in that When the probability of the text data appearing reaches a preset probability threshold, determining that the text data is complete includes: Determining a target number of characters of the text data; Determining the probability threshold corresponding to the target number of characters from a preset correspondence between the number of characters and the probability threshold; When the occurrence probability of the text data reaches the determined probability threshold, it is determined that the text data is complete.
7. The method according to claim 4, characterized in that The step of obtaining the occurrence probability of the text data according to the occurrence probability of each character in the text data comprises: The product of the occurrence probabilities of the characters in the text data is calculated as the occurrence probability of the text data.
8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.
