Text generation method, device, electronic device and storage medium

By using placeholders to predict in the handwriting input method, the problem of low typing accuracy and efficiency of handwriting input method is solved, and the effect of user independent and fast input text is achieved.

CN114089841BActive Publication Date: 2025-05-09BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111396688.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-23
Publication Date
2025-05-09
Estimated Expiration
2041-11-23

AI Technical Summary

Technical Problem

The handwriting input method has low typing accuracy and efficiency, making it difficult for users to quickly and accurately enter text when forgetting words.

Method used

By responding to the user's touch command, determine the target prediction method and use placeholders to predict in the text entered by the user to generate the final text.

Benefits of technology

The typing accuracy and efficiency of handwriting input method is improved, and users can independently complete text input without helping others or changing expression methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114089841B_ABST
    Figure CN114089841B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, electronic device and storage medium for generating text. In particular, it relates to the field of artificial intelligence and big data technology. The specific implementation scheme is: in response to a touch instruction of a first control, a target prediction method is determined; in response to a touch instruction of a second control, a first text input by a user is obtained; a placeholder in the first text is predicted using the target prediction method to obtain a target prediction word; and a placeholder in the first text is processed based on the target prediction word to generate a second text. The technical effect of improving the typing accuracy and efficiency of the handwriting input method is achieved, thereby solving the technical problem of low typing accuracy and low efficiency of the handwriting input method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, in particular to the field of artificial intelligence and big data technology, and specifically provides a text generation method, device, electronic device and storage medium. Background Art

[0002] With the development of communication technology, the proportion of some netizens is affected by their pinyin level or cultural level. The most important typing method on mobile terminals is handwriting. Handwriting requires users to recognize and recall the correct text results, which leads to a long period of "forgetting words when writing". Users can only solve this problem by asking others for help or changing the way of expression. Therefore, the handwriting input method has a high typing threshold and it is difficult for users to complete accurate input. Summary of the invention

[0003] The present disclosure provides a text generation method, device, electronic device and storage medium to at least solve the technical problems of low accuracy and low efficiency of handwriting typing.

[0004] According to one aspect of the present disclosure, a method for generating text is provided, comprising: in response to a touch instruction to a first control, determining a target prediction mode, wherein the first control is used to sense the touch instruction and trigger the calling of at least one prediction mode, and the target prediction mode is used to indicate whether a prediction word is provided; in response to a touch instruction to a second control, obtaining a first text input by a user, wherein the second control is used to sense the touch instruction and trigger the calling of a prediction function, and the first text includes at least a placeholder; predicting the placeholders in the first text using the target prediction mode to obtain a target prediction word; and processing the placeholders in the first text based on the target prediction word to generate a second text.

[0005] According to another aspect of the present disclosure, a text generation device is provided, including: a determination module, used to determine a target prediction mode in response to a touch instruction to a first control, wherein the first control is used to sense the touch instruction and trigger the calling of at least one prediction mode, and the target prediction mode is used to indicate whether a prediction word is provided; an acquisition module, used to acquire a first text input by a user in response to a touch instruction to a second control, wherein the second control is used to sense the touch instruction and trigger the calling of a prediction function, and the first text includes at least a placeholder; a prediction module, used to predict the placeholders in the first text using the target prediction mode to obtain a target prediction word; and a generation module, used to process the placeholders in the first text based on the target prediction word to generate a second text.

[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising: 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 text generation method proposed in the present disclosure.

[0007] According to another 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 text generation method proposed in the present disclosure.

[0008] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, and the computer program executes the text generation method proposed in the present disclosure when a processor executes the computer program.

[0009] In the above embodiment of the present disclosure, by responding to a touch instruction of the first control, determining the target prediction mode; responding to a touch instruction of the second control, obtaining the first text input by the user, predicting the placeholder in the first text using the target prediction mode, and obtaining the target prediction word; processing the placeholder in the first text based on the target prediction word to generate the second text. The technical effect of improving the typing accuracy and efficiency of the handwriting input method is achieved, thereby solving the technical problem of low typing accuracy and low efficiency of the handwriting input method.

[0010] 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

[0011] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0012] Figure 1 is a flow chart of a text generation method according to an embodiment of the present invention;

[0013] Figure 2 This is a display diagram of a page of a method for generating text according to an embodiment of the present invention;

[0014] Figure 3 It is a display diagram of a page of a method for generating text according to an optional embodiment of the present invention;

[0015] Figure 4 is a flow chart of a method for generating text according to an optional embodiment of the present invention;

