Text input method, apparatus, device, storage medium and product

CN122777028APending Publication Date: 2026-09-18BEIJING QIHOOD TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610922855.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-24
Publication Date
2026-09-18

AI Technical Summary

Technical Problem

然而,这类方案的格式化能力局限于单个应用内部,不同应用采用的格式化规则彼此独立,用户在不同应用间切换时需要适应各自不同的格式要求,例如,用户在应用A中习惯了一种日期格式,切换到应用B时却需要手动输入另一种格式,导致输入效率降低且出错率升高

Benefits of technology

本申请提供的文本输入方案,通过响应于文本输入操作,确定该操作对应的文本输入控件内的增量文本区域,精确锁定了用户本次输入所涉及的文本范围。进而获取增量文本区域内的原始文本以及文本输入控件的属性信息,为后续的格式化处理同时提供了输入内容本身和输入控件格式上下文两方面的依据。在此基础上,结合原始文本和属性信息自动确定与当前输入场景相匹配的文本格式化方案,并据此对原始文本执行格式化处理得到目标文本。无需用户手动选择或预设格式化规则,减少了用户调整格式的操作步骤。最后,将增量文本区域内的原始文本替换为目标文本,在实现格式化的同时保留了控件内其他已有的文本内容,避免了对控件内其他已有文本造成干扰。该方案能够实现在用户输入过程中自动对输入内容进行格式化处理,有效避免了因格式不符导致的反复修改和数据校验失败,提高了文本输入的效率和准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122777028A_ABST
    Figure CN122777028A_ABST
Patent Text Reader

Abstract

The application discloses a text input method, device, equipment, storage medium and product, and relates to the computer technical field, and discloses that in response to a text input operation, an incremental text region in a text input control corresponding to the text input operation is determined;Original text in the incremental text region and attribute information of the text input control are obtained;Based on the original text and the attribute information, a text formatting scheme is determined;Based on the text formatting scheme, the original text is formatted to obtain target text;The original text in the incremental text region is replaced by the target text.The method can intelligently format the input text, improve the text input efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a text input method, apparatus, device, storage medium, and product. Background Technology

[0002] In fields such as enterprise management, financial offices, medical records, and government services, business personnel need to input large amounts of structured data daily into various applications according to strict format specifications, such as dates and times, monetary amounts, phone numbers, and serial numbers. Different applications often have different format requirements for the same type of data. If the input format is incorrect, it may result in data validation failures requiring repeated modifications, or even cause parsing errors in downstream systems or business interruptions.

[0003] Currently, some applications implement formatting logic within the application itself using custom tools, such as date pickers replacing manual input and automatically adding thousands separators to amount input fields. However, the formatting capabilities of these solutions are limited to a single application. Different applications use independent formatting rules, requiring users to adapt to different formatting requirements when switching between applications. For example, a user accustomed to a certain date format in application A may need to manually input a different format when switching to application B, leading to reduced input efficiency and increased error rates. Therefore, there is an urgent need to provide a method to solve this problem.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main objective of this application is to provide a text input method, apparatus, device, storage medium, and product that can intelligently format input text to improve text input efficiency and accuracy.

[0006] To achieve the above objectives, this application proposes a text input method, the method comprising: In response to a text input operation, determine the incremental text area within the text input control corresponding to the text input operation; Obtain the original text within the incremental text area, as well as the attribute information of the text input control; Based on the original text and the attribute information, a text formatting scheme is determined; Based on the aforementioned text formatting scheme, the original text is formatted to obtain the target text; Replace the original text in the incremental text area with the target text.

[0007] Optionally, determining the text formatting scheme based on the original text and the attribute information includes: The original text is semantically classified to obtain its semantic type; Based on the attribute information, intent inference is performed to obtain the target format description of the original text; The text formatting scheme is determined based on the semantic type and the target format description.

[0008] Optionally, determining the text formatting scheme based on the semantic type and the target format description includes: Based on the semantic type and the target format description, the corresponding formatting rule is matched in the formatting rule template library; If a match is successful and the confidence score of the match result is higher than a preset threshold, the matched formatting rule will be determined as the text formatting scheme. Otherwise, the text formatting scheme is generated based on the semantic type and the target format description using a large language model.

[0009] Optionally, matching the corresponding formatting rule in the formatting rule template library based on the semantic type and the target format description includes: Using the semantic type as the first search condition, a coarse screening is performed in the formatting rule template library to obtain coarsely screened formatting rules; Using the keywords in the target format description as the second search criteria, the candidate formatting rules are matched in the coarse-screening formatting rules to obtain the candidate formatting rules. Based on the application identifier in the attribute information and the application identifier associated with each of the candidate formatting rules, a matching formatting rule is determined from the candidate formatting rules.

[0010] Optionally, generating the text formatting scheme based on the semantic type and the target format description using a large language model includes: Obtain a formatted example that matches the semantic type and the target format description, the formatted example including the sample text before formatting and the target text after formatting; Based on the original text, the semantic type, the target format description, and the formatting example, construct model prompt words; The text formatting scheme is generated based on the model prompts using the large language model.

[0011] Optionally, the step of semantically classifying the original text to obtain its semantic type includes: Using a semantic classification model, the semantic type of the original text is selected from candidate semantic types based on the original text and the attribute information; The semantic types include at least one of the following: date and time, amount / currency, percentage, number sequence, telephone number, ID number, address, postal code, email address, Uniform Resource Locator, unit of measurement, and custom type.

[0012] Optionally, the step of inferring intent based on the attribute information to obtain the target format description of the original text includes: Parse the application identifier, control tooltip text, input type constraints, and associated label text in the attribute information; Obtain application format preferences based on the application identifier; Based on the control prompt text, the input type constraints, the associated label text, and the application format preferences, multi-dimensional intent inference is performed to obtain the target format description of the original text.

[0013] Optionally, determining the incremental text area within the text input control corresponding to the text input operation in response to the text input operation includes: In response to the text input operation, the text input control obtains a first text content before the text input operation occurs, and a second text content after the text input operation is completed; The first text content and the second text content are compared character by character to determine the character range in which the second text content has changed relative to the first text content; The character range is defined as the incremental text region.

[0014] Optionally, the attribute information of the text input control includes: The text input control's own control properties and the context properties of the page where the text input control is located; The control attributes include at least one of the following: control tooltip text, input type identifier, input type constraint, control package name, and control class name; the context attributes include at least one of the following: associated label text and application identifier.

[0015] Optionally, determining the incremental text area within the text input control corresponding to the text input operation in response to the text input operation includes: By utilizing the system-level auxiliary services of the operating system, text input operations of any application running on the terminal can be monitored. In response to the detected text input operation, an incremental text area within the text input control corresponding to the text input operation is determined.

[0016] Optionally, the step of formatting the original text based on the text formatting scheme to obtain the target text includes: Based on the aforementioned text formatting scheme, the original text is formatted and converted to obtain formatted text; The formatted text is matched and validated against the validation rules corresponding to the text formatting scheme. The formatted text that passes the verification is identified as the target text.

[0017] Optionally, replacing the original text within the incremental text region with the target text includes: If the text setting interface of the system-level auxiliary service is available, the original text in the incremental text area is replaced with the target text through the text setting interface; If the text settings interface is unavailable, the original text in the incremental text area is replaced with the target text via the clipboard.

[0018] Optionally, after replacing the original text in the incremental text region with the target text, the method further includes: Set the cursor at the end of the incremental text area in the text input control.

[0019] Optionally, after replacing the original text in the incremental text region with the target text, the method further includes: Record the undo information corresponding to this replacement operation, including the original text, the target text, and the replacement position; In response to a text undo operation, based on the undo information, the target text within the incremental text area is restored to the original text.

[0020] Optionally, after replacing the original text in the incremental text region with the target text, the method further includes: Monitor feedback operations on the target text; Based on the feedback operation, the formatting rules in the formatting rule template library are updated.

