Server and text error correction method
Through multi-view recall and feature probability calculation methods, the accuracy of text error correction in speech recognition is improved, the problem of low error correction accuracy in the existing technology is solved, and more accurate error correction effect is achieved.
Patent Information
- Application Number
- CN202111057489.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-09
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-09-09
AI Technical Summary
The accuracy of existing text error correction methods is low, and it cannot effectively solve text errors in speech recognition due to factors such as user accent, speech speed, and volume, which affects the accuracy of intention recognition and response results.
The candidate recall of the error correction entity is carried out through various recall methods (such as confusion recall, ES full entity recall, end-to-end model recall), and the probability of the candidate entity is calculated based on the characteristics of the pinyin, word, semantics and heat level, using pre-order The trained classification sorting model performs weighted summing to determine the entity after error correction.
It improves the accuracy of error correction, can effectively solve common text error types, provide more accurate error correction results, and enhances the response accuracy of the voice interaction system.
Smart Images

Figure CN113836935B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a server and a text error correction method. Background Art
[0002] Text error correction is an important task in natural language processing, especially in the process of voice interaction. After the user speaks a voice command, the recognized input text may be inconsistent with the voice command due to the influence of the user's accent, speaking speed, volume, and the hardware and software capabilities of the voice recognition device. If the recognized input text is not corrected, but the intent recognition is performed directly based on the input text, the intent recognition result may not meet the user's true intention, and it is difficult to output a response result that meets the user's true intention.
[0003] In the related art, one method of text error correction is a dictionary-based error correction method. This error correction method is to search the input text in a pre-established offline dictionary to obtain the correct text corresponding to the input text in the offline dictionary. If the input text is the same as the correct text, no error correction is required. If they are different, the correct text is output as the corrected text of the input text. However, the accuracy of the above error correction method depends on the correspondence between the input text and the correct text in the offline dictionary. The error correction principle is relatively simple, which makes it difficult for the actual error correction accuracy to reach the expected level. Summary of the invention
[0004] In order to solve the technical problem of low error correction accuracy, the present application provides a server and a text error correction method.
[0005] In a first aspect, the present application provides a server, which is configured to:
[0006] Performing voice recognition on the received voice command to obtain the text to be corrected;
[0007] Performing error detection on the text to be corrected to obtain an entity to be corrected corresponding to the text to be corrected;
[0008] Perform candidate recall on the entity to be corrected by using multiple recall methods to obtain multiple candidate entities;
[0009] The probability of each candidate entity is calculated according to the features of the entity to be corrected at multiple preset levels, and the corrected entity corresponding to the entity to be corrected is determined according to the probability of each candidate entity.
[0010] In some embodiments, candidate recall is performed on the entity to be corrected through multiple recall methods to obtain multiple candidate entities, including:
[0011] The entities to be corrected are respectively recalled as candidates through the confusion set recall method, the ES full entity recall method and the end-to-end model recall method to obtain multiple candidate entities.
[0012] In some embodiments, the probability of each candidate entity is calculated according to the characteristics of the entity to be corrected at multiple preset levels, including:
[0013] Constructing features of each candidate entity at multiple preset levels, the preset levels including phonetic level, character level, semantic level and popularity level;
[0014] The features of each candidate entity are input into the pre-trained classification and ranking model to obtain the probability of each candidate entity.
[0015] In some embodiments, constructing features of each candidate entity at the phonetic level, character level, semantic level, and heat level includes:
[0016] Calculating a first edit distance between the pinyin of the entity to be corrected and the pinyin of the candidate entity, and setting the first edit distance as a feature of the entity to be corrected at the pinyin level;
[0017] Calculating a second edit distance between the text of the entity to be corrected and the text of the candidate entity, and setting the second edit distance as a feature of the entity to be corrected at the word level;
[0018] Inputting the entity to be corrected and the candidate entity into a pre-trained semantic vector model in sequence to obtain a first semantic vector and a second semantic vector, and setting the first semantic vector and the second semantic vector as features of the entity to be corrected at the semantic level, wherein the semantic vector model includes a pre-trained model based on BERT, and the first semantic vector and the second semantic vector are both 64-dimensional vectors;
[0019] The real-time heat value of the candidate entity is obtained, and the real-time heat value is set as the characteristic of the entity to be corrected at the heat level.
[0020] In some embodiments, the features of each candidate entity are input into a pre-trained classification and ranking model to obtain the probability of each candidate entity, including:
[0021] Combining the features of each candidate entity at multiple preset levels respectively;
[0022] The combined features of each candidate entity are input into a pre-trained classification and ranking model, and the probability predicted by the classification and ranking model for the features at multiple preset levels is weighted and summed to obtain the probability of each candidate entity.
[0023] In a second aspect, an embodiment of the present application provides a text error correction method, the method comprising:
[0024] Performing voice recognition on the received voice command to obtain the text to be corrected;
[0025] Performing error detection on the text to be corrected to obtain an entity to be corrected corresponding to the text to be corrected;
[0026] Performing candidate recall on the entity to be corrected to obtain multiple candidate entities;
[0027] The probabilities of multiple candidate entities are ranked according to the features of the entity to be corrected at multiple preset levels, and the candidate entity with the highest probability is determined as the corrected entity of the entity to be corrected.
[0028] The beneficial effects of the server and text error correction method provided by this application include:
[0029] The embodiment of the present application performs candidate recall on the entity to be corrected through multiple recall methods, thereby realizing multi-perspective recall. The number of obtained candidate entities is large and very comprehensive. The corrected entity is determined according to the probability of each candidate entity, thereby improving the correction accuracy and being able to well resolve text errors of common text error types. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0031] Figure 1 Schematic diagram of an operation scenario between a display device and a control device according to some embodiments is exemplarily shown in FIG.
[0032] Figure 2 exemplarily shows a hardware configuration block diagram of a display device 200 according to some embodiments;
[0033] Figure 3 exemplarily shows a schematic diagram of software configuration in a display device 200 according to some embodiments;
[0034] Figure 4 A schematic diagram of a speech recognition network architecture according to some embodiments is exemplarily shown in FIG.
[0035] Figure 5 The overall flow chart of the text error correction method according to some embodiments is exemplarily shown in FIG.
[0036] Figure 6 A flowchart of a text error correction method according to some embodiments is exemplarily shown in FIG.
[0037] Figure 7A schematic diagram of the software architecture of a text error correction method according to some embodiments is exemplarily shown in FIG.
[0038] Figure 8 Schematic diagram of error detection according to some embodiments is exemplarily shown in FIG.
[0039] Fig. 9 Schematic diagram of recall according to some embodiments is exemplarily shown in FIG.
[0040] Fig.10 A schematic diagram of sorting according to some embodiments is exemplarily shown in FIG. DETAILED DESCRIPTION
[0041] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0042] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0043] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.
[0044] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.
[0045] The display device provided in the embodiments of the present application may have various implementation forms, for example, it may be a television, a smart television, a laser projection device, a monitor, an electronic bulletin board, an electronic table, etc. Figure 1 and Figure 2 This is a specific implementation of the display device of the present application.
[0046] Figure 1 FIG. 1 is a schematic diagram of an operation scenario between a display device and a control device according to an embodiment. Figure 1As shown, the user can operate the display device 200 through the smart device 300 or the control apparatus 100 .
[0047] In some embodiments, the control device 100 may be a remote controller, and the communication between the remote controller and the display device includes infrared protocol communication or Bluetooth protocol communication, and other short-range communication methods, and the display device 200 is controlled wirelessly or wired. The user may control the display device 200 by inputting user commands through buttons on the remote controller, voice input, control panel input, etc.
[0048] In some embodiments, a smart device 300 (such as a mobile terminal, a tablet computer, a computer, a laptop computer, etc.) may also be used to control the display device 200. For example, the display device 200 is controlled using an application running on the smart device.
[0049] In some embodiments, the display device may not use the above-mentioned smart device or control device to receive instructions, but may receive user control through touch or gestures.
[0050] In some embodiments, the display device 200 can also be controlled in a manner other than the control device 100 and the smart device 300. For example, the user's voice command control can be directly received through a module for obtaining voice commands configured inside the display device 200, or the user's voice command control can be received through a voice control device set outside the display device 200.
[0051] In some embodiments, the display device 200 also communicates data with the server 400. The display device 200 may be allowed to communicate via a local area network (LAN), a wireless local area network (WLAN), and other networks. The server 400 may provide various content and interactions to the display device 200. The server 400 may be one cluster or multiple clusters, and may include one or more types of servers.
[0052] like Figure 2 The display device 200 includes at least one of a tuner and demodulator 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a memory, a power supply, and a user interface.
[0053] In some embodiments, the controller includes a processor, a video processor, an audio processor, a graphics processor, a RAM, a ROM, and a first interface to an nth interface for input / output.
[0054] The display 260 includes a display screen component for presenting images, and a driving component for driving image display, which is used to receive image signals output from the controller, and display video content, image content, and menu control interface components and user control UI interface.
[0055] The display 260 may be a liquid crystal display, an OLED display, or a projection display, and may also be a projection device and a projection screen.
[0056] The communicator 220 is a component for communicating with an external device or server according to various communication protocol types. For example, the communicator may include at least one of a Wifi module, a Bluetooth module, a wired Ethernet module, and other network communication protocol chips or near field communication protocol chips, and an infrared receiver. The display device 200 can establish transmission and reception of control signals and data signals with the external control device 100 or the server 400 through the communicator 220.
[0057] The user interface can be used to receive control signals from the control device 100 (such as an infrared remote controller, etc.).
[0058] The detector 230 is used to collect signals from the external environment or the external interaction. For example, the detector 230 includes a light receiver, a sensor for collecting the intensity of ambient light; or, the detector 230 includes an image collector, such as a camera, which can be used to collect external environment scenes, user attributes or user interaction gestures; or, the detector 230 includes a sound collector, such as a microphone, etc., for receiving external sounds.
[0059] The external device interface 240 may include, but is not limited to, any one or more of the following: a high-definition multimedia interface (HDMI), an analog or digital high-definition component input interface (component), a composite video input interface (CVBS), a USB input interface (USB), an RGB port, etc. It may also be a composite input / output interface formed by the above multiple interfaces.
[0060] The tuner-demodulator 210 receives broadcast television signals via wired or wireless reception, and demodulates audio and video signals, such as EPG data signals, from a plurality of wireless or wired broadcast television signals.
[0061] In some embodiments, the controller 250 and the tuner-demodulator 210 may be located in different separate devices, that is, the tuner-demodulator 210 may also be located in an external device of the main device where the controller 250 is located, such as an external set-top box.
[0062] The controller 250 controls the operation of the display device and responds to user operations through various software control programs stored in the memory. The controller 250 controls the overall operation of the display device 200. For example, in response to receiving a user command for selecting a UI object to be displayed on the display 260, the controller 250 can perform operations related to the object selected by the user command.
[0063] In some embodiments, the controller includes a central processing unit (CPU), a video processor, an audio processor, a graphics processing unit (GPU), a RAM Random Access Memory (RAM), a ROM (Read-Only Memory, ROM), a first interface to an nth interface for input / output, a communication bus (Bus), etc.
[0064] The user may input a user command through a graphical user interface (GUI) displayed on the display 260, and the user input interface receives the user input command through the graphical user interface (GUI). Alternatively, the user may input a user command through a specific sound or gesture, and the user input interface recognizes the sound or gesture through a sensor to receive the user input command.
[0065] "User interface" is the medium interface for interaction and information exchange between applications or operating systems and users. It realizes the conversion between the internal form of information and the form acceptable to users. The commonly used form of user interface is the Graphical User Interface (GUI), which refers to the user interface related to computer operation displayed in a graphical way. It can be an interface element such as an icon, window, control, etc. displayed on the display screen of an electronic device, where the control can include icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.
[0066] See also Figure 3 In some embodiments, the system is divided into four layers, from top to bottom, namely, the application layer (Applications) layer (referred to as "application layer"), the application framework layer (Application Framework) layer (referred to as "framework layer"), the Android runtime (Android runtime) and system library layer (referred to as "system runtime library layer"), and the kernel layer.
[0067] To clearly illustrate the embodiments of the present application, Figure 4 A speech recognition network architecture provided in an embodiment of the present application is described.
[0068] See also Figure 4 , Figure 4 A schematic diagram of a speech recognition network architecture provided for an embodiment of the present application. Figure 4 In the example, the smart device is used to receive input information and output the processing results of the information. The speech recognition service device is an electronic device deployed with a speech recognition service, the semantic service device is an electronic device deployed with a semantic service, and the business service device is an electronic device deployed with a business service. The electronic devices here may include servers, computers, etc. The speech recognition service, semantic service (also called semantic engine) and business service here are web services that can be deployed on electronic devices, wherein the speech recognition service is used to recognize audio as text, the semantic service is used to perform semantic analysis on the text, and the business service is used to provide specific services such as the weather query service of Moji Weather, the music query service of QQ Music, etc. In one embodiment, Figure 4 In the illustrated architecture, there may be multiple physical service devices deployed with different business services, or one or more functional services may be integrated into one or more physical service devices.
[0069] In some embodiments, the following Figure 4 The process of processing the information input into the smart device by the architecture shown is described by way of example. Taking the information input into the smart device as a query statement input by voice as an example, the above process may include the following three processes:
[0070] [Speech Recognition]
[0071] After receiving the query statement input by voice, the smart device may upload the audio of the query statement to the voice recognition service device, so that the voice recognition service device recognizes the audio as text through the voice recognition service and returns it to the smart device. In one embodiment, before uploading the audio of the query statement to the voice recognition service device, the smart device may perform denoising on the audio of the query statement, and the denoising process here may include steps such as removing echoes and environmental noise.
[0072] [Semantic understanding]
[0073] The smart device uploads the text of the query statement recognized by the speech recognition service to the semantic service device, so that the semantic service device performs semantic analysis on the text through the semantic service to obtain the business field, intent, etc. of the text.
[0074] [Semantic Response]
[0075] The semantic service device sends a query instruction to the corresponding business service device according to the semantic analysis result of the text of the query statement to obtain the query result given by the business service. The intelligent device can obtain the query result from the semantic service device and output it. As an embodiment, the semantic service device can also send the semantic analysis result of the query statement to the intelligent device, so that the intelligent device can output the feedback statement in the semantic analysis result.
[0076] It should be noted that Figure 4 The architecture shown is only an example and does not limit the protection scope of the present application. In the embodiment of the present application, other architectures can also be used to implement similar functions. For example, all or part of the three processes can be completed by the smart terminal, which will not be described in detail here.
[0077] The hardware or software architecture in some embodiments may be based on the introduction in the above embodiments, and in some embodiments may be based on other similar hardware or software architectures, so as to implement the technical solution of the present application.
[0078] In some embodiments, Figure 4 The smart device shown can be a display device, such as a smart TV. The function of the voice recognition service device can be implemented by the sound collector and controller set on the display device. The functions of the semantic service device and the business service device can be implemented by the controller of the display device or by the server of the display device.
[0079] In some embodiments, Figure 4 The speech recognition service device, semantic service device and business service device shown may be implemented by one server or multiple servers of the display device.
[0080] In some embodiments, a query statement or other interactive statement input by a user into a display device through voice may be referred to as a voice command.
[0081] In some embodiments, the display device obtains search results given by the business service from the semantic service device. The display device can analyze the search results, generate response data for the voice command, and then control the display device to perform corresponding actions based on the response data.
[0082] In some embodiments, the display device obtains the semantic analysis result of the voice command from the semantic service device. The display device can analyze the semantic analysis result, generate response data, and then control the display device to perform corresponding actions according to the response data.
[0083] In some embodiments, a voice control button may be provided on the remote controller of the display device. When the user presses the voice control button on the remote controller, the controller of the display device may control the display of the display device to display a voice interaction interface and control a sound collector, such as a microphone, to collect sounds around the display device. At this time, the user may input voice commands to the display device.
[0084] In some embodiments, the display device may support a voice wake-up function, and the sound collector of the display device may be in a state of continuously collecting sound. After the user says the wake-up word, the display device performs voice recognition on the voice command input by the user, and after recognizing the voice command as the wake-up word, the display of the display device may be controlled to display a voice interaction interface, at which point the user may continue to input voice commands to the display device.
[0085] In some embodiments, after the user inputs a voice command, while the display device obtains response data of the voice command or the display device responds according to the response data, the sound collector of the display device can maintain the state of sound collection, and the user can press and hold the voice control button on the remote control at any time to re-enter the voice command, or say the wake-up word. At this time, the display device can end the last voice interaction process and start a new voice interaction process according to the new voice command input by the user, thereby ensuring the real-time nature of the voice interaction.
[0086] By interacting with the display device through voice, the user can search for media resources on the display device and control the display device, where the device control may include adjusting the volume, adjusting the brightness, etc.
[0087] In some embodiments, the user can wake up the voice assistant application by issuing a voice command to the display device. The voice command can be some preset wake-up words. After the voice assistant application wakes up, the user can interact with the voice assistant application to perform voice control on the display device. After receiving the user's voice command, the intelligent voice assistant needs to perform voice recognition on the voice command to obtain the recognized text. Since many characters are easily confused, there is a certain probability of error in the recognized text.
[0088] In order to solve the above technical problems, an embodiment of the present application provides a server and a text error correction method, wherein the server is used to execute the text error correction method.
[0089] It should be noted that the text correction method provided by the present application can also be executed by the display device, or a part of it can be executed by the display device and the rest can be executed by the server. The text correction method provided by the present application can also be adaptively adjusted to achieve text correction in more scenarios. For example, it can also be applied to the text input by the user and the text obtained by the optical character recognition system for correction.
[0090] In some embodiments, the text correction method provided in the embodiments of the present application can be applied before the natural language processing application system to perform text correction on the input text and improve subsequent system performance. The natural language processing application system may include a semantic understanding system, a knowledge dialogue system, a machine translation system, and the like.
[0091] See also Figure 5 The overall process of the text correction method provided in the embodiment of the present application can be divided into: inputting the text to be corrected, error detection, recall, sorting and outputting the text to be corrected. After the input text to be corrected is error-checked, if no error is detected, the input text to be corrected is directly output as the corrected text; if an error is detected, the corrected text is obtained after recall and sorting.
[0092] Figure 6 For Figure 5 For further explanation, see Figure 6 , the text error correction method may include the following steps:
[0093] Step S110: Perform voice recognition on the received voice command to obtain a text to be corrected.
[0094] In some embodiments, the voice command received by the server comes from a display device or a voice interaction device. The text obtained by performing voice recognition on the voice command can be referred to as the text to be corrected.
[0095] In some embodiments, in some text correction scenarios, the input of the device performing text correction is the text to be corrected rather than a voice command. In this case, the device performing text correction may not execute step S110, and directly start performing text correction from step S120.
[0096] In some embodiments, there may be text errors in the text to be corrected. Common text errors can be divided into the following types: (1) homophonic word errors: our years - our era, etc.; (2) mixed pronunciation word errors: play home - play for home, etc.; (3) missing word errors: play thirty miles of peach blossoms - play thirty kilometers of peach blossoms, etc.; (4) multiple word errors: I want to see I fall in love with soldiers - I want to see I fall in love with soldiers, etc.; (5) word order reversal errors: Zhang XX - XX Zhang, etc.
[0097] Step S120: performing error detection on the text to be corrected to obtain an entity to be corrected corresponding to the text to be corrected.
[0098] In some embodiments, the entity in the text to be corrected refers to a proper noun representing a person or thing, such as a movie name entity, a music name entity, an actor name entity, a novel name entity, etc. After error checking the text to be corrected, the entity to be corrected corresponding to the text to be corrected can be obtained.
[0099] Step S130: performing candidate recall on the entity to be corrected by using a plurality of recall methods to obtain a plurality of candidate entities.
[0100] In some embodiments, multiple recall methods can be used for candidate recall, such as confusion set recall, ES full entity recall, end-to-end model recall, etc., to obtain multiple candidate entities corresponding to the entity to be corrected.
[0101] Step S140: Calculate the probability of each candidate entity according to the characteristics of the entity to be corrected at multiple preset levels, and determine the corrected entity corresponding to the entity to be corrected according to the probability of each candidate entity.
[0102] In some embodiments, the preset levels may include the phonetic level, the character level, the semantic level, the heat level, etc. For a candidate entity, the features of the entity to be corrected at the above multiple levels may be constructed, and then these features may be input into a classification and sorting model based on the XGBoost (extreme Gradient Boosting) algorithm to calculate the probability that the candidate entity is a corrected entity.
[0103] In some embodiments, after the probabilities of multiple candidate entities are calculated, the multiple entities can be sorted according to the probabilities, and the candidate entity with the highest probability is determined as the corrected entity to achieve text correction.
[0104] To further explain the text error correction method of this application, Figure 7-Figure 10 The schematic diagrams of the software architecture, error detection, recall, and sorting of the text error correction method according to some embodiments are shown in sequence.
[0105] See also Figure 7 For example, the text to be corrected is "XXXXXA". After the text to be corrected is successively subjected to error detection based on error correction rules and deep learning, multi-model single entity multi-way recall, and multi-level feature ranking learning, the corrected text "XXXXXB" can be finally obtained.
[0106] In some embodiments, the error detection model based on error correction rules and deep learning can set error correction rules, language models, and end-to-end error detection program codes. The error detection method based on error correction rules and deep learning error detection models can be found in Figure 8 , which is a flowchart of an error detection method according to some embodiments.
[0107] like Figure 8 As shown, the error detection method may include the following steps:
[0108] Step S201: Determine whether error correction is required based on error correction rules.
[0109] The error correction rules can be some manually preset rules for determining whether the text to be corrected needs to be corrected. If not, no correction will be performed. This can prevent the problem of system performance degradation caused by incorrect text correction. If correction is required, the error detection flag ERROR_STATE can be set to True, and the entity to be corrected can be set to the text to be corrected.
[0110] In some embodiments, the preset error correction rules may include: if the text to be corrected contains numbers, such as Chinese zero to nine, Arabic numerals 0-9, no correction is performed to avoid the correction not meeting the user's intention.
[0111] In some embodiments, the preset error correction rules may include: if the text to be corrected contains instructions, such as control instructions: fast forward, rewind, pause, play, etc., no correction will be performed to avoid the correction not meeting the user's intention.
[0112] The above two error correction rules are only examples. In actual implementation, the error correction rules can be determined according to the actual business situation.
[0113] Taking the text to be corrected as "XXXXXA" as an example, after the text to be corrected is input into the error detection model based on error correction rules and deep learning, the model first determines whether the text to be corrected needs to be corrected through the error correction rules. If correction is required, continue to execute step S202. If not, end the error detection and output the text to be corrected to the recall model for candidate recall. According to the above error correction rules, "XXXXXA" needs to be corrected, so "XXXXXA" can be set as the entity to be corrected, and the error detection flag ERROR_STATE is set to True, and the entity to be corrected is input into the language model for processing.
[0114] Step S202: If necessary, determine whether it is an entity through a language model.
[0115] In some embodiments, the language model is used to perform entity determination on the text to be corrected. The meaning of entity can refer to proper nouns, such as characters, animals, plants, film and television drama names, etc. Therefore, if it is determined to be an entity, it can be corrected according to a preset entity database, where the entity database includes the names of multiple entities. If it is determined not to be an entity, it is necessary to combine the manually preset entity determination rules and the end-to-end model for further entity determination.
[0116] In some embodiments, the language model may be a BERT (Bidirectional Encoder Representations from Transformers, Chinese meaning) model. The BERT model can measure the probability of a sentence appearing by perplexity. The smaller the perplexity, the greater the probability of the sentence appearing. The perplexity threshold of the BERT model can be set in advance, and the text to be corrected is input into the language model. If the perplexity of the output text to be corrected is less than the perplexity threshold, the text to be corrected is determined to be a sentence. If it is greater than the perplexity threshold, the text to be corrected is determined not to be a sentence, but a word, and may be a pure entity. Since the BERT model can only judge words, when it is judged that the text to be corrected is a sentence, the text to be corrected is input into the end-to-end model for entity recognition. When it is judged that the text to be corrected is a word, it can turn to step S204 to determine the text to be corrected as an entity.
[0117] In some embodiments, after the language model determines that the text to be corrected is a sentence, some manually set rules can be used to determine whether it is a pure entity. Exemplarily, the rules include: if the text to be corrected includes words such as "I want to see", "I want to listen", "open", etc., the text to be corrected is considered to be a non-pure entity. At this time, the text to be corrected can be passed to the end-to-end model for entity recognition; if the text to be corrected does not contain words such as "I want to see", "I want to listen", "open", etc., the text to be corrected is considered to be a pure entity, and then the process can be turned to step S204 to determine the text to be corrected as an entity.
[0118] Step S203: If it is determined to be a non-entity, an entity is identified through an end-to-end model.
[0119] In some embodiments, the end-to-end model for entity recognition of the text to be corrected is a Transformer+CRF model. The model is pre-trained with a data set, which contains a large number of erroneous entities, so that when the model encounters the erroneous entity again, it can accurately identify the erroneous entity. If an erroneous entity is identified from the text to be corrected, the error detection part of the model returns the identified entity and sets the system state ERROR_STATE to require error correction. The end-to-end model corrects the text to be corrected in the system state ERROR_STATE. Compared with the common use of Bi-LSTM+CRF to perform entity recognition on the text to be corrected, the difference is that the encoder part of the Transformer model is used in this embodiment to extract features from the input sequence X=x_0x_1…x_T of the text to be corrected, where T is the length of the input text, and obtains hidden layer features h_i, h_i represents the hidden features of the i-th word, and then identifies the film and television name entities, music name entities, actor name entities, novel name entities, etc. through the CRF (full English spelling, Chinese meaning) model, wherein the number of encoder layers is set to 6.
[0120] Step S204: Obtain the entity to be corrected.
[0121] In some embodiments, the entity obtained in this step may be the text to be corrected that does not need to be corrected as determined in step S201, may be the entity determined in step S202, or may be the entity identified in step S203.
[0122] In some embodiments, the entity obtained in this step may be referred to as an entity to be corrected to distinguish it from the entity obtained in the candidate recall step.
[0123] After obtaining the entity to be corrected corresponding to the text to be corrected, candidate recall can be performed on the entity to be corrected.
[0124] See also Fig. 9 The recall methods may include confusion set recall, ES full entity recall, end-to-end model recall and other methods. After recalling the error-corrected entities using multiple recall methods, the obtained candidate entities may include candidate entity 1, candidate entity 2, candidate entity 3, candidate entity 4…
[0125] It should be noted that Fig. 9 In the process, the recall methods do not affect each other and can be executed in parallel to improve the recall efficiency. In actual implementation, the recall model corresponding to the recall method can be conveniently added or deleted through the configuration file, which can be used for subsequent recall part model optimization.
[0126] In some embodiments, the confusion set is obtained in advance by analyzing user log big data in the form of source–>target, where source represents the erroneous entity and target represents the target entity corresponding to the erroneous entity. For example, the data in the confusion set includes: AAAAB–>XXXXXB, indicating that the erroneous entity is AAAAB, and the target entity corresponding to AAAAB is XXXXXB.
[0127] Through similarity calculation, the similarity between the entity obtained in the error detection part and multiple erroneous entities in the confusion set can be calculated, and the erroneous entity whose similarity exceeds the similarity threshold can be obtained, and then the target entity corresponding to the erroneous entity can be recalled.
[0128] Exemplarily, for the entity to be corrected "XXXXXA", it is calculated that the similarity between the entity to be corrected and the erroneous entities AAAAB and AAAAC in the confusion set exceeds the threshold, and AAAAB–>XXXXXB, AAAAC–>XXXXXC, therefore, the candidate entities recalled through the confusion set are: "XXXXXB" and "XXXXXC".
[0129] In some embodiments, ElasticSearch (full-text search engine) stores all entities in the field supported by error correction, such as movie name entities, music name entities, actor name entities, novel name entities, etc. When recalling all entities in ES, after the entity to be corrected is input into ElasticSearch, ElasticSearch can calculate the similarity between the entity to be corrected and all entities, obtain entities whose similarity meets the preset conditions, and output the obtained entities whose similarity meets the preset conditions as candidate recall entities.
[0130] For example, for the entity to be corrected "XXXXXA", the candidate entities obtained through ES full entity recall may be: "XXXXXD", "XXXXXE".
[0131] In some embodiments, the end-to-end model recall is an end-to-end error correction model based on ALBERT (Albert), which has the limitation that the number of input and output words is the same. Recall can be performed only when the text to be corrected queried by the user is a non-entity. If the text to be corrected is determined to be a pure entity, the recall result may not be output. If there is a recall result, only one recalled entity may be output, wherein the position of the current entity is also determined by Transformer+CRF.
[0132] Taking the entity to be corrected as "XXXXXA" as an example, after the end-to-end model recall, the candidate entity obtained may be: "XXXXXF".
[0133] In some embodiments, the end-to-end model obtains candidate entities by calculating similarity. Unlike other models that use edit distance to calculate similarity, the end-to-end model recall uses the cosine based on the angle for similarity measurement. In actual implementation, the end-to-end model can use the pre-trained model BERT to encode the entities determined by the error detection part and the entities recalled by each module, obtain the vector expression of the entity to be corrected and the recalled entity, and calculate the cosine similarity respectively. The calculation formula is as follows:
[0134]
[0135] In the above formula, vector a represents the vector expression of the entity to be corrected after the pre-trained model BERT, and vector b represents the vector expression of the recalled entity determined by the recall sub-model after the pre-trained model BERT.
[0136] In some embodiments, when an entity meets the set cosine similarity threshold, the entity recalled by the sub-model can be used as the output of the recall part. The vector expression of the entity obtained by the pre-trained model BERT can better understand the semantic expression between the entity to be corrected and the recalled entity, and improve the error correction performance.
[0137] After obtaining multiple candidate entities, you can sort them. For the sorting method, see Fig.10 .
[0138] like Fig.10 As shown, in some embodiments, entity features can be constructed for multiple candidate entities respectively. Entity feature construction is to construct features for candidate entities and entities to be corrected, and the constructed features include at least pinyin level features, character level features, semantic level features, heat level features, etc.
[0139] The calculation method of the classification and sorting model is as follows: the features constructed by the entity feature construction module are used as input, and the machine learning method XGBoost (extreme Gradient Boosting) is used as the classification and sorting model. The output of the model is the probability of each candidate entity, and the entity sorting output probability threshold is set. If it is less than the threshold, it is considered that the entity identified by the error detection part does not need to be corrected. If it is greater than the threshold, the entity with the largest probability is selected as the corrected entity.
[0140] Exemplarily, the pinyin level features, character level features, semantic level features, and heat level features are constructed as follows:
[0141] Pinyin-level features: All entities to be corrected and recalled entities are converted into pinyin form, and then the edit distance between the two groups of pinyin is calculated, and the edit distance is used as the pinyin-level features of the recalled entities. If a maximum of 10 entities are recalled, there are 10 dimensions of features at the pinyin level.
[0142] Character-level features: Calculate the edit distance between the entity to be corrected and the recalled entity, and use the edit distance as the character-level feature. If a maximum of 10 entities are recalled, there are 10 dimensions of features at the pinyin level. The calculation formula for the edit distance is as follows:
[0143]
[0144] In the above formula, lev represents the marking distance, a represents the entity to be corrected, b represents the recalled entity, i represents the length of a when calculating the edit distance, j represents the length of b when calculating the edit distance, and otherwise represents others.
[0145] Semantic level features: The vectors of the entity to be corrected and the recalled entity are calculated respectively through the BERT-based pre-training model, where the BERT-based pre-training model can be called a semantic vector model, the semantic vector corresponding to the entity to be corrected can be called a first semantic vector, and the semantic vector corresponding to the recalled entity can be called a second semantic vector. These two sets of vectors are used as the semantic level features of the recalled entity. The vector can be a 64-dimensional vector. The semantic level of a single entity is a 64-dimensional vector. If 10 entities are set to be recalled, there are 704 dimensions of features in total.
[0146] Heat level features: belong to business level features. Pre-configure heat data. For example, during sports games, set entities such as athletes and sports events as heat data. When the entity to be corrected is heat data, the heat data is recalled first, and then the heat code is set. The setting method is: Heat code means:. If a maximum of 10 entities are set to be recalled, the heat level features have a total of 10 dimensions.
[0147] After constructing the features of the entity, it can be sorted using a classification and sorting model.
[0148] XGBoost is a set of tree-boosting scalable machine learning systems, which is based on the idea of ensemble learning, and multiple weak learners are weighted and summed to obtain the final model structure. This method has better prediction performance than a single model (i.e., weak learner). In the sorting step, the present invention combines the character-level features, phonetic-level features, semantic-level features, and heat values of the entities to be corrected and the recalled entities, and then uses them as the input of XGBoost to perform multi-classification tasks, that is, according to the above features, the entities to be corrected are classified into the correct entity categories.
[0149] It can be seen from the above embodiments that the embodiments of the present application perform candidate recall on the entities to be corrected through a variety of recall methods, thereby realizing multi-perspective recall. The number of candidate entities obtained is large and very comprehensive. The corrected entity is determined according to the probability of each candidate entity, thereby improving the correction accuracy and being able to well solve text errors of common text error types.
[0150] Since the above embodiments are all described by citing and combining with other embodiments, different embodiments have the same parts, and the same and similar parts between the embodiments in this specification can be referred to each other. No further detailed description is given here.
[0151] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0152] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.
Claims
1. A server, characterized in that: The server is configured to: Performing voice recognition on the received voice command to obtain the text to be corrected; Performing error detection on the text to be corrected to obtain an entity to be corrected corresponding to the text to be corrected; Perform candidate recall on the entity to be corrected by using multiple recall methods to obtain multiple candidate entities; Calculating the probability of each candidate entity according to the characteristics of the entity to be corrected at multiple preset levels, and determining the corrected entity corresponding to the entity to be corrected according to the probability of each candidate entity; Among them, the multiple preset levels include a pinyin level, a character level, a semantic level and a heat level; the feature of the entity to be corrected at the pinyin level includes a first edit distance between the pinyin of the entity to be corrected and the pinyin of the candidate entity, the feature of the entity to be corrected at the character level includes a second edit distance between the text of the entity to be corrected and the text of the candidate entity, the feature of the entity to be corrected at the semantic level includes a first semantic vector and a second semantic vector obtained by inputting the entity to be corrected and the candidate entity into a pre-trained semantic vector model in sequence, and the feature of the entity to be corrected at the heat level includes the real-time heat value of the candidate entity; Among them, the error detection of the text to be corrected to obtain the entity to be corrected corresponding to the text to be corrected includes: determining whether the text to be corrected needs to be corrected through error correction rules; if it is determined that correction is needed, determining whether the text to be corrected is an entity through a language model, and if it is determined that correction is not needed, determining the text to be corrected as the entity to be corrected; if the language model determines that the text to be corrected is a non-entity, identifying the entity to be corrected corresponding to the text to be corrected through an end-to-end model.
2. The server according to claim 1, characterized in that: The candidate entities to be corrected are recalled by multiple recall methods to obtain multiple candidate entities, including: The entities to be corrected are respectively recalled as candidates through the confusion set recall method, the ES full entity recall method and the end-to-end model recall method to obtain multiple candidate entities.
3. The server according to claim 1, characterized in that: The probability of each candidate entity is calculated according to the characteristics of the entity to be corrected at multiple preset levels, including: Construct features of each candidate entity at multiple preset levels; The features of each candidate entity are input into the pre-trained classification and ranking model to obtain the probability of each candidate entity.
4. The server according to claim 3, characterized in that: Input the features of each candidate entity into the pre-trained classification and ranking model to obtain the probability of each candidate entity, including: Combining the features of each candidate entity at multiple preset levels respectively; The combined features of each candidate entity are input into a pre-trained classification and ranking model, and the probability predicted by the classification and ranking model for the features at multiple preset levels is weighted and summed to obtain the probability of each candidate entity.
5. The server according to claim 4, characterized in that: The classification and sorting model is an XGBoost model.
6. The server according to claim 1, characterized in that: Determining the corrected entity corresponding to the to-be-corrected entity according to the probability of each candidate entity includes: The candidate entities are sorted according to the probability of each candidate entity, and the candidate entity with the greatest probability is determined as the corrected entity of the entity to be corrected.
7. The server according to claim 1, characterized in that: Determining the corrected entity corresponding to the to-be-corrected entity according to the probability of each candidate entity includes: Determine whether the probability of each candidate entity exceeds a preset probability threshold; If the probability of each candidate entity does not exceed the probability threshold, the entity to be corrected is determined as a corrected entity; If the probability of the existence of a candidate entity exceeds the probability threshold, a candidate entity with the largest probability among the candidate entities whose probabilities exceed the probability threshold is selected and determined as the corrected entity.
8. A text error correction method, characterized in that: include: Performing voice recognition on the received voice command to obtain the text to be corrected; Performing error detection on the text to be corrected to obtain an entity to be corrected corresponding to the text to be corrected; Performing candidate recall on the entity to be corrected to obtain multiple candidate entities; Sorting the probabilities of multiple candidate entities according to the features of the entity to be corrected at multiple preset levels, and determining the candidate entity with the highest probability as the corrected entity of the entity to be corrected; Among them, the multiple preset levels include a pinyin level, a character level, a semantic level and a heat level; the feature of the entity to be corrected at the pinyin level includes a first edit distance between the pinyin of the entity to be corrected and the pinyin of the candidate entity, the feature of the entity to be corrected at the character level includes a second edit distance between the text of the entity to be corrected and the text of the candidate entity, the feature of the entity to be corrected at the semantic level includes a first semantic vector and a second semantic vector obtained by inputting the entity to be corrected and the candidate entity into a pre-trained semantic vector model in sequence, and the feature of the entity to be corrected at the heat level includes the real-time heat value of the candidate entity; Among them, the error detection of the text to be corrected to obtain the entity to be corrected corresponding to the text to be corrected includes: determining whether the text to be corrected needs to be corrected through error correction rules; if it is determined that correction is needed, determining whether the text to be corrected is an entity through a language model, and if it is determined that correction is not needed, determining the text to be corrected as the entity to be corrected; if the language model determines that the text to be corrected is a non-entity, identifying the entity to be corrected corresponding to the text to be corrected through an end-to-end model.
Citation Information
Patent Citations
Speech text error correction method
CN110782892A
Intelligent text error correction model training method
CN112989806A