[0016] Figure 5 is a structural diagram of a text generation device according to an embodiment of the present invention;

[0017] Figure 6 A schematic block diagram of an example electronic device 600 that may be used to implement embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0018] 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.

[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0020] When users who use handwriting input methods forget words, they can ask others for help, but others may not be present every time; they can change the way of expression, for example, change "put something 'on the door'" to "put something 'on the door'"; users may try to use pinyin input, but due to their limited pinyin level, they may not be able to enter subsequent syllables after entering the initial consonant, for example: "drink", after entering h, the user may keep searching, which takes a lot of time; they can change the communication method, for example, sending voice messages or communicating by phone, but this method is sometimes not applicable when users need to send text messages, and does not fundamentally meet the needs of users; they can use homophones instead, such as "pineapple cake - pineapple soy", but in some cases, homophones cannot accurately express the meaning, and some users are very concerned about typos and would rather not send than write typos.

[0021] According to an embodiment of the present disclosure, a method for generating text is provided. Figure 1is a flowchart of a method for generating text according to an embodiment of the present invention. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here. Figure 1 As shown, the method comprises the following steps:

[0022] Step S102, determining a target prediction method in response to a touch instruction to the first control.

[0023] The first control is used to sense a touch instruction and trigger the calling of at least one prediction method, and the target prediction method is used to indicate whether to provide a prediction word.

[0024] Specifically, the target prediction method may be the prediction method finally adopted. The touch instruction may be a touch instruction generated by a user performing a touch operation on the screen, and the first control may be a button set on the screen, including but not limited to a "forgotten word" control, an initial consonant control, and a replacement word control. At the same time, according to the control selected by the user on the screen, the prediction method corresponding to the selected control may be called for prediction.

[0025] In an optional embodiment, after the user clicks the first control, at least one prediction method may be called for the user to select, so that a target prediction method is determined from the at least one prediction method according to the user's selection.

[0026] Step S104, in response to a touch instruction to a second control, obtaining a first text input by a user, wherein the second control is used to sense the touch instruction and trigger a call prediction function, and the first text at least includes a placeholder.

[0027] Specifically, the second control may be a button set on the screen, which is used to trigger the prediction function. After the user clicks the second control, the placeholder in the first book can be predicted according to the prediction instruction generated by the second control.

[0028] In an alternative embodiment, Figure 2 As shown, the first control can be a button set on the screen, including but not limited to a "forgotten word" control, a "initial consonant" control, and a "near sound" control. The second control can be a "prediction control". When the user encounters a word that is difficult to write, the user can select one of the first controls and enter the parameters required for the prediction method corresponding to the control, and then click the second control to obtain the desired target predicted word.

[0029] Step S106: predict the placeholder in the first text using a target prediction method to obtain a target predicted word.

[0030] Specifically, the target detection method can be determined according to the user's touch designation. Using an existing model or NLP (Natural Language Processing) technology, based on the parameters provided by the user, or the parameters provided by the user and the input text, the placeholder is predicted to obtain multiple initial predicted words. Then, the user selects the required predicted word from the multiple initial predicted words, that is, the target predicted word.

[0031] Step S108, process the placeholder in the first text based on the target predicted word to generate a second text.

[0032] The above target predicted word can be one or more.

[0033] In an alternative embodiment, when the number of target predicted words is multiple, the multiple target predicted words can be sorted according to the confidence level of the target predicted words, and the placeholder in the first text is replaced with the target predicted word with the highest confidence level.

[0034] Furthermore, the obtained multiple target predicted words can be displayed, and the user selects the correct target predicted word from the multiple target predicted words, and the placeholder in the first text is replaced with the target predicted word.

[0035] In another alternative embodiment, after obtaining one or more target predicted words, the target predicted words can be displayed. If there is no word required by the user among the obtained one or more target predicted words, the first text input by the user can be predicted again until the target predicted word required by the user is predicted. It is also possible to combine the predicted target predicted word and the first text for prediction, thereby improving the prediction accuracy.

[0036] In yet another alternative embodiment, when the accuracy rate of the predicted target predicted word reaches the preset accuracy rate, the placeholder in the predicted first text can be replaced with the target predicted word to obtain the complete second text, so that the user can send the second text. For example: The first text is "Go to the Yellow 'placeholder' Building today", and the target predicted word is "Crane", and the obtained second text is "Go to the Yellow Crane Tower today".