[0021] Optionally, updating the formatting rules in the formatting rule template library based on the feedback operation includes: If the feedback operation is a text receiving operation, then increase the confidence score of the corresponding formatting rule; If the feedback operation is a text undo operation, then the confidence score of the corresponding formatting rule is reduced; If the feedback operation is a text correction operation, then the new formatting rules are extracted from the corrected text and added to the formatting rule template library.

[0022] Furthermore, to achieve the above objectives, this application also proposes a text input device, the device comprising: The region determination module is used to determine the incremental text region within the text input control corresponding to the text input operation in response to the text input operation. The information acquisition module is used to acquire the original text within the incremental text area and the attribute information of the text input control; The scheme determination module is used to determine a text formatting scheme based on the original text and the attribute information; The text processing module is used to format the original text based on the text formatting scheme to obtain the target text; The text replacement module is used to replace the original text in the incremental text area with the target text.

[0023] Optionally, the scheme determination module includes: A semantic classification unit is used to perform semantic classification on the original text to obtain the semantic type of the original text; An intent inference unit is used to infer intent based on the attribute information to obtain a target format description of the original text. The scheme determination unit is used to determine the text formatting scheme based on the semantic type and the target format description.

[0024] Optionally, the scheme determination unit includes: The rule matching subunit is used to match the corresponding formatting rule in the formatting rule template library based on the semantic type and the target format description. The scheme determines a sub-unit, which is used to determine the matched formatting rule as the text formatting scheme if the match is successful and the confidence score of the matching result is higher than a preset threshold; otherwise, the text formatting scheme is generated based on the semantic type and the target format description through a large language model.

[0025] Optionally, the rule matching subunit is used to perform coarse screening in the formatting rule template library with the semantic type as the first retrieval condition to obtain coarse screening formatting rules; to perform matching in the coarse screening formatting rules with the keywords in the target format description as the second retrieval condition to obtain candidate formatting rules; and to determine the matching formatting rule from the candidate formatting rules based on the application identifier in the attribute information and the application identifier associated with each of the candidate formatting rules.

[0026] Optionally, the scheme determines a sub-unit for obtaining a formatting example that matches the semantic type and the target format description, the formatting example including the sample text before formatting and the target text after formatting; constructing model prompt words based on the original text, the semantic type, the target format description and the formatting example; and generating the text formatting scheme based on the model prompt words through the large language model.

[0027] Optionally, the semantic classification unit is used to select the semantic type of the original text from candidate semantic types based on the original text and the attribute information through a semantic classification model; wherein the semantic type includes at least one of date and time, amount / currency, percentage, number sequence, telephone number, ID number, address, postal code, email address, Uniform Resource Locator, unit of measurement, and custom type.

[0028] Optionally, the intent inference unit is used to parse the application identifier, control prompt text, input type constraint, and associated label text in the attribute information; obtain the application format preference based on the application identifier; and perform multi-dimensional intent inference based on the control prompt text, the input type constraint, the associated label text, and the application format preference to obtain the target format description of the original text.

[0029] Optionally, the region determination module is configured to, in response to the text input operation, acquire the first text content of the text input control before the text input operation occurs, and the second text content after the text input operation is completed; perform character comparison between the first text content and the second text content to determine the character range in which the second text content changes relative to the first text content; and determine the character range as the incremental text region.

[0030] Optionally, the attribute information of the text input control includes: The text input control's own control properties and the context properties of the page where the text input control is located; The control attributes include at least one of the following: control tooltip text, input type identifier, input type constraint, control package name, and control class name; the context attributes include at least one of the following: associated label text and application identifier.

[0031] Optionally, the region determination module is used to monitor text input operations of any application running on the terminal through system-level auxiliary services of the operating system; and in response to the monitored text input operations, determine the incremental text region within the text input control corresponding to the text input operations.

[0032] Optionally, the text processing module is configured to perform format conversion on the original text based on the text formatting scheme to obtain formatted text; match and verify the formatted text with the verification rules corresponding to the text formatting scheme; and determine the formatted text that passes the verification as the target text.

[0033] Optionally, the text replacement module is configured to replace the original text in the incremental text area with the target text through the text setting interface if the system-level auxiliary service text setting interface is available; and replace the original text in the incremental text area with the target text through the clipboard if the text setting interface is unavailable.

[0034] Optionally, the text replacement module is further configured to set the cursor at the end position of the incremental text area in the text input control.

[0035] Optionally, the text replacement module is further configured to record the undo information corresponding to this replacement operation, the undo information including the original text, the target text, and the replacement position; in response to the text undo operation, based on the undo information, the target text in the incremental text area is restored to the original text.

[0036] Optionally, the device further includes: The rule update module is used to monitor feedback operations on the target text; based on the feedback operations, it updates the formatting rules in the formatting rule template library.

[0037] Optionally, the rule update module is configured to: if the feedback operation is a text accept operation, increase the confidence score of the corresponding formatting rule; if the feedback operation is a text undo operation, decrease the confidence score of the corresponding formatting rule; and if the feedback operation is a text correction operation, extract new formatting rules from the corrected text and add them to the formatting rule template library.

[0038] In addition, to achieve the above objectives, this application also proposes a text input device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the text input method as described above.

[0039] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and which, when executed by a processor, implements the steps of the text input method described above.

[0040] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the text input method described above.

[0041] One or more technical solutions proposed in this application have at least the following technical effects: The text input solution provided in this application, by responding to a text input operation, determines the incremental text area within the corresponding text input control, precisely locking the range of text involved in the user's current input. It then obtains the original text within the incremental text area and the attribute information of the text input control, providing both the input content itself and the formatting context of the input control for subsequent formatting processing. Based on this, it automatically determines a text formatting scheme matching the current input scenario by combining the original text and attribute information, and performs formatting processing on the original text accordingly to obtain the target text. This eliminates the need for users to manually select or preset formatting rules, reducing the number of steps required for formatting adjustments. Finally, the original text within the incremental text area is replaced with the target text, preserving other existing text content within the control while achieving formatting, thus avoiding interference with other existing text within the control. This solution enables automatic formatting of input content during user input, effectively avoiding repeated modifications and data validation failures due to formatting inconsistencies, and improving the efficiency and accuracy of text input. Attached Figure Description

[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0043] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a schematic diagram of an implementation environment for the text input method of this application; Figure 2 This is a flowchart illustrating the first embodiment of the text input method of this application; Figure 3 This is a detailed explanation of step S30 in the second embodiment of the text input method of this application; Figure 4 This is a detailed explanation of step S303 in the third embodiment of the text input method of this application; Figure 5This is a detailed explanation of step S10 in the fourth embodiment of the text input method of this application. Figure 6 This is a detailed explanation of step S50 in the fifth embodiment of the text input method of this application; Figure 7 A schematic diagram of a text formatting process provided for this application; Figure 8 This is a schematic diagram of the module structure of the text input device according to an embodiment of this application; Figure 9 This is a schematic diagram of the device structure of the hardware operating environment involved in the text input method in the embodiments of this application.

[0045] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0046] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0047] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0048] Figure 1 This is a schematic diagram illustrating an implementation environment provided by an embodiment of this disclosure. See also... Figure 1 The implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 are connected via a wireless or wired network. For example, the terminal 101 is installed with a target application provided by the server 102, and the terminal 101 can perform functions such as data transmission and message interaction through the target application.

[0049] Terminal 101 can be an electronic device with text input and application running capabilities, such as a smartphone, tablet, desktop computer, or laptop. Terminal 101 has various applications installed, including built-in system applications, third-party office applications, and business system applications with text input functions. Server 102 is a cloud service device, which can consist of a standalone server, a server cluster, or a cloud server, primarily providing backend support services for Terminal 101.

[0050] In this implementation environment, terminal 101 mainly performs core local operations such as global text input monitoring, incremental text region positioning, control attribute collection, edge semantic classification, intent inference, rule engine matching, text formatting, incremental replacement, cursor restoration, and user behavior feedback collection; server 102 is mainly responsible for sending the latest formatting rules to terminal 101, maintaining the global formatting rule template library, and providing remote configuration and model update services for the terminal.

