Data input method, device, equipment and computer readable storage medium

文档序号:1963400 发布日期:2021-12-14 浏览:26次 中文

阅读说明:本技术 数据输入方法、装置、设备及计算机可读存储介质 (Data input method, device, equipment and computer readable storage medium ) 是由 李立锋 张健 于 2021-08-17 设计创作,主要内容包括:本发明公开了一种数据输入方法,包括:获取当前输入操作对应的输入法,并获取所述当前输入操作对应的输入语句中的各个输入词以及各个输入词对应的候选词;基于各个输入词与对应的候选词之间的第一相似度,确定各个输入词中的待替换词;在所述待替换词对应的候选词中,基于所述输入法获取所述待替换词对应的目标词;将所述输入语句中的待替换词替换为所述目标词,获得目标输入语句。本发明还公开了一种数据输入装置、设备及计算机可读存储介质。本发明能够根据候选词自动选择输入语句中存在错误的输入词的目标词,实现输入语句中错误的词的自动修正,大大减少了错误修改过程中用户的操作过程,提高了语句错误的修正效率以及用户体验。(The invention discloses a data input method, which comprises the following steps: acquiring an input method corresponding to current input operation, and acquiring each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word; determining words to be replaced in the input words based on first similarity between the input words and the corresponding candidate words; obtaining a target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced; and replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences. The invention also discloses a data input device, equipment and a computer readable storage medium. The method and the device can automatically select the target word of the input word with the error in the input sentence according to the candidate word, realize the automatic correction of the error word in the input sentence, greatly reduce the operation process of a user in the error correction process, and improve the correction efficiency of the sentence error and the user experience.)

1. A data input method, characterized in that the data input method comprises the steps of:

acquiring an input method corresponding to current input operation, and acquiring each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word;

determining words to be replaced in the input words based on first similarity between the input words and the corresponding candidate words;

obtaining a target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced;

and replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences.

2. The data input method of claim 1, wherein the determining a word to be replaced in each input word based on a first similarity between each input word and a corresponding candidate word comprises:

sequentially acquiring input words to be processed in each input word, and acquiring a first similarity between the input words to be processed and candidate words corresponding to the input words to be processed;

determining a first similarity mean value of each first similarity corresponding to each input word;

and if the first similarity mean value has a target mean value smaller than a preset similarity, taking the input word corresponding to the target mean value as the word to be replaced.

3. The data input method of claim 2, wherein the input method is a five-stroke input method, and the step of obtaining the target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced comprises:

determining a second similarity between every two words to be replaced and each candidate word corresponding to the words to be replaced;

determining a second similarity mean value based on the second similarity of each candidate word corresponding to the word to be replaced;

and taking the candidate word corresponding to the maximum similarity mean in the second similarity means as the target word.

4. The data input method of claim 1, wherein the input method is a pinyin input method, and the step of obtaining the target word corresponding to the word to be replaced based on the input method in the candidate words corresponding to the word to be replaced comprises:

acquiring a previous word and a next word corresponding to the word to be replaced in the input sentence;

inputting the previous word and the candidate word corresponding to the word to be replaced into a Skip-Gram model to obtain a first sequence, and inputting the next word and the candidate word corresponding to the word to be replaced into the Skip-Gram model to obtain a second sequence;

and acquiring the target word from the candidate words corresponding to the words to be replaced based on the first sequence and the second sequence.

5. The data input method according to claim 4, wherein the step of obtaining the target word from the candidate words corresponding to the word to be replaced based on the first ordering and the second ordering includes:

determining the weight of each candidate word corresponding to the word to be replaced based on the sequence of each candidate word corresponding to the word to be replaced in the first sequence and the sequence of each candidate word corresponding to the word to be replaced in the second sequence;

and determining the maximum weight in the weights, and taking the candidate word corresponding to the maximum weight as the target word.

6. The data input method of claim 1, wherein the input method is a pinyin input method, and the step of obtaining each input word and candidate words corresponding to each input word in the input sentence corresponding to the current input operation comprises:

