Data processing method, device and electronic equipment
By combining input sequences and input correlation information in the prediction model, the problem of poor prediction results in the prior art is solved, and higher prediction accuracy and adaptability are achieved.
Patent Information
- Application Number
- CN202010768900.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-03
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2040-10-08
AI Technical Summary
When predicting input sequences, the prior art fails to fully combine information in the two dimensions of the input sequence and the input correlation information, resulting in poor prediction results in some scenarios.
The prediction model is used to predict based on input correlation information, and the input sequence is used for filtering during the prediction process to obtain the prediction results. The specific steps include obtaining the input sequence and input association information, determining the characteristic information corresponding to the input association information through the prediction model, filtering the preset word set based on the input sequence, calculating the probability of candidate words, and filtering out the target words.
By combining input sequences and input correlation information, the accuracy of prediction is improved and the prediction ability in different scenarios is enhanced.
Smart Images

Figure CN114063792B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method, device and electronic equipment. Background Art
[0002] With the development of computer technology, electronic devices such as mobile phones and tablet computers are becoming more and more popular, bringing great convenience to people's life, study and work. These electronic devices are usually installed with input method applications (input methods for short), so that users can use the input methods to input information.
[0003] During the user input process, the input method can predict various types of candidates that match the input sequence, such as sentence candidates, name candidates, associations, etc., for the user to display on the screen, thereby improving user input efficiency.
[0004] In the prior art, there are two commonly used methods for predicting candidates. One is to first use the previous context to predict text, and then use the pinyin string to filter candidates; the other is to first convert the pinyin string into text, and then concatenate it with the previous context to predict text. These two methods of using the previous context and pinyin are relatively isolated, and do not fully combine the information of the two dimensions for prediction, resulting in poor prediction results in some scenarios. Summary of the invention
[0005] An embodiment of the present invention provides a data processing method to improve the accuracy of prediction.
[0006] Correspondingly, an embodiment of the present invention further provides a data processing device and an electronic device to ensure the implementation and application of the above method.
[0007] In order to solve the above problems, an embodiment of the present invention discloses a data processing method, which specifically includes: obtaining an input sequence and input association information; using a prediction model to perform prediction based on the input association information and using the input sequence for screening during the prediction process to obtain a prediction result output by the prediction model.
[0008] Optionally, the prediction model is used to make predictions based on the input association information and the input sequence is used for screening during the prediction process to obtain a prediction result output by the prediction model, including: using the prediction model to determine the first feature information corresponding to the input association information; screening each word in the preset word set corresponding to the prediction model according to the input sequence to obtain multiple candidate words; determining the probability of each candidate word according to the first feature information; screening out the target word according to the probability of each candidate word and outputting it to obtain a prediction result.
[0009] Optionally, the prediction model includes an encoding module and a decoding module, the decoding module includes a hidden layer and an output layer, the output layer includes an output node corresponding to each word in the preset word set; the use of the prediction model to determine the first feature information corresponding to the input association information includes: using the encoding module to encode the input association information, obtaining the encoded information and inputting it into the decoding module; using the decoding module to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module; the use of the input sequence to screen each word in the preset word set corresponding to the prediction model to obtain multiple candidate words includes: using the decoding module to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; using the decoding module to activate the output node according to the second feature information and the third feature information, and determine the word corresponding to the activated output node as the candidate word.
[0010] Optionally, the method of selecting a target word based on the probabilities of the candidate words and outputting the target word to obtain a prediction result includes: selecting the top N candidate words with the highest probabilities as the target word and outputting the target word to obtain a prediction result; N is a positive integer.
[0011] Optionally, the use of the decoding module to activate the output node according to the second feature information and the third feature information includes: at the i-th moment: for a target output node, determining the first syllable number Y1 of the word corresponding to the target output node, and determining the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all syllables used to activate the output node in the previous i-1 moments; matching the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information; if the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information, then activating the target output node.
[0012] Optionally, the prediction model is used to determine the probability of each candidate word based on the first feature information, including: at the i-th moment: for a target word screened out at the i-1-th moment, the decoding module is used to determine the fourth feature information corresponding to the target word; the decoding module is used to calculate the probability of each candidate word based on the first feature information and the fourth feature information.
[0013] An embodiment of the present invention also discloses a data processing device, which specifically includes: an acquisition module, used to acquire an input sequence and input association information; a prediction module, used to use a prediction model to perform prediction based on the input association information and use the input sequence for screening during the prediction process to obtain a prediction result output by the prediction model.
[0014] Optionally, the prediction module includes: a feature information determination submodule, used to use a prediction model to determine the first feature information corresponding to the input association information; a screening submodule, used to screen each word in the preset word set corresponding to the prediction model according to the input sequence to obtain multiple candidate words; a probability determination submodule, used to determine the probability of each candidate word based on the first feature information; and a result prediction submodule, used to screen out the target word based on the probability of each candidate word and output it to obtain a prediction result.
[0015] Optionally, the prediction model includes an encoding module and a decoding module, the decoding module includes a hidden layer and an output layer, the output layer includes an output node corresponding to each word in the preset word set; the feature information determination submodule is used to call the encoding module to encode the input association information, obtain the encoded information and input it into the decoding module; call the decoding module to decode the encoded information to obtain the first feature information of the hidden layer output of the decoding module; the screening submodule is used to call the decoding module to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; call the decoding module to activate the output node according to the second feature information and the third feature information, and determine the word corresponding to the activated output node as the candidate word.
[0016] Optionally, the result prediction submodule is used to screen out the top N candidate words with the highest probability as target words and output them to obtain a prediction result; N is a positive integer.
[0017] Optionally, the screening submodule is used to: determine, for a target output node, at the i-th moment: the first syllable number Y1 of the word corresponding to the target output node, and determine the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all syllables used to activate the output node in the previous i-1 moments; match the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information; if the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information, then activate the target output node.
[0018] Optionally, the probability determination submodule is used to: at the i-th moment: for a target word screened out at the i-1-th moment, use the decoding module to determine the fourth feature information corresponding to the target word; and use the decoding module to calculate the probability of each candidate word based on the first feature information and the fourth feature information.
[0019] An embodiment of the present invention further discloses a readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute a data processing method as described in any one of the embodiments of the present invention.
[0020] An embodiment of the present invention also discloses an electronic device, comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations: obtaining an input sequence and input association information; using a prediction model to perform prediction based on the input association information and using the input sequence for screening during the prediction process to obtain a prediction result output by the prediction model.
[0021] Optionally, the prediction model is used to make predictions based on the input association information and the input sequence is used for screening during the prediction process to obtain a prediction result output by the prediction model, including: using the prediction model to determine the first feature information corresponding to the input association information; screening each word in the preset word set corresponding to the prediction model according to the input sequence to obtain multiple candidate words; determining the probability of each candidate word according to the first feature information; screening out the target word according to the probability of each candidate word and outputting it to obtain a prediction result.
[0022] Optionally, the prediction model includes an encoding module and a decoding module, the decoding module includes a hidden layer and an output layer, the output layer includes an output node corresponding to each word in the preset word set; the use of the prediction model to determine the first feature information corresponding to the input association information includes: using the encoding module to encode the input association information, obtaining the encoded information and inputting it into the decoding module; using the decoding module to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module; the use of the input sequence to screen each word in the preset word set corresponding to the prediction model to obtain multiple candidate words includes: using the decoding module to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; using the decoding module to activate the output node according to the second feature information and the third feature information, and determine the word corresponding to the activated output node as the candidate word.
[0023] Optionally, the method of selecting a target word based on the probabilities of the candidate words and outputting the target word to obtain a prediction result includes: selecting the top N candidate words with the highest probabilities as the target word and outputting the target word to obtain a prediction result; N is a positive integer.
[0024] Optionally, the use of the decoding module to activate the output node according to the second feature information and the third feature information includes: at the i-th moment: for a target output node, determining the first syllable number Y1 of the word corresponding to the target output node, and determining the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all syllables used to activate the output node in the previous i-1 moments; matching the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information; if the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information, then activating the target output node.
[0025] Optionally, the prediction model is used to determine the probability of each candidate word based on the first feature information, including: at the i-th moment: for a target word screened out at the i-1-th moment, the decoding module is used to determine the fourth feature information corresponding to the target word; the decoding module is used to calculate the probability of each candidate word based on the first feature information and the fourth feature information.
[0026] The embodiments of the present invention include the following advantages:
[0027] In an embodiment of the present invention, an input sequence and input association information can be obtained; then a prediction model is used to perform prediction based on the input association information and the input sequence is used for screening during the prediction process to obtain a prediction result output by the prediction model; and then the two dimensions of input sequence and input association information can be combined to perform prediction together, thereby improving the accuracy of the prediction. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 is a flow chart of steps of an embodiment of a data processing method of the present invention;
[0029] Figure 2 is a flowchart of steps of an embodiment of a model training method of the present invention;
[0030] Figure 3 is a flowchart of steps of an optional embodiment of a data processing method of the present invention;
[0031] Figure 4A is a schematic diagram of the structure of a prediction model according to an embodiment of the present invention;
[0032] Figure 4B is a flowchart of steps of another optional embodiment of a data processing method of the present invention;
[0033] Figure 5 is a structural block diagram of an embodiment of a data processing device of the present invention;
[0034] Figure 6 is a structural block diagram of an optional embodiment of a data processing device of the present invention;
[0035] Figure 7 A structural block diagram of an electronic device for data processing according to an exemplary embodiment;
[0036] Figure 8 It is a structural schematic diagram of an electronic device for data processing according to another exemplary embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0038] Reference Figure 1 , shows a flow chart of steps of a data processing method embodiment of the present invention, which may specifically include the following steps:
[0039] Step 102: Obtain input sequence and input association information.
[0040] In the embodiment of the present invention, prediction can be performed during the user inputting the input sequence to generate corresponding prediction results. The prediction may include long sentence prediction, word prediction, long sentence association, word association, etc.; correspondingly, the prediction result may include sentence candidates or word candidates, which is not limited in the embodiment of the present invention.
[0041] The embodiments of the present invention can be applied to predictions in various input scenarios, such as stroke input scenarios, pinyin input scenarios, voice input scenarios, etc., and the embodiments of the present invention are not limited thereto.
[0042] In addition, the embodiments of the present invention can also be applied to multiple language scenarios for prediction. For example, it can be applied to Chinese input scenarios for sentence prediction; for example, it can be applied to English input scenarios for prediction; for example, it can be applied to Korean input scenarios for prediction; and so on, which are not limited by the embodiments of the present invention.
[0043] Correspondingly, the input sequence may include a stroke sequence, a pinyin sequence, a foreign character string, etc., which is not limited in the embodiment of the present invention.
[0044] In which, during the process of the user using the input method to input, the input sequence and input association information of the user input can be obtained; then based on the obtained input sequence and input association information, the corresponding sentence candidates are predicted.
[0045] The input-related information may include information related to the input, such as the above information, input environment information, etc., which is not limited in the embodiment of the present invention.
[0046] In an example of the present invention, a method for performing prediction based on the acquired input sequence and input association information may refer to the following step 104:
[0047] Step 104: Use a prediction model to perform prediction based on the input association information and use the input sequence for screening during the prediction process to obtain a prediction result output by the prediction model.
[0048] In the embodiment of the present invention, the prediction model can be pre-trained, and then the trained prediction model is used for prediction. The training process of the prediction model will be described in the subsequent embodiments.
[0049] The input association information and the input sequence can be input into the prediction model, and the prediction model uses the input sequence for screening during the prediction based on the input association information, and outputs the corresponding prediction result. That is, the prediction model predicts based on the input association information while screening the predicted information based on the input sequence, and outputs the prediction result.
[0050] In summary, in the embodiments of the present invention, an input sequence and input association information can be obtained; then a prediction model is used to perform prediction based on the input association information and the input sequence is used for screening during the prediction process to obtain a prediction result output by the prediction model; and then the two dimensions of input sequence and input association information can be combined to perform prediction together, thereby improving the accuracy of the prediction.
[0051] The following is an explanation of how to train the prediction model.
[0052] Reference Figure 2 , shows a step flow chart of an embodiment of a model training method of the present invention.
[0053] Step 202: Collect corpus.
[0054] In the embodiment of the present invention, corpus can be collected, and then training data can be generated based on the collected corpus, so as to train the prediction model using the training data. There are many ways to collect corpus, such as collecting sentences input by users in the input method as corpus; or collecting the text and abstracts in various web pages as corpus; the embodiment of the present invention does not limit this.
[0055] Step 204: divide the corpus into word granularity to obtain training data.
[0056] In the embodiment of the present invention, the corpus may be divided to generate training data.
[0057] One way to divide the corpus and generate training data may be: divide the corpus into word granularity to obtain training data. The corpus may be divided into multiple words with words as granularity; and then two adjacent and semantically related words are used as a set of training data.
[0058] In the embodiment of the present invention, the word granularity may be determined based on natural language processing, and then the corpus is divided into multiple words based on the word granularity. Alternatively, the word granularity may be determined based on the user's on-screen operation during the input process, and then the corpus is divided into multiple words based on the word granularity; the embodiment of the present invention does not limit this.
[0059] Step 206: Use the training data to train the prediction model.
[0060] The following is an example of using a set of training data to train the prediction model.
[0061] In one embodiment of the present invention, when the training data is obtained by dividing the corpus into sentence granularity, each group of training data may include two groups of words. In the embodiment of the present invention, the first group of words in the group of training data may be input into the prediction model, and the prediction model performs forward calculation to obtain word candidates. The word candidates are then compared with the second group of words in the group of training data, and the weight of the prediction model is adjusted. In this way, the prediction model is trained using multiple groups of training data until the set end condition is met.
[0062] In one example of the present invention, the prediction model can be a deep learning model, such as RNN (Recurrent Neural Network), LTSM (Long Short-Term Memory), Transformer (machine translation model), etc.; the embodiment of the present invention is not limited to this.
[0063] The following describes a method for performing prediction using the prediction model trained according to steps 202 to 206.
[0064] Reference Figure 3 , shows a flow chart of steps of an optional embodiment of a data processing method of the present invention, which may specifically include the following steps:
[0065] Step 302: Obtain input sequence and input association information.
[0066] The input sequence may include a single code or multiple codes, which is not limited in the embodiment of the present invention. The input associated information may include: the above information and / or input environment information, and of course may include other information, which is not limited in the embodiment of the present invention; the above information may include interactive information and / or content in the edit box.
[0067] In the embodiment of the present invention, after the input sequence and the input association information are obtained, the input sequence and the input association information can be input into the trained prediction model, and the prediction model performs prediction based on the input association information while screening based on the input sequence; refer to steps 304 to 310:
[0068] Step 304: Use a prediction model to determine first feature information corresponding to the input association information.
[0069] After the preset model obtains the input association information, it can perform feature extraction on the input association information to determine feature information corresponding to the input association information; for the convenience of subsequent description, the feature information corresponding to the input association information can be referred to as first feature information.
[0070] Step 306: Screen each word in the preset word set corresponding to the prediction model according to the input sequence to obtain a plurality of candidate words.
[0071] The prediction model has a corresponding preset word set, which includes a plurality of words. The prediction model performs prediction by selecting some words from the preset word set as prediction results.
[0072] After acquiring the input sequence, the prediction model can use the input sequence to screen each word in the preset word set to screen out multiple candidate words that match the input sequence.
[0073] In the embodiment of the present invention, step 304 and step 306 may be performed simultaneously, and step 306 may also be performed after step 304, which is not limited in the embodiment of the present invention.
[0074] Step 308: Determine the probability of each candidate word based on the first feature information.
[0075] Step 310: Filter out the target word according to the probabilities of the candidate words and output it to obtain a prediction result.
[0076] After determining the first feature information and selecting candidate words, the prediction model can determine the probability of each candidate word based on the first feature information, that is, the probability of each candidate word being the next word under the condition of the input association information. Then, based on the probability of each candidate word, the target word is selected from multiple candidate words and output, thereby obtaining a prediction result.
[0077] In an optional embodiment of the present invention, the target word is selected and output according to the probability of each candidate word, and an implementation method for obtaining the prediction result may include: selecting the top N candidate words with the highest probability as the target word and outputting them to obtain the prediction result. Then, the words with high probability are output to generate the prediction result, which can improve the accuracy of the prediction. Wherein, N is a positive integer, which can be set according to the requirements, and the embodiment of the present invention does not limit this.
[0078] In summary, in an embodiment of the present invention, a prediction model is used to perform prediction based on the input association information and the input sequence is used for screening during the prediction process: the prediction model is used to determine the first feature information corresponding to the input association information, and each word in the preset word set corresponding to the prediction model is screened according to the input sequence to obtain a plurality of candidate words; then the probability of each candidate word is determined according to the first feature information, and the target word is screened out and output according to the probability of each candidate word to obtain a prediction result; compared with calculating the probabilities of all words in the preset word set and then screening the target word, the embodiment of the present invention only needs to calculate the probabilities of some words in the preset word set, which can reduce the calculation amount of the prediction model; thereby improving the prediction efficiency and also improving the user experience.
[0079] In an optional embodiment of the present invention, the prediction model may include an encoding module and a decoding module, and the decoding module includes an input layer, a hidden layer, and an output layer. Figure 4A , shows a schematic diagram of the structure of a prediction model according to an embodiment of the present invention. In an example of the present invention, the output layer may be a softmax layer.
[0080] The output layer may include output nodes corresponding to each word in the preset word set. That is, if the preset word set includes multiple words, the output layer may include as many output nodes as desired.
[0081] The following describes using a prediction model including an encoding module and a decoding module, performing prediction based on the input association information, and using the input sequence for screening during the prediction process.
[0082] Reference Figure 4B , showing a step flow chart of another optional embodiment of the data processing method of the present invention.
[0083] Step 402: Obtain input sequence and input association information.
[0084] In the embodiment of the present invention, step 402 is similar to the above step 302 and will not be described in detail here.
[0085] Wherein, the step 304 of using the prediction model to determine the first feature information corresponding to the input association information may include steps 404 to 406:
[0086] Step 404: Use the encoding module to encode the input association information to obtain encoded information and input it into the decoding module.
[0087] Step 406: Use the decoding module to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module.
[0088] In an embodiment of the present invention, when inputting the input association information into the prediction model, the input association information may be input into a coding module of the prediction model; the coding module encodes the input association information to obtain coding information corresponding to the input association information.
[0089] After the encoding module completes encoding of the input association information, the encoded information can be input into the input layer of the decoding module. After receiving the encoded information, the input layer of the decoding module processes the encoded information and then inputs it into the hidden layer of the decoding model; the hidden layer decodes the encoded information to obtain the decoded information corresponding to the input association information, that is, the first feature information.
[0090] The above step 306 uses the input sequence to filter each word in the preset word set corresponding to the prediction model to obtain multiple candidate words, which may include: Step 408-Step 410:
[0091] Step 408: Use the decoding module to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence.
[0092] Step 410: Use the decoding module to activate the output node according to the second feature information and the third feature information, and determine the word corresponding to the activated output node as a candidate word.
[0093] In an embodiment of the present invention, an input sequence can be used to activate each output node of the output layer of the decoding module, and some of the output nodes can be activated; then the words corresponding to the activated output nodes are determined as candidate words, thereby realizing the screening of each word in the preset word set.
[0094] In one embodiment of the present invention, each output node on the output layer may have corresponding feature information; the feature information of the syllable network corresponding to the input sequence may be used to activate the output nodes according to the feature information corresponding to each output node.
[0095] In order to facilitate subsequent explanation, the feature information corresponding to the output node can be called the second feature information; and the feature information of the syllable network corresponding to the input sequence can be called the third feature information.
[0096] In an embodiment of the present invention, when the second feature information corresponding to each output node is pre-generated, the pre-generated second feature information can be directly obtained; that is, the second feature information of each output node is fixed. Among them, the pre-generated second feature information of the output node can be the feature information of the word corresponding to the output node, or it can be other information, and the embodiment of the present invention does not limit this. When the second feature information of the output node is not pre-generated, the second feature information of each output node can be calculated in real time. Among them, the second feature information of the output node can be calculated in a variety of ways, such as using the first feature information to calculate the second feature information of the output node; for example, using the feature information of part of the hidden layer output to calculate the second feature information of the output node; and so on, and the embodiment of the present invention does not limit this.
[0097] The second feature information corresponding to each output node may be a 1*d vector; assuming that the number of output nodes in the output layer is m, the second feature information of all output nodes may constitute an m*d matrix. m and d are positive integers, which are not limited in the embodiment of the present invention.
[0098] And the third characteristic information of the syllable network corresponding to the input sequence can be obtained. When the third characteristic information of the syllable network corresponding to the preset input sequence is generated in advance, the third characteristic information of the syllable network corresponding to the input sequence can be searched from the third characteristic information of the syllable network corresponding to the preset input sequence. If the third characteristic information of the syllable network corresponding to the input sequence is not found from the third characteristic information of the syllable network corresponding to the preset input sequence, or the third characteristic information of the syllable network corresponding to the preset input sequence is not generated in advance, the third characteristic information of the syllable network corresponding to the input sequence can be generated in real time. Among them, the preset input sequence can be set according to demand, such as it can be an input sequence corresponding to a frequently used word, etc., and the embodiment of the present invention does not limit this.
[0099] The method of generating the third feature information of the syllable network corresponding to the input sequence may be: first generate the syllable network of the input sequence, and then generate the third feature information corresponding to the syllable network. The following takes the input sequence as a pinyin sequence as an example for explanation:
[0100] In an embodiment of the present invention, the same pinyin sequence may include multiple division methods; for example, the pinyin sequence: "fangan", the corresponding pinyin forms may include: "fang'an", "fan'gan", "fa'n'gan", etc. Therefore, the historical pinyin sequence can be parsed and parsed into multiple forms of pinyin; wherein each form of pinyin may include at least M syllables of pinyin, and M is a positive integer. For example: one form of pinyin is "fang'an", corresponding to the pinyin including two syllables: "fang" and "an"; one form of pinyin is "fan'gan", corresponding to the pinyin including two syllables: "fan" and "gan"; one form of pinyin is "fa'n'gan", corresponding to the pinyin including two syllables: "fa", "n" and "gan". In an embodiment of the present invention, one form of pinyin can be selected from multiple forms of pinyin as the target form of pinyin; then the target form of pinyin can be converted into the corresponding syllable path. The syllable paths corresponding to the various forms of pinyin are then used to generate the syllable network corresponding to the pinyin sequence. Among them, one form of pinyin may include pinyin of M syllables, where M is a positive integer.
[0101] Since most users are accustomed to only entering the first pinyin character or the first few pinyin characters of the target text when inputting a pinyin sequence, in order to provide users with prediction results related to their target input when they have not input a complete pinyin sequence, thereby improving user input efficiency, the embodiments of the present invention can convert the pinyin in the target form into a pinyin identifier that matches the pinyin prefix of the target form when converting the pinyin in the target form into a corresponding syllable path, thereby obtaining the syllable path corresponding to the pinyin in the target form, thereby improving the comprehensiveness of the prediction results.
[0102] Among them, one way to convert the pinyin of the target form into a pinyin identifier that matches the pinyin prefix of the target form is: convert the pinyin of the Mth syllable in the pinyin of the target form into a pinyin identifier that matches the pinyin prefix of the Mth syllable. Among them, prefix matching can mean that the pinyin corresponding to the pinyin identifier contains the pinyin corresponding to the syllable in the pinyin of the target form. And determine the syllables whose corresponding pinyin contains initial consonants and finals and the syllables whose pinyin only contains initial consonants in the first M-1 syllables in the pinyin sequence of the target form; convert the syllables whose corresponding pinyin contains initial consonants and finals in the first M-1 syllables in the pinyin sequence of the target form into a pinyin identifier that completely matches the corresponding pinyin. And convert the syllables whose corresponding pinyin only contains initial consonants in the first M-1 syllables in the pinyin sequence of the target form into a pinyin identifier that matches the corresponding initial consonant.
[0103] Among them, the pinyin of the target form can be converted into a pinyin identifier that matches the pinyin prefix of the target form by querying the mapping relationship between the pinyin and the pinyin identifier (such as the pinyin ID). For example, the pinyin of the Mth syllable in the pinyin of the target form is "h", and the pinyins that match the prefix of "h" are "h", "hen", "he", "heng" and "ha", etc.; then the pinyin identifier 99 corresponding to "h", the pinyin identifier 120 corresponding to "hen", the pinyin identifier 110 corresponding to "he", the pinyin identifier 122 corresponding to "heng" and the pinyin identifier 105 corresponding to "ha" are determined as the pinyin identifiers that match the pinyin prefix corresponding to the Mth syllable. For another example, if there is a pinyin of "he" in the first M-1 syllables of the pinyin of the target form, then only the identifier 110 corresponding to "he" can be used as the pinyin identifier of the pinyin corresponding to the syllable.
[0104] Then, the pinyin identifier corresponding to each syllable in the target pinyin can be used as a syllable node; the pinyin identifier corresponding to the Mth syllable in the target pinyin can include X, where X is a positive integer. Then, the first M-1 syllable nodes in the target pinyin are combined with the X syllable nodes corresponding to the Mth syllable to form a syllable path; and then the X syllable paths corresponding to the target pinyin can be obtained.
[0105] Then, each syllable path in the syllable network is encoded separately, and then the encoding information corresponding to each syllable path can be spliced to obtain the third feature information of the syllable network corresponding to the input sequence. Among them, for a syllable path, each syllable node in the syllable path can be encoded, and then the encoding information of each syllable node can be spliced according to the order between the syllable nodes in the path to obtain the encoding information of the syllable path. There are many ways to encode each syllable path, such as one-hot (hot encoding), and the embodiment of the present invention does not limit this. Among them, the third feature information can be a 1*j matrix, j is a positive integer; j can be determined according to the syllable paths contained in the syllable network, and the length of the encoding information corresponding to each syllable path.
[0106] In the embodiment of the present invention, since the output layer of the decoding module can determine the probability of each candidate word according to the first feature information at each moment, and screen out the top N candidate words with the highest probability as target words and output them; therefore, the decoding module can be used at the output layer at each moment to activate the output node according to the second feature information and the third feature information.
[0107] The following takes a moment as an example to illustrate the method of using the decoding module to activate the output node according to the second characteristic information and the third characteristic information; the method may include the following sub-steps:
[0108] At the i-th moment:
[0109] Sub-step S4102, for a target output node, determines the first syllable number Y1 of the word corresponding to the target output node, and determines the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all the syllables used to activate the output node in the previous i-1 moments.
[0110] Sub-step S4104, matching the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2 syllable in the third feature information.
[0111] Sub-step S4106, if the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2 syllable in the third feature information, then activating the target output node.
[0112] Wherein, i is a positive integer.
[0113] In the embodiment of the present invention, at the i-th moment, one output node may be selected from the multiple output nodes of the output layer each time as the target output node, and then sub-steps S4102 to S4106 are executed to determine whether to activate the target output node.
[0114] Among them, the first syllable number Y1 of the word corresponding to the target output node can be determined. For example, if the word corresponding to the target output node is "好的" (hǎo de) and the corresponding pinyin sequence is "haode", then the first syllable number Y1 = 2. Another example, if the word corresponding to the target output node is "太" (tài) and the corresponding pinyin sequence is "太", then the first syllable number Y1 = 1.
[0115] Then, the feature information corresponding to Y1 syllables in the input sequence can be used to match the second feature information corresponding to the target output node to determine whether to aggregate the target output node.
[0116] Since at the previous i - 1 moments, some syllables have been used to activate the output nodes, the feature information corresponding to Y1 syllables after these syllables can be used to match the second feature information corresponding to the target output node. Among them, all the syllables used to activate the output nodes at the previous i - 1 moments can be called target syllables; and the second syllable number Y2 of the target syllables in the syllable network corresponding to the input sequence is determined.
[0117] Then, the second feature information corresponding to the target output node is matched with the feature information corresponding to Y1 syllables after the Y2nd syllable in the third feature information; among them, the matching degree / similarity between the second feature information of the target output node and the feature information corresponding to these Y1 syllables can be calculated; then, according to the matching degree / similarity, it is judged whether the second feature information corresponding to the target output node matches the feature information corresponding to Y1 syllables after the Y2nd syllable in the third feature information.
[0118] If the second feature information corresponding to the target output node matches the feature information corresponding to Y1 syllables after the Y2nd syllable in the third feature information, the target output node is activated. If the second feature information corresponding to the target output node does not match the feature information corresponding to Y1 syllables after the Y2nd syllable in the third feature information, the target output node may not be activated, and then the next target output node is selected, and sub - steps S4102 - sub - steps S4106 are executed for the next target output node.
[0119] Among them, when the syllable network corresponding to the input sequence includes multiple syllable paths, the second syllable number Y2 of the target syllables can be determined for each syllable path; among them, the second syllable numbers Y2 corresponding to different syllable paths may be the same or different.
[0120] Then, the second feature information corresponding to the target output node can be matched with the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information corresponding to each syllable path. If the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information corresponding to one of the syllable paths, the target output node can be activated. Each time the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information corresponding to a syllable path is matched with the second feature information corresponding to the target output node, the Y1 syllables corresponding to the syllable path can be marked so that the target syllable and the corresponding second syllable number Y2 can be determined at the next moment.
[0121] Then the words corresponding to the activated output nodes can be determined as candidate words.
[0122] Step 412: determine the probability of each candidate word based on the first feature information.
[0123] Taking the i-th moment as an example, the method of determining the probability of each candidate word according to the first feature information may include the following sub-steps:
[0124] At the i-th moment:
[0125] Sub-step S4122, for a target word selected at the i-1th moment, using the decoding module to determine the fourth feature information corresponding to the target word.
[0126] Sub-step S4124, using a decoding module to calculate the probability of each candidate word according to the first feature information and the fourth feature information.
[0127] In the embodiment of the present invention, after N target words are screened out at each moment, on the one hand, the N target words can be output, and on the other hand, the N target words can be combined with the input association information to jointly predict the words at the next moment.
[0128] Among them, for a target word among the N target words, the decoding module can be used to determine the fourth feature information corresponding to the target word; and then the decoding module is used to calculate the probability of each candidate word based on the first feature information and the fourth feature information.
[0129] Step 414: Filter out the top N candidate words with the highest probability as target words and output them to obtain prediction results.
[0130] In the embodiment of the present invention, after the target word at the last moment is output, the target words output at each moment may be concatenated to form a prediction result.
[0131] When a target word is selected at each moment, the identifier of the target word at the last moment used to predict the target word can be recorded and associated with the target word. When the target word is selected at the last moment, the splicing method of the target word output at each moment can be determined based on the identifier associated with each target word at each moment; then, according to the splicing method of the target word, the target word output at each moment is used to form a prediction result.
[0132] For example, at the first moment, three target words A1, A2 and A3 are output; at the second moment, three target words B1, B2 and B3 are output; at the third moment, C1, C2 and C3 are output. If A1 is used for prediction, B1 is output at the second moment; if A2 is used for prediction, B1 and B2 are output at the second moment; if the previous moment is A3, B2 and B3 are output at the second moment. At this time, the identifier a1 of A1 and the identifier a2 of A2 can be recorded and associated with B1; the identifier a2 of A2 and the identifier a3 of A3 can be recorded and associated with B2; and the identifier a3 of A3 can be recorded and associated with B3. If B1 is used for prediction, C1 is output at the third moment; if B2 is used for prediction, C2 is output at the third moment; if B3 is used for prediction, C2 and C3 are output at the third moment. At this time, the identifier b1 of B1 can be recorded and associated with C1; the identifier b2 of B2 and the identifier b3 of B3 can be recorded and associated with C2; and the identifier b3 of B3 can be recorded and associated with C3. The final prediction results may include: (A1B1C1), (A2B1C1), (A2B2C2), (A3B2C2), (A3B3C2) and (A3B3C3).
[0133] In summary, in an embodiment of the present invention, in the process of using the input sequence to screen each word in the preset word set corresponding to the prediction model to obtain multiple candidate words, the second feature information corresponding to each output node on the output layer and the third feature information of the syllable network corresponding to the input sequence can be obtained by using the decoding module; then the decoding module is used to activate the output node according to the second feature information and the third feature information, and the word corresponding to the activated output node is determined as the candidate word; and then the candidate words are screened out by activation, so that the screening of candidate words is completed within the model, thereby improving the efficiency of screening candidate words.
[0134] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0135] Reference Figure 5 , shows a structural block diagram of a data processing device embodiment of the present invention, which may specifically include the following modules:
[0136] An acquisition module 502 is used to acquire an input sequence and input association information;
[0137] The prediction module 504 is used to use the prediction model to make predictions based on the input association information and use the input sequence for screening during the prediction process to obtain the prediction results output by the prediction model.
[0138] Reference Figure 6 , showing a structural block diagram of an optional embodiment of a data processing device of the present invention.
[0139] In an optional embodiment of the present application, the prediction module 504 includes:
[0140] A feature information determination submodule 5042 is used to determine first feature information corresponding to the input association information using a prediction model;
[0141] A screening submodule 5044 is used to screen each word in the preset word set corresponding to the prediction model according to the input sequence to obtain a plurality of candidate words;
[0142] A probability determination submodule 5046, for determining the probability of each candidate word according to the first feature information;
[0143] The result prediction submodule 5048 is used to filter out the target word according to the probability of each candidate word and output it to obtain the prediction result.
[0144] In an optional embodiment of the present application, the prediction model includes an encoding module and a decoding module, the decoding module includes a hidden layer and an output layer, and the output layer includes an output node corresponding to each word in the preset word set;
[0145] The feature information determination submodule 5042 is used to call the encoding module to encode the input association information, obtain the encoded information and input it to the decoding module; call the decoding module to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module;
[0146] The screening submodule 5044 is used to call the decoding module to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; call the decoding module to activate the output node according to the second feature information and the third feature information, and determine the word corresponding to the activated output node as the candidate word.
[0147] In an optional embodiment of the present application, the result prediction submodule 5048 is used to screen out the top N candidate words with the highest probability as target words and output them to obtain a prediction result; N is a positive integer.
[0148] In an optional embodiment of the present application, the screening submodule 5044 is used to: at the i-th moment: for a target output node, determine the first syllable number Y1 of the word corresponding to the target output node, and determine the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all syllables used to activate the output node in the previous i-1 moments; match the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information; if the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information, then activate the target output node.
[0149] In an optional embodiment of the present application, the probability determination submodule 5046 is used to: at the i-th moment: for a target word screened out at the i-1-th moment, use the decoding module to determine the fourth feature information corresponding to the target word; and use the decoding module to calculate the probability of each candidate word based on the first feature information and the fourth feature information.
[0150] In summary, in the embodiments of the present invention, an input sequence and input association information can be obtained; then a prediction model is used to perform prediction based on the input association information and the input sequence is used for screening during the prediction process to obtain a prediction result output by the prediction model; and then the two dimensions of input sequence and input association information can be combined to perform prediction together, thereby improving the accuracy of the prediction.
[0151] Figure 7 1 is a block diagram of an electronic device 700 for data processing according to an exemplary embodiment. For example, the electronic device 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0152] Reference Figure 7, the electronic device 700 may include one or more of the following components: a processing component 702 , a memory 704 , a power component 706 , a multimedia component 708 , an audio component 710 , an input / output (I / O) interface 712 , a sensor component 714 , and a communication component 716 .
[0153] The processing component 702 generally controls the overall operation of the electronic device 700, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 702 may include one or more processors 720 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 702 may include one or more modules to facilitate the interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate the interaction between the multimedia component 708 and the processing component 702.
[0154] The memory 704 is configured to store various types of data to support operations on the electronic device 700. Examples of such data include instructions for any application or method operating on the electronic device 700, contact data, phone book data, messages, pictures, videos, etc. The memory 704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0155] The power component 706 provides power to the various components of the electronic device 700. The power component 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 700.
[0156] The multimedia component 708 includes a screen that provides an output interface between the electronic device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front camera and / or a rear camera. When the electronic device 700 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0157] The audio component 710 is configured to output and / or input audio signals. For example, the audio component 710 includes a microphone (MIC), and when the electronic device 700 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 704 or sent via the communication component 716. In some embodiments, the audio component 710 also includes a speaker for outputting audio signals.
[0158] I / O interface 712 provides an interface between processing component 702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0159] The sensor assembly 714 includes one or more sensors for providing various aspects of status assessment for the electronic device 700. For example, the sensor assembly 714 can detect the open / closed state of the electronic device 700, the relative positioning of components, such as the display and keypad of the electronic device 700, and the sensor assembly 714 can also detect the position change of the electronic device 700 or a component of the electronic device 700, the presence or absence of user contact with the electronic device 700, the orientation or acceleration / deceleration of the electronic device 700, and the temperature change of the electronic device 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 714 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0160] The communication component 716 is configured to facilitate wired or wireless communication between the electronic device 700 and other devices. The electronic device 700 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0161] In an exemplary embodiment, the electronic device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.
[0162] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 704 including instructions, and the instructions can be executed by a processor 720 of an electronic device 700 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0163] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute a data processing method, the method comprising: obtaining an input sequence and input association information; using a prediction model to make a prediction based on the input association information and using the input sequence for screening during the prediction process to obtain a prediction result output by the prediction model.
[0164] Optionally, the prediction model is used to make predictions based on the input association information and the input sequence is used for screening during the prediction process to obtain a prediction result output by the prediction model, including: using the prediction model to determine the first feature information corresponding to the input association information; screening each word in the preset word set corresponding to the prediction model according to the input sequence to obtain multiple candidate words; determining the probability of each candidate word according to the first feature information; screening out the target word according to the probability of each candidate word and outputting it to obtain a prediction result.
[0165] Optionally, the prediction model includes an encoding module and a decoding module, the decoding module includes a hidden layer and an output layer, the output layer includes an output node corresponding to each word in the preset word set; the use of the prediction model to determine the first feature information corresponding to the input association information includes: using the encoding module to encode the input association information, obtaining the encoded information and inputting it into the decoding module; using the decoding module to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module; the use of the input sequence to screen each word in the preset word set corresponding to the prediction model to obtain multiple candidate words includes: using the decoding module to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; using the decoding module to activate the output node according to the second feature information and the third feature information, and determine the word corresponding to the activated output node as the candidate word.
[0166] Optionally, the method of selecting a target word based on the probabilities of the candidate words and outputting the target word to obtain a prediction result includes: selecting the top N candidate words with the highest probabilities as the target word and outputting the target word to obtain a prediction result; N is a positive integer.
[0167] Optionally, the use of the decoding module to activate the output node according to the second feature information and the third feature information includes: at the i-th moment: for a target output node, determining the first syllable number Y1 of the word corresponding to the target output node, and determining the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all syllables used to activate the output node in the previous i-1 moments; matching the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information; if the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information, then activating the target output node.
[0168] Optionally, the prediction model is used to determine the probability of each candidate word based on the first feature information, including: at the i-th moment: for a target word screened out at the i-1-th moment, the decoding module is used to determine the fourth feature information corresponding to the target word; the decoding module is used to calculate the probability of each candidate word based on the first feature information and the fourth feature information.
[0169] Figure 8: is a structural diagram of an electronic device 800 for data processing according to another exemplary embodiment of the present invention. The electronic device 800 may be a server, which may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 822 (for example, one or more processors) and a memory 832, and one or more storage media 830 (for example, one or more mass storage devices) storing application programs 842 or data 844. Among them, the memory 832 and the storage medium 830 may be temporary storage or permanent storage. The program stored in the storage medium 830 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Furthermore, the central processor 822 may be configured to communicate with the storage medium 830 and execute a series of instruction operations in the storage medium 830 on the server.
[0170] The server may also include one or more power supplies 826, one or more wired or wireless network interfaces 850, one or more input and output interfaces 858, one or more keyboards 856, and / or one or more operating systems 841, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0171] An electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations: obtaining an input sequence and input association information; using a prediction model to perform prediction based on the input association information and using the input sequence for screening during the prediction process to obtain a prediction result output by the prediction model.
[0172] Optionally, the prediction model is used to make predictions based on the input association information and the input sequence is used for screening during the prediction process to obtain a prediction result output by the prediction model, including: using the prediction model to determine the first feature information corresponding to the input association information; screening each word in the preset word set corresponding to the prediction model according to the input sequence to obtain multiple candidate words; determining the probability of each candidate word according to the first feature information; screening out the target word according to the probability of each candidate word and outputting it to obtain a prediction result.
[0173] Optionally, the prediction model includes an encoding module and a decoding module, the decoding module includes a hidden layer and an output layer, the output layer includes an output node corresponding to each word in the preset word set; the use of the prediction model to determine the first feature information corresponding to the input association information includes: using the encoding module to encode the input association information, obtaining the encoded information and inputting it into the decoding module; using the decoding module to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module; the use of the input sequence to screen each word in the preset word set corresponding to the prediction model to obtain multiple candidate words includes: using the decoding module to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; using the decoding module to activate the output node according to the second feature information and the third feature information, and determine the word corresponding to the activated output node as the candidate word.
[0174] Optionally, the method of selecting a target word based on the probabilities of the candidate words and outputting the target word to obtain a prediction result includes: selecting the top N candidate words with the highest probabilities as the target word and outputting the target word to obtain a prediction result; N is a positive integer.
[0175] Optionally, the use of the decoding module to activate the output node according to the second feature information and the third feature information includes: at the i-th moment: for a target output node, determining the first syllable number Y1 of the word corresponding to the target output node, and determining the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all syllables used to activate the output node in the previous i-1 moments; matching the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information; if the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2th syllable in the third feature information, then activating the target output node.
[0176] Optionally, the prediction model is used to determine the probability of each candidate word based on the first feature information, including: at the i-th moment: for a target word screened out at the i-1-th moment, the decoding module is used to determine the fourth feature information corresponding to the target word; the decoding module is used to calculate the probability of each candidate word based on the first feature information and the fourth feature information.
[0177] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0178] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0179] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0180] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0181] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0182] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0183] The data processing method, the data processing device and the electronic device provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained by using specific examples in this article. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and the scope of application. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A data processing method, characterized in that: include: Get input sequence and input association information; Encoding the input association information using an encoding module of the prediction model to obtain encoded information and input the encoded information into a decoding module of the prediction model; The decoding module is used to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module; the decoding module includes a hidden layer and an output layer, and the output layer includes an output node corresponding to each word in the preset word set; The decoding module is used to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; the syllable network is a plurality of syllable paths corresponding to the plurality of pinyin forms of the input sequence, and the syllable path is a pinyin identifier that matches the pinyin prefix of each pinyin form; Using the decoding module to activate the output node according to the second feature information and the third feature information, and determining the word corresponding to the activated output node as a candidate word; Determining the probability of each candidate word according to the first feature information; The target word is selected according to the probability of each candidate word and output to obtain a prediction result.
2. The method according to claim 1, characterized in that: The step of selecting a target word based on the probability of each candidate word and outputting the target word to obtain a prediction result includes: The top N candidate words with the highest probability are selected as the target words and output to obtain the prediction result; N is a positive integer.
3. The method according to claim 1, characterized in that The using the decoding module to activate the output node according to the second feature information and the third feature information includes: At the i-th moment: For a target output node, determine the first syllable number Y1 of the word corresponding to the target output node, and determine the second syllable number Y2 of the target syllable in the syllable network corresponding to the input sequence; wherein the target syllable is all the syllables used to activate the output node in the previous i-1 moments; Matching the second feature information corresponding to the target output node with the feature information corresponding to the Y1 syllables after the Y2 syllable in the third feature information; If the second feature information corresponding to the target output node matches the feature information corresponding to the Y1 syllables after the Y2 syllable in the third feature information, the target output node is activated.
4. The method according to claim 1, characterized in that: The using the prediction model to determine the probability of each candidate word according to the first feature information includes: At the i-th moment: For a target word selected at the i-1th moment, using the decoding module to determine the fourth feature information corresponding to the target word; A decoding module is used to calculate the probability of each candidate word according to the first feature information and the fourth feature information.
5. A data processing device, characterized in that: include: An acquisition module, used to acquire input sequence and input association information; A prediction module, used to use a prediction model to make predictions based on the input association information and to use the input sequence for screening during the prediction process to obtain a prediction result output by the prediction model; A feature information determination submodule, used to encode the input association information using the encoding module of the prediction model, obtain the encoded information and input it into the decoding module; Decoding the encoded information using the decoding module to obtain first feature information output by a hidden layer of the decoding module; The decoding module includes a hidden layer and an output layer, and the output layer includes an output node corresponding to each word in the preset word set; A screening submodule, used for obtaining, by using the decoding module, second feature information corresponding to each output node on the output layer and third feature information of the syllable network corresponding to the input sequence; The decoding module is used to activate the output node according to the second feature information and the third feature information, and the word corresponding to the activated output node is determined as a candidate word; the syllable network is a plurality of syllable paths corresponding to the plurality of pinyin forms of the input sequence, and the syllable path is a pinyin identifier that matches the pinyin prefix of each of the pinyin forms; A probability determination submodule, used to determine the probability of each candidate word according to the first feature information; The result prediction submodule is used to select the target word according to the probability of each candidate word and output it to obtain the prediction result.
6. An electronic device, characterized in that: The system comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, wherein the one or more programs include instructions for performing the following operations: Get input sequence and input association information; Encoding the input association information using an encoding module of the prediction model to obtain encoded information and input the encoded information into a decoding module of the prediction model; The decoding module is used to decode the encoded information to obtain the first feature information output by the hidden layer of the decoding module; the decoding module includes a hidden layer and an output layer, and the output layer includes an output node corresponding to each word in the preset word set; The decoding module is used to obtain the second feature information corresponding to each output node on the output layer, and the third feature information of the syllable network corresponding to the input sequence; the syllable network is a plurality of syllable paths corresponding to the plurality of pinyin forms of the input sequence, and the syllable path is a pinyin identifier that matches the pinyin prefix of each pinyin form; Using the decoding module to activate the output node according to the second feature information and the third feature information, and determining the word corresponding to the activated output node as a candidate word; Determining the probability of each candidate word according to the first feature information; The target word is selected according to the probability of each candidate word and output to obtain a prediction result.
7. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the data processing method as described in any one of method claims 1-4.
Citation Information
Patent Citations
Text input method and device and electronic equipment
CN107621891A
Candidate text sorting method and device, apparatus, and storage medium
CN109032375A
Data processing method and device and electronic equipment
CN113589946A
Data processing method, device and electronic equipment
CN113589947A