[0051] This solution supports two operating modes: Pure terminal offline mode: The entire text input formatting process can be completed independently by terminal 101. All AI (Artificial Intelligence) inference, rule matching, and text processing logic run locally on the terminal without relying on server 102. It can also be used normally in a network-off environment. Terminal and server collaboration mode: Terminal 101 completes real-time text processing at the front end, while interacting with server 102 to realize extended functions such as cloud hot update of formatting rules, synchronization of user behavior data, and iterative upgrade of AI models.

[0052] Furthermore, this solution can be directly driven by the terminal operating system layer, or it can be implemented in conjunction with the target application installed in the terminal 101. This application does not limit the specific implementation form.

[0053] The intelligent text input formatting method provided in this application has a wide range of applications and can be used in various scenarios that require batch input of structured text. Examples include data entry scenarios in office business systems such as enterprise resource planning systems, customer relationship management systems, office automation systems, government systems, and hospital information systems; text input scenarios in everyday office software, social software, and web forms; and structured information filling scenarios in various third-party applications and native apps. It can automatically complete intelligent formatting of text across applications, improving text input efficiency and data standardization.

[0054] Figure 2 This is a flowchart illustrating the first embodiment of the text input method of this application. (Refer to...) Figure 2 Taking the terminal as the executing entity as an example, this text input method includes the following steps S10~S50: Step S10: In response to the text input operation, determine the incremental text area within the text input control corresponding to the text input operation.

[0055] Among them, text input controls refer to interactive elements in the application interface used to receive user text input, including but not limited to input boxes, text boxes, rich text editors, search bars, address bars, code editors, and message input areas of instant messaging software.

[0056] The incremental text area refers to the character range within a text input control where the text added or modified by the user's current input operation is relative to the previous input operation. It includes the start and end positions of the range within the control, as well as the text content within the range.

[0057] Optionally, in response to a text input operation, determining the incremental text area within the text input control corresponding to the text input operation includes: monitoring text input operations of any application running on the terminal through system-level auxiliary services of the operating system; and in response to the detected text input operation, determining the incremental text area within the text input control corresponding to the text input operation.

[0058] System-level auxiliary services refer to system services provided by the operating system that can monitor and intervene in the running status of other applications, such as the Accessibility Service in the Android system, which can be used to monitor text input events of applications and obtain information about input controls.

[0059] System-level accessibility services require explicit user authorization before activation. For example, the terminal displays an accessibility service permission application page in the settings interface, explaining to the user that the service will be used to listen for text input events to achieve intelligent formatting. After reading and agreeing to the authorization terms, the user can actively activate the service via a toggle or confirmation button.

[0060] After the user authorizes and enables accessibility services, the terminal registers continuous listening for two types of events, TYPE_VIEW_TEXT_CHANGED and TYPE_VIEW_FOCUSED, at the Android system layer. When the user focuses on a text input control in any application and begins to input, the service captures the corresponding AccessibilityEvent, thereby triggering subsequent incremental text area determination, text formatting processing, and replacement operations.

[0061] The text input solution provided in this application monitors text input operations of any application running on the terminal through the operating system's system-level auxiliary services, achieving unified monitoring of cross-application text input events. It eliminates the need to integrate formatting functions separately in each application, breaking down barriers between applications. Responding to detected text input operations, it determines the incremental text area within the corresponding text input control, enabling formatting of user input across any application. This achieves cross-application universality of formatting, providing users with a consistent formatting experience.

[0062] Step S20: Obtain the original text within the incremental text area and the attribute information of the text input control.

[0063] Attribute information refers to descriptive data related to text input controls, used to characterize the type, purpose, and environment of the input control. Optionally, the attribute information of a text input control includes: the control properties of the text input control itself and the context properties of the page where the text input control is located. The control properties include at least one of the following: control tooltip text, input type identifier, input type constraint, control package name, and control class name; the context properties include at least one of the following: associated label text and application identifier.

[0064] Among them, control tooltip text refers to the prompt text displayed by a text input control when it has not received user input. It is used to explain to the user the expected input content or format requirements of the control, such as displaying "Please enter the date" or "Please enter the mobile phone number".

[0065] The input type identifier refers to the input data type marker declared by the text input control, which indicates the type of input content that the control expects to receive, such as number input, date input, telephone number input, email address input, etc.

[0066] Input type constraints refer to the restrictions imposed by text input controls on the format of the input content. They are used to constrain the content entered by the user to conform to specific format specifications. For example, date input controls require that the input content must be in a valid date format, and amount input controls require that the input content must be a numeric type.

[0067] The control package name refers to the package name identifier of the application to which the text input control belongs, used to uniquely identify the application in which the control resides. The control class name refers to the class name corresponding to the text input control in the application code, used to identify the specific implementation type of the control.

[0068] Associated label text refers to static text labels that are located near and associated with a text input control. They are typically used to describe the purpose or name of the control, such as labels like "Name" or "Mobile Number" located above the input box.

[0069] The application identifier is a unique identifier for an application, used to distinguish different applications. The application identifier can be the same as the control's package name, that is, the package name of the application to which the control belongs is used as the application identifier.

[0070] The text input scheme provided in this application can structure the information of input controls by dividing attribute information into two main categories: control attributes and context attributes. Control attributes include control tooltip text, input type identifier, input type constraints, control package name, and control class name, reflecting the control's design intent and functional characteristics. Context attributes include associated label text and application identifier, reflecting the formatting requirements of the page and application environment where the control is located. This classification method helps subsequent steps to more effectively utilize different types of information for semantic analysis and intent inference, improving the efficiency of information utilization and the accuracy of the determined text formatting scheme.

[0071] Step S30: Determine the text formatting scheme based on the original text and attribute information.

[0072] A text formatting scheme refers to a set of rules used to convert raw text into target text that meets specific formatting requirements. It includes formatting conversion rules, validation rules, and corresponding confidence scores.

[0073] Optionally, based on the original text and attribute information, the text formatting scheme can be determined as follows: semantic analysis is performed on the original text to determine its semantic type, and contextual analysis is performed on the attribute information to determine the target format description. Then, based on the semantic type and target format description, the text formatting scheme is determined through rule matching or model generation. This ensures the matching between the text formatting scheme and the original text.

[0074] Optionally, based on the original text and attribute information, the text formatting scheme can be determined by directly inputting the original text and attribute information into a large language model, which then outputs the text formatting scheme end-to-end, without explicit semantic classification, intent inference, or rule matching. This improves the efficiency of determining the text formatting scheme.

[0075] Step S40: Based on the text formatting scheme, the original text is formatted to obtain the target text.

[0076] Formatting refers to the process of transforming raw text according to the formatting conversion rules in a text formatting scheme, converting it from a non-standard or inconsistent format into standardized text that conforms to the target format requirements. This process includes, but is not limited to, separating numbers in the text with thousands separators, formatting dates uniformly, displaying phone numbers in segments, converting letters to uppercase or lowercase, and adding or deleting special symbols.

[0077] For example, partial formatting scenarios require special handling during the formatting process. When the user-inputted text partially conforms to the target format but still contains non-standard parts, the terminal only corrects the non-standard parts, rather than completely rewriting the entire text. For instance, if the user inputs "2024-3-5" and the target format is "YYYY-MM-DD", the terminal recognizes that the month "3" and the day "5" are missing leading zeros. It only pads "3" to "03" and "5" to "05", resulting in "2024-03-05", while the year "2024", which already conforms to the format requirements, remains unchanged. Through this partial formatting method, the user's original input intent is preserved to the greatest extent, avoiding unnecessary modifications to the content that the user has correctly entered, thus improving the user's acceptance of the formatted results and the user experience.

[0078] Optionally, the original text is formatted based on a text formatting scheme to obtain the target text, including: converting the original text into a formatted text based on the text formatting scheme; matching and validating the formatted text with the validation rules corresponding to the text formatting scheme; and determining the formatted text that passes the validation as the target text.

