Disclosure of Invention
The embodiment of the invention provides an input error correction method, an input error correction device, electronic equipment and a storage medium, which are used for solving the problem that the reliability of input error correction is poor due to the existing manually formulated rules.
In a first aspect, an embodiment of the present invention provides an input error correction method, including:
acquiring each touch coordinate corresponding to a character string input by a user;
inputting each touch coordinate into an error correction model to obtain an error correction result output by the error correction model; the error correction model is trained based on sample touch coordinates corresponding to the sample character strings and sample input results, and is used for correcting the error of keys corresponding to the touch coordinates based on each touch coordinate and outputting error correction results.
Preferably, the error correction model comprises an output layer, and a replacement error correction layer and/or a multi-splice error correction layer.
Preferably, the inputting each touch coordinate to an error correction model to obtain an error correction result output by the error correction model specifically includes:
inputting each point-touch coordinate into the replacement error correction layer to obtain the key probability of each point-touch coordinate output by the replacement error correction layer corresponding to each key;
and/or inputting each point-touch coordinate into the multi-spelling error correction layer to obtain multi-spelling probability corresponding to each point-touch coordinate output by the multi-spelling error correction layer;
And inputting each point-touch coordinate, the key probability of each point-touch coordinate corresponding to each key and/or the multi-spelling probability of each point-touch coordinate to the output layer to obtain the error correction result output by the output layer.
Preferably, the inputting each point coordinate, and the key probability of each point coordinate corresponding to each key and/or the multi-spelling probability of each point coordinate to the output layer, to obtain the error correction result output by the output layer specifically includes:
determining a plurality of first candidate paths based on each touch coordinate and a preset coordinate area of each key;
determining a plurality of second candidate paths based on the key probability that each point-touch coordinate corresponds to each key and/or the multi-spelling probability that each point-touch coordinate corresponds to;
outputting the error correction result based on each of the first candidate paths and each of the second candidate paths.
Preferably, the determining a number of second candidate paths based on the key probability that each of the touch coordinates corresponds to each key specifically includes:
if the key probability of any point touch coordinate relative to any key is larger than a key probability threshold, taking any key as a replacement candidate key corresponding to any point touch coordinate;
And determining a plurality of second candidate paths based on the replacement candidate keys corresponding to each point touch coordinate.
Preferably, the determining a plurality of second candidate paths based on the multi-spelling probability corresponding to each touch coordinate specifically includes:
if the multi-spelling probability corresponding to any point touch coordinate is larger than the multi-spelling probability threshold, determining multi-spelling candidate keys corresponding to any point touch coordinate based on the any point touch coordinate and a preset coordinate area of each key;
and deleting the multi-spelling candidate keys corresponding to the arbitrary touch coordinates in each first candidate path to obtain a plurality of second candidate paths.
Preferably, the outputting the error correction result based on each of the first candidate paths and each of the second candidate paths specifically includes:
determining a language model score for each candidate result under each candidate path;
determining a penalty score of each candidate path based on a key probability that each of the click coordinates corresponds to each key and/or a multi-spelling probability that each of the click coordinates corresponds to;
determining a composite score for each candidate result in any candidate path based on the penalty score for the candidate path and the language model score for each candidate result in any path;
And outputting the error correction result based on the comprehensive score of each candidate result under each candidate path.
Preferably, the inputting each of the touch coordinates to the multi-spelling error correction layer obtains a multi-spelling probability corresponding to each of the touch coordinates output by the multi-spelling error correction layer, which specifically includes:
determining candidate keys corresponding to any point touch coordinates based on the any point touch coordinates and a preset coordinate area of each key;
the distance between the candidate keys corresponding to the any point touch coordinates and the candidate keys corresponding to the previous point touch coordinates and the next point touch coordinates respectively, or the distance between the candidate keys corresponding to the any point touch coordinates and the candidate keys corresponding to the previous point touch coordinates and the next point touch coordinates respectively and the auxiliary information of the candidate keys corresponding to the any point touch coordinates are input into the multi-spelling error correction layer, so that the multi-spelling probability corresponding to the any point touch coordinates output by the multi-spelling error correction layer is obtained;
the auxiliary information comprises interval time and/or high-frequency multi-spelling marks, and the high-frequency multi-spelling marks are used for indicating whether the candidate keys corresponding to the touch coordinates are in a preset high-frequency multi-spelling area or not.
Preferably, the inputting each touch coordinate into the error correction model to obtain an error correction result output by the error correction model further includes:
and training the error correction model based on the historical touch coordinates corresponding to the historical character string input by the user and the historical input result.
In a second aspect, an embodiment of the present invention provides an input error correction apparatus, including:
the coordinate acquisition unit is used for acquiring each touch coordinate corresponding to the character string input by the user;
the error correction output unit is used for inputting each touch coordinate into the error correction model to obtain an error correction result output by the error correction model; the error correction model is trained based on sample touch coordinates corresponding to the sample character strings and sample input results, and is used for correcting the error of keys corresponding to the touch coordinates based on each touch coordinate and outputting error correction results.
Preferably, the error correction model comprises an output layer, and a replacement error correction layer and/or a multi-splice error correction layer.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a bus, where the processor, the communication interface, and the memory are in communication with each other through the bus, and the processor may invoke logic instructions in the memory to perform the steps of the method as provided in the first aspect.
In a fourth aspect, embodiments of the present invention provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method as provided by the first aspect.
According to the input error correction method, the input error correction device, the electronic equipment and the storage medium, the touch coordinates are input into the pre-trained error correction model to obtain the error correction result, so that the condition that rules are manually formulated in the automatic error correction process is avoided, the objectivity of the automatic error correction method is ensured, and the reliability and the accuracy of the error correction result are improved. In addition, the application of the touch coordinates reserves the detail information input by the user, has better fault tolerance, is beneficial to providing more accurate error correction results for the user and optimizes the user experience.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
With the increasing popularity of mobile internet technology nowadays, the scene of people using the internet is mostly transferred from a PC end to a portable intelligent terminal with a full touch screen, such as a smart phone, a tablet computer, and the like. For the user in the middle and Korean, the main way of information interaction on the portable intelligent terminal still is to complete input through the pinyin input method, but as the input environment is converted from a physical keyboard to a smaller full-touch screen with uniform feedback (the touch feeling at any position is the same, the feeling of pressing the middle of a key and the edge of the key is not different) of the physical keyboard, the probability of inputting errors is obviously increased, the difficulty of modifying the incorrect pinyin on the portable intelligent terminal is higher than that of modifying the physical keyboard, the incorrect pinyin position needs to be completely deleted by deleting the key, the correct pinyin string needs to be re-input, or the user needs to manually click the incorrect position, and then move the cursor to the final position to complete modification, so that the smoothness of user input is greatly affected.
The input error correction method used by the inventor before is mainly divided into a manual error correction method and an automatic error correction method:
the manual error correction method provides a convenient error correction modification path for improving the experience of manual error correction of a user, and provides error correction related candidates, namely modification candidate words, for the user when the user selects the candidates needing error correction, so that the influence of modification operation on the user is reduced. For example, an error correction button is provided, a series of candidate error correction results are provided after clicking, or when the user moves the cursor, candidate options which can occur when deleting one letter before the cursor movement position are automatically simulated, or candidate options for modifying one letter before the cursor movement position into other letters are automatically simulated, or candidate options for adding letters before the cursor movement position are automatically simulated, so that the time of the user is saved.
The automatic error correction method is to construct a rule association related key, and default the possibility of inputting the key related key after inputting a key, thereby achieving the effect of automatic error correction. Aiming at the problems that people in different areas have different pronunciations, roll and flat tongues and the front nasal sound and the rear nasal sound are not separated, the problem can be solved by using a construction rule, for example, an error correction rule of z=zh is preset, a user inputs 'zeli' and the candidate of 'zheli' is automatically given, so that the effect of automatic error correction is achieved.
However, the rules in the prior art are manually formulated, have strong subjectivity, and the accuracy of input error correction is greatly influenced by the quality of rule formulation, so that the reliability of the input error correction is poor. In this regard, the embodiment of the invention provides an input error correction method, which can be applied to a scene needing to be input through a touch screen, for example, typing through a smart phone with a touch screen, a smart watch, a tablet computer and other devices.
Fig. 1 is a flow chart of an input error correction method according to an embodiment of the present invention, as shown in fig. 1, the method includes:
step 110, obtaining each touch coordinate corresponding to the character string input by the user.
Specifically, when a user inputs a character string through a virtual keyboard on the touch screen, the touch coordinates corresponding to each character in the character string when the user inputs the character string can be recorded. Here, the touch coordinates are used to represent position information of a touch screen when a user inputs a character string, and one touch coordinate is recorded when the user touches the touch screen once.
Step 120, inputting each touch coordinate into an error correction model to obtain an error correction result output by the error correction model; the error correction model is trained based on sample touch coordinates corresponding to the sample character strings and sample input results, and is used for correcting the keys corresponding to the touch coordinates based on the touch coordinates and outputting error correction results.
In general, the touch coordinates may directly reflect the key that the user wants to input, where the coordinate area where the touch coordinates are located corresponds to the key that the user inputs, but in the actual input process, the key that the touch coordinates are located corresponds to the key that the user wants to input may deviate from the key that the user actually wants to input due to factors such as the size of the touch screen, the habit of inputting the user, and the speed of inputting the user. The traditional input method only records the keys corresponding to the coordinate areas where the point touch coordinates are located, so that candidate input results are provided for the user, and possible existence of the user in the input process is ignoredThe user experience is affected by the condition of error transfusion, missing transfusion or multiple transfusion. In step 120, each touch coordinate corresponding to the character string input by the user is applied to input error correction, so that the detail information of the user during input is reserved. Taking the input character string "aihao" as an example, each touch coordinate corresponding to the character string can be respectively expressed as loc0 To loc4 ,loc0 To loc4 The keys corresponding to the coordinate areas are "a", "o", "h", "a" and "o", that is, when the user inputs "i", the user actually touches the area corresponding to the key "o", and if only the key corresponding to the coordinate area where the coordinates are touched is used for providing the candidate input result for the user, only the candidate input result corresponding to the character string "aohao" can be necessarily obtained. While in the embodiment of the invention, the touch coordinates loc of the user during input are reserved1 When the user actually wants to input keys around the key "o", such as the keys "p", "i" or "l", he may also touch loc1 The position is directly input and corrected by applying the touch coordinates, so that a more accurate input result is provided for a user.
The error correction model is a pre-trained model and is used for analyzing the result which the user actually wants to input based on the input touch coordinates, further correcting the error of the key corresponding to the coordinate area where the touch coordinates are located, obtaining the path corresponding to the key after error correction, and outputting the error correction result. The error correction result may include one or more input results corresponding to each touch coordinate, where the input results may be from the same path or from different paths, and embodiments of the present invention are not limited in this respect specifically.
In addition, before executing step 120, an error correction model may be trained in advance, and specifically, the error correction model may be trained by the following manner: first, training samples are collected in units of the upper screen segments. Here, the screen-up means that the chinese characters are selected from the candidate region of the input method as final input and displayed in a final input box, and the screen-up section includes the character string input by the user and the final selected input result. For example, in chat software, "nihao" is input, after selecting "hello" as a candidate, the word "hello" appears as an input in an input box of chat software, for example, the user inputs "today weather is good", as "jin ' tu # ian '. Times.ian ' qi '. Times.bu ' cuu #o '. Times.good", where # replaces the delete key, and ' just for watching the word and not representing the actual effect,. Times.kanji represents that the user touches the kanji at the candidate, so that the kanji is on screen, and there are three screen segments in total (jintu # ian today, tianqi weather, bucuu#o are good). Taking the above screen segment "jintu# ian today" as an example, where "jintu# ian" is an input character string and "today" is an input result. And recording the corresponding sample touch coordinates of the user when the sample character string is input and the sample input result corresponding to the sample character string as a training sample. And training the initial model based on the sample touch coordinates corresponding to the sample character strings and the sample input results, so as to obtain an error correction model. The initial model may be a single model, such as an n-gram language model and a transducer model, or may be a combination of multiple models, such as a combination of a probability model and a language model.
According to the method provided by the embodiment of the invention, the touch coordinates are input into the pre-trained error correction model to obtain the error correction result, so that the condition of manually making rules in the automatic error correction process is avoided, the objectivity of the automatic error correction method is ensured, and the reliability and the accuracy of the error correction result are improved. In addition, the application of the touch coordinates reserves the detail information input by the user, has better fault tolerance, is beneficial to providing more accurate error correction results for the user and optimizes the user experience.
Based on the above embodiment, in the method, the error correction model includes an output layer, and a replacement error correction layer and/or a multi-splice error correction layer. Correspondingly, fig. 2 is a schematic operation flow diagram of an error correction model provided in an embodiment of the present invention, as shown in fig. 2, step 120 specifically includes:
step 121, inputting each touch coordinate to the replacement error correction layer to obtain a key probability that each touch coordinate output by the replacement error correction layer corresponds to each key; and/or inputting each touch coordinate into the multi-spelling error correction layer to obtain multi-spelling probability corresponding to each touch coordinate output by the multi-spelling error correction layer.
Step 122, inputting each point touch coordinate, and the key probability of each point touch coordinate corresponding to each key and/or the multi-spelling probability of each point touch coordinate to the output layer, to obtain the error correction result output by the output layer.
Here, the substitution error mainly means that the key of the user when performing the input action is not the key that the user actually wants to input. Replacement errors typically occur when a user mistakenly touches a key surrounding a target key.
The replacement error correction layer is used for analyzing the probability of the point touch coordinate corresponding to each key based on the input point touch coordinate and outputting the key probability of the point touch coordinate relative to each key. Here, for any point-touch coordinate, the key probability of the point-touch coordinate corresponding to any key characterizes the probability of the key that the user actually wants to touch when performing the input action. For example, the user may want to input hexie, but when e is input, the user may inadvertently touch a position near the key e in the coordinate region of the key r, and input the touch coordinate to the alternative error correction layer, where the key probability of the touch coordinate with respect to the key r is 60% and the key probability with respect to the key e is 40%.
The replacement error correction layer can be obtained through sample touch coordinates and key training actually corresponding to the sample touch coordinates. In the process of collecting training samples, aiming at any sample point touch coordinate corresponding to a sample character string, if a user deletes a key corresponding to the sample point touch coordinate by using a delete key and modifies the key into other keys, and the modified key is around the deleted key, the key actually corresponding to the sample point touch coordinate is determined to be the modified key. For example, the user inputs hr#exie (# number key represents a delete key), where the key actually corresponding to the coordinates of the point touch corresponding to r is e.
In addition, the multi-spelling error is mainly directed to the case where the redundant key is input. A multi-tap error typically occurs when a user clicks the same key multiple times or mistouches an edge key.
The multi-spelling error correction layer is used for analyzing whether the user point touch corresponding to the point touch coordinate is redundant based on the input point touch coordinate, and further outputting multi-spelling probability corresponding to the point touch coordinate. Here, the multi-spelling probability indicates a probability that the touch coordinates are multi-spelling errors. For example, the user wants to input hexie, but the actual input is heexie, and each touch coordinate corresponding to the character string may be input to the replacement error correction layer, so as to obtain a multi-spelling probability corresponding to the third touch coordinate of 90%.
The multi-spelling error correction layer can be obtained through training of each sample point touch coordinate corresponding to the sample character string and the multi-spelling mark corresponding to each sample point touch coordinate. Here, the multi-tap flag indicates whether the corresponding sample touch coordinates are multi-tap errors. In the process of collecting training samples, aiming at any sample point-touch coordinate corresponding to a sample character string, if a user uses a delete key to delete a key corresponding to the sample point-touch coordinate, and the deleted key is the same as the previous key, or the next key of the deleted key is not around the deleted key, the multi-spelling mark of the deleted key is determined to be yes.
When the error correction model comprises a replacement error correction layer and an output layer, inputting each point touch coordinate into the replacement error correction layer to obtain the key probability of each point touch coordinate corresponding to each key output by the replacement error correction layer, and inputting each point touch coordinate and the key probability of each point touch coordinate corresponding to each key into the output layer to obtain an error correction result output by the output layer.
When the error correction model comprises a multi-spelling error correction layer and an output layer, inputting each point touch coordinate into the multi-spelling error correction layer to obtain multi-spelling probability corresponding to each point touch coordinate output by the multi-spelling error correction layer, and inputting each point touch coordinate and the multi-spelling probability corresponding to each point touch coordinate into the output layer to obtain an error correction result output by the output layer.
When the error correction model comprises a replacement error correction layer, a multi-spelling error correction layer and an output layer, inputting each point touch coordinate into the replacement error correction layer to obtain the key probability that each point touch coordinate output by the replacement error correction layer corresponds to each key; inputting each point touch coordinate into a multi-spelling error correction layer to obtain multi-spelling probability corresponding to each point touch coordinate output by the multi-spelling error correction layer; and inputting each point touch coordinate, the key probability of each point touch coordinate corresponding to each key and the multi-spelling probability corresponding to each point touch coordinate to the output layer to obtain an error correction result output by the output layer.
In the error correction model, the replacement error correction layer and the multi-spelling error correction layer are two mutually independent layers, and output results of the replacement error correction layer and the multi-spelling error correction layer are input into the output layer, wherein the output layer is used for outputting an error correction result based on each point touch coordinate, the key probability of each point touch coordinate corresponding to each key and/or the multi-spelling probability of each point touch coordinate.
According to the method provided by the embodiment of the invention, the error correction layers aiming at different types of errors are arranged in the error correction model, so that the accuracy of an error correction result is improved.
Based on any one of the above embodiments, fig. 3 is a flowchart of an error correction result output method according to an embodiment of the present invention, as shown in fig. 3, step 122 specifically includes:
step 1221, determining a plurality of first candidate paths based on each touch coordinate and a preset coordinate area of each key.
Specifically, the coordinate information of the touch screen, such as the number of integral coordinate points on the touch screen, the size of the coordinate points, the position of the virtual keyboard on the touch screen, the size ratio of the virtual keyboard to the touch screen, and the like, may be predetermined. On this basis, the layout of the virtual keyboard, such as a usual 9-key layout or 26-key layout, may be predetermined. And aiming at any key on the virtual keyboard, taking the display range of the key on the touch screen as the coordinate area of the key.
For any point touch coordinate, a coordinate area where the point touch coordinate is located can be judged, then a candidate key corresponding to the point touch coordinate is determined, and according to the candidate key corresponding to each point touch coordinate, a first candidate path can be determined. Here, the number of the first candidate paths may be one or more, for example, under a 26-key layout, three touch coordinates of continuous touch by the user are respectively in the coordinate areas of the keys h, d and y, and the first candidate path is determined to be hdy. For another example, in a 9-key layout, two touch coordinates of continuous touch by the user are respectively within coordinate areas of the keys GHI and DEF, and it is determined that the first candidate path includes gd, ge, gf, hd, he, hf, id, ie, if.
In step 1222, a number of second candidate paths are determined based on the key probability that each touch coordinate corresponds to each key and/or the multi-tap probability that each touch coordinate corresponds to.
Specifically, based on the key probability that any point-touch coordinate corresponds to each key, the point-touch coordinate may be associated with one or more keys, and a number of second candidate paths may be determined according to the key associated with each point-touch coordinate.
In addition, based on the multi-spelling probability corresponding to any point coordinate, whether the point coordinate has multi-spelling errors or not can be determined, namely whether a key corresponding to the point coordinate needs to be deleted when a path is constructed, so that a plurality of second candidate paths are determined.
Furthermore, a number of second candidate paths may be determined based on the key associated with each touch coordinate and whether there is a multi-spelling error for each touch coordinate.
It should be noted that, the execution sequence of step 1221 and step 1222 is not specifically limited in the embodiment of the present invention, and step 1221 may be executed prior to step 1222, may be executed after step 1222, or may be executed synchronously with step 1222.
Step 1223, outputting an error correction result based on each first candidate path and each second candidate path.
The candidate path is composed of letters represented by candidate keys corresponding to each touch coordinate. For example, when the character string hrxie is input, the candidate result corresponding to the first candidate path is (good writing, good thank you, black man you): and the candidate results corresponding to the second candidate path are (harmonious river crabs), the candidate results on all paths are contained in the list, and the candidate results are ranked according to the final score.
Based on any of the above embodiments, the method further includes a step 1222 of: if the key probability of any point touch coordinate relative to any key is larger than the key probability threshold, the key is used as a replacement candidate key corresponding to the point touch coordinate; and determining a plurality of second candidate paths based on the replacement candidate keys corresponding to each touch coordinate.
Here, the key probability threshold is a minimum value of the key probabilities that the preset click coordinates correspond to the replacement candidate keys. The replacement candidate key is a candidate key determined based on a key probability of replacing the error correction layer output. Assume that the character string contains two touch coordinates loc0 And loc1 Where loc is0 The corresponding candidate keys are keys h and j, loc1 The corresponding alternative candidate keys are keys e and r, whereby a second candidate path can be constructed: he. hr, je, jr.
Based on any of the above embodiments, the method further includes a step 1222 of: if the multi-spelling probability corresponding to any point touch coordinate is larger than the multi-spelling probability threshold, determining multi-spelling candidate keys corresponding to the point touch coordinate based on the point touch coordinate and a preset coordinate area of each key; and deleting the multi-spelling candidate keys corresponding to the point touch coordinates in each first candidate path to obtain a plurality of second candidate paths.
Here, the multi-tap probability threshold is a preset minimum multi-tap probability of the touch coordinates where the multi-tap error exists. The multi-tap candidate key is a candidate key determined to be likely to have a multi-tap error based on the multi-tap probability of the multi-tap error correction layer output. Assuming that five touch coordinates of continuous touch by a user are respectively located in the coordinate areas of the keys h, e, e, q, i, determining that the first candidate path is heqi, wherein the multi-spelling probability of the third touch coordinate is greater than the multi-spelling probability threshold, deleting the third candidate key in the first candidate path heqi to obtain the second candidate path heqi.
Based on any of the above embodiments, the method in step 1223 specifically includes: determining a language model score for each candidate result under each candidate path; determining a penalty score for each candidate path based on the key probability that each point touch coordinate corresponds to each key and/or the multi-tap probability that each point touch coordinate corresponds to; determining a composite score for each candidate result under the candidate path based on the penalty score for any candidate path and the language model score for each candidate result under any path; and outputting an error correction result based on the comprehensive score of each candidate result under each candidate path.
Here, the candidate paths include a first candidate path and a second candidate path. Any candidate path may correspond to one or more candidate results, e.g., candidate path hd corresponds to candidate results "good", "active".
And scoring the candidate result through a language model aiming at any candidate result in any candidate path, and obtaining the language model score of the candidate result. Here, the language model score characterizes the smoothness and popularity of the candidate result, etc.
Further, for any candidate path, a penalty score for the candidate path is determined based on the key probability that each touch coordinate corresponds to each key and/or the multi-tap probability that each touch coordinate corresponds to, where the penalty score is used to indicate whether there is a replacement error and/or multi-tap error in the candidate path.
If the error correction model includes a replacement error correction layer and an output layer, for any point touch coordinate, where the key probability of the point touch coordinate corresponding to each key is Pr (ch|loc), a penalty score α×in (Pr (ch|loc)) for any candidate path may be obtained. Where α is a weight and In () is a penalty function.
If the error correction model includes a multi-spelling error correction layer and an output layer, for any point touch coordinate, the multi-spelling probability corresponding to the point touch coordinate is Pr (add|loc), and a penalty score α×in (Pr (add|loc)) for any candidate path can be obtained.
If the error correction model includes a replacement error correction layer, a multi-mismatching error correction layer and an output layer, penalty scores of α×in (Pr (ch|loc), pr (add|loc)) for any candidate path may be obtained, or α×in (Pr (ch|loc)) and α×in (Pr (add|loc)) may be weighted and summed, and a penalty score may be calculated.
After obtaining the language model score of each candidate result under each candidate path and the penalty score of each candidate path, for any candidate result under any candidate path, the comprehensive score of the candidate result can be calculated based on the language model score of the candidate result and the penalty score of the candidate path to which the candidate result belongs.
After determining the composite score of each candidate result, each candidate result can be arranged according to the sequence from high to low of the composite score, and the previous preset number of candidate results are selected as error correction results.
For example, when inputting e, the user wants to input hexie, but carelessly inputs near the e key of r key, the click coordinate is 60% of the probability of the key corresponding to the key r, 40% of the probability of the key corresponding to the key e, the candidate result corresponding to the first candidate path hrxie is Huang Ruixie (the first name of h 'r' xie pinyin result), the candidate result corresponding to the second candidate path hexie is harmony (the first name of hexie pinyin result), the comprehensive score of calculating and knowing "Huang Ruixie" is smaller than harmony ", and the error correction result" harmony "is preferentially output, thereby achieving the error correction effect.
Based on any one of the above embodiments, the method specifically includes: determining the key probability of any point touch coordinate corresponding to each key based on the Gaussian mixture model; the Gaussian mixture model consists of Gaussian models corresponding to all keys; the gaussian model characterizes the probability distribution of the coordinates of the touches of the corresponding keys.
Fig. 4 is a schematic diagram of distribution of coordinate points of user input according to an embodiment of the present invention, and fig. 4 shows a black point marked on a 26-key virtual keyboard at each point coordinate position of user input. As can be seen from fig. 4, the probability distribution of each key accords with the two-dimensional gaussian distribution, and a mixed gaussian model can be formed based on the key layout of the virtual keyboard for fitting, where K is equal to the number of keys of the virtual keyboard, and K is 26 in fig. 4. A large amount of training data are collected in advance, wherein each piece of data comprises point touch coordinates and corresponding keys, gaussian distribution N (mu, sigma) of the corresponding keys is obeyed, a maximum likelihood estimation algorithm can be adopted based on the training data, specific numerical values of parameters mu and sigma of each Gaussian model in the Gaussian mixture model are obtained, and the trained Gaussian mixture model replaces an error correction layer.
In the existing input error correction methods, no distinction is usually made between application scenarios, and most input error correction methods can be applied to both physical keyboards and virtual keyboards. However, the physical keyboard and the virtual keyboard are actually two completely different application scenarios, many errors cannot occur on the physical keyboard, and the errors all belong to high-incidence errors on the virtual keyboard, for example, when a user holds a touch screen mobile phone, the holding action is very likely to touch the edge of the virtual keyboard by mistake, and similar problems obviously do not exist in the application scenarios of the physical keyboard. Therefore, the input error correction method of the physical keyboard is not suitable for the input error correction of the virtual keyboard.
Based on any one of the above embodiments, the method specifically includes: determining a candidate key corresponding to the point touch coordinate based on any point touch coordinate and a preset coordinate area of each key; the distance between the candidate keys corresponding to the point touch coordinates and the candidate keys corresponding to the previous point touch coordinates and the next point touch coordinates respectively, or the distance between the candidate keys corresponding to the point touch coordinates and the candidate keys corresponding to the previous point touch coordinates and the next point touch coordinates respectively and the auxiliary information of the candidate keys corresponding to the point touch coordinates are input into a multi-spelling error correction layer, so that the multi-spelling probability corresponding to the point touch coordinates output by the multi-spelling error correction layer is obtained; the auxiliary information comprises interval time and/or high-frequency multi-spelling marks, and the high-frequency multi-spelling marks are used for indicating whether the candidate keys corresponding to the point touch coordinates are in a preset high-frequency multi-spelling area or not.
Specifically, assume that any point touch coordinate is loci I is a natural number. loci Is loci-1 The latter touch coordinate is loci+1 。loci-1 、loci And loci+1 The corresponding candidate keys are keys respectivelyi-1 、keyi And keyi+1 。keyi-1 And keyi The distance between them is keyi-1 Center and key of coordinate region of (2)i Distance d between the centers of the coordinate areas of (2)i-1,i ,keyi And keyi+1 The distance between them is keyi Center and key of coordinate region of (2)i+1 Distance d between the centers of the coordinate areas of (2)i,i+1 . Here, the distance between the keys is 0 to 300mm.
For any point touch coordinates loci D can bei-1,i And di,i+1 Input to a multi-misspell error correction layer to obtain loci Corresponding multi-spelling probability, d can also be usedi-1,i And di,i+1 And keyi Is input into a multi-misspell error correction layer to obtain loci Corresponding multi-spelling probabilities.
Here, the keyi The interval time refers to the key point touched by the useri-1 Time and user click key of (2)i Is about 0 to 200ms; high-speed multi-spelling mark for indicating keyi Whether in a preset high-incidence multi-spelling area. The preset high-speed multi-spelling area can be preset, and the position, such as the edge of the touch screen, where false touch is easy to occur can be set as the preset high-speed multi-spelling area, for example, the coordinate area of the key q, a, z, p, l, m in the virtual keyboard of the touch screen mobile phone 26 keys, so that the problem that the holding action is likely to touch the edge of the virtual keyboard by false when a user holds the touch screen device is solved.
According to the method provided by the embodiment of the invention, the high-frequency multi-spelling mark for indicating whether the candidate key corresponding to the point touch coordinate is in the preset high-frequency multi-spelling area is used as auxiliary information to input the multi-spelling error correction layer, so that the input error correction with more scene pertinence is realized.
Different users may have different input habits, in order to adapt to the user input habits, to provide a high quality input error correction service for the user, according to any of the above embodiments, the method further includes, before step 120: and training an error correction model based on the historical touch coordinates corresponding to the historical character string input by the user and the historical input result.
Specifically, in the user input process, the touch coordinates corresponding to the user input history character string are recorded and saved as history touch coordinates, and meanwhile, the input result selected by the user from the candidate input results is recorded and saved as history input results. The history touch coordinates and the history input result are recorded and stored in units of users.
When the data quantity of the historical touch coordinates and the historical input results corresponding to the user is larger than a preset threshold value, weighting the historical touch coordinates and the historical input results corresponding to the user, and then training an error correction model by combining the existing sample data, updating the error correction model, and further providing personalized input error correction service for the user.
Based on any of the above embodiments, in the method, before training the error correction model, coordinate setting is further required:
when the mobile phone end or other devices taking the touch screen as a main input way input, a virtual keyboard is displayed in a part of the area of the touch screen, each key in the virtual keyboard corresponds to a coordinate area of the touch screen, and when a finger points on the screen, the device can obtain a coordinate point touched by the finger, namely a point touch coordinate. If the point touch coordinates are in the virtual keyboard region, further judging which key corresponds to the point touch coordinates, transmitting information of the corresponding key into an input method engine, and recording the point touch coordinates and the point touch time.
Further, since there may be different coordinate settings of the input method on different devices, and the layout of the virtual keyboard may be adjusted when the input method is updated, each input method version needs to record its coordinate layout for each device. The setting of coordinates is specifically as follows:
the method comprises the steps of recording the integral coordinate point information of the device, including the integral coordinate point quantity information of the device, the size of the coordinate point, and the specific azimuth of the device, of the virtual keyboard of the input method, wherein the size ratio of the virtual keyboard to the integral screen.
Recording virtual keyboard layout distribution in an input method: the common layout is 9 keys and 26 keys, the 9 keys are virtual keyboard simulation of the mobile phone key layout, and the 26 keys are simulation of the PC computer keyboard. Further, the coordinate area of each key is recorded.
Based on any one of the above embodiments, fig. 5 is a schematic structural diagram of an input error correction device according to an embodiment of the present invention, as shown in fig. 5, where the device includes a coordinate acquiring unit 510 and an error correction output unit 520;
the coordinate acquiring unit 510 is configured to acquire each touch coordinate corresponding to a character string input by a user;
the error correction output unit 520 is configured to input each touch coordinate to an error correction model, so as to obtain an error correction result output by the error correction model; the error correction model is trained based on sample touch coordinates corresponding to the sample character strings and sample input results, and is used for correcting the error of keys corresponding to the touch coordinates based on each touch coordinate and outputting the error correction results.
According to the device provided by the embodiment of the invention, the touch coordinates are input into the pre-trained error correction model to obtain the error correction result, so that the condition of manually making rules in the automatic error correction process is avoided, the objectivity of the automatic error correction method is ensured, and the reliability and the accuracy of the error correction result are improved. In addition, the application of the touch coordinates reserves the detail information input by the user, has better fault tolerance, is beneficial to providing more accurate error correction results for the user and optimizes the user experience.
Based on any one of the above embodiments, in the apparatus, the error correction model includes an output layer, and a replacement error correction layer and/or a multi-splice error correction layer;
based on any one of the above embodiments, in the apparatus, the error correction output unit 520 specifically includes:
the replacing and correcting subunit is used for inputting each point-touch coordinate into the replacing and correcting layer to obtain the key probability of each point-touch coordinate output by the replacing and correcting layer corresponding to each key;
and/or a multi-spelling error correction subunit, configured to input each point touch coordinate to the multi-spelling error correction layer, so as to obtain a multi-spelling probability corresponding to each point touch coordinate output by the multi-spelling error correction layer;
and the output subunit is used for inputting each point-touch coordinate, the key probability of each point-touch coordinate corresponding to each key and/or the multi-spelling probability of each point-touch coordinate to the output layer, and obtaining the error correction result output by the output layer.
Based on any of the foregoing embodiments, in the apparatus, the output subunit includes:
the first path module is used for determining a plurality of first candidate paths based on each point touch coordinate and a preset coordinate area of each key;
The second path module is used for determining a plurality of second candidate paths based on the key probability that each point-touch coordinate corresponds to each key and/or the multi-spelling probability that each point-touch coordinate corresponds to;
and the result output module is used for outputting the error correction result based on each first candidate path and each second candidate path.
Based on any of the foregoing embodiments, in the apparatus, the second path module is specifically configured to:
if the key probability of any point touch coordinate relative to any key is larger than a key probability threshold, taking any key as a replacement candidate key corresponding to any point touch coordinate;
and determining a plurality of second candidate paths based on the replacement candidate keys corresponding to each point touch coordinate.
Based on any of the foregoing embodiments, in the apparatus, the second path module is specifically configured to:
if the multi-spelling probability corresponding to any point touch coordinate is larger than the multi-spelling probability threshold, determining multi-spelling candidate keys corresponding to any point touch coordinate based on the any point touch coordinate and a preset coordinate area of each key;
and deleting the multi-spelling candidate keys corresponding to the arbitrary touch coordinates in each first candidate path to obtain a plurality of second candidate paths.
Based on any one of the above embodiments, in the device, the result output module is specifically configured to:
determining a language model score for each candidate result under each candidate path;
determining a penalty score of each candidate path based on a key probability that each of the click coordinates corresponds to each key and/or a multi-spelling probability that each of the click coordinates corresponds to;
determining a composite score for each candidate result in any candidate path based on the penalty score for the candidate path and the language model score for each candidate result in any path;
and outputting the error correction result based on the comprehensive score of each candidate result under each candidate path.
Based on any of the foregoing embodiments, in the apparatus, the multi-splice error correction subunit is specifically configured to:
determining candidate keys corresponding to any point touch coordinates based on the any point touch coordinates and a preset coordinate area of each key;
the distance between the candidate keys corresponding to the any point touch coordinates and the candidate keys corresponding to the previous point touch coordinates and the next point touch coordinates respectively, or the distance between the candidate keys corresponding to the any point touch coordinates and the candidate keys corresponding to the previous point touch coordinates and the next point touch coordinates respectively and the auxiliary information of the candidate keys corresponding to the any point touch coordinates are input into the multi-spelling error correction layer, so that the multi-spelling probability corresponding to the any point touch coordinates output by the multi-spelling error correction layer is obtained;
The auxiliary information comprises interval time and/or high-frequency multi-spelling marks, and the high-frequency multi-spelling marks are used for indicating whether the candidate keys corresponding to the touch coordinates are in a preset high-frequency multi-spelling area or not.
Based on any of the above embodiments, the apparatus further comprises:
and the personalized training unit is used for training the error correction model based on the historical touch coordinates corresponding to the historical character string input by the user and the historical input result.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, as shown in fig. 6, the electronic device may include: processor 610, communication interface (Communications Interface) 620, memory 630, and communication bus 640, wherein processor 610, communication interface 620, and memory 630 communicate with each other via communication bus 640. The processor 610 may call logic instructions in the memory 630 to perform the following methods: acquiring each touch coordinate corresponding to a character string input by a user; inputting each touch coordinate into an error correction model to obtain an error correction result output by the error correction model; the error correction model is trained based on sample touch coordinates corresponding to the sample character strings and sample input results, and is used for correcting the error of keys corresponding to the touch coordinates based on each touch coordinate and outputting the error correction results.
Further, the logic instructions in the memory 630 may be implemented in the form of software functional units and stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Embodiments of the present invention also provide a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the methods provided by the above embodiments, for example, comprising: acquiring each touch coordinate corresponding to a character string input by a user; inputting each touch coordinate into an error correction model to obtain an error correction result output by the error correction model; the error correction model is trained based on sample touch coordinates corresponding to the sample character strings and sample input results, and is used for correcting the error of keys corresponding to the touch coordinates based on each touch coordinate and outputting the error correction results.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.