[0037] In the above embodiment of the present disclosure, a target prediction method is determined in response to a touch instruction to a first control; in response to a touch instruction to a second control, a first text input by a user is obtained, and a placeholder in the first text is predicted using the target prediction method to obtain a target predicted word; and the placeholder in the first text is processed based on the target predicted word to generate a second text. It is easy to notice that the present disclosure uses placeholders to replace words that the user cannot write when the user inputs, and then predicts the placeholders in the user's first text to obtain the target predicted word. The user can complete the text input independently without asking others or changing the expression method, thereby achieving the technical effect of improving the typing accuracy and efficiency of the handwriting input method, thereby solving the technical problem of low typing accuracy and low efficiency of the handwriting input method.

[0038] Optionally, the first control includes at least: a first sub-control and a second sub-control, and in response to a touch instruction to the first control, a target prediction mode is obtained, including: in response to a touch instruction to the first sub-control, determining that the target prediction mode is a first prediction mode, wherein the first sub-control is used to sense the touch instruction and trigger a call to obtain target prediction parameters, and the first prediction mode is a method of predicting through target prediction parameters; in response to a touch instruction to the second sub-control, determining that the target prediction mode is a second prediction mode, wherein the second sub-control is used to sense the touch instruction and trigger a call to prohibit obtaining target prediction parameters, and the second prediction mode is a method of predicting without using target prediction parameters.

[0039] Specifically, the target prediction method includes a first prediction method and a second prediction method. The first sub-control may include but is not limited to an initial consonant control and a replacement word control, and the prediction method corresponding to the initial consonant control and the replacement word control is adopted, that is, the first prediction method. Among them, the first prediction method requires obtaining corresponding target prediction parameters. The second sub-control may include but is not limited to a "forgotten word" control. After triggering the "forgotten word" control, there is no need to obtain the target prediction parameters, and the placeholder in the text can be directly predicted through the first text to obtain the second text.

[0040] In the above optional embodiment, the target prediction method can be determined according to the first control selected by the user, so as to predict the placeholder and obtain the target prediction word required by the user, thereby achieving the technical effect of improving the accuracy and efficiency of handwriting input method typing.

[0041] Optionally, the first sub-control includes at least: an initial consonant control, the first prediction method includes at least: an initial consonant prediction method, the target prediction parameter includes at least: a first prediction parameter, and in response to a touch instruction to the first sub-control, the target prediction method is determined to be the first prediction method, including: in response to a touch instruction to the initial consonant control, the target prediction method is determined to be the initial consonant prediction method, wherein the initial consonant prediction method is a method of predicting through the first prediction parameter, wherein the first prediction parameter is the initial consonant corresponding to the target prediction word.

[0042] Specifically, the first prediction parameter may be the initial consonant of the target predicted word considered by the user. When the first touch instruction determines that the initial consonant control is a control, the target detection method is determined to be an initial consonant prediction method, and the user is required to input the initial consonant. The user can input the initial consonant by handwriting or by using an input method in a keyboard, and then the prediction is performed based on the context of the first text and the initial consonant input by the user to obtain the target predicted word.

[0043] It should be noted that when the user inputs for the first time, he can use a placeholder to replace the position of the target prediction word, and then enter the first prediction parameter to make a prediction based on the context and the first prediction parameter. He can also not use a placeholder and directly enter the first prediction parameter when inputting for the first time to make a prediction based on the first prediction parameter.

[0044] In the above optional embodiment, the target predicted word required by the user is obtained based on the initial consonant input by the user, thereby achieving the technical effect of improving the accuracy and efficiency of handwriting input method typing.

[0045] Optionally, the first sub-control includes at least: a replacement word control, the first prediction method also includes: a replacement word prediction method, the target prediction parameter includes at least: a second prediction parameter, and in response to a touch instruction to the first sub-control, determining that the target prediction method is the first prediction method, including: in response to a touch instruction to the replacement word control, determining that the target prediction method is the replacement word prediction method, wherein the replacement word prediction method is a method of predicting through the second prediction parameter, wherein the pronunciation similarity between the second prediction parameter and the target prediction word is greater than a preset similarity.

[0046] Specifically, the second prediction parameter may be a character or phrase that the user believes has the same pronunciation as or is similar to the target predicted word. When the first touch instruction is generated by the replacement word control, it can be determined that the target detection method is the replacement word prediction method, and the user is required to input a character or phrase that has the same pronunciation as or is similar to the target predicted word. At this time, the user can input the initial consonant by handwriting, and then predict based on the context of the first text and the second prediction parameter input by the user to obtain the target predicted word.