[0079] Optionally, if the formatted text passes the matching check, it is identified as the target text; if the formatted text fails the matching check, an alternative text formatting scheme is determined based on the original text and attribute information, and the original text is re-formatted and matched based on the alternative text formatting scheme until the formatted text that passes the matching check is obtained or the preset maximum number of retries is reached.

[0080] The text input scheme provided in this application obtains formatted text by converting the original text into formatted text based on a text formatting scheme, thus implementing the core processing logic of formatting. The formatted text is then matched and validated against validation rules, enabling timely detection of whether the formatted result meets the expected format requirements and preventing unqualified formatted results from being applied to the input control. Only formatted text that passes validation is identified as the target text, ensuring that the text ultimately replaced in the control conforms to the formatting specifications, thereby improving the reliability and accuracy of formatting.

[0081] For example, before formatting the original text based on a text formatting scheme, the original text can be pre-cleaned. This pre-cleaning process includes removing obvious input noise from the original text, such as redundant spaces, mixed full-width and half-width punctuation marks, and invisible characters. Simultaneously, the original text is normalized, for example, by unifying full-width and half-width numbers and date separators. Through pre-cleaning, irregularities in the original text can be eliminated, ensuring the input text is relatively well-organized before entering the formatting conversion process. This improves the accuracy and success rate of subsequent formatting, and avoids formatting errors caused by input noise.

[0082] Step S50: Replace the original text in the incremental text area with the target text.

[0083] Optionally, after replacing the original text in the incremental text area with the target text, the method further includes setting the cursor at the end of the incremental text area in the text input control.

[0084] For example, the terminal sets the cursor at the end of the incremental text area within the text input control via a system-level accessibility service. The system obtains the end position of the incremental text area within the text input control and moves the cursor to that end position through the cursor setting interface provided by the system-level accessibility service. For instance, in the Android system, the ACTION_SET_SELECTION action of AccessibilityNodeInfo sets the selection area to the end of the target text, thus positioning the cursor at the end of the target text and ensuring the user can continue inputting subsequent content at that position.

[0085] The text input solution provided in this application, after replacing the original text in the incremental text area with the target text, sets the cursor at the end of the incremental text area within the text input control. Since the incremental text area is the location of the content currently entered by the user, placing the cursor at the end of this area aligns with the user's input expectations, facilitating subsequent text input operations and improving user operation continuity and user experience.

[0086] Optionally, after replacing the original text in the incremental text area with the target text, the method further includes: recording the undo information corresponding to this replacement operation, the undo information including the original text, the target text, and the replacement position; and in response to the text undo operation, restoring the target text in the incremental text area to the original text based on the undo information.

[0087] The text input scheme provided in this application records undo information after a text replacement operation, including the original text, target text, and replacement position, providing a complete data foundation for subsequent undo operations. When a user triggers a text undo operation, the target text within the incremental text area can be restored to the original text based on the undo information, enabling rapid rollback of the formatted result. This scheme gives users control over the formatted result; when the formatted result does not meet user expectations, users can undo it with a single click, avoiding repeated manual modifications due to formatting errors and improving the user experience.

[0088] The text input solution provided in this application, by responding to a text input operation, determines the incremental text area within the corresponding text input control, precisely locking the range of text involved in the user's current input. It then obtains the original text within the incremental text area and the attribute information of the text input control, providing both the input content itself and the formatting context of the input control for subsequent formatting processing. Based on this, it automatically determines a text formatting scheme matching the current input scenario by combining the original text and attribute information, and performs formatting processing on the original text accordingly to obtain the target text. This eliminates the need for users to manually select or preset formatting rules, reducing the number of steps required for formatting adjustments. Finally, the original text within the incremental text area is replaced with the target text, preserving other existing text content within the control while achieving formatting, thus avoiding interference with other existing text within the control. This solution enables automatic formatting of input content during user input, effectively avoiding repeated modifications and data validation failures due to formatting inconsistencies, and improving the efficiency and accuracy of text input.

[0089] Based on the first embodiment described above, a second embodiment of this application is proposed. Contents that are the same as or similar to the first embodiment can be referred to the above description and will not be repeated hereafter. (Refer to...) Figure 3 In the second embodiment, step S30 includes steps S301 to S303: Step S301: Perform semantic classification on the original text to obtain the semantic type of the original text.

[0090] Semantic type refers to the category to which the text belongs, determined by semantic analysis of the text content. It is used to identify the data nature of the text, such as date and time, amount and currency, telephone number, etc.

[0091] Optionally, semantic classification is performed on the original text to obtain the semantic type of the original text, including: selecting the semantic type of the original text from candidate semantic types based on the original text and attribute information through a semantic classification model; wherein the semantic type includes at least one of date and time, amount / currency, percentage, number sequence, telephone number, ID number, address, postal code, email address, Uniform Resource Locator, unit of measurement, and custom type.

[0092] Among them, candidate semantic type refers to the set of all possible semantic categories predefined in the semantic classification model. The semantic classification model selects the category that best matches the original text as the semantic type.

[0093] For example, the semantic classification model is deployed on the device based on the TensorFlow Lite framework. For instance, a lightweight text classification model using knowledge distillation compression can support real-time classification of 12 predefined semantic types, including date and time, currency, percentage, serial number sequences, phone numbers, ID numbers, addresses, postal codes, email addresses, Uniform Resource Locators (URLs), units of measurement, and custom types. Lightweight text classification models such as DistilBERT-tiny can be used as examples.

[0094] Optionally, a semantic classification model selects the semantic type of the original text from candidate semantic types based on the original text and attribute information. Specifically, this is achieved by: segmenting the original text into words to obtain segmentation features; encoding the input type identifier in the attribute information to obtain input type features; and semantically extracting the control prompt text and associated label text in the attribute information to obtain semantic embedding features. The segmentation features, input type features, and semantic embedding features are then concatenated to form a comprehensive feature, which is then input into the semantic classification model. The semantic classification model outputs the probability distribution of each candidate semantic type, selecting the category with the highest probability as the semantic type of the original text, and simultaneously outputting the corresponding confidence score.

[0095] Among them, word segmentation features, such as the token ID sequence generated after WordPiece word segmentation of the original text, are used to convert the original text into a numerical representation that can be processed by the semantic classification model; input type features, such as the numerical feature vector obtained by one-hot encoding of the input type identifier, are used to characterize the type constraint of the input control on the input content; semantic embedding features, such as the dense vector obtained by semantic extraction of the control prompt text and associated label text, are used to characterize the contextual semantic environment of the input control. By concatenating these three types of features and inputting them into the semantic classification model, the model can make semantic judgments based on multiple factors, improving the accuracy and robustness of semantic classification.

[0096] The text input solution provided in this application selects semantic types from candidate semantic types based on the original text and attribute information using a semantic classification model. This approach comprehensively utilizes both the input content itself and the contextual information of the input controls for semantic judgment, improving the accuracy of semantic classification. Furthermore, the semantic types cover a wide range of common data types, including date and time, monetary amounts, percentages, number sequences, phone numbers, ID numbers, addresses, postal codes, email addresses, Uniform Resource Locators (URLs), units of measurement, and custom types. This comprehensive coverage addresses the formatting needs of most business scenarios and demonstrates broad applicability.

[0097] Step S302: Based on the attribute information, perform intent inference to obtain the target format description of the original text.

[0098] The target format description refers to the description of the final format expected to be achieved by the original text, obtained through intent inference, and includes the target format template and validation rules.

[0099] Optionally, intent inference is performed based on attribute information to obtain the target format description of the original text, including: parsing the application identifier, control tooltip text, input type constraints, and associated label text in the attribute information; obtaining application format preferences based on the application identifier; and performing multi-dimensional intent inference based on the control tooltip text, input type constraints, associated label text, and application format preferences to obtain the target format description of the original text.

[0100] Application format preference refers to the preferred format specifications of a specific application when processing a certain type of data. For example, a system may uniformly require the date field to be in the format "YYYY-MM-DD".

