Text correction, model training method, correction model, equipment and robot
By converting the speech recognition results into pinyin and using the coding network model for correction, the problem of speech recognition inaccuracy is solved, the correction efficiency and accuracy are improved, the computational burden is reduced, and a more efficient correction process is achieved.
Patent Information
- Application Number
- CN202010773594.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-04
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2040-08-04
AI Technical Summary
The prior art is susceptible to environmental noise and non-standard pronunciation interference in the speech recognition process, resulting in inaccurate recognition, low efficiency of correction process and large calculations, which cannot effectively solve the accuracy of the recognition results.
By converting words in text into pinyin, using pre-trained text correction model for correction, using coding network model for processing, reducing the decoding process, improving computing efficiency, and considering pinyin context association during the correction process, achieving more efficient correction result.
Improve correction efficiency and processing speed, reduce the computing burden of equipment, obtain more accurate correction results, and avoid the adverse effects of wrong words and words on correction.
Smart Images

Figure CN114091408B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to text correction, model training methods, correction models, equipment and robots. Background Art
[0002] With the continuous development of artificial intelligence technology, various language recognition and text recognition technologies are increasingly entering people's lives, such as voice recognition in human-computer interactive dialogue applications, OCR recognition in text images, and so on.
[0003] In actual applications, even the most intelligent recognition applications can have inaccurate recognition problems. Take speech recognition as an example. When voice information is collected, it is easily disturbed by environmental noise, resulting in inaccurate recognition. In the process of voice-to-text conversion, if the collected voice pronunciation is not standard, it will also lead to inaccurate recognition. In view of the above-mentioned inaccurate recognition problems, the recognition results need to be corrected to obtain accurate recognition results. Summary of the invention
[0004] Various aspects of the present application provide text correction, model training methods, correction models, devices and robots to implement a solution for correcting recognized characters in a text.
[0005] In a first aspect, an embodiment of the present application provides a text correction method, the method comprising:
[0006] Convert at least part of the words in the text into pinyin to obtain a converted character sequence;
[0007] Using a text correction model, processing the character sequence to obtain a corrected text;
[0008] The text correction model is obtained by training with training samples, and the training samples include a plurality of character sequence samples, at least part of which are pinyin.
[0009] In a second aspect, an embodiment of the present application provides a text correction model, the model comprising:
[0010] An input layer, for receiving a character sequence containing pinyin corresponding to a text, wherein the character sequence contains at least one character string representing a single word or character;
[0011] At least one intermediate layer, configured to convert a character string in the character sequence into a feature vector; and calculate the text corresponding to the first position according to the order of the character strings in the character sequence and the feature vector corresponding to the character string at the first position and the feature vector corresponding to the character string at at least one adjacent position to the first position;
[0012] The output layer is used to output the text at the first position.
[0013] In a third aspect, an embodiment of the present application provides a text correction model training method, the method comprising:
[0014] Get a sample of character sequences containing pinyin;
[0015] Using the character sequence samples, training a text correction model to obtain an output result;
[0016] Based on the output result, the text correction model is optimized.
[0017] In a fourth aspect, an embodiment of the present application provides an electronic device, the electronic device comprising: a memory and a processor; wherein:
[0018] The memory is used to store programs;
[0019] The processor is coupled to the memory and is configured to execute the program stored in the memory to:
[0020] Convert at least part of the words in the text into pinyin to obtain a converted character sequence;
[0021] Using a text correction model, processing the character sequence to obtain a corrected text;
[0022] The text correction model is obtained by training with training samples, wherein the training samples include a plurality of character sequence samples, at least part of which are pinyin.
[0023] In a fifth aspect, an embodiment of the present application provides a robot, the robot comprising:
[0024] Body,
[0025] A traveling assembly, arranged on the machine body, for providing power to the machine body so that the machine body can move autonomously in the field where it is located;
[0026] A storage component with a built-in speech recognition module and a text correction module;
[0027] The speech recognition module is used to convert the received speech into text;
[0028] The text correction module converts at least part of the words in the text into pinyin to obtain a converted character sequence;
[0029] The character sequence is processed using a text correction model to obtain a corrected text; wherein the text correction model is obtained by training with training samples, the training samples include a plurality of character sequence samples, and at least part of the character sequence samples are pinyin.
[0030] In some embodiments of the present application, during a speech recognition application, a corresponding text to be corrected is obtained based on the speech recognition result. The text may contain some words whose corresponding characters cannot be accurately determined. These words in the text can be converted into pinyin to obtain a character sequence containing the pinyin. Then, the character sequence is corrected using a pre-trained text correction model to obtain the corrected characters corresponding to each pinyin. Through the above technical solution, the words that cannot be accurately recognized are converted into pinyin, and then corrected using a character sequence containing pinyin and a pre-trained text correction model. The text correction model can be used to simultaneously output the correction results corresponding to all the pinyins in the character sequence, so that higher correction efficiency and correction processing speed can be obtained, and the computing burden of the device during the correction process can be effectively reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0032] Figure 1 A flowchart of an object search method provided in an embodiment of the present application;
[0033] Figure 2 A table diagram of the pinyin expression provided in the embodiment of the present application;
[0034] Figure 3 A flowchart of a pinyin conversion method provided in an embodiment of the present application;
[0035] Figure 4 A structural diagram of a text correction model provided in an embodiment of the present application;
[0036] Figure 5 A flowchart of a text correction model training method provided in an embodiment of the present application;
[0037] Figure 6 A table diagram of training samples provided in an embodiment of the present application;
[0038] Figure 7a A schematic diagram of a robot application scenario provided in an embodiment of the present application;
[0039] Figure 7b A schematic diagram of another robot application scenario provided in an embodiment of the present application;
[0040] Figure 8 A structural schematic diagram of a text correction device provided in an embodiment of the present application;
[0041] Fig. 9A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. 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 without making creative work are within the scope of protection of the present application.
[0043] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.
[0044] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0045] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0046] Although some technical solutions take the context into consideration, the text obtained by simply relying on the context recognition may still have relatively large deviations. If the deviated text is used for correction, it will be affected by the pronunciation, the wrong meaning of the word, and the meaning of the wrong word after forming a word, which is not conducive to correction. Therefore, the present application scheme uses pinyin in combination with the context to avoid the adverse effects of wrong words and wrong word formation on correction, and the result obtained by correction through pinyin is closer to the essence of the original audio.
[0047] In addition, in existing correction solutions, the encoding-decoding network technology is usually adopted. This technology can only output one correction result in each round of correction calculation, and uses the previous correction result as the input of the next correction result. After multiple iterations like this, the correction results of all characters are output. For example, for the sentence "我要理财" (I want to manage finances), the pinyin sequence is wo yao licai. The Chinese character "我" (I) is generated based on the encoding information of wo yao li cai; the Chinese character "要" (want) is generated based on the encoding information of wo yao li cai and "我" (I); the Chinese character "理" (manage) is generated based on the encoding information of wo yao li cai and "我要" (I want); the Chinese character "财" (finances) is generated based on the encoding information of wo yao licai and "我要理" (I want to manage). Finally, "我要理财" (I want to manage finances) is output. The correction result can be output only after four rounds of iterative correction calculations as described above. This correction method has a slow processing speed and low efficiency, and a large amount of calculation is required to obtain the correction result. In order to solve the above problems, the inventor proposed the technical solution of this application.
[0048] The following will, with reference to the accompanying drawings, detail the technical solutions provided by the embodiments of this application.
[0049] As Figure 1 is a schematic flowchart of the data processing method provided by the embodiment of this application. The execution subject of this method can be a server device, or the server device and the client device cooperate with each other. Specifically, it includes the following steps:
[0050] 101: Convert at least some words in the text into pinyin to obtain a converted character sequence.
[0051] 102: Use a text correction model to process the character sequence to obtain a corrected text; wherein, the text correction model is trained with training samples, and the training samples include multiple character sequence samples, and at least some of the character sequence samples are pinyin.
[0052] The character sequence mentioned here can be a character sequence composed entirely of pinyin, or a character sequence composed of a combination of Chinese characters, words, sentences and pinyin. It should be noted that in the converted character sequence, the association order of Chinese characters, words, sentences and pinyin is exactly the same as the order in the text. If this text is obtained through speech recognition, then this text needs to be as close as possible to the speech content, and it is not necessary to filter or delete some words or characters that may be considered meaningless, because it cannot be ensured whether the words or characters filtered or deleted in the recognition result are really meaningless. Maybe a certain character is accidentally deleted due to recognition error, so that it cannot be corrected and the true meaning of the text to be expressed is affected.
[0053] For example, a user speaks to a terminal device with speech recognition function (e.g., a counter robot) and says the sentence "Hello, please recommend a set of financial products to me". The terminal device may have limited recognition ability, so the terminal device can send the text to the server, and the server converts the uncertain words into pinyin, for example, "a set" is converted into the pinyin "yi tao". Then, the character sequence that can be obtained is "Hello, please recommend a set of financial products to me". It is also possible to convert all words into pinyin, and the corresponding character sequence is "nin hao, qing bang wo tui jian yi tao licai chan pin ba". It can also be a character sequence composed of sentences and pinyin, such as "nin hao, please recommend a set of financial products to me".
[0054] After obtaining the above character sequence, the character sequence is used as the input of the text correction model, so that the character sequence is corrected by the text correction model to obtain the corrected text. In practical applications, the character sequence corresponding to the text can be used as the input as a whole, such as "Hello, please recommend yi tao financial products to me". The character sequence can also be decomposed, for example, with pinyin as the center, one or more words with adjacent pinyin are combined to obtain a sub-character sequence, such as "recommend yi tao financial management" or "recommend yi tao" and so on.
[0055] In actual applications, during the process of converting speech recognition into text, there may be incorrect words recognized as having the same pinyin and the same tone, incorrect words with the same pinyin but different tones, incorrect words with mixed pronunciations, etc. In order to avoid the adverse effects of these problems on the correction effect, multiple pinyin expressions can be used, for example, at least one of the following can be included: a pinyin expression with tone, a pinyin expression without tone, and a pinyin expression of the first initial consonant.
[0056] For example, Figure 2 A table diagram of the pinyin expression provided in the embodiment of the present application. Figure 2It can be seen that the actual content of the speech to be recognized is "I want to withdraw money". The pinyin obtained after converting the text after speech recognition can be: the pinyin with tone is expressed as "wo3, yao4, qu3, kuan3", the pinyin with falling tone is expressed as "wo, yao, qu, kuan", and the pinyin of the first initial consonant is expressed as "w, y, q, k". It should be noted that the pinyin expression methods used in training and actual use should be consistent. For example, during training, only the training samples of the pinyin expression with tone are used to train the text correction model. Then, when it is used, the pinyin in the input character sequence should also be the pinyin expression with tone; if the training samples of the pinyin expression with tone, the pinyin expression with falling tone and the pinyin expression of the first initial consonant are used to train the text correction model at the same time, then when it is used, the pinyin in the input character sequence should also be the pinyin expression with tone, the pinyin expression with falling tone and the pinyin expression of the first initial consonant.
[0057] like Figure 3 The flowchart of the pinyin conversion method provided in the embodiment of the present application is shown in FIG. Figure 3 As shown, converting at least part of the words in the text into pinyin to obtain a converted character sequence includes the following steps:
[0058] 301: Acquire a word library. 302: Determine non-word library words in the text based on the word library. 303: Convert the non-word library words in the text into pinyin to obtain the character sequence.
[0059] It should be noted that the word library mentioned here is a word library used to help correct the recognition results, and the words contained in the word library can be set according to the actual application needs. For example, if the application scenario is a hospital, the corresponding word library contains words related to medical professional terms (for example, gastroscopy); if the application scenario is a bank, the corresponding word library contains words related to deposits and withdrawals, financial management, etc. (for example, opening an account). This word library can be updated over time, and may contain some of the latest popular words after the update. Of course, the word library can also open permissions to users, and users can optimize the word library according to their own usage habits (for example, delete or add certain words), so that the word library can better meet the user's correction needs. For example, if the user's pronunciation is not standard, there are dialect tones or words, then the user optimizes the word library according to his own needs. When correcting errors, the word library can quickly and accurately correct the text corresponding to the voice.
[0060] As an optional solution, during the text correction process, the specific word library to be selected can be customized according to the actual application scenario, or specified by the user. In addition, the server can also make the selection itself. For example, after receiving the text, the server speculates the application scenario or word library that may be involved in the current sentence to be corrected based on the confirmed text carried in the text, and then recommends at least one word library for the scenario based on the guessing results. In this way, the effective word library can be quickly locked, the processing speed can be improved, and the workload of personnel can be reduced.
[0061] In actual applications, after obtaining the text through speech recognition, the words or characters in the text are checked one by one with the words in the word library. If they are in the word library, the text corresponding to the word is determined; if they are not in the word library, that is, the word cannot be found in the word library, it is determined to be a non-word library word. Then, the non-word library word is converted into pinyin, which can be expressed in many ways, which has been illustrated in the above embodiments, and will not be repeated here. For details, please refer to the above embodiments. After error correction through the word library, the words that need to be corrected can be determined more accurately.
[0062] In the above embodiment, the character sequence is generated by first performing speech recognition to obtain a text that is all text, and then converting some words in the text (non-lexicon words that do not belong to the lexicon) into pinyin according to the lexicon. In addition, in the speech recognition process, unrecognizable words can also be directly converted into pinyin according to the audio.
[0063] In one or more embodiments of the present application technology, the text correction model is an encoding network model in a sequence-to-sequence neural network model. Specifically, the encoding network model is: a convolutional neural network, a recurrent neural network, a long short-term memory network, or a Transformer network.
[0064] The text correction model is a coding network model, that is, it only has a coding process, but does not include a decoding process, which greatly reduces the amount of calculation, can effectively improve the calculation efficiency, can complete the speech correction more quickly, and is not prone to causing server downtime. Moreover, when inputting to the coding network model, the pinyin and its associated (that is, adjacent) words are input together, and when calculating, the feature vector associated with the pinyin context is fully considered for calculation. When outputting, the text corresponding to each pinyin is output independently, that is, the output of the latter text does not need to be iterated with the previous text. Such a coding network model has a faster processing speed, especially when the length of the input character sequence is longer, compared with the processing method with output iteration or decoding process, the processing speed advantage is more obvious.
[0065] In addition, the character sequence input to the text correction model may contain certain words, so these words are input into the model and no correction is required. For example, the words in the text to be corrected are searched according to the word library. If they are found in the word library, the word is determined to be a word library word, and the word library word and pinyin are generated according to the contextual relationship in the text to be corrected. Pinyin will be output according to the correction result, and the word library words adjacent to or associated with pinyin are directly output to obtain the corrected text. For example, the pinyin is located in the first position in the text to be corrected, and the word library word is located in the second position adjacent to the first position in the corrected text. After the character sequence is corrected by the text correction model, the first position is output as the word corresponding to the pinyin, and the second position is output as the word library word. Because the word library word is already determined, there is no need for the text correction model to perform relevant calculations or processing, but only the word library word needs to be used to determine the word corresponding to the pinyin, which can improve the correction effect, but will not increase the calculation burden for the text correction model, nor will it reduce the processing efficiency.
[0066] Based on the above embodiments, it can be known that in a speech recognition application, the corresponding text to be corrected is obtained according to the speech recognition result. The text may contain some characters whose corresponding parts cannot be accurately determined. These words in the text can be converted into pinyin to obtain a character sequence containing pinyin. Then, the character sequence is corrected using a pre-trained text correction model to obtain the characters corresponding to each corrected pinyin. Through the above technical solution, the words that cannot be accurately recognized are converted into pinyin, and then corrected using the pinyin sequence and the pre-trained text correction model. The use of the text correction model can achieve the simultaneous output of the correction results corresponding to all pinyins, which can achieve higher correction efficiency and higher correction processing speed, and can also effectively reduce the computing burden of the equipment during the correction process.
[0067] The present application also provides a text correction model. Figure 4 A structural diagram of a text correction model provided in an embodiment of the present application. Figure 4 As can be seen in , the model includes: an input layer, which is used to receive a character sequence containing pinyin corresponding to a text, wherein the character sequence contains at least one string representing a single word or character;
[0068] At least one intermediate layer, configured to convert a character string in the character sequence into a feature vector; and calculate the text corresponding to the first position according to the order of the character strings in the character sequence and the feature vector corresponding to the character string at the first position and the feature vector corresponding to the character string at at least one adjacent position to the first position;
[0069] The output layer is used to output the text at the first position.
[0070] Before inputting the character sequence into the model input layer, the text needs to be converted into a character sequence. The relevant technical solutions for obtaining text from speech and converting text into a character sequence have been explained in the above embodiments. For details, please refer to the above embodiments, and will not be repeated here. This embodiment will focus on explaining the working process of the text correction model.
[0071] After the input layer obtains the input character sequence, it determines the first position corresponding to the pinyin character string in the character sequence and the character string adjacent to the first position. The character string representing the pinyin in the character sequence is passed to the middle layer to be converted into a feature vector, and at the same time, the character string at the adjacent position is also converted into a feature vector. Then, the text at the first position is calculated based on the above feature vector. After the text is determined, the output layer is directly used for output, and the text output by the output layer is independent of each other. The text mentioned here can be Chinese characters, Arabic numerals, Greek letters (for example, α, β), etc. When outputting, the position of each text must be consistent with that when it was input, that is, the text obtained by correcting the pinyin in the first position is still placed in the first position, and the adjacent text before and after it remains unchanged. For example, Figure 4 As shown in the figure, assuming that the input character sequence is (x1, x2, x3, x4), it is input into the encoding network model. After being processed by the intermediate layer, the mutually independent (y1, y2, y3, y4) can be directly obtained. Moreover, since there is no iterative relationship between the outputs, the simultaneous output can be guaranteed, which can improve the processing efficiency, reduce the computing burden of the computer and avoid the occurrence of downtime. The intermediate layer mentioned here can be implemented based on the self-attention mechanism.
[0072] In one or more embodiments of the present application, the character sequence contains a vocabulary word, and the vocabulary word is determined based on a vocabulary; and the output layer is also used to use the vocabulary word as the text output at the second position when the character string at the second position is the vocabulary word.
[0073] In practical applications, after obtaining text through speech recognition, the word library can be used to correct the words in the text. The words in the word library are called word library words, and the words not in the word library are called non-word library words. Since the non-word library words are not in the word library, it is impossible to determine the true text content of the non-word library words. Therefore, it is necessary to determine the text corresponding to the non-word library words expressed in pinyin with the help of the word library words that have been determined. Since the word library words that have been determined in the character sequence no longer need to be corrected, they are input into the text correction model together with the pinyin string in order to correct the pinyin string more accurately. Therefore, when outputting, the string at the second position in the character sequence will be directly output. Through the above scheme, the word library words are output as they are, which can also avoid excessive occupation of computing resources. It is conducive to improving the working efficiency of the text correction model.
[0074] In one or more embodiments of the present application, when calculating the text corresponding to the first position based on the feature vector corresponding to the string at the first position and the feature vector corresponding to at least one adjacent string adjacent to the first position, the at least one intermediate layer is specifically used to: calculate multiple candidate texts corresponding to the first position and the probabilities of the candidate texts based on the feature vector corresponding to the string at the first position and the feature vector corresponding to at least one adjacent string adjacent to the first position; and select the candidate text with a high probability as the text corresponding to the first position.
[0075] Specifically: the middle layer is used to calculate the first feature vector of the character string at the first position and the second feature vector of the character string at the second position. The first position and the second position mentioned here are adjacent positions, and in practical applications, in order to better correct the pinyin character string at the first position, it can also be corrected in combination with the character string at the third position. Since the position relationship needs to be considered in the calculation process, it is also necessary to determine the position vector corresponding to each character through the middle layer. For example, the first feature vector corresponding to the pinyin character string and its position vector are summed to obtain the feature vector of the character string at the first position, and the second feature vector corresponding to the word library word character string and its position vector are summed to obtain the feature vector of the character string at the second position. Then, the correlation between the two feature vectors is calculated to determine the probability that the pinyin at the first position corresponds to each non-word library word.
[0076] Then the probability is compared with the threshold. If the probability is greater than the threshold, the word with the highest probability is selected as the corrected non-lexicon word. If the probability is less than the threshold, the correction result of the middle layer is abandoned, and the pinyin at the first position is not corrected. For example, the text generated by the speech recognition result can be directly used to fill in the first position to generate the corrected text.
[0077] Based on the above embodiment, it can be known that when the above text correction model is used to input a character sequence for correction, the pinyin context association relationship in the character sequence is fully considered. When outputting, the output results of each corrected text are independent of each other. That is, simultaneous input and output can be achieved, which has higher output efficiency.
[0078] like Figure 5 A flowchart of a text correction model training method provided in an embodiment of the present application. Figure 5 As you can see, the specific steps include the following:
[0079] 501: Get a sample of a character sequence containing pinyin.
[0080] 502: Use the character sequence sample to train a text correction model to obtain an output result.
[0081] 503: Optimize the text correction model based on the output result.
[0082] In order to make the text correction model have better correction ability, the actual situation should be fully considered when making training samples. Specifically, the obtained character sequence samples containing pinyin include at least one of the following: obtaining character sequence samples containing only pinyin; obtaining character sequence samples containing pinyin and Chinese characters; modifying the tone of the pinyin in the existing character sequence samples to obtain a new character sequence sample; modifying the initial consonant in the pinyin in the existing character sequence sample to obtain a new character sequence sample; modifying the final vowel in the pinyin in the existing character sequence sample to obtain a new character sequence sample; modifying one of the adjacent pinyins in the existing character sequence sample to obtain a new character sequence sample.
[0083] When generating training sample data, some original words in the sentence are randomly selected and not replaced with pinyin, and the context sentences are added with a certain probability to form a combination sequence of Chinese characters and pinyin. Figure 6 The training sample table diagram provided in the embodiment of this application shows Figure 6The following is an example of data generation for the sentence “Which financial product has the highest return”: the character sequence sample containing only pinyin is “li3 cai2 chan3 pin3 na3 ge4 shou1 yi4 gao1”; the character sequence sample containing pinyin and Chinese characters is “financial product na3 ge4 shou1 yi4 gao1”; the tone of the pinyin in the existing character sequence sample is modified to obtain a new character sequence sample of “li3 cai2 chan3 pin3 na3 ge4 shou4 yi1gao1”; the initial consonant in the pinyin in the existing character sequence sample is modified to obtain a new character sequence sample of “li3cai2chan3 pin3 la3 ge4 shou1 yi4 gao1”; the final vowel in the pinyin in the existing character sequence sample is modified to obtain a new character sequence sample of “li3 cai2 chan3 pin3 na3 ge4 feng1 yi4 gao1"; modify one of the adjacent pinyins in the existing character sequence sample to obtain a new character sequence sample "li3 kuan2 chan3pin3 la3 ge4 shou1 yi4 gao1".
[0084] In addition, the pinyin in the generated corpus needs to be modified for some special cases, for example, (1) using the pinyin input that is exactly the same as the original sentence pinyin to solve the recognition errors of the same pinyin and the same tone, such as "wu3 zhong3" is recognized as "wu3 zhong3"; (2) using the same syllable but different tone as the original sentence pinyin to solve the recognition errors of the same pinyin but different tone, such as "wu3 zhong3" is recognized as "wu4 zhong3"; (3) using the pinyin input corresponding to the original sentence pinyin to solve the recognition errors of confused sounds, including confused initial consonants such as "li3 cai2" is recognized as "ni3 cai1", and confused final consonants "wai4 hui4" is recognized as "wan4 hui4"; (4) using arbitrary pinyin input to increase the robustness of the model, such as "xiao4hua4" is replaced with "dong4hua4". In actual training, the above four methods are replaced in a ratio of 5:2:2:1. The sentence can be repeated multiple times, and different words can be selected for replacement to obtain multiple different data.
[0085] It should be noted that when constructing pinyin, multiple pinyin expressions can be constructed, including at least one of: a pinyin expression with tone, a pinyin expression without tone, and a pinyin expression of the first initial consonant. Specifically:
[0086] When constructing the data, each sentence in the corpus will first be converted from a text sequence to a corresponding character sequence containing a pinyin string as the input of the text correction model. Because in speech recognition to text conversion, there will be words that are recognized as having the same pinyin and the same tone, the same pinyin but different tones, and confused pronunciation. Therefore, according to the different characteristics of pinyin, three different pinyin sequence expressions can be designed, namely, pinyin with tone removed, pinyin with tone, and pinyin using only the first initial consonant. The three expressions can be used separately as pinyin feature input or used in combination. For details, please refer to Figure 2 The corresponding embodiments will not be repeated here.
[0087] The present application also provides a robot. The robot comprises:
[0088] Body,
[0089] A traveling assembly, arranged on the machine body, for providing power to the machine body so that the machine body can move autonomously in the field where it is located;
[0090] A storage component with a built-in speech recognition module and a text correction module;
[0091] The speech recognition module is used to convert the received speech into text;
[0092] The text correction module converts at least part of the words in the text into pinyin to obtain a converted character sequence;
[0093] The character sequence is processed using a text correction model to obtain a corrected text; wherein the text correction model is obtained by training with training samples, the training samples include a plurality of character sequence samples, and at least part of the character sequence samples are pinyin.
[0094] In addition, the robot can also be configured with a communication module for sending the text obtained by speech recognition to the server, and the server corrects the text using a text correction model.
[0095] For example, Figure 7aA schematic diagram of a robot application scenario provided by an embodiment of the present application. In some public places, more and more scenarios are beginning to introduce robots to provide relevant services to customers. For example, in the bank business hall, it is used to guide customers to complete related businesses such as account opening and deposit; in the hospital triage desk or hall, it is used to guide patients to make appointments, triage and other related medical treatments; in the mall, it is used to guide users to complete shopping activities such as commodity selection and settlement; it can also be a robot that sweeps goods in the warehouse, a large-scale cleaning robot in public places, and so on. The robots in these application scenarios need to face different customers, who may come from various regions of the country and foreigners. When performing voice interaction, there will be obvious differences in customer pronunciation. Some non-standard pronunciations will directly affect the voice recognition results, and it is inevitable that there will be some recognition errors. Therefore, in order to enable the robot to better complete the voice interaction work, it is necessary to further correct the text corresponding to the voice recognition result. For ease of understanding, the following specific examples are given for bank application scenarios. Suppose that a customer wants to choose a certain financial product. After the customer comes to the hall, he can actively look for a teller robot, or the teller robot can actively look for the customer after sensing that the customer has entered the hall. The customer can say to the teller robot in the bank's business hall, "Which financial product has a high return?" Then, after receiving the voice, the teller robot recognizes a text. The teller robot sends the text to the server, which uses the text correction model to correct the text (for example, financial management chan pin na ge shou yi gao) to obtain the corrected text information (for example, which financial product has a high return). The corrected text information is then returned to the teller robot, and the teller robot can correctly understand what the customer said and recommend at least one financial product to the customer in order of high and low returns. In the specific application process, at least one financial product can also be recommended to the customer based on the corrected voice combined with the customer's previous purchase history of financial products. In these application scenarios, not only does the robot have to face a more complex communication environment, but the communication volume is also relatively large, and there are also more text contents that need to be corrected. Therefore, the use of the technical solution of this application can not only improve the recognition results, but also effectively improve the correction processing speed and efficiency.
[0096] For example, Figure 7b A schematic diagram of another robot application scenario provided in an embodiment of the present application. Figure 7bAs can be seen in the figure, the robot is connected to the server. Assuming that the robot is a sweeping robot, when the user says to the robot "clean under the master bedroom bed", the robot will recognize a text after receiving the voice and send the text to the server. The server will correct the text using the text correction model and get the correct text information. The server will then return it to the robot. The robot will correctly understand what the user said and perform the task required by the user.
[0097] Of course, in some smart home scenarios, it is possible not to issue voice commands directly to the robot. For example, the user can speak voice commands through the mobile client, and then the client sends the voice recognition results to the server. The server uses the text correction model to correct the text, obtain the correct text information, and then return it to the robot. The robot correctly understands what the user said and performs the task required by the user.
[0098] In addition, the text correction scheme in the above embodiment can also be widely applied to various voice interaction scenarios. For example, smart speakers and other smart electrical appliances perform text correction on the voice recognition results during the voice interaction process, and when unmanned driving is used, text is generated during the voice interaction process for correction, and so on. It is also possible to further correct the text corresponding to the voice recognition results of other application software after voice recognition. The text correction scheme in the above embodiment can also be applied to correct text files directly. For example, after completing the meeting minutes with a voice recorder, the voice recorder can directly export the text file. After obtaining the text file, the user cannot determine whether the export result of the voice recorder is accurate, and the above scheme can also be used to correct the text file.
[0099] like Figure 8 A structural diagram of a text correction device provided in an embodiment of the present application. Figure 8 You can see that the following modules are included:
[0100] The conversion module 81 is used to convert at least part of the words in the text into pinyin to obtain a converted character sequence.
[0101] The processing module 82 is used to process the character sequence using a text correction model to obtain a corrected text; wherein the text correction model is obtained by training with training samples, the training samples include multiple character sequence samples, and at least part of the character sequence samples are pinyin.
[0102] Furthermore, the conversion module 81 is also used to obtain a vocabulary; determine non-vocabulary words in the text based on the vocabulary; and convert the non-vocabulary words in the text into pinyin to obtain the character sequence.
[0103] The pinyin expression includes at least one of a pinyin expression with tone, a pinyin expression without tone and a pinyin expression of the first initial consonant.
[0104] Optionally, the text correction model is an encoding network model in a sequence-to-sequence neural network model.
[0105] Optionally, the encoding network model is: convolutional neural network, recurrent neural network, long short-term memory network, Transformer network
[0106] The present application also provides an electronic device, such as Fig. 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device includes a power supply component 901, a memory 902 and a processor 903; wherein:
[0107] The memory 902 is used to store programs;
[0108] The processor 903 is coupled to the memory 902 and is configured to execute the program stored in the memory 902 to:
[0109] Convert at least part of the words in the text into pinyin to obtain a converted character sequence;
[0110] Using a text correction model, processing the character sequence to obtain a corrected text;
[0111] The text correction model is obtained by training with training samples, and the training samples include a plurality of character sequence samples, at least part of which are pinyin.
[0112] In particular, when the processor 903 executes the program in the memory 902, in addition to the above functions, other functions may also be implemented, and details may refer to the description of the previous embodiments.
[0113] The present application also provides a computer-readable storage medium storing a computer program. When the computer-readable storage medium stores the computer program and the computer program is executed by one or more processors, the one or more processors execute the corresponding Figures 1 to 5 The steps in the method embodiment are shown.
[0114] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0115] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0116] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0117] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0118] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0119] The memory may include non-permanent storage in a computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0120] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0121] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0122] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A text correction method, characterized in that: include: Converting at least part of the words in the text into pinyin to obtain a converted character sequence; specifically comprising: obtaining a vocabulary; determining non-vocabulary words in the text based on the vocabulary; converting the non-vocabulary words in the text into pinyin to obtain the character sequence; wherein, converting the non-vocabulary words in the text into pinyin to obtain the character sequence comprises: determining vocabulary words in the text based on the vocabulary; combining the vocabulary words with the pinyin to obtain the character sequence according to the contextual relationship in the text; Using a text correction model, processing the character sequence to obtain a corrected text; The text correction model is obtained by training with training samples, and the training samples include a plurality of character sequence samples, at least part of which are pinyin.
2. The method according to claim 1, characterized in that The pinyin expression includes at least one of a pinyin expression with tone, a pinyin expression without tone and a pinyin expression of the first initial consonant.
3. The method according to any one of claims 1 to 2, characterized in that The text correction model is an encoding network model in a sequence-to-sequence neural network model.
4. The method according to claim 3, characterized in that The encoding network models are: convolutional neural network, recurrent neural network, long short-term memory network, and Transformer network.
5. The method according to claim 1, characterized in that The text correction model is used to process the character sequence to obtain a corrected text. The text correction model is used to output the text corresponding to the pinyin in the character sequence to a first position in the text, and to output the word library word to a second position in the text.
6. A method for training a text correction model, characterized in that: include: Get a sample of character sequences containing pinyin; The character sequence samples include pinyin and vocabulary words; Using the character sequence samples, training a text correction model to obtain an output result; Based on the output result, optimizing the text correction model; Wherein, the text correction model includes: The input layer is used to receive a character sequence containing pinyin corresponding to a text, wherein the character sequence contains at least one character string representing a single word or character; the character sequence is generated in a manner including: obtaining a vocabulary; based on the vocabulary, determining non-vocabulary words in the text; converting the non-vocabulary words in the text into pinyin to obtain the character sequence; wherein the converting the non-vocabulary words in the text into pinyin to obtain the character sequence includes: based on the vocabulary, determining vocabulary words in the text; and combining the vocabulary words with the pinyin to obtain the character sequence according to the contextual relationship in the text; At least one intermediate layer, configured to convert a character string in the character sequence into a feature vector; and calculate the text corresponding to the first position according to the order of the character strings in the character sequence and the feature vector corresponding to the character string at the first position and the feature vector corresponding to the character string at at least one adjacent position to the first position; The output layer is used to output the text at the first position.
7. The method according to claim 6, characterized in that Obtain a sample of a character sequence containing pinyin, including at least one of the following: Get a sample of character sequences containing only pinyin; Obtain character sequence samples containing pinyin and Chinese characters; Modify the pinyin tone in the existing character sequence sample to obtain a new character sequence sample; Modify the initial consonants in the pinyin of the existing character sequence sample to obtain a new character sequence sample; Modify the finals in the pinyin of the existing character sequence sample to obtain a new character sequence sample; Modify one of the adjacent pinyins in the existing character sequence sample to obtain a new character sequence sample.
8. The method according to claim 6, characterized in that The pinyin expressions include: At least one of the following: the pinyin expression with tone, the pinyin expression with falling tone and the pinyin expression of the first initial consonant.
9. The method according to claim 6, characterized in that The character sequence contains a word in the vocabulary, and the word in the vocabulary is determined based on the vocabulary; and The output layer is further configured to use the word in the vocabulary as the text output at the second position when the character string at the second position is the word in the vocabulary.
10. The method according to claim 9, characterized in that When the at least one intermediate layer calculates the character corresponding to the first position according to the feature vector corresponding to the character string at the first position and the feature vector corresponding to the character string at at least one adjacent position adjacent to the first position, the at least one intermediate layer is specifically used to: Calculate a plurality of candidate characters corresponding to the first position and the probabilities of the candidate characters according to a feature vector corresponding to the character string at the first position and a feature vector corresponding to at least one character string at a neighboring position adjacent to the first position; A candidate character with a high probability is selected as the character corresponding to the first position.
11. The method according to claim 9, characterized in that The at least one intermediate layer is also used for: When the probabilities of the multiple candidate characters corresponding to the first position are all lower than a threshold, the correction of the character string at the first position is abandoned.
12. An electronic device, characterized in that: comprising a memory and a processor; wherein, The memory is used to store programs; The processor is coupled to the memory and is configured to execute the program stored in the memory to: Converting at least part of the words in the text into pinyin to obtain a converted character sequence; specifically comprising: obtaining a vocabulary; determining non-vocabulary words in the text based on the vocabulary; converting the non-vocabulary words in the text into pinyin to obtain the character sequence; wherein, converting the non-vocabulary words in the text into pinyin to obtain the character sequence comprises: determining vocabulary words in the text based on the vocabulary; combining the vocabulary words with the pinyin to obtain the character sequence according to the contextual relationship in the text; Using a text correction model, processing the character sequence to obtain a corrected text; The text correction model is obtained by training with training samples, and the training samples include a plurality of character sequence samples, at least part of which are pinyin.
13. A robot, characterized in that: include: Body, A traveling assembly, arranged on the machine body, for providing power to the machine body so that the machine body can move autonomously in the field where it is located; A storage component with a built-in speech recognition module and a text correction module; The speech recognition module is used to convert the received speech into text; The text correction module converts at least part of the words in the text into pinyin to obtain a converted character sequence; specifically includes: obtaining a vocabulary; based on the vocabulary, determining non-vocabulary words in the text; converting the non-vocabulary words in the text into pinyin to obtain the character sequence; wherein, converting the non-vocabulary words in the text into pinyin to obtain the character sequence includes: based on the vocabulary, determining vocabulary words in the text; combining the vocabulary words with the pinyin to obtain the character sequence according to the contextual relationship in the text; The character sequence is processed using a text correction model to obtain a corrected text; wherein the text correction model is obtained by training with training samples, the training samples include a plurality of character sequence samples, and at least part of the character sequence samples are pinyin.