[0047] It should be noted that when the user makes the first input, they can use a placeholder to replace the position where the target prediction word is located. Then, after inputting the second prediction parameter, the target prediction word can be predicted based on the second prediction parameter. Alternatively, the user can directly input the second prediction parameter to predict the target prediction word without using a placeholder when making the first input.

[0048] In the above optional embodiment, based on the replacement word input by the user, the target prediction word required by the user can be obtained, thereby achieving the technical effect of improving the accuracy and efficiency of typing with a handwriting input method.

[0049] Optionally, using the target prediction method to predict the placeholder in the first text to obtain the target prediction word includes: predicting the placeholder based on the target prediction method and other text in the first text except the placeholder to obtain the target prediction word.

[0050] Specifically, the target prediction method can be to predict the placeholder based on other text in the first text input by the user except the placeholder to obtain the target prediction word. In an optional embodiment, as Figure 3 shown, when the user wants to input "I want to travel to Tibet", and cannot write the character "zang" (Tibet), they can first use a placeholder to replace "zang". In the figure, "x" represents the placeholder. After the user finishes inputting the text and clicks "Predict", then the target prediction word is predicted based on the context. After obtaining the target prediction word, the placeholder can be directly replaced with the target prediction word and displayed to the user.

[0051] In an optional embodiment, as Figure 4 shown, Step 1: The user makes a handwriting input. When encountering a character they don't know, they use a placeholder to replace it. After the user finishes the input and clicks "Predict", based on other text in the user input text, prediction can be performed using an existing model and word library, or using NLP technology (Natural Language Processing) to obtain multiple initial prediction words. The user can select the correct prediction word from them to generate the second text.

[0052] In the above optional embodiment, the user can directly predict the target prediction word based on the input text, thereby achieving the technical effect of improving the accuracy and efficiency of typing with a handwriting input method.

[0053] Optionally, using the target prediction method to predict the placeholder in the first text to obtain the target prediction word includes: using the target prediction method to predict the placeholder in the first text to obtain at least one initial prediction word; obtaining the confidence level of each initial prediction word among the at least one initial prediction word; sorting the confidence levels of each initial prediction word to obtain a first sorting result; and determining the target prediction word from the at least one initial prediction word based on the first sorting result.

[0054] Specifically, based on the prediction of other texts in the first text, multiple initial predicted words may be obtained. When multiple predicted words are obtained, the existing sorting model can be used to sort the initial predicted words according to the confidence of the initial predicted words to obtain a first sorting result, and the result is displayed to the user. The user can determine the target predicted word from the first sorting result.

[0055] Furthermore, the predicted word ranked higher in the first ranking result may be used as the target predicted word, so as to improve the accuracy of the target predicted word.

[0056] In the above optional embodiment, the confidence level based on the initial predicted word is used to sort multiple prediction results using a sorting model, and the target predicted word is determined from the sorted results, thereby improving the accuracy of handwriting input method typing.

[0057] Optionally, predicting the placeholders in the first text using a target prediction method to obtain a target predicted word includes: predicting the placeholders in the first text using a target prediction method to obtain at least one initial predicted word; obtaining the occurrence frequency of each initial predicted word in the at least one initial predicted word; sorting the occurrence frequency of each initial predicted word to obtain a second sorting result; and determining the target predicted word from the at least one initial predicted word based on the second sorting result.

[0058] Specifically, based on predictions made on other texts in the first text, multiple initial predicted words may be obtained. When multiple initial predicted words are obtained, the existing sorting model can be used to sort the initial predicted words based on the probabilities of the initial predicted words to obtain a second sorting result, and the result is displayed to the user, who determines the target predicted word from the second sorting result.

[0059] In the above optional embodiment, a plurality of prediction results may be sorted using a sorting model according to the probability of the initial prediction word, and a target prediction word may be determined from the sorted results, thereby improving the accuracy of handwriting input method typing.

[0060] According to an embodiment of the present disclosure, the present disclosure also provides a text generation device, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0061] According to an embodiment of the present disclosure, a text generation device is provided. Figure 5 is a structural diagram of a text generation device according to an embodiment of the present invention, such as Figure 5 As shown, the device comprises:

[0062] A determination module 50, configured to determine a target prediction mode in response to a touch instruction to a first control, wherein the first control is configured to sense the touch instruction and trigger the calling of at least one prediction mode, and the target prediction mode is configured to indicate whether to provide a prediction word;