[0101] For example, the implementation of obtaining application format preferences based on application identifier is as follows: using the application identifier as an index, query the application format preference configuration corresponding to the application in the locally stored application format preference database. If it is found, it is obtained directly; if it is not found, the system default format preference is used as the application format preference for the application.

[0102] For example, the implementation of multi-dimensional intent inference based on control tooltip text, input type constraints, associated label text, and application format preferences is as follows: The control tooltip text, input type constraints, associated label text, and application format preferences are input into the intent inference model. The model integrates the above multi-dimensional information for semantic understanding and outputs the target format description that the original text is expected to achieve in the input scenario. The intent inference model can be a lightweight Transformer-based model. After training with labeled intent inference samples, it can identify the format preferences indicated by keywords in the control tooltip text, extract mandatory format restrictions from the input type constraints, understand the semantic meaning of the fields to which the control belongs from the associated label text, and combine this with the global format specifications represented by the application format preferences to comprehensively infer the target format description that best suits the current input scenario.

[0103] The text input solution provided in this application comprehensively acquires multi-dimensional information related to input controls by parsing application identifiers, control tooltips, input type constraints, and associated label texts from attribute information. Furthermore, it obtains application format preferences based on the application identifier, understanding the overall format specifications of a specific application. Finally, by combining control tooltips, input type constraints, associated label texts, and application format preferences for multi-dimensional intent inference, it can comprehensively determine the user's expected format from multiple dimensions, avoiding biases that may result from single-dimensional inference and improving the accuracy and rationality of the target format description.

[0104] Step S303: Determine the text formatting scheme based on the semantic type and target format description.

[0105] Optionally, the terminal can use semantic type and target format description as a basis to search for matching formatting rules in the formatting rule template library as a text formatting scheme. Alternatively, a large language model can be used to generate a text formatting scheme based on semantic type and target format description, thus balancing the efficiency and flexibility of formatting processing.

[0106] The text input scheme provided in this application obtains semantic types by semantically classifying the original text, which can accurately identify the nature of the user input content. Simultaneously, it infers the target format description based on attribute information, enabling it to understand the format requirements of the input control for the input content. Finally, it combines the semantic type and the target format description to determine the text formatting scheme. This ensures that the formatting scheme considers both the characteristics of the input content itself and the format constraints of the input control, achieving precise matching of formatting and further improving the accuracy and adaptability of formatting.

[0107] Based on the second embodiment described above, a third embodiment of this application is proposed. Contents that are the same as or similar to the second hundredth embodiment can be referred to the above description and will not be repeated hereafter. (Refer to...) Figure 4In the third embodiment, step S303 includes steps S3031 to S3033: Step S3031: Based on the semantic type and target format description, match the corresponding formatting rule in the formatting rule template library.

[0108] A formatting rule template library refers to a pre-built database that stores multiple formatting rules. Each rule contains information such as the applicable semantic type, target format description, target format template, regular expression matching pattern, formatting transformation logic, validation rules, and confidence score. Each rule can be defined using a JSON structure.

[0109] Optionally, based on the semantic type and target format description, the corresponding formatting rules are matched in the formatting rule template library, including: using the semantic type as the first search condition, performing coarse screening in the formatting rule template library to obtain coarse screening formatting rules; using the keywords in the target format description as the second search condition, matching in the coarse screening formatting rules to obtain candidate formatting rules; and determining the matching formatting rules from the candidate formatting rules based on the application identifier in the attribute information and the application identifier associated with each candidate formatting rule.

[0110] The formatting rule template library employs a hierarchical index structure. The first layer performs a coarse-grained search using semantic type as the key, quickly filtering out rules irrelevant to the semantic type of the current input content, thus narrowing the search scope. The second layer performs an exact match using keywords in the target format description, further filtering rules from the coarse-grained results that match the expected format description. The third layer prioritizes rules based on application identifiers, with rules whose associated application identifier matches the application identifier in the attribute information taking precedence over general rules. The formatting rule is then selected based on the ranking result, ensuring that the formatting rule most suitable for the current application is used first.

[0111] The text input scheme provided in this application performs a coarse screening based on semantic type as the first search condition, which quickly narrows the search scope and reduces computational overhead. Then, it performs precise matching using keywords in the target format description to further filter out rules highly relevant to the current input scenario. Finally, it performs matching based on application identifiers to ensure that formatting rules adapted to the current application are prioritized, avoiding confusion between formatting rules from different applications. This scheme improves search efficiency while maintaining matching accuracy through a hierarchical search and filtering mechanism.

[0112] Step S3032: If the match is successful and the confidence score of the matching result is higher than the preset threshold, the matched formatting rule is determined as the text formatting scheme.

[0113] Confidence score refers to a numerical indicator used to measure the reliability of a formatting rule. A higher score indicates that the rule is more reliable. Illustratively, the value range of the confidence score is 0 to 1. The preset threshold of the confidence score can be set according to actual situations, for example, it is set to 0.85.

[0114] When a rule is matched and the confidence score of the rule is higher than a preset threshold, the terminal selects the fast path of the rule engine, directly loads the template and conversion function of the matched rule, and completes the preparation of the text formatting scheme with millisecond-level latency. Wherein, the rule engine supports multiple formatting operations, including regular expression capture group extraction and template string filling. For example, "March 5, 2024" is processed by the regular expression "(\d{4})年(\d{1,2})月(\d{1,2})日" to extract the year, month and day, which are then filled into the template "$1-$2-$3"; thousand separator injection, for example, converting "1234567" into "1,234,567"; case conversion; prefix and suffix padding; number segmentation formatting, etc.

[0115] Step S3033, otherwise, a text formatting scheme is generated based on the semantic type and target format description through a large language model.

[0116] A large language model refers to an artificial intelligence model trained based on deep learning technology that has text understanding and generation capabilities, and can generate corresponding text content according to the input prompt words. For example, the large language model is a lightweight sequence-to-sequence (Seq2Seq) model deployed on a terminal device. The model is trained via knowledge distillation based on the T5-small architecture, and is dedicated to text formatting tasks.

[0117] Optionally, generating a text formatting scheme based on semantic type and target format description through a large language model includes: acquiring a formatting example matched with the semantic type and the target format description; constructing model prompt words based on the original text, the semantic type, the target format description and the formatting example; generating the text formatting scheme based on the model prompt words through the large language model.

[0118] A formatting example refers to sample data used to guide the large language model to perform formatting generation, which includes a sample text before formatting and a corresponding target text after formatting. A model prompt word refers to a structured text instruction input to the large language model that is used to guide the model to generate a specific output.

[0119] In the embodiment of the present application, when no rule is matched or the confidence score of the matched rule is not higher than the preset threshold, the terminal selects the dynamic generation path of the model. Although the latency of this path is slightly higher, about 50 to 100 milliseconds, it can handle formatting requirements that are not pre-defined in the rule base.

[0120] The text input scheme provided in this application offers a reference template for large language models by acquiring formatting examples that match semantic types and target format descriptions. It then combines the original text, semantic types, target format descriptions, and formatting examples to construct model prompts, enabling the large language model to fully understand the current formatting requirements and contextual information. Finally, based on the model prompts, a text formatting scheme is generated, which fully utilizes the semantic understanding and generation capabilities of the large language model to output high-quality, highly adaptable formatting schemes, especially suitable for novel or complex formatting scenarios not covered by the rule base.

[0121] Optionally, the formatting rule template library supports multiple rule sources and update mechanisms to meet formatting needs in different scenarios. For example, the formatting rule template library can be updated based on user feedback. This is achieved by replacing the original text in the incremental text area with the target text, monitoring feedback operations on the target text, and then updating the formatting rules in the formatting rule template library based on these feedback operations. Here, feedback operations refer to the reactive actions performed by the user on the formatting result, including text acceptance, text undo, or text correction operations.

[0122] For example, after replacing the original text in the incremental text area with the target text, the terminal enters a feedback listening state, continuously listening for subsequent text change events of the same text input control for a preset time window, such as 5 seconds. If the user does not make any modifications to the formatting result within the listening time, the terminal records this feedback operation as a text acceptance operation, indicating that the formatting result meets the user's expectations. If the user undoes the target text within the listening time, the terminal records this feedback operation as a text undo operation and automatically restores the target text in the incremental text area to the original text. If the user manually modifies the formatting result within the listening time, the terminal records this feedback operation as a text correction operation.

