Text conversion method, device and equipment and computer storage medium
By identifying and adjusting the language type rules of handwritten input text, the problem of space space insertion errors in the mixed input of Chinese and English in the prior art is solved, and the format self-correction of electronic text is realized, and the user experience is improved.
Patent Information
- Application Number
- CN202411840426.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-11
AI Technical Summary
When the existing handwriting recognition system processes mixed inputs in Chinese and English, it cannot correctly insert spaces, resulting in errors in conjunction or word spacing, affecting the accuracy of input and user experience.
By obtaining handwritten input text, converting it into electronic input text, and identifying its language type, adjusting the output of electronic input text according to the rules of the language type, including determining the interval rules between words and/or characters, and adding or correcting the intervals according to these rules.
Based on the conversion of handwritten text into electronic text, the format adjustment is made according to the language type of the input text, so that the final output electronic text meets the user's expected format, and improves the user's user experience.
Smart Images

Figure CN119810853A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of handwriting recognition, and in particular to a text conversion method, a text conversion apparatus, a text conversion device and a computer storage medium. Background Art
[0002] In the existing handwriting recognition system, the input language may be a single language or a mixed input of multiple languages. When the user performs handwriting input, the system converts the handwritten text into electronic text after the pen is lifted.
[0003] However, due to different rules for spaces and character spacing in different languages, especially in mixed Chinese and English input scenarios, the system often fails to insert spaces correctly, resulting in incorrect conjunctions or word spacing. This not only affects input accuracy, but also reduces the user experience. Summary of the invention
[0004] In order to solve the above technical problems, the present application proposes a text conversion method, a text conversion device, a text conversion equipment and a computer storage medium.
[0005] In order to solve the above technical problems, the present application proposes a text conversion method, which includes:
[0006] Get handwriting input text;
[0007] Converting the handwritten input text into electronic input text;
[0008] identifying a language type of the electronic input text;
[0009] The output of the electronic input text is adjusted according to the language rule corresponding to the language type to display the electronic output text.
[0010] The step of adjusting the output of the electronic input text according to the language rule corresponding to the language type to display the electronic output text includes:
[0011] Determining spacing rules between words and / or characters according to the language type;
[0012] Adding spacing to adjacent words and / or adjacent characters of the electronic input text according to the spacing rule.
[0013] wherein the interval includes a conjunction interval;
[0014] Adding spacing to adjacent words and / or adjacent characters of the electronic input text according to the spacing rule comprises:
[0015] Acquire context information of each word or each character according to the spacing rule;
[0016] The conjunction intervals between adjacent words and / or adjacent characters are determined based on the context information.
[0017] The step of obtaining the handwritten input text includes:
[0018] Acquire handwriting trajectory information when inputting the handwriting input text;
[0019] Acquire the user's handwriting pen-lifting time interval based on the handwriting trajectory information;
[0020] Different words and / or different phrases in the handwriting input text are divided according to the handwriting pen lift time interval.
[0021] The step of obtaining the handwritten input text includes:
[0022] In response to the handwriting pen-lifting time interval being greater than a preset time threshold, adding a spacing symbol based on the language type.
[0023] After obtaining the handwritten input text, the text conversion method further includes:
[0024] In response to a line break instruction from the user, a line break space format is determined according to a grammar rule corresponding to the language type.
[0025] Wherein, determining the line break space format according to the grammatical rules corresponding to the language type includes:
[0026] In response to the language type of the electronic input text being a mixed language, a line break space format is determined according to a switching position of the mixed language and a grammatical rule corresponding to the mixed language.
[0027] To solve the above technical problems, the present application also proposes a text conversion device, which includes: an input module, a conversion module, a recognition module, and an adjustment module;
[0028] in,
[0029] The input module is used to obtain handwritten input text;
[0030] The conversion module is used to convert the handwritten input text into electronic input text;
[0031] The recognition module is used to recognize the language type of the electronic input text;
[0032] The adjustment module is used to adjust the electronic
[0033] The output of the sub-input text is adjusted to display the electronic output text.
[0034] In order to solve the above technical problems, the present application also proposes a text conversion device, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the text conversion method as described above.
[0035] In order to solve the above technical problems, the present application also proposes a computer storage medium, which is used to store program data. When the program data is executed by a computer, it is used to implement the above text conversion method.
[0036] Compared with the prior art, the beneficial effects of the present application are: the text conversion device obtains handwritten input text; converts the handwritten input text into electronic input text; identifies the language type of the electronic input text; and adjusts the output of the electronic input text according to the language rules corresponding to the language type to display the electronic output text. Through the above-mentioned text conversion method, on the basis of realizing the conversion of handwritten text into electronic text, the format of the electronic text is further adjusted according to the language type of the input text, so that the final output electronic text meets the user's expected format, thereby improving the user's experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0038] in:
[0039] Figure 1 It is a schematic diagram of an embodiment of a display interface of a text conversion method provided by the present application;
[0040] Figure 2 It is a flowchart of an embodiment of a text conversion method provided by the present application;
[0041] Figure 3 It is a schematic diagram of the overall process of the text conversion method provided by this application;
[0042] Figure 4 is a structural schematic diagram of an embodiment of a text conversion device provided by the present application;
[0043] Figure 5 is a structural schematic diagram of an embodiment of a text conversion device provided by the present application;
[0044] Figure 6 It is a structural diagram of an embodiment of a computer storage medium provided by the present application. DETAILED DESCRIPTION
[0045] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application 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 application described herein can, for example, be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations 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.
[0047] During global handwriting, users can write freely in an area, but line breaks may occur. Figure 1 In the text input diagram shown, when the user enters [Today's weather is very good] in Chinese in the free handwriting area, it is a complete sentence. Although there is a line break between [weather] and [very good], in the generated text, the user's expectation is [Today's weather is very good] rather than [Today's weather is very good].
[0048] When the user inputs English in the free handwriting area, there is a line break between [the weather] and [isnice today] during the English handwriting process. However, in the generated text, the user's expectation is [the weather is nicetoday], not [the weatheris nice today], so a grammatical error will occur.
[0049] Therefore, in the above two cases, Chinese line breaks do not require spaces, while English line breaks require spaces. The same problem exists in other languages.
[0050] In order to solve the above problems, this application provides a text conversion method to achieve self-correction of text format in various languages under global free writing. Figure 2 and Figure 3 , Figure 2 is a flowchart of an embodiment of a text conversion method provided by the present application, Figure 3 It is a schematic diagram of the overall flow of the text conversion method provided by this application.
[0051] Specifically, during handwriting input, due to different languages, the spaces between words and letters may be handled inconsistently, and the text conversion device needs to intelligently determine whether to insert spaces. This includes the following two aspects:
[0052] Time interval judgment: This module detects the time when the user lifts the pen during handwriting input. If the time interval between lifting the pen exceeds the preset threshold, the text conversion device will determine that this is the end of a word or a language switch, and the system will automatically add a comma of the corresponding language.
[0053] Language rule-driven spacing correction: Based on the characteristics of different languages, the text conversion device will automatically determine whether it is necessary to correct the spacing between words. For example, in the Chinese input process, there is usually no need for spaces between characters, while in English input, there must be spaces between words. For mixed input, when a language switch is detected, such as switching from Chinese to English or vice versa, the text conversion device will automatically determine and insert spaces according to the language rules, and ensure that the continuity of the sentence is not interrupted.
[0054] The text conversion method of the present application is applied to a text conversion device, wherein the text conversion device of the present application can be a server, a terminal device, or a system in which a server and a terminal device cooperate with each other. Accordingly, the various parts included in the text conversion device, such as various units, subunits, modules, and submodules, can all be set in the server, can all be set in the terminal device, or can be set in the server and the terminal device respectively.
[0055] Furthermore, the above-mentioned server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules, such as software or software modules used to provide distributed servers, or it can be implemented as a single software or software module, which is not specifically limited here.
[0056] like Figure 2 As shown, the specific steps are as follows:
[0057] Step S11: Obtain handwritten input text.
[0058] In the embodiment of the present application, the user inputs the following information through a handwriting tablet or other handwriting input device: Figure 1 The text conversion device converts the handwritten content in the free handwriting area into Figure 1 During the process of transferring the electronic output text of the text area, it is necessary to make certain adjustments or corrections to the text format of the electronic text according to the language type of the handwritten content.
[0059] Specifically, Figure 3 As shown, the text conversion device collects the user's handwriting trajectory in real time, that is, records each stroke of the user's handwriting in real time, including but not limited to: the trajectory of starting the pen, moving the pen and lifting the pen.
[0060] Furthermore, the text conversion device analyzes the handwritten content of the user, that is, uses a language model to identify the language type of the current input text, including but not limited to: Chinese, English, other languages, etc.
[0061] Among them, the text conversion device can divide the language detection and recognition tasks of the speech model into the following according to the number of speech types involved in the handwritten input text input in the same time period:
[0062] Single language detection: If all handwritten characters belong to the same language, keep the current language setting unchanged.
[0063] Multi-language detection: If language switching is detected (such as Chinese to English), the system automatically switches to the corresponding language mode.
[0064] Furthermore, the text conversion device can also divide the words or phrases in the handwriting input text during the process of obtaining the handwriting input text. Specifically, the text conversion device obtains multiple handwriting pen-lifting time intervals of the user according to the pen-lifting time in the above-mentioned real-time recorded handwriting trajectory information.
[0065] In the handwriting habit of humans, when writing the next word or phrase, they will lift the pen to avoid misreading caused by connected strokes. Therefore, the text conversion device can determine whether adjacent input texts are different words and / or phrases according to the time interval between the user's handwriting and lifting the pen.
[0066] Specifically, the text conversion device detects the time interval between pen lifts: if the time interval between pen lifts is less than a preset threshold, the text conversion device considers that the user is still inputting the same word or phrase. If the time interval between pen lifts is greater than the preset threshold, the text conversion device determines that the user may have completed inputting a word or phrase and is preparing to input the next word.
[0067] Step S12: Convert the handwritten input text into electronic input text.
[0068] In an embodiment of the present application, the text conversion device can realize the conversion of handwritten input text to electronic input text based on the combination of computer vision and natural language processing, and the algorithm scheme used includes but is not limited to: using OCR (Optical Character Recognition) software, using deep learning models, using OCR technology, etc.
[0069] Step S13: Identify the language type of the electronic input text.
[0070] In the embodiment of the present application, as described in step S11, the text conversion device may input the electronic input text into a language model to obtain the language type of the electronic input text.
[0071] Step S14: adjusting the output of the electronic input text according to the language rules corresponding to the language type to display the electronic output text.
[0072] In the embodiments of the present application, Figure 3 As shown, the text conversion device can determine the spacing correction according to the language rules.
[0073] Specifically, when the current language mode is the Chinese mode, the text conversion device processes the spacing between characters according to Chinese rules. For Chinese, it is usually not necessary to add spaces or spacing.
[0074] It should be noted that the relevant technical content on how to distinguish different characters, words, and phrases has been explained in detail in step S11 and will not be repeated here.
[0075] When the current language mode is English mode, the text conversion device processes the spacing between words according to English rules. Spaces need to be added between each word, and when connecting words, it is necessary to determine whether additional symbols are needed based on the context, including but not limited to apostrophes in abbreviations.
[0076] When the current language mode is another language mode, the text conversion device performs spacing processing on words or characters according to the rules of the specific language to ensure compliance with the standard writing format of the language.
[0077] Among them, the language rules of different language modes are not listed here one by one.
[0078] Furthermore, the text conversion device can also execute line break processing logic according to language rules.
[0079] Specifically, when the text conversion device detects that the user is wrapping a line, that is, obtains a line wrap instruction, the text conversion device can also automatically determine whether the line wrap behavior requires a space.
[0080] When the current language mode is the Chinese mode, the text conversion device determines the Chinese line break, and usually does not need to add a space at the line break.
[0081] When the current language mode is the English mode, the text conversion device determines the English line break, and the text conversion device automatically adds a space at the line break to ensure grammatical correctness.
[0082] When the current language mode is a mixed language mode, the text conversion device determines the language of the closest character, word or phrase when the line break instruction is input, and determines whether the line break behavior requires a space according to the closest language mode. When the current sentence of the line break instruction input by the user is in Chinese, the text conversion device does not need to add a space at the line break.
[0083] The text conversion device determines whether to add spaces according to the language switching to ensure that the sentence still complies with grammatical rules after the line break.
[0084] Finally, if Figure 3 As shown, the text conversion device adjusts the electronic input text according to all the rules to generate a final electronic text that complies with the grammar and language format.
[0085] In the present application, a text conversion device obtains handwritten input text; converts the handwritten input text into electronic input text; identifies the language type of the electronic input text; and adjusts the output of the electronic input text according to the language rules corresponding to the language type to display the electronic output text. Through the above-mentioned text conversion method, on the basis of realizing the conversion of handwritten text into electronic text, the format of the electronic text is further adjusted according to the language type of the input text, so that the final output electronic text meets the user's expected format, thereby improving the user's experience.
[0086] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0087] In order to implement the above text conversion method, this application also proposes a text conversion device, please refer to Figure 4 , Figure 4 It is a structural diagram of an embodiment of a text conversion device provided by the present application.
[0088] The text conversion device 500 of this embodiment includes: an input module 51 , a conversion module 52 , a recognition module 53 , and an adjustment module 54 .
[0089] The input module 51 is used to obtain handwritten input text.
[0090] The conversion module 52 is used to convert the handwritten input text into electronic input text.
[0091] The recognition module 53 is used to recognize the language type of the electronic input text.
[0092] The adjustment module 54 is used to adjust the output of the electronic input text according to the language rule corresponding to the language type to display the electronic output text.
[0093] In order to implement the above text conversion method, this application also proposes a text conversion device, please refer to Figure 5 , Figure 5 It is a structural diagram of an embodiment of a text conversion device provided by the present application.
[0094] The text conversion device 400 of this embodiment includes a processor 41 , a memory 42 , an input / output device 43 , and a bus 44 .
[0095] The processor 41 , the memory 42 , and the input / output device 43 are respectively connected to the bus 44 . The memory 42 stores program data, and the processor 41 is used to execute the program data to implement the text conversion method described in the above embodiment.
[0096] In the embodiment of the present application, the processor 41 may also be referred to as a CPU (Central Processing Unit). The processor 41 may be an integrated circuit chip having the ability to process signals. The processor 41 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or the processor 41 may also be any conventional processor, etc.
[0097] This application also provides a computer storage medium, please continue to refer to Figure 6 , Figure 6 It is a schematic diagram of the structure of an embodiment of a computer storage medium provided in the present application. The computer storage medium 600 stores a computer program 61. When the computer program 61 is executed by a processor, it is used to implement the text conversion method of the above embodiment.
[0098] When the embodiments of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.
[0099] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A text conversion method, characterized in that: The text conversion method comprises: Get handwriting input text; Converting the handwritten input text into electronic input text; identifying a language type of the electronic input text; The output of the electronic input text is adjusted according to the language rule corresponding to the language type to display the electronic output text.
2. The text conversion method according to claim 1, characterized in that: The step of adjusting the output of the electronic input text according to the language rule corresponding to the language type to display the electronic output text includes: Determining spacing rules between words and / or characters according to the language type; Adding spacing to adjacent words and / or adjacent characters of the electronic input text according to the spacing rule.
3. The text conversion method according to claim 2, characterized in that: The intervals include conjunction intervals; Adding spacing to adjacent words and / or adjacent characters of the electronic input text according to the spacing rule comprises: Acquire context information of each word or each character according to the spacing rule; The conjunction intervals between adjacent words and / or adjacent characters are determined based on the context information.
4. The text conversion method according to claim 1, characterized in that: The step of obtaining the handwritten input text includes: Acquire handwriting trajectory information when inputting the handwriting input text; Acquire the user's handwriting pen-lifting time interval based on the handwriting trajectory information; Different words and / or different phrases in the handwriting input text are divided according to the handwriting pen lift time interval.
5. The text conversion method according to claim 4, characterized in that: The step of obtaining the handwritten input text includes: In response to the handwriting pen-lifting time interval being greater than a preset time threshold, adding a spacing symbol based on the language type.
6. The text conversion method according to claim 1, characterized in that: After obtaining the handwritten input text, the text conversion method further includes: In response to a line break instruction from the user, a line break space format is determined according to a grammar rule corresponding to the language type.
7. The text conversion method according to claim 6, characterized in that: The determining of the line break space format according to the grammatical rules corresponding to the language type includes: In response to the language type of the electronic input text being a mixed language, a line break space format is determined according to a switching position of the mixed language and a grammatical rule corresponding to the mixed language.
8. A text conversion device, characterized in that: The text conversion device comprises: an input module, a conversion module, a recognition module, and an adjustment module; wherein: The input module is used to obtain handwritten input text; The conversion module is used to convert the handwritten input text into electronic input text; The recognition module is used to recognize the language type of the electronic input text; The adjustment module is used to adjust the output of the electronic input text according to the language rule corresponding to the language type to display the electronic output text.
9. A text conversion device, characterized in that: The text conversion device includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the text conversion method according to any one of claims 1 to 7.
10. A computer storage medium, characterized in that: The computer storage medium is used to store program data, and when the program data is executed by a computer, it is used to implement the text conversion method according to any one of claims 1 to 7.