[0063] an acquisition module 52, configured to acquire a first text input by a user in response to a touch instruction to a second control, wherein the second control is configured to sense the touch instruction and trigger a call prediction function, and the first text at least includes a placeholder;

[0064] A prediction module 54, configured to predict the placeholder in the first text using a target prediction method to obtain a target predicted word;

[0065] The generating module 56 is configured to process the placeholders in the first text based on the target predicted word to generate a second text.

[0066] In the above embodiment of the present disclosure, a target prediction method is determined in response to a touch instruction to a first control; in response to a touch instruction to a second control, a first text input by a user is obtained, and a placeholder in the first text is predicted using the target prediction method to obtain a target predicted word; and the placeholder in the first text is processed based on the target predicted word to generate a second text. It is easy to notice that the present disclosure uses placeholders to replace words that the user cannot write when the user inputs, and then predicts the placeholders in the user's first text to obtain the target predicted word. The user can complete the text input independently without asking others or changing the expression method, thereby achieving the technical effect of improving the typing accuracy and efficiency of the handwriting input method, thereby solving the technical problem of low typing accuracy and low efficiency of the handwriting input method.

[0067] Optionally, the first control includes at least: a first sub-control and a second sub-control, and the determination module includes a first determination unit and a second determination unit. The first determination unit is used to determine that the target prediction mode is a first prediction mode in response to a touch instruction to the first sub-control, wherein the first sub-control is used to sense the touch instruction and trigger a call to obtain target prediction parameters, and the first prediction mode is a mode of predicting through target prediction parameters. The second determination unit is used to determine that the target prediction mode is a second prediction mode in response to a touch instruction to the second sub-control, wherein the second sub-control is used to sense the touch instruction and trigger a call to prohibit obtaining target prediction parameters, and the second prediction mode is a mode of predicting without using target prediction parameters.

[0068] Optionally, the first sub-control includes at least: an initial consonant control, the first prediction method includes at least: an initial consonant prediction method, the target prediction parameter includes at least: a first prediction parameter, and the first determination unit is also used to respond to a touch instruction to the initial consonant control to determine that the target prediction method is an initial consonant prediction method, wherein the initial consonant prediction method is a method of predicting through the first prediction parameter, wherein the first prediction parameter is the initial consonant corresponding to the target prediction word.

[0069] Optionally, the first subcontrol includes at least a replacement word control, the first prediction method also includes a replacement word prediction method, and the target prediction parameter includes at least a second prediction parameter. The first determination unit is further configured to determine, in response to a touch instruction to the replacement word control, that the target prediction method is a replacement word prediction method, wherein the replacement word prediction method is a method of predicting using the second prediction parameter, and wherein the pronunciation similarity between the second prediction parameter and the target prediction word is greater than a preset similarity.

[0070] Optionally, the prediction module is further configured to predict the placeholder based on the target prediction mode and other texts in the first text except the placeholder to obtain a target predicted word.

[0071] Optionally, the prediction module is also used to predict the placeholder in the first text using a target prediction method to obtain at least one initial predicted word; obtain the confidence of each initial predicted word in the at least one initial predicted word; sort the confidence of each initial predicted word to obtain a first sorting result; and determine the target predicted word from the at least one initial predicted word based on the first sorting result.

[0072] Optionally, the prediction module is also used to predict the placeholder in the first text using a target prediction method to obtain at least one initial predicted word; obtain the occurrence frequency of each initial predicted word in the at least one initial predicted word; sort the occurrence frequency of each initial predicted word to obtain a second sorting result; and determine the target predicted word from the at least one initial predicted word based on the second sorting result.

[0073] 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.

[0074] Figure 6A schematic block diagram of an example electronic device 600 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 required herein.

[0075] like Figure 6 As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0076] A number of components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0077] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 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 601 performs the various methods and processes described above, such as the method for generating text. For example, in some embodiments, the method for generating text may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the method for generating text described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the method for generating text in any other appropriate manner (e.g., by means of firmware).

[0078] 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.

[0079] 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.

[0080] 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.

[0081] 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).

[0082] 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.

[0083] 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.

[0084] 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.