[0123] The text input scheme provided in this application monitors user feedback on the target text after the text replacement operation, enabling timely acquisition of user satisfaction information regarding the formatting results. Based on this feedback, the formatting rules in the formatting rule template library are updated, allowing the formatting rules to be dynamically adjusted and optimized according to actual user usage. This scheme achieves self-learning and continuous evolution of the formatting strategy. As users use the system, the formatting rules become increasingly aligned with their personal preferences and usage habits, further improving formatting accuracy and user satisfaction.

[0124] Optionally, based on the feedback operation, the formatting rules in the formatting rule template library are updated, including: if the feedback operation is a text accept operation, the confidence score of the corresponding formatting rule is increased; if the feedback operation is a text undo operation, the confidence score of the corresponding formatting rule is decreased; if the feedback operation is a text correction operation, a new formatting rule is extracted from the corrected text and added to the formatting rule template library.

[0125] For example, the terminal continuously monitors the correction behavior of the same semantic type in the same application. When it detects that the same semantic type is repeatedly corrected to the same format in the same application, it automatically extracts new formatting rules from the correction pattern and adds them to the formatting rule template library, thereby realizing the ability to learn new rules autonomously from user behavior.

[0126] In addition, when the confidence score of a rule is consistently lower than the preset elimination threshold, the terminal will automatically mark the rule as low priority, thereby reducing its priority in subsequent rule matching and continuously optimizing the quality and effectiveness of the rule base.

[0127] The text input scheme provided in this application increases the confidence score of the corresponding formatting rule when the feedback operation is a text accept operation, thus increasing the probability that the rule will be prioritized in the future. When the feedback operation is a text undo operation, it decreases the confidence score of the corresponding formatting rule, reducing the possibility that the rule will be reused. When the feedback operation is a text correction operation, it extracts new formatting rules from the corrected text and adds them to the rule template library, achieving automatic learning of new formatting patterns. Through a refined feedback processing mechanism, this scheme enables the formatting rule library to be continuously optimized and expanded, constantly improving the intelligence level of the formatting scheme.

[0128] For example, the formatting rule template library allows users to actively add and manage custom formatting rules through a settings interface. For instance, the terminal displays a visual rule editor where users can define rule triggering conditions, including application identifiers, keywords in control tooltip text, and semantic types, while also setting the target format template and corresponding conversion logic. User-defined rules have the highest priority, ensuring that explicitly set formatting requirements are always met first.

[0129] For example, the formatting rule template library supports a cloud-based hot update mechanism. The terminal periodically pulls the latest rule set from the cloud configuration center. This rule set includes popular rules contributed by the community and adaptation patches for specific applications. The pulled rules are incrementally merged into the local formatting rule template library without manual user intervention, thus ensuring the continuous evolution and updating of formatting capabilities.

[0130] The text input scheme provided in this application first matches the corresponding formatting rules in a formatting rule template library. When a rule is matched, a mature formatting scheme can be quickly obtained, ensuring processing efficiency. When a match is successful and the confidence score is higher than a preset threshold, the scheme from the rule library is directly adopted, ensuring the stability and reliability of the formatting. When a match fails or the confidence score is insufficient, a formatting scheme is dynamically generated through a large language model, which can flexibly handle long-tail scenarios not covered by the rule library and novel formatting requirements. This scheme balances processing efficiency for high-frequency scenarios with coverage of low-frequency scenarios, achieving comprehensiveness and robustness in the formatting scheme.

[0131] Based on the first embodiment described above, a fourth embodiment of this application is proposed. Contents that are the same as or similar to the first embodiment can be referred to the above description and will not be repeated hereafter. (Refer to...) Figure 5 In the fourth embodiment, step S10 includes steps S101 to S103: Step S101: In response to a text input operation, obtain the first text content of the text input control before the text input operation occurs, and the second text content after the text input operation is completed.

[0132] For example, when the terminal detects that a user is focusing on a text input control through system-level auxiliary services, such as receiving a TYPE_VIEW_FOCUSED event, it immediately obtains the current complete text content of the control as the first text content, also known as a pre-input snapshot. This first text content records the text state in the control before the user begins the current input operation and serves as the baseline data for calculating the incremental text area. After the user completes the input of a text segment, the terminal again obtains the current text content of the control as the second text content, also known as a post-input snapshot. The conditions for determining whether input is complete include detecting an input pause exceeding a preset threshold, such as no new text changes within 800 milliseconds, or the user actively triggering a formatting operation.

[0133] Step S102: Compare the first text content and the second text content character by character to determine the character range in which the second text content has changed relative to the first text content.

[0134] For example, the terminal performs a character-by-character difference comparison of the first and second text contents, and uses the longest common subsequence algorithm to perform alignment calculations on the two texts, generating a difference editing sequence. This difference editing sequence precisely identifies the specific changes that have occurred in the second text content relative to the first text content, including newly added characters, deleted characters, or replaced characters, thereby determining the range of characters that have changed and the type of editing operation.

[0135] Step S103: Determine the character range as the incremental text region.

[0136] For example, the terminal encapsulates the character range determined in step S102 into an incremental text region object. This object contains the following key information: the start and end positions of the incremental text in the control, the actual content of the incremental text, and the type of editing operation. The editing operation type includes insertion, replacement, and deletion. Insertion refers to adding content to existing text, replacement refers to selecting part of the text and overwriting the input, and deletion only removes existing text. The editing operation type is used to determine the specific strategy for subsequent formatting processing. For example, for a replacement operation, it is necessary to record the original text being replaced to support undoing in case of formatting failure.

[0137] The text input solution provided in this application accurately captures changes in the text before and after an input operation by obtaining the first text content of the text input control before the operation and the second text content after the operation. Then, by comparing the first and second text content character by character, the solution identifies the range of characters that have changed, precisely recognizing the text added or modified by the user in this input, rather than simply replacing the entire control content. This solution achieves precise positioning of the user's input content, laying the foundation for subsequent accurate formatting and replacement, and avoiding accidental operations on other text within the control.

[0138] Based on the first embodiment described above, a fifth embodiment of this application is proposed. Contents that are the same as or similar to the first embodiment can be referred to the above description and will not be repeated hereafter. (Refer to...) Figure 6 In the fifth embodiment, step S50 includes steps S501 to S503: Step S501: Determine whether the text settings interface of the system-level auxiliary service is available.

[0139] The text setting interface refers to the programming interface provided by the system-level auxiliary service for directly setting the text content in text input controls. For example, in the Android system, this interface corresponds to setting the control's text content by passing the ACTION_SET_TEXT action to the performAction method of AccessibilityNodeInfo. Because different operating system versions or different types of application controls have varying levels of support for this interface, the terminal needs to determine whether the interface is available before performing a replacement operation.

[0140] Step S502: If the text setting interface of the system-level auxiliary service is available, the original text in the incremental text area is replaced with the target text through the text setting interface.

[0141] If the text setting interface is available, the terminal constructs the replaced complete text based on the start and end positions of the incremental text area within the control. The replaced complete text consists of three parts: the original text before the incremental text area, the formatted target text, and the original text after the incremental text area. Subsequently, the replaced complete text is set into the corresponding text input control through the text setting interface, completing the replacement operation. In this way, the replacement operation is strictly limited to the incremental text area, replacing only the part involved in the user's current input, without touching any text content that existed before the current operation.

[0142] Step S503: If the text setting interface is unavailable, the original text in the incremental text area is replaced with the target text via the clipboard.

[0143] The clipboard refers to a shared storage area provided by the operating system for temporarily storing text or data, supporting copy, cut, and paste operations. If the text setting interface is unavailable, for example, in older applications or special controls that do not support ACTION_SET_TEXT, the terminal automatically uses a clipboard injection scheme. First, the contents of the current system clipboard are backed up; then, the formatted target text is written to the clipboard; next, the incremental text area is selected through the selection operation interface provided by the system-level auxiliary service, and then the target text in the clipboard is pasted into the incremental text area through the paste operation interface to complete the replacement; finally, the clipboard contents are restored to their original state at the time of backup.

