Input method candidate word generation method, device, electronic device and readable storage medium
Through the methods of syllable segmentation and historical input word filtering, the input method candidate words are determined, which solves the problem of low quality of candidate words in the existing input method software and improves the input efficiency of users.
Patent Information
- Application Number
- CN202211167848.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-23
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-09-23
AI Technical Summary
When existing input method software provides candidate words, it is difficult to ensure the quality of candidate words, which affects the user's input efficiency.
By syllable segmentation of the current input character, the target historical input words related to the current input character are filtered out from the historical input word set based on the syllable segmentation results, and the candidate words are determined based on the prediction data.
It improves the quality of candidate words, helps users quickly select input words, and improves user input efficiency.
Smart Images

Figure CN115454261B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technology, and in particular to the field of artificial intelligence or input method technology. Specifically, the present disclosure relates to an input method candidate word generation method, device, electronic device and readable storage medium. Background Art
[0002] Input method refers to a coding method used to input various symbols into a computer or other device (such as a mobile phone). In existing input method software, after a user submits a coded character, the input method software will display candidate words to the user, and the user can select the input word he wants to enter from the candidate words.
[0003] The quality of the candidate words provided by the input method software will directly affect the user's input efficiency. Therefore, how to provide high-quality candidate words to improve the user's input efficiency has become an important technical issue in the field of input methods. Summary of the invention
[0004] In order to solve at least one of the above-mentioned defects, the present disclosure provides a method, device, electronic device and readable storage medium for generating candidate words for an input method.
[0005] According to a first aspect of the present disclosure, a method for generating candidate words for an input method is provided, the method comprising:
[0006] Perform syllable segmentation on the current input character of the current user to obtain a syllable segmentation result;
[0007] Determine a target historical input word from a historical input word set based on the syllable segmentation result, the historical input word set including historical input words corresponding to historical input operations of the current user before inputting the current input character, and the target historical input word is a historical input word related to the current input character;
[0008] Prediction data is obtained, and a candidate word corresponding to the current input character is determined based on the prediction data, wherein the prediction data includes the current input character, the target historical input word, and related information of the target historical input word.
[0009] According to a second aspect of the present disclosure, there is provided an input method candidate word generating device, the device comprising:
[0010] The syllable segmentation module is used to perform syllable segmentation on the current input characters of the current user to obtain the syllable segmentation result;
[0011] A target historical input word determination module is used to determine a target historical input word from a historical input word set based on the syllable segmentation result, the historical input word set including historical input words corresponding to the historical input operation of the current user before inputting the current input character, and the target historical input word is a historical input word related to the current input character;
[0012] The candidate word generation module is used to obtain prediction data and determine the candidate word corresponding to the current input character based on the prediction data. The prediction data includes the current input character, the target historical input word and related information of the target historical input word.
[0013] According to a third aspect of the present disclosure, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the input method candidate word generation method.
[0017] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above-mentioned input method candidate word generation method.
[0018] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, which implements the above-mentioned input method candidate word generation method when executed by a processor.
[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0021] Figure 1 It is a flowchart of a method for generating candidate words for an input method provided by an embodiment of the present disclosure;
[0022] Figure 2 It is a structural schematic diagram of an input method candidate word generation device provided by an embodiment of the present disclosure;
[0023] Figure 3 is a structural diagram of a target historical input word matching system provided by an embodiment of the present disclosure;
[0024] Figure 4 It is a structural schematic diagram of an input method candidate word generation device provided by an embodiment of the present disclosure;
[0025] Figure 5It is a block diagram of an electronic device used to implement the input method candidate word generation method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0027] In the related art, in order to improve the quality of candidate words, the input method may analyze the user's historical input word set to determine the candidate words. However, since the historical input word set may be formed by the user's long-term input operations, the number of words contained in the historical input word set is large and the time span is long, it is not convenient to directly analyze.
[0028] In the related art, when determining candidate words based on the user's historical input word set, a neural network model may be used. The length of the input vector of the neural network model is generally fixed, and to ensure the processing efficiency of the neural network model, the length of the input vector will be limited to a certain reasonable range. However, due to the large amount of information contained in the historical input word set and the long time span, the historical input word set may not be effectively converted into an input vector of fixed length, affecting the prediction effect of the candidate words.
[0029] The input method candidate word generation method, device, electronic device and readable storage medium provided by the embodiments of the present disclosure are intended to solve at least one of the above technical problems in the prior art.
[0030] Figure 1 A schematic diagram of a process for generating candidate words for an input method provided by an embodiment of the present disclosure is shown. Figure 1 As shown in , the method can mainly include:
[0031] Step S110: performing syllable segmentation on the current input character of the current user to obtain a syllable segmentation result.
[0032] Among them, when users use input method software installed on terminal devices such as computers and mobile phones, they can input characters by pressing keys on the physical keyboard or virtual keyboard.
[0033] The current input character is the coded character currently input by the current user, that is, the input code.
[0034] After detecting that the current user inputs the current input character, the current input character may be segmented into syllables to obtain a syllable segmentation result, which may include a syllable combination.
[0035] Syllable segmentation can be implemented based on pinyin rules. As an example, syllable segmentation can be performed based on each initial consonant as a separator. For example, if the current input character is "jintian", the syllable segmentation result can be "jin / tian", where " / " is used to separate syllables in the syllable combination.
[0036] By performing syllable segmentation on the current input character, one or more syllable segmentation results can be obtained. For example, if the current input character is "xian", the syllable segmentation results may include two items, one of which is "xian" and the other is "xi / an".
[0037] Step S120: determining a target historical input word from a historical input word set based on the syllable segmentation result, the historical input word set including historical input words corresponding to historical input operations of the current user before inputting the current input character, and the target historical input word is a historical input word related to the current input character.
[0038] The historical input word set includes historical input words corresponding to historical input operations of the current user, and the historical input word set can reflect the historical input preference of the current user.
[0039] The syllable segmentation result is obtained by segmenting the current input character based on the pinyin rules, and can represent the pronunciation of the input word that the current user actually wants to input. Based on the syllable segmentation result, the historical input word related to the current input character can be determined from the historical input word set, that is, the target historical input word.
[0040] Since the historical input word set may contain many historical input words, and most of the historical input words may be irrelevant to the current input character, these historical input words irrelevant to the current input character may be meaningless for analyzing the candidate words corresponding to the current input character. Therefore, the target historical input words related to the current input character can be screened out from the historical input word set based on the syllable segmentation result of the current input character, so as to analyze the candidate words corresponding to the current input character based on the target historical input words.
[0041] Step S130: Obtain prediction data, and determine a candidate word corresponding to the current input character based on the prediction data, wherein the prediction data includes the current input character, the target historical input word, and related information of the target historical input word.
[0042] In the embodiment of the present disclosure, the relevant information of the target historical input word may include multi-dimensional information related to the target historical input word, which is used to describe the target historical input word from multiple data dimensions, thereby helping to better analyze the user's historical input preferences.
[0043] In the disclosed embodiment, prediction data may be constructed based on the current input character, the target historical input word, and related information of the target historical input word, and the candidate word corresponding to the current input character may be analyzed based on the prediction data.
[0044] In the disclosed embodiment, after the candidate words are determined, the candidate words can be displayed to the current user so that the user can select an input word from the candidate words, thereby completing the current input operation. Since the candidate words are analyzed by screening out the historical input words related to the current input character, the effective use of the historical input words is achieved, the quality of the candidate words recommended to the user can be improved, and the user can quickly select the input word from the high-quality candidate words, which can improve the user's input efficiency.
[0045] The method provided by the embodiment of the present disclosure performs syllable segmentation on the current input character of the current user to obtain a syllable segmentation result; based on the syllable segmentation result, a target historical input word related to the current input character is determined from a historical input word set, thereby determining a candidate word corresponding to the current input character based on the current input character, the target historical input word, and related information of the target historical input word. In this solution, by filtering out the target historical input word related to the current input character from the historical input word set based on the syllable segmentation result of the current input character to determine the candidate word corresponding to the current input character, the quality of the candidate words can be improved, which helps to improve the input efficiency of the user.
[0046] In the disclosed embodiment, by screening out historical input words related to the current input character and analyzing candidate words for the target historical input word, it is possible to avoid introducing a large number of historical input words that are not related to the current input character, causing data redundancy and affecting the analysis effect. If a relevant artificial intelligence model is used to analyze the candidate words, an input vector can be constructed for the target historical input word. Since the number of target historical input words is limited, the fixed-length input vector converted based on the target historical input word can effectively represent the target historical input word, avoid introducing redundant data, ensure the prediction effect of the candidate words, and improve the quality of the predicted candidate words.
[0047] In an optional manner of the present disclosure, determining a target historical input word from a historical input word set based on a syllable segmentation result includes:
[0048] Determine a candidate historical input word that matches the syllable segmentation result from the historical input word set;
[0049] A target historical input word is determined based on the candidate historical input words.
[0050] In the disclosed embodiment, the historical input words matching the syllable segmentation result may be determined as candidate historical input words, and then the target historical input words may be determined based on the candidate historical input words.
[0051] The candidate historical input word matches the syllable segmentation result, that is, the syllable combination formed by the syllables of each character in the candidate historical input word is the same as the syllable combination corresponding to the syllable segmentation result, so that the candidate historical input word has the same pronunciation as the syllable segmentation result.
[0052] As an example, the current input character is "xian", the syllable segmentation result is "xi / an", and the candidate historical input word matching the syllable segmentation result is: "Xi'an".
[0053] In actual use, a syllable graph can be constructed based on the syllable segmentation results of the current input character. The syllable graph includes syllable nodes and syllable edges connecting the syllable nodes, where the syllable edges represent syllable combinations and the syllable nodes represent the separation of syllables in the syllable combination. The syllable segmentation results can be matched with historical input words based on the syllable graph to improve matching efficiency.
[0054] In the disclosed embodiment, the candidate historical input word has the same pronunciation as the syllable segmentation result, which is related to the current input character. The candidate historical input word can be directly used as the target historical input word for subsequent analysis of the candidate word.
[0055] In the disclosed embodiment, a target historical input word may also be screened out from the candidate historical input words to ensure that there is a strong correlation between the target historical input word and the current input character.
[0056] In an optional manner of the present disclosure, determining a target historical input word based on candidate historical input words includes:
[0057] Determining a first occurrence probability of a candidate historical input word in a first preset dictionary, where the first preset dictionary is constructed based on input words of a preset first historical user within a first preset historical period;
[0058] Determine a second occurrence probability of a syllable segmentation result matching the candidate historical input word in a second preset dictionary, where the second preset dictionary is constructed based on syllable combinations corresponding to input words of a preset second historical user within a second preset historical period;
[0059] Determine a joint probability corresponding to the candidate historical input word based on the first occurrence probability and the second occurrence probability;
[0060] A target historical input word is determined from the candidate historical input words based on the joint probability.
[0061] In the embodiment of the present disclosure, the first preset dictionary can be constructed by counting the input words entered by the first historical user within the first preset historical time period. The number of users of the first historical user is large, and the first preset historical time period is a relatively long period, so that the first occurrence probability is the occurrence probability of the candidate historical input word under a large sample, which can characterize the frequency of use of the candidate historical input word under normal circumstances.
[0062] When the candidate historical input words are some common words, the corresponding first occurrence probability is higher, and when the candidate historical input words are some uncommon words, the corresponding first occurrence probability is lower.
[0063] In the disclosed embodiment, the second preset dictionary can be constructed by counting the syllable combinations corresponding to the input words entered by the second historical user within the second preset historical time period. The number of second historical users is large, and the second preset historical time period is a relatively long period, so that the second occurrence probability is the occurrence probability of the syllable combination corresponding to the candidate historical input word under a large sample, which can characterize the frequency of use of the syllable combination corresponding to the candidate historical input word under normal circumstances.
[0064] When the syllable combination corresponding to the candidate historical input word is some commonly used syllable combination, its corresponding second occurrence probability is higher, and when the syllable combination corresponding to the candidate historical input word is some uncommon syllable combination, its corresponding second occurrence probability is lower.
[0065] In actual use, the first preset dictionary and the second preset dictionary may be the same dictionary, in which the input words and the syllable combinations corresponding to the input words are recorded.
[0066] In the disclosed embodiment, the joint probability corresponding to the candidate historical input words can be determined based on the first occurrence probability and the second occurrence probability. The joint probability can represent the actual degree of common use of the candidate historical input words, and the common use can reflect the correlation between the candidate historical input words and the current input characters. Therefore, the target historical input word can be determined from the candidate historical input words based on the joint probability.
[0067] As an example, the joint probability may be the product of the first occurrence probability and the second occurrence probability.
[0068] In an optional manner of the present disclosure, before determining the joint probability corresponding to the candidate historical input word based on the first occurrence probability and the second occurrence probability, the method further includes:
[0069] Determine a correction coefficient based on the number of times the candidate historical input word appears on the screen and the most recent time when the candidate historical input word appears on the screen;
[0070] The first occurrence probability is corrected based on the correction coefficient.
[0071] In the disclosed embodiment, since the current user may have different input preferences for different candidate historical input words, the first occurrence probability may be modified in combination with the input preference of the current user.
[0072] Specifically, the correction coefficient may be determined based on the number of times the candidate historical input word appears on the screen and the most recent time when the candidate historical input word appears on the screen.
[0073] The number of times the candidate historical input word appears on the screen is the number of times the candidate historical input word has been input by the user in history, and the most recent time the candidate historical input word appears on the screen is the time point when the candidate historical input word was most recently input by the user in history. The correction coefficient determined based on the number of times the candidate historical input word appears on the screen and the most recent time the candidate historical input word appears on the screen can reflect the user's input preference for the candidate historical input word.
[0074] As an example, the last screen time can be converted into a weight. When the current time interval is close to the last screen time, the corresponding weight is higher; when the current time interval is far from the last screen time, the corresponding weight is lower. The correction coefficient can be the product of the weight corresponding to the screen time multiplied by the number of screen times.
[0075] As an example, when the first occurrence probability is corrected based on the correction coefficient, the correction coefficient can be multiplied by the first occurrence probability, and the product obtained by the multiplication is used as the corrected first occurrence probability. Then, based on the corrected first occurrence probability and the second occurrence probability, the joint probability corresponding to the candidate historical input word can be determined.
[0076] In an optional manner of the present disclosure, determining a target historical input word from candidate historical input words based on a joint probability includes:
[0077] Sort candidate historical input words from high to low based on joint probability;
[0078] The first preset number of candidate historical input words in the sorting are determined as target historical input words.
[0079] In the disclosed embodiment, since the joint probability can reflect the relevance between the candidate historical input words and the current input character, the candidate historical input words can be sorted from high to low based on the joint probability, wherein the candidate historical input words with a higher ranking have a higher joint probability and a higher relevance to the current input character. Therefore, the candidate historical input words with a preset number in the sorting can be selected as the target historical input words.
[0080] As an example, the candidate historical input words whose joint probability is higher than a preset value may also be used as the target historical input words.
[0081] In an optional manner of the present disclosure, the relevant information includes:
[0082] The number of times the target historical input word appears on the screen;
[0083] The most recent screen time of the target historical input word.
[0084] The number of times the target historical input word is inputted on the screen is the number of times the target historical input word is inputted by the current user in history. The most recent time the target historical input word is inputted on the screen is the most recent time point when the target historical input word is inputted by the current user in history.
[0085] Based on the number of times the target historical input word appears on the screen and the most recent time it appears on the screen, the historical input preference of the current user can be effectively analyzed.
[0086] In an optional manner of the present disclosure, the prediction data also includes preceding characters and / or following characters, the preceding characters being characters within a first preset character length before the input position of the current input character, and the following characters being characters within a second preset character length after the input position of the current input character.
[0087] In the disclosed embodiment, both the preceding character and the succeeding character may have a certain correlation with the current input character, and therefore, the candidate word may be analyzed in combination with the preceding character and / or the succeeding character.
[0088] In the embodiment of the present disclosure, the first preset character length and the second preset character length can be set according to actual needs, and the two can be the same or different.
[0089] In an optional manner of the present disclosure, before determining the target historical input word from the historical input word set based on the syllable segmentation result, the method further includes:
[0090] Determine whether there is a target syllable segmentation result in the syllable segmentation result, where the target syllable segmentation result includes the syllable to be completed;
[0091] In response to the existence of a target syllable segmentation result in the syllable segmentation result, a completion process is performed on the syllable to be completed in the target syllable segmentation result.
[0092] In the disclosed embodiment, since the user may input abbreviations, this may result in incomplete syllables in the syllable segmentation result. To facilitate subsequent processing, the target syllable segmentation result can be determined from the syllable segmentation result. If there are syllables to be completed in the syllable combination corresponding to the target syllable segmentation structure, the syllables to be completed in the target syllable segmentation result are completed so that the syllables to be completed are completed syllables.
[0093] For example, the target syllable segmentation result is "jin / t", in which there is a syllable "t" to be completed. The syllable to be completed can be completed, and the completed syllable combination is "jin / tian".
[0094] As an example, whether a syllable is a full syllable to be completed can be determined based on the type of characters contained in the syllable. For example, if the syllable only contains initial consonants, the syllable can be determined to be a full syllable to be completed.
[0095] In an optional manner of the present disclosure, determining a candidate word corresponding to a current input character based on prediction data includes:
[0096] The preset data is input into the pre-trained candidate word prediction model to obtain the candidate word corresponding to the current input character.
[0097] In the disclosed embodiment, a candidate word prediction model may be pre-trained, and by inputting preset data into the pre-trained candidate word prediction model, a candidate word corresponding to the current input character output by the candidate word prediction model may be obtained.
[0098] Specifically, the current input character, the target historical input word, and related information of the target historical input word can be input into a pre-trained candidate word prediction model, wherein the target historical input word and related information of the target historical input word will be jointly converted into a representation vector of the historical input word.
[0099] When the prediction data also includes preceding characters and / or succeeding characters, the current input character, the target historical input word, relevant information of the target historical input word, and the preceding characters and / or succeeding characters may be input into a pre-trained candidate word prediction model.
[0100] As an example, the candidate word prediction model in this example may adopt a neural network model.
[0101] In an optional manner of the present disclosure, the candidate word prediction model is obtained by:
[0102] Perform syllable segmentation on the sample current input characters of the sample user to obtain the sample syllable segmentation result;
[0103] Determine a sample target historical input word from a sample historical input word set based on the sample syllable segmentation result, the sample historical input word set includes historical input words corresponding to historical input operations of the sample user before inputting the current input character of the sample, and the sample target historical input word is a historical input word related to the current input character of the sample;
[0104] Acquire training data, the training data including the sample current input character, the sample target historical input word, sample related information of the sample target historical input word, and the sample candidate word corresponding to the sample current input character;
[0105] The model is trained based on the training data to obtain a candidate word prediction model.
[0106] In the disclosed embodiment, the sample currently input character is the coded character currently input by the sample user, that is, the input code.
[0107] The sample syllable segmentation result is one or more syllable segmentation results obtained by performing syllable segmentation on the sample current input characters according to the pinyin rule.
[0108] The sample historical input word set includes historical input words corresponding to historical input operations of the sample user, and the sample historical input word set can reflect the historical input preference of the sample user.
[0109] Based on the sample syllable segmentation result, a historical input word related to the current input character of the sample, ie, the sample target historical input word, can be determined from the sample historical input word set.
[0110] In the disclosed embodiment, training data can be constructed based on the sample's current input characters, the sample's target historical input words, sample-related information of the sample's target historical input words, and the template candidate words corresponding to the sample's current input characters, and model training can be performed based on the training data to obtain a candidate word prediction model.
[0111] Specifically, the sample's current input characters, the sample's target historical input words, and the sample-related information of the sample's target historical input words can be used as the model's input, and the template candidate words corresponding to the sample's current input characters can be used as the model's output. The initial model is trained to obtain a candidate word prediction model.
[0112] In the disclosed embodiment, since the sample historical input word set may contain a large number of historical input words, and most of the historical input words may be irrelevant to the sample current input character, by screening out sample target historical input words related to the sample current input character from the sample historical input word set based on the syllable segmentation result of the sample current input character, thereby determining the candidate words corresponding to the current input character based on the target historical input words, the amount of data input during model training can be reduced, the introduction of redundant data can be avoided, the amount of data processing during model training can be reduced, the prediction effect of the trained model on the candidate words can be improved, and the quality of the predicted candidate words can be improved.
[0113] In the disclosed embodiment, the process of selecting sample target historical input words from the sample historical input word set of the sample user may refer to the process of selecting target historical input words from the historical input word set of the current user, which will not be described in detail here.
[0114] In an optional manner of the present disclosure, the sample-related information includes:
[0115] The number of times the sample target historical input word appears on the screen;
[0116] The most recent screen time of the sample target historical input word.
[0117] The number of times the sample target historical input word is displayed on the screen is the number of times the sample target historical input word is input by the sample user in history. The most recent time the sample target historical input word is displayed on the screen is the time point when the sample target historical input word is most recently input by the sample user in history.
[0118] Based on the number of times the sample target input word appears on the screen in history and the sample's most recent screen appearance time, the sample user's historical input preference can be effectively analyzed.
[0119] In an optional manner of the present disclosure, the training data also includes sample prefix characters and / or sample post-order characters, the sample prefix characters are characters within a third preset character length before the input position of the sample currently input characters, and the sample post-order characters are characters within a fourth preset character length after the input position of the sample currently input characters.
[0120] In the disclosed embodiment, both the sample leading characters and the sample trailing characters may have certain correlation with the sample current input characters, and therefore, the candidate words may be analyzed in combination with the sample leading characters and / or the sample trailing characters.
[0121] In the embodiment of the present disclosure, the third preset character length and the fourth preset character length can be set according to actual needs, and the two can be the same or different.
[0122] As an example, Figure 2 A schematic diagram of the structure of a device for generating candidate words for an input method provided by an embodiment of the present disclosure is shown in FIG. Figure 2 As shown, the input method candidate word generating device 20 may include:
[0123] The input module 210 is used to obtain prediction data and input the prediction data into the candidate word prediction model.
[0124] The candidate word prediction model 220 is used to predict the candidate word corresponding to the current input character according to the prediction data input by the input module, and output the predicted candidate word to the candidate word prediction result output module.
[0125] The candidate word prediction result output module 230 is used to present the candidate words predicted by the candidate word prediction model to the current user, so that the current user can select an input word from the candidate words.
[0126] The input module 210 includes the following submodules: a preceding character submodule 211, a current input character submodule 212, and a history information submodule 213. The preceding character submodule is used to obtain the preceding character, the current input character submodule is used to obtain the current input character, and the history information submodule is used to obtain the target history input word and related information of the target history input word.
[0127] As an example, Figure 3 FIG. 4 shows a schematic diagram of a target historical input word matching system provided by an embodiment of the present disclosure. Figure 3 As shown, the system may include:
[0128] The input code module 310 is used to obtain the input code currently input by the user, that is, the current input character.
[0129] The syllable segmentation result module 320 is used to perform syllable segmentation on the current input character to obtain a syllable segmentation result.
[0130] The syllable graph module 330 is used to construct a syllable graph based on the syllable segmentation result.
[0131] The historical input word module 340 is used to store the historical input word set of the current user.
[0132] The matching module 350 is used to filter the historical input word set according to the syllable graph to obtain a target historical input word.
[0133] The target historical input word module 360 is used to obtain the target historical input word provided by the matching module, and input the target historical input word into the candidate word prediction model to predict the candidate word.
[0134] Based on Figure 1 The same principle as shown in the method, Figure 4 A schematic diagram of the structure of a device for generating candidate words for an input method provided by an embodiment of the present disclosure is shown. Figure 4 As shown, the input method candidate word generating device 40 may include:
[0135] The syllable segmentation module 410 is used to perform syllable segmentation on the current input character of the current user to obtain a syllable segmentation result;
[0136] A target historical input word determination module 420 is used to determine a target historical input word from a historical input word set based on the syllable segmentation result, the historical input word set including historical input words corresponding to the historical input operation of the current user before inputting the current input character, and the target historical input word is a historical input word related to the current input character;
[0137] The candidate word generation module 430 is used to obtain prediction data and determine the candidate word corresponding to the current input character based on the prediction data. The prediction data includes the current input character, the target historical input word and related information of the target historical input word.
[0138] The device provided by the embodiment of the present disclosure performs syllable segmentation on the current input character of the current user to obtain a syllable segmentation result; based on the syllable segmentation result, a target historical input word related to the current input character is determined from a historical input word set, thereby determining a candidate word corresponding to the current input character based on the current input character, the target historical input word, and related information of the target historical input word. In this solution, by filtering out the target historical input word related to the current input character from the historical input word set based on the syllable segmentation result of the current input character to determine the candidate word corresponding to the current input character, the quality of the candidate words can be improved, which helps to improve the input efficiency of the user.
[0139] Optionally, when the target historical input word determination module determines the target historical input word from the historical input word set based on the syllable segmentation result, it is specifically used to:
[0140] Determine a candidate historical input word that matches the syllable segmentation result from the historical input word set;
[0141] A target historical input word is determined based on the candidate historical input words.
[0142] Optionally, when determining the target historical input word based on the candidate historical input words, the target historical input word determination module is specifically configured to:
[0143] Determining a first occurrence probability of a candidate historical input word in a first preset dictionary, where the first preset dictionary is constructed based on input words of a preset first historical user within a first preset historical period;
[0144] Determine a second occurrence probability of a syllable segmentation result matching the candidate historical input word in a second preset dictionary, where the second preset dictionary is constructed based on syllable combinations corresponding to input words of a preset second historical user within a second preset historical period;
[0145] Determine a joint probability corresponding to the candidate historical input word based on the first occurrence probability and the second occurrence probability;
[0146] A target historical input word is determined from the candidate historical input words based on the joint probability.
[0147] Optionally, the above device further comprises a correction processing module, and the correction processing module is used to:
[0148] Before determining the joint probability corresponding to the candidate historical input word based on the first occurrence probability and the second occurrence probability, determining a correction coefficient based on the number of times the candidate historical input word appears on the screen and the most recent time when the candidate historical input word appears on the screen;
[0149] The first occurrence probability is corrected based on the correction coefficient.
[0150] Optionally, when the target historical input word determination module determines the target historical input word from the candidate historical input words based on the joint probability, it is specifically used to:
[0151] Sort candidate historical input words from high to low based on joint probability;
[0152] The first preset number of candidate historical input words in the sorting are determined as target historical input words.
[0153] Optionally, relevant information includes:
[0154] The number of times the target historical input word appears on the screen;
[0155] The most recent screen time of the target historical input word.
[0156] Optionally, the prediction data also includes preceding characters and / or succeeding characters, the preceding characters being characters within a first preset character length before the input position of the current input character, and the succeeding characters being characters within a second preset character length after the input position of the current input character.
[0157] Optionally, the above device further comprises a syllable completion module, and the syllable completion module is used to:
[0158] Before determining a target historical input word from the historical input word set based on the syllable segmentation result, determining whether there is a target syllable segmentation result in the syllable segmentation result, the target syllable segmentation result including the syllable to be completed;
[0159] In response to the existence of a target syllable segmentation result in the syllable segmentation result, a completion process is performed on the syllable to be completed in the target syllable segmentation result.
[0160] Optionally, when determining the candidate word corresponding to the current input character based on the prediction data, the candidate word generation module is specifically used to:
[0161] The preset data is input into the pre-trained candidate word prediction model to obtain the candidate word corresponding to the current input character.
[0162] Optionally, the candidate word prediction model is obtained by:
[0163] Perform syllable segmentation on the sample current input characters of the sample user to obtain the sample syllable segmentation result;
[0164] Determine a sample target historical input word from a sample historical input word set based on the sample syllable segmentation result, the sample historical input word set includes historical input words corresponding to historical input operations of the sample user before inputting the current input character of the sample, and the sample target historical input word is a historical input word related to the current input character of the sample;
[0165] Acquire training data, the training data including the sample current input character, the sample target historical input word, sample related information of the sample target historical input word, and the sample candidate word corresponding to the sample current input character;
[0166] The model is trained based on the training data to obtain a candidate word prediction model.
[0167] Optionally, the sample-related information includes:
[0168] The number of times the sample target historical input word appears on the screen;
[0169] The most recent screen time of the sample target historical input word.
[0170] Optionally, the training data also includes sample prefix characters and / or sample post-sequence characters, the sample prefix characters are characters within a third preset character length before the input position of the sample currently input character, and the sample post-sequence characters are characters within a fourth preset character length after the input position of the sample currently input character.
[0171] It can be understood that the above modules of the input method candidate word generation device in the embodiment of the present disclosure have the function of realizing Figure 1 The functions of the corresponding steps of the input method candidate word generation method in the embodiment shown in . The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The above modules can be software and / or hardware, and the above modules can be implemented separately or integrated with multiple modules. For the functional description of each module of the above input method candidate word generation device, please refer to Figure 1 The corresponding description of the input method candidate word generating method in the embodiment shown in will not be repeated here.
[0172] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0173] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0174] The electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the input method candidate word generation method provided in the embodiment of the present disclosure.
[0175] Compared with the prior art, the electronic device performs syllable segmentation on the current input character of the current user to obtain a syllable segmentation result; based on the syllable segmentation result, a target historical input word related to the current input character is determined from a historical input word set, thereby determining a candidate word corresponding to the current input character based on the current input character, the target historical input word, and related information of the target historical input word. In this solution, by filtering out the target historical input word related to the current input character from a historical input word set based on the syllable segmentation result of the current input character to determine the candidate word corresponding to the current input character, the quality of the candidate words can be improved, which helps to improve the input efficiency of the user.
[0176] The readable storage medium is a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the input method candidate word generation method provided in the embodiment of the present disclosure.
[0177] Compared with the prior art, the readable storage medium performs syllable segmentation on the current input character of the current user to obtain a syllable segmentation result; based on the syllable segmentation result, a target historical input word related to the current input character is determined from a historical input word set, thereby determining a candidate word corresponding to the current input character based on the current input character, the target historical input word, and related information of the target historical input word. In this solution, by filtering out the target historical input word related to the current input character from a historical input word set based on the syllable segmentation result of the current input character to determine the candidate word corresponding to the current input character, the quality of the candidate words can be improved, which helps to improve the input efficiency of the user.
[0178] The computer program product includes a computer program, and when the computer program is executed by a processor, the input method candidate word generation method provided in the embodiment of the present disclosure is implemented.
[0179] Compared with the prior art, the computer program product performs syllable segmentation on the current input character of the current user to obtain a syllable segmentation result; based on the syllable segmentation result, a target historical input word related to the current input character is determined from a historical input word set, thereby determining a candidate word corresponding to the current input character based on the current input character, the target historical input word, and related information of the target historical input word. In this solution, by filtering out the target historical input word related to the current input character from the historical input word set based on the syllable segmentation result of the current input character to determine the candidate word corresponding to the current input character, the quality of the candidate words can be improved, which helps to improve the input efficiency of the user.
[0180] Figure 5 A schematic block diagram of an example electronic device 50 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0181] like Figure 5 As shown, the electronic device 50 includes a computing unit 510, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 520 or a computer program loaded from a storage unit 580 into a random access memory (RAM) 530. In the RAM 530, various programs and data required for the operation of the device 50 can also be stored. The computing unit 510, the ROM 520, and the RAM 530 are connected to each other via a bus 540. An input / output (I / O) interface 550 is also connected to the bus 540.
[0182] A number of components in the device 50 are connected to the I / O interface 550, including: an input unit 560, such as a keyboard, a mouse, etc.; an output unit 570, such as various types of displays, speakers, etc.; a storage unit 580, such as a disk, an optical disk, etc.; and a communication unit 590, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 590 allows the device 50 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0183] The computing unit 510 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 510 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 510 executes the input method candidate word generation method provided in the embodiment of the present disclosure. For example, in some embodiments, the input method candidate word generation method provided in the embodiment of the present disclosure may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 580. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 50 via the ROM 520 and / or the communication unit 590. When the computer program is loaded into the RAM 530 and executed by the computing unit 510, one or more steps of the input method candidate word generation method provided in the embodiment of the present disclosure may be executed. Alternatively, in other embodiments, the computing unit 510 may be configured in any other appropriate manner (eg, by means of firmware) to execute the input method candidate word generating method provided in the embodiments of the present disclosure.
[0184] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0185] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0186] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0187] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0188] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0189] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0190] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0191] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for generating candidate words for an input method, comprising: Perform syllable segmentation on the current input character of the current user based on the pinyin rule to obtain a syllable segmentation result; Determine a candidate historical input word that matches the syllable segmentation result from the historical input word set; Determining a first occurrence probability of the candidate historical input word in a first preset dictionary, where the first preset dictionary is constructed based on input words of a preset first historical user within a first preset historical period; Determine a second occurrence probability of a syllable segmentation result matching the candidate historical input word in a second preset dictionary, where the second preset dictionary is constructed based on syllable combinations corresponding to input words of a preset second historical user within a second preset historical period; Calculating the product of the first occurrence probability and the second occurrence probability, and determining the product result as the joint probability corresponding to the candidate historical input word; Determine a target historical input word from candidate historical input words based on a joint probability; The currently input character, the target historical input word, the number of times the target historical input word appears on the screen, and the most recent time the target historical input word appears on the screen are input into a pre-trained candidate word prediction model to obtain a candidate word corresponding to the currently input character.
2. The method according to claim 1, wherein: The method further comprises: Determine a correction coefficient based on the number of times the candidate historical input word appears on the screen and the most recent time when the candidate historical input word appears on the screen; The first occurrence probability is corrected based on the correction coefficient.
3. The method according to claim 1 or 2, wherein: The determining a target historical input word from the candidate historical input words based on the joint probability comprises: Sort the candidate historical input words from high to low based on the joint probability; The candidate historical input words of the first preset number in the sorting are determined as target historical input words.
4. The method according to claim 1, wherein: The data input into the pre-trained candidate word prediction model also includes preceding characters and / or succeeding characters, wherein the preceding characters are characters within a first preset character length before the input position of the currently input character, and the succeeding characters are characters within a second preset character length after the input position of the currently input character.
5. The method according to claim 1, before determining a candidate historical input word matching the syllable segmentation result from the historical input word set, the method further comprises: Determine whether there is a target syllable segmentation result in the syllable segmentation results, wherein the target syllable segmentation result includes a syllable to be completed; In response to the existence of a target syllable segmentation result in the syllable segmentation results, a completion process is performed on the syllable to be completed in the target syllable segmentation result.
6. The method according to claim 1, wherein: The candidate word prediction model is obtained in the following way: Perform syllable segmentation on the sample current input characters of the sample user to obtain the sample syllable segmentation result; Determining a sample target historical input word from a sample historical input word set based on the sample syllable segmentation result, the sample historical input word set including historical input words corresponding to historical input operations of the sample user before inputting the sample current input character, and the sample target historical input word is a historical input word related to the sample current input character; Acquire training data, the training data including the sample currently input character, the sample target historical input word, sample related information of the sample target historical input word, and a template candidate word corresponding to the sample currently input character; Model training is performed based on the training data to obtain the candidate word prediction model.
7. The method according to claim 6, wherein: The sample-related information includes: The number of times the sample target historical input word appears on the screen; The most recent screen appearance time of the sample target historical input word.
8. The method according to claim 6, wherein: The training data also includes sample prefix characters and / or sample post-sequence characters, the sample prefix characters are characters within a third preset character length before the input position of the sample currently input character, and the sample post-sequence characters are characters within a fourth preset character length after the input position of the sample currently input character.
9. An input method candidate word generation device, comprising: The syllable segmentation module is used to perform syllable segmentation on the current input characters of the current user based on the pinyin rule to obtain the syllable segmentation result; A target historical input word determination module, used to determine a candidate historical input word that matches the syllable segmentation result from the historical input word set; Determining a first occurrence probability of the candidate historical input word in a first preset dictionary, where the first preset dictionary is constructed based on input words of a preset first historical user within a first preset historical period; Determine a second occurrence probability of a syllable segmentation result matching the candidate historical input word in a second preset dictionary, where the second preset dictionary is constructed based on syllable combinations corresponding to input words of a preset second historical user within a second preset historical period; calculate the product of the first occurrence probability and the second occurrence probability, and determine the product result as a joint probability corresponding to the candidate historical input word; determine a target historical input word from the candidate historical input words based on the joint probability; The candidate word generation module is used to input the current input character, the target historical input word, the number of times the target historical input word appears on the screen, and the most recent time the target historical input word appears on the screen into a pre-trained candidate word prediction model to obtain the candidate word corresponding to the current input character.
10. The device according to claim 9, further comprising a correction processing module, wherein the correction processing module is used to: Determine a correction coefficient based on the number of times the candidate historical input word appears on the screen and the most recent time when the candidate historical input word appears on the screen; The first occurrence probability is corrected based on the correction coefficient.
11. The device according to claim 9 or 10, wherein: When the target historical input word determination module determines the target historical input word from the candidate historical input words based on the joint probability, it is specifically used to: Sort the candidate historical input words from high to low based on the joint probability; The candidate historical input words of the first preset number in the sorting are determined as target historical input words.
12. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 8.
13. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
14. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Input method and device
CN106873799A
Association input method and apparatus, and electronic device
CN107608532A
Method and device for recommending candidate words of input method
CN113360004A