[0085] 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 text, comprising: In response to a touch instruction to a first control, determining a target prediction mode, wherein the first control is used to sense the touch instruction and trigger the invocation of at least one prediction mode, and the target prediction mode is used to indicate whether to provide a prediction word; In response to a touch instruction to a second control, obtaining a first text input by a user, wherein the second control is used to sense the touch instruction and trigger a call prediction function, and the first text includes at least a placeholder; Predicting the placeholder in the first text using the target prediction method to obtain a target predicted word; Processing the placeholder in the first text based on the target predicted word to generate a second text; The first control at least includes: a first sub-control and a second sub-control, and in response to a touch instruction to the first control, determining a target prediction mode includes: In response to a touch instruction to the first subcontrol, determining that the target prediction mode is a first prediction mode, wherein the first subcontrol is used to sense the touch instruction and trigger a call to obtain a target prediction parameter, and the first prediction mode is a mode of performing prediction using the target prediction parameter; In response to a touch instruction to the second sub-control, the target prediction mode is determined to be a second prediction mode, wherein the second sub-control is used to sense the touch instruction and trigger a call to prohibit obtaining the target prediction parameters, and the second prediction mode is a mode of predicting without using the target prediction parameters.

2. The method according to claim 1, wherein: The first subcontrol includes at least an initial consonant control, the first prediction mode includes at least an initial consonant prediction mode, the target prediction parameter includes at least a first prediction parameter, and in response to a touch instruction to the first subcontrol, determining that the target prediction mode is the first prediction mode includes: In response to a touch instruction on the initial consonant control, the target prediction method is determined to be an initial consonant prediction method, wherein the initial consonant prediction method is a method of predicting through the first prediction parameter, wherein the first prediction parameter is the initial consonant corresponding to the target predicted word.

3. The method according to claim 2, wherein: The first subcontrol at least includes: a replacement word control, the first prediction mode further includes: a replacement word prediction mode, the target prediction parameter at least includes: a second prediction parameter, and in response to a touch instruction to the first subcontrol, determining that the target prediction mode is the first prediction mode includes: In response to a touch instruction on the replacement word control, the target prediction method is determined to be a replacement word prediction method, wherein the replacement word prediction method is a method of predicting through the second prediction parameter, wherein the pronunciation similarity between the second prediction parameter and the target prediction word is greater than a preset similarity.

4. The method according to claim 1, wherein: Predicting the placeholder in the first text by using the target prediction method to obtain a target predicted word includes: The placeholder is predicted based on the target prediction mode and other texts in the first text except the placeholder to obtain the target predicted word.

5. The method according to claim 1, wherein: Predicting the placeholder in the first text by using the target prediction method to obtain a target predicted word includes: Predicting the placeholders in the first text using the target prediction method to obtain at least one initial predicted word; Obtaining a confidence score of each initial prediction word in the at least one initial prediction word; Sorting the confidence of each of the initial predicted words to obtain a first sorting result; A target predicted word is determined from the at least one initial predicted word based on the first ranking result.

6. The method according to claim 5, wherein: Predicting the placeholder in the first text by using the target prediction method to obtain a target predicted word includes: Predicting the placeholder in the first text by using the target prediction method to obtain the at least one initial predicted word; Obtaining the occurrence frequency of each initial prediction word in the at least one initial prediction word; Sorting the occurrence frequency of each of the initial predicted words to obtain a second sorting result; A target predicted word is determined from the at least one initial predicted word based on the second ranking result.

7. A text generation device, comprising: a determination module, configured to determine a target prediction mode in response to a touch instruction to a first control, wherein the first control is configured to sense the touch instruction and trigger the calling of at least one prediction mode, the target prediction mode is configured to indicate whether to provide a prediction word, and the first control at least includes: a first sub-control and a second sub-control; an acquisition module, configured to acquire a first text input by a user in response to a touch instruction to a second control, wherein the second control is configured to sense the touch instruction and trigger a call prediction function, and the first text at least includes a placeholder; A prediction module, configured to predict the placeholder in the first text by using the target prediction method to obtain a target predicted word; A generating module, configured to process the placeholder in the first text based on the target predicted word to generate a second text; Among them, the determination module is also used to determine that the target prediction mode is a first prediction mode in response to a touch instruction to the first sub-control, wherein the first sub-control is used to sense the touch instruction and trigger a call to obtain the target prediction parameters, and the first prediction mode is a method of predicting through the target prediction parameters; and is used to determine that the target prediction mode is a second prediction mode in response to a touch instruction to the second sub-control, wherein the second sub-control is used to sense the touch instruction and trigger a call to prohibit obtaining the target prediction parameters, and the second prediction mode is a method of predicting without using the target prediction parameters.

8. 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 6.

9. 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-6.

10. 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 6.

Citation Information

Patent Citations

  • A method and apparatus for input prediction

    CN109002186A

  • Missing character / word completion method and electronic equipment

    CN112580310A