[0144] The text input solution provided in this application prioritizes the use of the system-level auxiliary service's text setting interface for text replacement, enabling efficient and direct text replacement operations and ensuring smooth replacement. When the text setting interface is unavailable, automatic replacement via the clipboard ensures successful replacement under various system environments and application compatibility conditions. This solution, through the cooperation of these two replacement mechanisms, improves the compatibility and success rate of replacement operations, guarantees the stable availability of formatting functions, and ultimately enhances text input efficiency and accuracy.

[0145] Figure 7 This is a diagram illustrating a text formatting process. (Reference) Figure 7The entire process constructs a complete closed loop from input capture to intelligent formatting and continuous optimization: First, the system listens for global text input events at the system level and captures the context of the input. Next, by comparing text snapshots before and after input, the incremental text region is accurately located. Then, the edge model is invoked to perform semantic classification on the original content within the incremental text region and infer the user's formatting intent. Based on the inference result, corresponding formatting rules are matched or dynamically generated. Then, the text formatting engine performs format conversion operations on the original text. The formatted target text is accurately replaced back into the incremental text region, and the cursor state is restored. Finally, user feedback on the formatting results is collected, and the rules are continuously optimized based on the feedback, forming a closed loop.

[0146] The text input scheme provided in this application has at least the following beneficial effects: First, a unified intelligent formatting experience across applications eliminates the pain point of format confusion.

[0147] Traditional input formatting schemes are confined to a single application, with different applications implementing their own formatting logic. This can easily lead to formatting inconsistencies when users frequently switch between multiple applications. This application addresses this by implementing global text input monitoring through system-level auxiliary services at the operating system level, providing unified intelligent formatting capabilities across all applications used by the user. Whether a user is entering a date in an enterprise resource planning system, filling in an amount in accounting software, or inputting a phone number in a customer relationship management system, the system can automatically identify the semantic type and format it according to the corresponding specifications, eliminating the pain point of inconsistent formatting across applications.

[0148] Second, AI semantic understanding replaces hard-coded rules, covering long-tail scenarios.

[0149] Existing input method text replacement and in-app formatting rely entirely on hard-coded regular expressions or fixed templates, rendering them ineffective for scenarios not covered by the rule base. This application's edge-side semantic classification model understands the semantic meaning of input text rather than simply matching character patterns. Even when faced with data formats never predefined, it can infer reasonable formatting schemes from contextual intent. The hybrid formatting strategy ensures millisecond-level response times for common scenarios while dynamically generating paths using AI to cover long-tail scenarios that the rule base cannot exhaustively cover, achieving an optimal balance between coverage and real-time performance.

[0150] Third, incremental and precise replacement protects existing content, ensuring a seamless user experience.

[0151] Traditional methods typically employ a full replacement strategy when performing text formatting, clearing the entire input box before filling in the formatted content. This not only loses the user's cursor position information but may also corrupt other correctly entered content within the same input box. This application precisely locates the incremental area of ​​the user's current input through text snapshot difference comparison. After formatting, only the content of that area is replaced, leaving existing text completely untouched. Simultaneously, it ensures that the cursor automatically returns to the correct position after replacement, ensuring uninterrupted input fluency and achieving a seamless formatting experience.

[0152] Fourth, edge-side inference ensures data privacy and offline availability.

[0153] All AI inference processes are completed locally on the user's terminal device, and the text content entered by the user does not need to be uploaded to the cloud server. For sensitive information involving trade secrets, such as contract amounts, customer contact information, and employee ID numbers, this solution ensures data security from the architectural level to prevent leakage. At the same time, edge deployment ensures that formatting capabilities are still available in offline environments, meeting the needs of offline office scenarios such as business trips and field work.

[0154] Fifth, the feedback-driven self-learning mechanism allows the formatting strategy to continuously evolve.

[0155] Traditional static rule-based solutions remain fixed once deployed, failing to adapt to changes in user-specific needs and business format specifications. This application, however, dynamically adjusts rule confidence, automatically learns new rules, and continuously optimizes the classification model by continuously collecting user feedback on the formatting results. The longer the system is used and the more usage scenarios it encompasses, the higher the formatting accuracy and user satisfaction become, forming a positive evolutionary closed-loop learning mechanism.

[0156] Sixth, it significantly improves data entry efficiency and data quality.

[0157] In enterprise-level data entry scenarios, formatting errors are the primary cause of data validation failures and the need for rework. This application automatically standardizes the format the moment the user inputs, eliminating the generation of non-standard formatted data at the source and significantly reducing the rework rate of data entry. Simultaneously, real-time automatic formatting saves users the time spent manually checking and adjusting the format, significantly improving the efficiency of entering single data entries, and the cumulative time savings are particularly considerable in large-scale data entry scenarios.

[0158] Another point to note is that the above examples are only for understanding this application and do not constitute a limitation on the text input method of this application. Any simple modifications based on this technical concept are within the protection scope of this application.

[0159] This application also provides a text input device, please refer to... Figure 8 The text input device includes: The region determination module 10 is used to determine the incremental text region within the text input control corresponding to the text input operation in response to the text input operation. The information acquisition module 20 is used to acquire the original text in the incremental text area and the attribute information of the text input control; The scheme determination module 30 is used to determine the text formatting scheme based on the original text and attribute information; Text processing module 40 is used to format the original text based on a text formatting scheme to obtain the target text; The text replacement module 50 is used to replace the original text in the incremental text area with the target text.

[0160] Optionally, the solution determination module 30 includes: Semantic classification unit, used to perform semantic classification on the original text to obtain the semantic type of the original text; The intent inference unit is used to infer intent based on attribute information and obtain the target format description of the original text. The scheme determination unit is used to determine the text formatting scheme based on the semantic type and target format description.

[0161] Optionally, the scheme determination unit includes: The rule matching subunit is used to match the corresponding formatting rule in the formatting rule template library based on the semantic type and target format description. The scheme determines the sub-unit, which is used to determine the matched formatting rule as the text formatting scheme if the match is successful and the confidence score of the matching result is higher than a preset threshold; otherwise, the text formatting scheme is generated based on the semantic type and target format description through the large language model.

[0162] Optionally, the rule matching subunit is used to perform coarse screening in the formatting rule template library with semantic type as the first retrieval condition to obtain coarse formatting rules; to perform matching in the coarse formatting rules with keywords in the target format description as the second retrieval condition to obtain candidate formatting rules; and to determine the matching formatting rule from the candidate formatting rules based on the application identifier in the attribute information and the application identifier associated with each candidate formatting rule.

[0163] Optionally, the scheme determines a sub-unit for obtaining formatting examples that match the semantic type and target format description. The formatting examples include the sample text before formatting and the target text after formatting. Based on the original text, semantic type, target format description, and formatting examples, model prompt words are constructed. Based on the model prompt words, a text formatting scheme is generated through a large language model.

[0164] Optionally, the semantic classification unit is used to select the semantic type of the original text from candidate semantic types based on the original text and attribute information through a semantic classification model; wherein the semantic type includes at least one of date and time, amount / currency, percentage, number sequence, telephone number, ID number, address, postal code, email address, Uniform Resource Locator, unit of measurement, and custom type.

[0165] Optionally, the intent inference unit is used to parse the application identifier, control tooltip text, input type constraints, and associated label text in the attribute information; obtain the application format preference based on the application identifier; and perform multi-dimensional intent inference based on the control tooltip text, input type constraints, associated label text, and application format preference to obtain the target format description of the original text.

[0166] Optionally, the region determination module 10 is used to respond to a text input operation by obtaining the first text content of the text input control before the text input operation occurs, and the second text content after the text input operation is completed; comparing the first text content and the second text content character by character to determine the character range in which the second text content changes relative to the first text content; and determining the character range as the incremental text region.