acquiring each input word in the input sentence corresponding to the current input operation;

if a first input word with non-full-spelling input pinyin exists in each input word, acquiring full-spelling pinyin corresponding to the input pinyin of the first input word, and acquiring a first candidate word corresponding to the full-spelling pinyin;

acquiring a second candidate word corresponding to a second input word of which the input pinyin is a full pinyin in each input word;

wherein the candidate words comprise the first candidate word and the second candidate word.

7. The data input method according to any one of claims 1 to 6, wherein the step of obtaining the input method corresponding to the current input operation and obtaining each input word and candidate word corresponding to each input word in the input sentence corresponding to the current input operation comprises:

determining an input method corresponding to the current input operation based on the keyboard input information and the input words corresponding to the current input operation;

and when detecting that the keyboard input information corresponding to the input operation is punctuation, acquiring each input word in the input sentence corresponding to the current input operation and a candidate word corresponding to each input word.

8. A data input device, characterized in that the data input device comprises:

the first acquisition module is used for acquiring an input method corresponding to the current input operation and acquiring each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word;

the determining module is used for determining words to be replaced in the input words based on the first similarity between the input words and the corresponding candidate words;

the second obtaining module is used for obtaining a target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced;

and the replacing module is used for replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences.

9. A data input device, characterized in that the data input device comprises: memory, a processor and a data input program stored on the memory and executable on the processor, the data input program when executed by the processor implementing the steps of the data input method of any one of claims 1 to 7.

10. A computer-readable storage medium, having stored thereon a data input program which, when executed by a processor, implements the steps of the data input method of any one of claims 1 to 7.

Technical Field

The present invention relates to the field of data processing technologies, and in particular, to a data input method, apparatus, device, and computer readable storage medium.

Background

Currently, in the process of inputting characters through an input method keyboard of an electronic device, the electronic device may display a character string indicated by keys and some candidate words corresponding to the character string according to the keys in the input method keyboard clicked by a user, and then the user may select a desired word from the candidate words.

However, in the input process of the user, the input method changes the sequence of the candidate words according to the input habits of the user, and the user often selects the candidate words according to the habits of the user in the input process, for example, the user finishes playing a series of codes at one go, so that an error occurs in one or some input words in the middle, and at this time, the user needs to return the operation cursor (or mouse) to the error position of the input word, and then delete and modify the input word, so that the error modification process is complicated.

The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.

Disclosure of Invention

The invention mainly aims to provide a data input method, a data input device, data input equipment and a computer readable storage medium, and aims to solve the technical problem that the process of error modification in the existing text input process is complicated.

In order to achieve the above object, the present invention provides a data input method, including the steps of:

acquiring an input method corresponding to current input operation, and acquiring each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word;

determining words to be replaced in the input words based on first similarity between the input words and the corresponding candidate words;

obtaining a target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced;

and replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences.

Further, the step of determining a word to be replaced in each input word based on the first similarity between each input word and the corresponding candidate word includes:

sequentially acquiring input words to be processed in each input word, and acquiring a first similarity between the input words to be processed and candidate words corresponding to the input words to be processed;

determining a first similarity mean value of each first similarity corresponding to each input word;

and if the first similarity mean value has a target mean value smaller than a preset similarity, taking the input word corresponding to the target mean value as the word to be replaced.

Further, the input method is a five-stroke input method, and the step of obtaining the target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced includes:

determining a second similarity between every two words to be replaced and each candidate word corresponding to the words to be replaced;

determining a second similarity mean value based on the second similarity of each candidate word corresponding to the word to be replaced;

and taking the candidate word corresponding to the maximum similarity mean in the second similarity means as the target word.

Further, the input method is a pinyin input method, and the step of obtaining the target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced includes:

acquiring a previous word and a next word corresponding to the word to be replaced in the input sentence;

inputting the previous word and the candidate word corresponding to the word to be replaced into a Skip-Gram model to obtain a first sequence, and inputting the next word and the candidate word corresponding to the word to be replaced into the Skip-Gram model to obtain a second sequence;

and acquiring the target word from the candidate words corresponding to the words to be replaced based on the first sequence and the second sequence.

Further, the step of obtaining the target word from the candidate words corresponding to the word to be replaced based on the first ordering and the second ordering includes:

determining the weight of each candidate word corresponding to the word to be replaced based on the sequence of each candidate word corresponding to the word to be replaced in the first sequence and the sequence of each candidate word corresponding to the word to be replaced in the second sequence;

and determining the maximum weight in the weights, and taking the candidate word corresponding to the maximum weight as the target word.

Further, the input method is a pinyin input method, and the step of acquiring each input word and candidate words corresponding to each input word in the input sentence corresponding to the current input operation includes:

acquiring each input word in the input sentence corresponding to the current input operation;

if a first input word with non-full-spelling input pinyin exists in each input word, acquiring full-spelling pinyin corresponding to the input pinyin of the first input word, and acquiring a first candidate word corresponding to the full-spelling pinyin;

acquiring a second candidate word corresponding to a second input word of which the input pinyin is a full pinyin in each input word;

wherein the candidate words comprise the first candidate word and the second candidate word.

Further, the step of obtaining the input method corresponding to the current input operation, and obtaining each input word and candidate words corresponding to each input word in the input sentence corresponding to the current input operation includes:

determining an input method corresponding to the current input operation based on the keyboard input information and the input words corresponding to the current input operation;

and when detecting that the keyboard input information corresponding to the input operation is punctuation, acquiring each input word in the input sentence corresponding to the current input operation and a candidate word corresponding to each input word.

In addition, to achieve the above object, the present invention also provides a data input device, comprising:

the first acquisition module is used for acquiring an input method corresponding to the current input operation and acquiring each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word;

the determining module is used for determining words to be replaced in the input words based on the first similarity between the input words and the corresponding candidate words;

the second obtaining module is used for obtaining a target word corresponding to the word to be replaced based on the input method in the candidate word corresponding to the word to be replaced;

and the replacing module is used for replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences.

In addition, to achieve the above object, the present invention also provides a data input device, including: the data input program is stored on the memory and can run on the processor, and when being executed by the processor, the data input program realizes the steps of the data input method.

In addition, to achieve the above object, the present invention further provides a computer readable storage medium, wherein the computer readable storage medium stores thereon a data input program, and the data input program, when executed by a processor, implements the steps of the aforementioned data input method.

According to the method, an input method corresponding to the current input operation is obtained, and each input word and a candidate word corresponding to each input word in an input sentence corresponding to the current input operation are obtained; determining words to be replaced in each input word based on first similarity between each input word and other input words; then, in the candidate words corresponding to the words to be replaced, acquiring target words corresponding to the words to be replaced based on the input method; and then replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences, automatically selecting the target words of the input words with errors in the input sentences according to the candidate words, and realizing the automatic correction of the wrong words in the input sentences, thereby greatly reducing the operation process of users in the error correction process, and improving the correction efficiency of sentence errors and user experience.

Drawings

FIG. 1 is a schematic diagram of a data input device in a hardware operating environment according to an embodiment of the present invention;

FIG. 2 is a schematic flow chart of a data input method according to a first embodiment of the present invention;

fig. 3 is a functional block diagram of an embodiment of a data input device according to the invention.

The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.

Detailed Description

It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

As shown in fig. 1, fig. 1 is a schematic structural diagram of a data input device in a hardware operating environment according to an embodiment of the present invention.

The data input device of the embodiment of the invention can be a PC. As shown in fig. 1, the data input device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.

Optionally, the data input device may further include a camera, RF (Radio Frequency) circuitry, a sensor, audio circuitry, a WiFi module, and the like. Of course, the data input device may also be configured with other sensors such as barometer, hygrometer, thermometer, infrared sensor, etc., which are not described herein again.

Those skilled in the art will appreciate that the terminal structure shown in fig. 1 does not constitute a limitation of the data input device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.

As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a data input program.

In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be used to invoke a data input program stored in the memory 1005.