[0167] Optionally, the property information of the text input control includes: The text input control's own control properties and the context properties of the page where the text input control is located; The control properties include at least one of the following: control tooltip text, input type identifier, input type constraint, control package name, and control class name; the context properties include at least one of the following: associated label text and application identifier.

[0168] Optionally, the region determination module 10 is used to monitor text input operations of any application running on the terminal through the system-level auxiliary services of the operating system; and in response to the monitored text input operations, determine the incremental text region within the text input control corresponding to the text input operation.

[0169] Optionally, the text processing module 40 is used to perform format conversion on the original text based on the text formatting scheme to obtain formatted text; to match and verify the formatted text with the verification rules corresponding to the text formatting scheme; and to determine the formatted text that passes the verification as the target text.

[0170] Optionally, the text replacement module 50 is used to replace the original text in the incremental text area with the target text through the text setting interface if the text setting interface of the system-level auxiliary service is available; and to replace the original text in the incremental text area with the target text through the clipboard if the text setting interface is unavailable.

[0171] Optionally, the text replacement module 50 is also used to set the cursor at the end of the incremental text area in the text input control.

[0172] Optionally, the text replacement module 50 is also used to record the undo information corresponding to this replacement operation. The undo information includes the original text, the target text, and the replacement position. In response to the text undo operation, based on the undo information, the target text in the incremental text area is restored to the original text.

[0173] Optionally, the device further includes: The rule update module is used to monitor feedback operations on the target text; based on the feedback operations, it updates the formatting rules in the formatting rule template library.

[0174] Optionally, the rule update module is used to increase the confidence score of the corresponding formatting rule if the feedback operation is a text accept operation; decrease the confidence score of the corresponding formatting rule if the feedback operation is a text undo operation; and extract new formatting rules from the corrected text and add them to the formatting rule template library if the feedback operation is a text correction operation.

[0175] The text input device provided in this application, employing the text input method in the above embodiments, can solve the technical problem in related technologies where formatting capabilities are limited to a single application, and different applications use independent formatting rules, causing users to need to adapt to different formatting requirements when switching between applications, resulting in reduced text input efficiency and increased error rates. Compared with the prior art, the beneficial effects of the text input device provided in this application are the same as those of the text input method provided in the above embodiments, and other technical features in the text input device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0176] This application provides a text input device, which 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, which are executed by the at least one processor to enable the at least one processor to perform the text input method in the above embodiments.

[0177] The following is for reference. Figure 9The diagram illustrates a structural schematic of a text input device suitable for implementing embodiments of this application. The text input device in these embodiments may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 9 The text input device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0178] like Figure 9 As shown, the text input device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.) that can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1003 into a random access memory (RAM) 1004. The RAM 1004 also stores various programs and data required for the operation of the text input device. The processing unit 1001, ROM 1002, and RAM 1004 are interconnected via a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, touchscreens, touchpads, keyboards, mice, image sensors, microphones, accelerometers, gyroscopes, etc.; output devices 1008 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 1003 including, for example, magnetic tapes, hard disks, etc.; and communication devices 1009. Communication device 1009 allows the text input device to communicate wirelessly or wiredly with other devices to exchange data. Although text input devices with various systems are shown in the figures, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0179] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0180] The text input device provided in this application, employing the text input method in the above embodiments, can solve the technical problem in related technologies where formatting capabilities are limited to a single application, and different applications use independent formatting rules, causing users to need to adapt to different formatting requirements when switching between applications, resulting in reduced text input efficiency and increased error rates. Compared with the prior art, the beneficial effects of the text input device provided in this application are the same as those of the text input method provided in the above embodiments, and other technical features in this text input device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0181] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0182] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0183] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, the computer-readable program instructions being used to execute the text input method in the above embodiments.

[0184] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, system, or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0185] The aforementioned computer-readable storage medium may be included in a text input device; or it may exist independently and not assembled into a text input device.

[0186] The aforementioned computer-readable storage medium carries one or more programs that, when executed by a text input device, cause the text input device to: respond to a text input operation by determining an incremental text area within a text input control corresponding to the text input operation; obtain the original text within the incremental text area and the attribute information of the text input control; determine a text formatting scheme based on the original text and the attribute information; format the original text based on the text formatting scheme to obtain target text; and replace the original text within the incremental text area with the target text.

[0187] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages—such as Python, Java, Smalltalk, and C++—and conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0188] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0189] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0190] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described text input method. This solves the technical problem in related technologies where formatting capabilities are limited to a single application, and different applications use independent formatting rules, causing users to need to adapt to different formatting requirements when switching between applications, resulting in reduced text input efficiency and increased error rates. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the text input method provided in the above embodiments, and will not be repeated here.

[0191] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the text input method described above.

[0192] The computer program product provided in this application can solve the technical problem in related technologies where formatting capabilities are limited to a single application, and different applications use independent formatting rules, causing users to need to adapt to different formatting requirements when switching between different applications, resulting in reduced text input efficiency and increased error rate. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as those of the text input method provided in the above embodiments, and will not be repeated here.

[0193] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A text input method, characterized in that, The method includes: In response to a text input operation, determine the incremental text area within the text input control corresponding to the text input operation; Obtain the original text within the incremental text area, as well as the attribute information of the text input control; Based on the original text and the attribute information, a text formatting scheme is determined; Based on the aforementioned text formatting scheme, the original text is formatted to obtain the target text; Replace the original text in the incremental text area with the target text.

2. The method as described in claim 1, characterized in that, The step of determining a text formatting scheme based on the original text and the attribute information includes: The original text is semantically classified to obtain its semantic type; Based on the attribute information, intent inference is performed to obtain the target format description of the original text; The text formatting scheme is determined based on the semantic type and the target format description.

3. The method as described in claim 2, characterized in that, The step of determining the text formatting scheme based on the semantic type and the target format description includes: Based on the semantic type and the target format description, the corresponding formatting rule is matched in the formatting rule template library; If a match is successful and the confidence score of the match result is higher than a preset threshold, the matched formatting rule will be determined as the text formatting scheme. Otherwise, the text formatting scheme is generated based on the semantic type and the target format description using a large language model.

4. The method as described in claim 3, characterized in that, The step of matching the corresponding formatting rule in the formatting rule template library based on the semantic type and the target format description includes: Using the semantic type as the first search condition, a coarse screening is performed in the formatting rule template library to obtain coarsely screened formatting rules; Using the keywords in the target format description as the second search criteria, the candidate formatting rules are matched in the coarse-screening formatting rules to obtain the candidate formatting rules. Based on the application identifier in the attribute information and the application identifier associated with each of the candidate formatting rules, a matching formatting rule is determined from the candidate formatting rules.

5. The method as described in claim 3, characterized in that, The step of generating the text formatting scheme based on the semantic type and the target format description using a large language model includes: Obtain a formatted example that matches the semantic type and the target format description, the formatted example including the sample text before formatting and the target text after formatting; Based on the original text, the semantic type, the target format description, and the formatting example, construct model prompt words; The text formatting scheme is generated based on the model prompts using the large language model.

6. The method as described in claim 2, characterized in that, The semantic classification of the original text to obtain the semantic type of the original text includes: Using a semantic classification model, the semantic type of the original text is selected from candidate semantic types based on the original text and the attribute information; The semantic types include at least one of the following: date and time, amount / currency, percentage, number sequence, telephone number, ID number, address, postal code, email address, Uniform Resource Locator, unit of measurement, and custom type.

7. A text input device, characterized in that, The device includes: The region determination module is used to determine the incremental text region within the text input control corresponding to the text input operation in response to the text input operation. The information acquisition module is used to acquire the original text within the incremental text area and the attribute information of the text input control; The scheme determination module is used to determine a text formatting scheme based on the original text and the attribute information; The text processing module is used to format the original text based on the text formatting scheme to obtain the target text; The text replacement module is used to replace the original text in the incremental text area with the target text.

8. A text input device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the text input method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the text input method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the text input method as described in any one of claims 1 to 6.