In this embodiment, the data input device includes: the system comprises a memory 1005, a processor 1001 and a data input program which is stored on the memory 1005 and can run on the processor 1001, wherein when the processor 1001 calls the data input program stored in the memory 1005, the steps of the data input method in each embodiment are executed.

The invention also provides a data input method, and referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the data input method of the invention.

In this embodiment, the data input method includes the following steps:

step S101, an input method corresponding to the current input operation is obtained, and each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word are obtained;

in this embodiment, when a user inputs a character (chinese) through an electronic device, an input method corresponding to a current input operation is obtained, specifically, keyboard input information (input key value) of the electronic device may be obtained through Hook function, and an input word corresponding to the current input operation, that is, a content of the character input by an input, is obtained at the same time, and the input method used by the current user is determined according to the input word and the keyboard input information, as follows: the method for monitoring the keyboard input information through the hook comprises the following steps: fuvb + 'space', if the monitored input word is 'happy', the input method is determined to be the five-stroke input method by the word root reverse check and the pinyin reverse check of the five strokes, and if the current input operation is matched with the five-stroke input method.

Then, obtaining each input word and candidate words corresponding to each input word in the input sentence corresponding to the current input operation, specifically, monitoring keyboard input information in real time through Hook, if punctuation marks exist in the keyboard input information, determining that a sentence break exists currently, taking the text information between the label mark and a previous punctuation mark as the input sentence, wherein each text content input by input in the input sentence is the input word, selecting a preset number of words from other candidate words corresponding to each input word before input as candidate words of the input word, and the preset number can be set to be 3, 5, 8 and the like.

Step S102, determining words to be replaced in each input word based on first similarity between each input word and the corresponding candidate word;

in this embodiment, after the input word and the candidate word corresponding to the input word are obtained, a first similarity between each input word and the corresponding candidate word is obtained. For each input word, obtaining a candidate word corresponding to the input word, and calculating a first similarity between the input word and each candidate word, specifically, obtaining a word vector of the input word and a candidate word vector of each candidate word, calculating a cosine value between the word vector of the input word and the candidate word vector, and taking the cosine value as the first similarity. For example, models of the input word or candidate words word2vec, gpt, bert, fasttext, and the like may be trained to obtain a word vector of the input word or a candidate word vector of each candidate word.

When the first similarity is obtained, scoring the input words based on the first similarity to obtain a score corresponding to each input word, wherein the score can be a mean value or a sum value of the corresponding first similarity, and determining a word to be replaced in each input word according to the score; for example, an input word with a score smaller than a preset value is used as a word to be replaced, and if no input word with a small segmentation value and a preset value exists, it is determined that no error exists in the input sentence.

Step S103, in the candidate words corresponding to the words to be replaced, target words corresponding to the words to be replaced are obtained based on the input method;

in this embodiment, when a word to be replaced is obtained, a target word corresponding to the word to be replaced is obtained in a candidate word corresponding to the word to be replaced based on the input method. Specifically, for the five-stroke input method, the candidate words corresponding to the to-be-replaced words may be scored in the same manner as in the previous step, and the candidate word with the highest score is used as the target word. For the pinyin input method, candidate words corresponding to the words to be replaced are respectively ranked through a previous word and a next word of the words to be replaced, the weight of each candidate word corresponding to the words to be replaced is determined according to the ranking result, and the candidate word with the largest weight is used as a target word.

And step S104, replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences.

In this embodiment, when a target word is obtained, a word to be replaced in an input sentence is replaced with the target word, and then the target input sentence is obtained, further, in order to avoid a situation that a user does not find that there may be an error currently, therefore, when the target word is obtained, replacement confirmation information may be output, so that the user performs confirmation according to the replacement confirmation information, when the confirmation information is received, the word to be replaced in the input sentence is replaced with the target word, specifically, in an input file corresponding to a current input operation, the word to be replaced in the input sentence is replaced with the target word.

In the data input method provided by this embodiment, an input method corresponding to a current input operation is obtained, and each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word are obtained; determining words to be replaced in each input word based on first similarity between each input word and other input words; then, in the candidate words corresponding to the words to be replaced, acquiring target words corresponding to the words to be replaced based on the input method; and then replacing the words to be replaced in the input sentences with the target words to obtain the target input sentences, automatically selecting the target words of the input words with errors in the input sentences according to the candidate words, and realizing the automatic correction of the wrong words in the input sentences, thereby greatly reducing the operation process of users in the error correction process, and improving the correction efficiency of sentence errors and user experience.

Based on the first embodiment, a second embodiment of the data input method of the present invention is proposed, in this embodiment, step S102 includes:

step S201, sequentially acquiring input words to be processed in each input word, and acquiring a first similarity between the input words to be processed and candidate words corresponding to the input words to be processed;

step S202, determining a first similarity mean value of each first similarity corresponding to each input word;

step S203, if a target mean value smaller than a preset similarity exists in the first similarity mean value, taking the input word corresponding to the target mean value as the word to be replaced.

In this embodiment, after the input word and the candidate word corresponding to the input word are obtained, a first similarity between each input word and the corresponding candidate word is obtained. For each input word, obtaining a candidate word corresponding to the input word, and calculating a first similarity between the input word and each candidate word, specifically, obtaining a word vector of the input word and a candidate word vector of each candidate word, calculating a cosine value between the word vector of the input word and the candidate word vector, and taking the cosine value as the first similarity. For example, models of the input word or candidate words word2vec, gpt, bert, fasttext, and the like may be trained to obtain a word vector of the input word or a candidate word vector of each candidate word.

Then, the input words are scored based on the first similarity, specifically, a first similarity mean value is determined based on the first similarity of each input word corresponding to the word to be replaced, that is, a first similarity mean value of each input word is calculated to obtain the first similarity mean value.

And then, determining whether a target mean value smaller than a preset similarity exists in each first similarity mean value, and if the target mean value smaller than the preset similarity exists in the first similarity mean values, taking the input word corresponding to the target mean value as the word to be replaced, so as to accurately determine the word (error word) to be replaced in the input sentence.

The preset similarity may be set reasonably, for example, the preset similarity is set to be 30%.

In the data input method provided by this embodiment, input words to be processed are sequentially obtained from each input word, and a first similarity between the input words to be processed and candidate words corresponding to the input words to be processed is obtained; then determining a first similarity mean value of each first similarity corresponding to each input word; and then if the target mean value smaller than the preset similarity exists in the first similarity mean value, taking the input word corresponding to the target mean value as the word to be replaced, and accurately determining the word to be replaced (error word) in the input sentence according to the first similarity mean value of each input word, thereby further improving the accuracy of correcting the input sentence.

Based on the second embodiment, a third embodiment of the data input method of the present invention is provided, in this embodiment, the input method is a five-stroke input method, and step S103 includes:

step S301, determining a second similarity between every two words to be replaced and each candidate word corresponding to the words to be replaced;

step S302, determining a second similarity mean value based on the second similarity of each candidate word corresponding to the word to be replaced;

step S303, using the candidate word corresponding to the maximum similarity mean value in the second similarity mean values as the target word.

In this embodiment, when determining a word to be replaced, determining a second similarity between each two words of the word to be replaced and each candidate word corresponding to the word to be replaced. The second similarity is similar to the first similarity in calculation manner, and is not described herein again.

Then, a second similarity mean value is determined based on the second similarity of each candidate word corresponding to the word to be replaced, and specifically, the second similarity mean value of each input word is calculated to obtain the second similarity mean value.

And then comparing the second similarity mean values to obtain the maximum similarity mean value in the second similarity mean values, and taking the candidate word corresponding to the maximum similarity mean value in the second similarity mean values as the target word.

In the data input method provided by this embodiment, the second similarity between each two candidate words is determined by determining the word to be replaced and the candidate words corresponding to the word to be replaced; then, determining a second similarity mean value based on the second similarity of each candidate word corresponding to the word to be replaced; and then, the candidate word corresponding to the maximum similarity mean in the second similarity means is used as the target word, so that the target word can be accurately determined in the candidate words according to the second similarity mean, and the accuracy of input sentence correction is further improved.

Based on the first embodiment, a fourth embodiment of the data input method of the present invention is provided, in this embodiment, the input method is a pinyin input method, and step S103 includes:

step S401, acquiring a previous word and a next word corresponding to the word to be replaced in the input sentence;

step S402, inputting the previous word and the candidate word corresponding to the word to be replaced into a Skip-Gram model to obtain the first sequence, and inputting the next word and the candidate word corresponding to the word to be replaced into the Skip-Gram model to obtain a second sequence;

step S403, based on the first rank and the second rank, obtaining the target word from the candidate words corresponding to the word to be replaced.

In this embodiment, when determining the word to be replaced, the previous word and the next word corresponding to the word to be replaced are obtained from the input sentence, that is, the previous word is a word before the word to be replaced in the input sentence, and the next word is a word after the word to be replaced in the input sentence.

And then, inputting the previous word and the candidate word corresponding to the word to be replaced into a Skip-Gram model for model training, wherein the result of model training is the first ordering, and inputting the next word and the candidate word corresponding to the word to be replaced into the Skip-Gram model for model training, wherein the result of model training is the second ordering.

And then, based on the first sequence and the second sequence, obtaining the target word from the candidate words corresponding to the words to be replaced. Specifically, in one embodiment, the step S403 includes:

step a, determining the weight of each candidate word corresponding to the word to be replaced based on the sequence of each candidate word corresponding to the word to be replaced in the first sequence and the sequence of each candidate word corresponding to the word to be replaced in the second sequence;

and b, determining the maximum weight in the weights, and taking the candidate word corresponding to the maximum weight as the target word.

In this embodiment, the weight of each candidate word corresponding to the word to be replaced is determined based on the order of each candidate word corresponding to the word to be replaced in the first order and the order of each candidate word in the second order, specifically, for each candidate word, the order of the candidate word in the first order and the order of each candidate word in the second order are obtained first, and the corresponding weight of the order in the first order and the corresponding weight of the order in the second order are obtained, where the weight of the candidate word may be a sum of the corresponding weight of the order in the first order and the corresponding weight of the order in the second order, and in the first order or the second order, the higher the order is, the higher the corresponding weight is.

And then, determining the maximum weight in the weights, taking the candidate word corresponding to the maximum weight as the target word, and further accurately obtaining the target word through the weight of each candidate word, so that the accuracy of the target word is improved.

In the data input method provided by this embodiment, a previous word and a next word corresponding to the word to be replaced are obtained from the input sentence; inputting the previous word and the candidate word corresponding to the word to be replaced into a Skip-Gram model to obtain a first sequence, and inputting the next word and the candidate word corresponding to the word to be replaced into the Skip-Gram model to obtain a second sequence; and then based on the first sequence and the second sequence, the target words are obtained from the candidate words corresponding to the words to be replaced, the target words can be screened from the candidate words according to the sequence of the candidate words, and the accuracy of input sentence correction is further improved.

Based on the first embodiment, a fifth embodiment of the data input method of the present invention is provided, in this embodiment, the input method is a pinyin input method, and step S101 includes:

step S501, acquiring each input word in the input sentence corresponding to the current input operation;

step S502, if a first input word with non-full spelling input pinyin exists in each input word, acquiring full spelling pinyin corresponding to the input pinyin of the first input word, and acquiring a first candidate word corresponding to the full spelling pinyin;

step S503, acquiring a second candidate word corresponding to a second input word of which the input pinyin is a full pinyin in each input word;

wherein the candidate words comprise the first candidate word and the second candidate word.

In this embodiment, each input word in the input sentence is obtained first, and whether the first input word whose input pinyin is a non-full pinyin exists in the input words is determined according to the keyboard input information.

If the input pinyin is a first input word which is not a full pinyin, acquiring a full pinyin corresponding to the input pinyin of the first input word, wherein the full pinyin is all possible pinyins corresponding to the keyboard input information of the first input word, and acquiring a first candidate word corresponding to the full pinyin, wherein for each full-screen pinyin, a preset number of words are selected as the first candidate word of the input word.

And for the second input word of which the input pinyin is the full pinyin, directly acquiring a corresponding second candidate word.

In the data input method provided by this embodiment, each input word in the input sentence corresponding to the current input operation is obtained; then if a first input word with non-full-spelling input pinyin exists in each input word, acquiring full-spelling pinyin corresponding to the input pinyin of the first input word, and acquiring a first candidate word corresponding to the full-spelling pinyin; then acquiring a second candidate word corresponding to a second input word of which the input pinyin is a full pinyin in each input word; by obtaining the first candidate word of the full-spelling pinyin corresponding to the non-full-spelling pinyin, the candidate words of all input words can be completed, and the accuracy of screening the target words in the candidate words is further improved.

Based on the above embodiments, a sixth embodiment of the data input method of the present invention is proposed, in which step S101 includes:

step S601, determining an input method corresponding to the current input operation based on the keyboard input information and the input words corresponding to the current input operation;

step S602, when it is detected that the keyboard input information corresponding to the input operation is a punctuation mark, acquiring each input word and a candidate word corresponding to each input word in the input sentence corresponding to the current input operation.

In this embodiment, in the embodiment, when a user inputs a character (chinese) through an electronic device, an input method corresponding to the current input operation is determined based on keyboard input information and an input word corresponding to the current input operation, specifically, keyboard input information (input key value) of the electronic device may be obtained through Hook function, and an input word corresponding to the current input operation, that is, a content of the character input by input, is obtained at the same time, and the input method used by the current user is determined according to the input word and the keyboard input information, where: the method for monitoring the keyboard input information through the hook comprises the following steps: fuvb + 'space', if the monitored input word is 'happy', the input method is determined to be the five-stroke input method by the word root reverse check and the pinyin reverse check of the five strokes, and if the current input operation is matched with the five-stroke input method.

And then, when detecting that the keyboard input information corresponding to the input operation is punctuation, acquiring each input word in the input sentence corresponding to the current input operation and a candidate word corresponding to each input word. Specifically, keyboard input information is monitored in real time through Hook, if punctuation marks exist in the keyboard input information, a sentence break is determined to exist currently, the character information between the label mark and the previous punctuation mark is used as an input sentence, each character content input by an input in the input sentence is an input word, and words with a preset number are selected from other candidate words corresponding to each input word before the input as candidate words of the input word.

In the data input method provided by this embodiment, an input method corresponding to the current input operation is determined based on the keyboard input information and the input word corresponding to the current input operation; and then when detecting that the keyboard input information corresponding to the input operation is punctuation, acquiring each input word and candidate words corresponding to each input word in the input sentence corresponding to the current input operation, so as to accurately determine an input method and accurately obtain the candidate words corresponding to the input words, and further improve the accuracy of correcting the input sentence.

The present invention also provides a data input device, referring to fig. 3, the data input device including:

a first obtaining module 10, configured to obtain an input method corresponding to a current input operation, and obtain each input word in an input sentence corresponding to the current input operation and a candidate word corresponding to each input word;

the determining module 20 is configured to determine a word to be replaced in each input word based on a first similarity between each input word and the corresponding candidate word;

a second obtaining module 30, configured to obtain, based on the input method, a target word corresponding to the word to be replaced in the candidate words corresponding to the word to be replaced;

and the replacing module 40 is configured to replace the word to be replaced in the input sentence with the target word to obtain the target input sentence.

The method executed by each program unit can refer to each embodiment of the data input method of the present invention, and is not described herein again.

The invention also provides a computer readable storage medium.

The computer-readable storage medium of the present invention has stored thereon a data input program which, when executed by a processor, implements the steps of the data input method as described above.

The data input program executed on the processor may refer to various embodiments of the data input method of the present invention, and details thereof are not repeated herein.

Furthermore, an embodiment of the present invention further provides a computer program product, which includes a data input program, and when the data input program is executed by a processor, the data input program implements the steps of the data input method described above.

It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.

The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.

Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.

The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:密码输入方法、装置、电子设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类