String processing methods, devices, computer equipment, and storage media

By automatically determining and formatting strings in the software development process, the problems of poor program text readability and low coding efficiency are solved, achieving efficient and accurate string processing.

CN117312619BActive Publication Date: 2025-10-28CCB FINTECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311239259.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2025-10-28
Estimated Expiration
2043-09-22

AI Technical Summary

Technical Problem

In existing technologies, due to differences in different development software and program text categories, the readability of program text is poor when developers write code. Manually adding strings with a uniform format is time-consuming and inaccurate, resulting in low coding efficiency.

Method used

By responding to string input operations, multiple candidate strings are automatically identified using a pre-set database and semantic information, and their formats are converted to generate a second candidate string for the user to choose from, reducing the steps of manual translation and format conversion.

Benefits of technology

It improves the efficiency and accuracy of string input, reduces user workload, and enhances coding efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312619B_ABST
    Figure CN117312619B_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of big data processing technology, specifically disclosing a string processing method, apparatus, computer device, storage medium, and computer program product. The method, applied to a text development application, includes: in response to an input operation of a first string, determining multiple candidate first strings, wherein the multiple candidate first strings are determined based on the first string; based on the semantic information of the candidate first strings, determining an initial second string matching each candidate first string, resulting in multiple initial second strings, wherein the candidate first strings and the initial second strings belong to different language categories; performing format conversion on the multiple initial second strings to obtain multiple candidate second strings; and in response to a selection operation of a candidate second string, determining that the candidate second string corresponding to the selection operation is the second string corresponding to the first string. This method can improve encoding 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 big data processing technology, and in particular to a method, apparatus, computer device, storage medium and computer program product for processing strings. Background Technology

[0002] Developers can use development software to write code and generate program text to achieve corresponding functions. Due to differences in development software and the type of program text, different program texts that achieve the same function can have significant differences in form, resulting in poor readability and difficulties in subsequent use, modification, and adjustment.

[0003] Typically, formatting standards can be applied to the code written by developers to standardize program text. Developers input strings of specific types, and then a corresponding standardized string is created based on the semantics of those strings, making the generated program text easier to understand. However, manually adding the standardized string every time a specific type of string is input is time-consuming, inefficient, and cannot guarantee the accuracy of the added strings. Summary of the Invention

[0004] Therefore, it is necessary to provide a string processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve encoding efficiency and accuracy in response to the above-mentioned technical problems.

[0005] Firstly, this application provides a string processing method, which is applied to text development applications and includes:

[0006] In response to the input operation of the first string, a plurality of candidate first strings are determined, wherein the plurality of candidate first strings are determined based on the first string;

[0007] Based on the semantic information of the candidate first string, an initial second string that matches each candidate first string is determined, resulting in multiple initial second strings, wherein the candidate first strings and the initial second strings have different language categories;

[0008] The multiple initial second strings are format-converted to obtain multiple candidate second strings;

[0009] In response to the selection operation on the candidate second string, the candidate second string corresponding to the selection operation is determined to be the second string corresponding to the first string.

[0010] In one embodiment, determining a plurality of candidate first strings in response to an input operation of a first string includes:

[0011] In response to an initial input operation on a string, obtain the string corresponding to the initial input operation;

[0012] If the string category of the string meets the preset conditions, the string is determined to be the first string;

[0013] Multiple candidate first strings are determined based on the first string.

[0014] In one embodiment, the language category of the candidate first string is a first language category, and the determination of an initial second string matching each candidate first string based on the semantic information of the candidate first string yields a plurality of initial second strings, including:

[0015] A preset database is determined, which includes strings of a first language category and strings of a corresponding second language category;

[0016] Based on the semantic information of the candidate first string, an initial second string that matches each candidate first string is determined from the preset database, resulting in multiple initial second strings.

[0017] In one embodiment, the method for determining the preset database further includes:

[0018] Obtain historical strings from historical input data, wherein the historical strings include a first historical string for the first language category and a second historical string for the second language category;

[0019] Based on the semantic correspondence between the first language category and the second language category, an association is established between the first historical string and the second historical string to obtain a preset database.

[0020] In one embodiment, the method further comprises:

[0021] If the first string is not found in the preset database, the association between the first string and the second string is stored in the preset database to obtain an updated preset database.

[0022] In one embodiment, the method further comprises:

[0023] In response to the installation command for the string conversion plugin, obtain the plugin file corresponding to the string conversion plugin;

[0024] Install the plugin file into the text development application and run it.

[0025] In one embodiment, the plugin file is generated in the following ways:

[0026] In response to the string conversion plugin's generation command, generate the initial plugin project;

[0027] Obtain the configuration parameters corresponding to the string conversion plugin, wherein the configuration parameters are associated with the first language category, the second language category, and the preset format;

[0028] Adjust the initial plugin project according to the configuration parameters to obtain the string conversion plugin project;

[0029] Generate the plugin file corresponding to the string conversion plugin project.

[0030] Secondly, this application also provides a string processing apparatus, which is applied to a text development application and includes:

[0031] The first determining module is configured to determine multiple candidate first strings in response to an input operation of the first string, wherein the multiple candidate first strings are determined based on the first string;

[0032] The second determining module is used to determine an initial second string that matches each candidate first string based on the semantic information of the candidate first string, thereby obtaining multiple initial second strings, wherein the candidate first strings and the initial second strings have different language categories;

[0033] The conversion module is used to perform format conversion on the plurality of initial second strings to obtain a plurality of candidate second strings;

[0034] The third determining module is used to determine, in response to the selection operation of the candidate second string, that the candidate second string corresponding to the selection operation is the second string corresponding to the first string.

[0035] In one embodiment, the first determining module includes:

[0036] The first acquisition submodule is used to acquire the string corresponding to the initial input operation in response to the initial input operation of the string;

[0037] The first determining submodule is used to determine the string as the first string if the string category of the string meets the preset conditions;

[0038] The second determining submodule is used to determine multiple candidate first strings based on the first string.

[0039] In one embodiment, the language category of the candidate first string is a first language category, and the second determining module includes:

[0040] The third determining submodule is used to determine a preset database, which includes strings of a first language category and strings of a corresponding second language category;

[0041] The fourth determining submodule is used to determine an initial second string that matches each candidate first string from the preset database based on the semantic information of the candidate first string, thereby obtaining multiple initial second strings.

[0042] In one embodiment, the module for determining the preset database further includes:

[0043] The acquisition unit is used to acquire historical strings from historical input data, wherein the historical strings include a first historical string of the first language category and a second historical string of the second language category;

[0044] The establishment unit is used to establish an association between the first historical string and the second historical string based on the semantic correspondence between the first language category and the second language category, thereby obtaining a preset database.

[0045] In one embodiment, the device further includes:

[0046] The update module is used to store the association relationship between the first string and the second string into the preset database when the first string is not present in the preset database, so as to obtain the updated preset database.

[0047] In one embodiment, the device further includes:

[0048] The second acquisition submodule is used to acquire the plugin file corresponding to the string conversion plugin in response to the installation instruction of the string conversion plugin;

[0049] The installation module is used to install the plugin file into the text development application and run it.

[0050] In one embodiment, the plugin file generation module includes:

[0051] The first generation submodule is used to generate the initial plugin project in response to the generation instructions of the string conversion plugin;

[0052] The third acquisition submodule is used to acquire the configuration parameters corresponding to the string conversion plugin. The configuration parameters are associated with the first language category, the second language category, and the preset format.

[0053] An adjustment module is used to adjust the initial plugin project according to the configuration parameters to obtain a string conversion plugin project;

[0054] The second generation submodule is used to generate the plugin file corresponding to the string conversion plugin project.

[0055] Thirdly, embodiments of this disclosure also provide a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the method described in any one of the embodiments of this disclosure.

[0056] Fourthly, embodiments of this disclosure also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the method described in any one of the embodiments of this disclosure.

[0057] Fifthly, embodiments of this disclosure also provide a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the method described in any one of the embodiments of this disclosure.

[0058] The aforementioned string processing method, apparatus, computer equipment, storage medium, and computer program product are applied to text development applications. When a user generates program text through the text development application, in response to the input operation of a first string, multiple candidate first strings are determined based on the first string, and multiple initial second strings matching different language categories are obtained based on semantic information. After format conversion of the initial second strings, multiple candidate second strings are obtained, and the second string corresponding to the first string is determined based on a selection operation. Through the embodiments of this disclosure, after the user inputs a first string, the system can automatically complete the input based on the first string, and after translation and format conversion based on semantic information, obtain candidate second strings of the target format. Then, the required English string is determined based on a selection operation. This eliminates the need for the user to manually translate and format convert the input first string, automatically generating the corresponding second string, improving the efficiency of string input, and avoiding inaccuracies in the second string caused by user translation errors or format conversion errors. This effectively improves the accuracy of string input and is applicable to more application scenarios. In this embodiment, based on the first string, the system can automatically complete the input and generate multiple candidate second strings for the user to choose from, further reducing the user's workload, improving the efficiency and accuracy of automatically generating the second string, and enhancing the user experience. Attached Figure Description

[0059] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0060] Figure 1 This is a diagram illustrating the application environment of a string processing method in one embodiment.

[0061] Figure 2 This is a flowchart illustrating a string processing method in one embodiment;

[0062] Figure 3 This is a flowchart illustrating a string processing method in one embodiment;

[0063] Figure 4 This is a flowchart illustrating a string processing method in one embodiment;

[0064] Figure 5 This is a flowchart illustrating a string processing method in one embodiment;

[0065] Figure 6 This is a flowchart illustrating the method for determining a preset database in one embodiment;

[0066] Figure 7 This is a flowchart illustrating a method for installing plugin files in one embodiment;

[0067] Figure 8 This is a flowchart illustrating how plugin files are generated in one embodiment;

[0068] Figure 9 This is a flowchart illustrating the method for generating and installing plugin files in one embodiment;

[0069] Figure 10 This is a structural block diagram of a string processing device in one embodiment;

[0070] Figure 11 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. Detailed Implementation

[0071] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0072] The acquisition, storage, use, and processing of data in this application all comply with the relevant provisions of national laws and regulations.

[0073] The string processing method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0074] In one exemplary embodiment, such as Figure 2 As shown, a string processing method is provided, which can be applied to... Figure 1 Taking a terminal as an example, the method is applied to text-based application development and includes:

[0075] Step S210: In response to the input operation of the first string, determine a plurality of candidate first strings, wherein the plurality of candidate first strings are determined based on the first string;

[0076] In this embodiment of the disclosure, the application is applied to a text development application, whereby a user can use the text development application to write and generate program text to achieve corresponding functions. The user can write program text by inputting strings. In one example, the text development application may include, but is not limited to, IntelliJ IDEA, and the program text may include, but is not limited to, a POJO (Plain Ordinary Java Object) file. In response to the input of a first string, multiple candidate first strings are determined. Specifically, when the user inputs a first string, multiple candidate first strings can be determined based on the user-input first string. These candidate first strings have a correlation with the first string. In one example, the first string can be automatically completed to obtain multiple candidate first strings corresponding to various completion methods. For example, if the first string is "processing", the corresponding multiple candidate first strings may include, but are not limited to, "processing", "processing task", "processing task number", etc., which can be determined according to the actual application scenario. In one example, the method of completing the first string may include, but is not limited to, matching multiple candidate first strings through a preset first character database, or outputting multiple candidate first strings through a string completion model. The string completion model can be trained based on the correspondence between string samples and the labels of the completed strings.

[0077] Step S220: Based on the semantic information of the candidate first string, determine the initial second string that matches each candidate first string to obtain multiple initial second strings, wherein the candidate first strings and the initial second strings have different language categories;

[0078] In this embodiment, based on the semantic information of the candidate first string, an initial second string matching each candidate first string is determined, resulting in multiple initial second strings. The candidate first strings and the initial second strings belong to different language categories. Specifically, different language categories can be determined according to the actual application scenario. For example, when it is necessary to automatically generate a string of a second language category based on a string of a first language category, the first and second language categories can be set as preset language categories, and the initial second string of the second language category can be matched with the candidate first string based on its semantic information. In this embodiment, there is a one-to-one correspondence between the candidate first string and the initial second string. In one example, the initial second string can be output through a preset translation model, which can convert the string language category and output the result.

[0079] Step S230: Format conversion is performed on the plurality of initial second strings to obtain a plurality of candidate second strings;

[0080] In this embodiment, multiple initial second strings are format-converted to obtain multiple candidate second strings. The format conversion transforms the initial second strings into strings with a preset format, resulting in candidate second strings. The preset format is determined based on the actual application scenario and the required format of the automatically generated string in that scenario. This enables the automatic generation of strings with a uniform format based on user input. In one example, the preset format can be set to camelCase naming convention. The initial second strings are English strings, and the resulting candidate second strings are English strings with camelCase naming convention.

[0081] Step S240: In response to the selection operation of the candidate second string, determine that the candidate second string corresponding to the selection operation is the second string corresponding to the first string.

[0082] In this embodiment of the disclosure, in response to the selection operation of the candidate second string, the candidate second string corresponding to the selection operation is determined to be the second string corresponding to the first string. Typically, after obtaining multiple candidate second strings, these multiple candidate second strings can be displayed on the interface for the user to select. The user selects the target string from the multiple candidate second strings according to the string required in the actual application scenario, that is, the target string is determined as the second string corresponding to the first string.

[0083] This embodiment of the disclosure is applied to a text development application. When a user generates program text through the text development application, in response to the input operation of a first string, multiple candidate first strings are determined based on the first string, and multiple initial second strings matching different language categories are obtained based on semantic information. After format conversion of the initial second strings, multiple candidate second strings are obtained, and the second string corresponding to the first string is determined based on the selection operation. Through this embodiment of the disclosure, after the user inputs a first string, it can automatically complete the first string, and after translation and format conversion based on semantic information, obtain candidate second strings of the target format. Then, the required English string is determined based on the selection operation. The user does not need to manually translate and format convert the input first string. The corresponding second string can be automatically generated, which improves the efficiency of string input and avoids the problem of inaccurate second strings caused by user translation errors or format conversion errors. It effectively improves the accuracy of string input and is applicable to more application scenarios. In this embodiment, based on the first string, it can automatically complete and generate multiple candidate second strings for the user to choose from, further reducing the user's workload, improving the efficiency and accuracy of automatically generating second strings, and enhancing the user experience.

[0084] In one embodiment, such as Figure 3 As shown, in response to the input operation of the first string, determining multiple candidate first strings includes:

[0085] Step S211: In response to the initial input operation of the string, obtain the string corresponding to the initial input operation;

[0086] Step S212: If the string category of the string meets the preset conditions, determine the string as the first string;

[0087] Step S213: Determine multiple candidate first strings based on the first string.

[0088] In this embodiment, when acquiring the first string, in response to the initial input operation, the string corresponding to the initial input operation is acquired, the string is judged, and if the string category meets the preset conditions, the string is determined as the first string, and multiple candidate first strings are determined based on the first string. The string category and preset conditions can be set according to actual application scenarios. By setting the string category and preset conditions, the string to be automatically generated and converted, i.e., the first string, can be determined from the user-input string according to actual application needs. For example, when it is necessary to automatically generate a string with a corresponding preset format based on a Chinese string input by the user, the string category can be determined according to the language category, and the preset condition can be set to the string category as Chinese. In one example, a listener can be created to monitor input operations and judge and classify the strings corresponding to the input operations. In one example, when the string category does not meet the preset conditions, it can be considered that the string corresponding to the input operation at this time does not need to be processed according to the processing method described in this embodiment, no conversion processing is performed on the string at this time, and the strings of subsequent input operations are acquired for judgment.

[0089] Figure 4 This is a flowchart illustrating a string processing method in one embodiment. (Refer to...) Figure 4 As shown, the method described in this embodiment can be used to automatically generate English strings named using camelCase based on Chinese character strings. Specifically, an input operation is monitored by a listener. When a Chinese character string is detected, its content is obtained. Based on the semantic information of the Chinese character string, it is translated and its format converted to obtain an English string named using camelCase. In response to a click operation, the corresponding English string named using camelCase is generated below the Chinese character string. In one example, multiple candidate English strings can be generated. In response to a selection operation, the English string corresponding to the selection operation is determined and automatically generated below the Chinese character string.

[0090] In an embodiment of the present disclosure, the string corresponding to the input operation is judged. When the string category of the string meets the preset conditions, it is determined as the first string, so that the timing for automatically generating a string can be accurately determined according to the actual application scenario, and the corresponding string can be determined, which is convenient for subsequent translation and format conversion, improves the efficiency and accuracy of string conversion and generation, reduces the workload of data processing, further enhances the user experience, and is applicable to more application scenarios.

[0091] In one embodiment, as Figure 5 shown, the language category of the candidate first string is the first language category. Based on the semantic information of the candidate first string, an initial second string matching each candidate first string is determined, and multiple initial second strings are obtained, including:

[0092] Step S221, determine a preset database, where the preset database includes strings in the first language category and corresponding strings in the second language category;

[0093] Step S222, according to the semantic information of the candidate first string, determine an initial second string matching each candidate first string from the preset database, and obtain multiple initial second strings.

[0094] In an embodiment of the present disclosure, when determining the initial second string, a preset database is determined. The preset database includes strings in the first language category and strings in the second language category. Among them, according to the semantic relationship between different language categories, there is a corresponding relationship between the strings in the first language category and the strings in the second language category in the preset database. For example, the string "task" in the first language category corresponds to the string "process" in the second language category, and the string "task" in the first language category corresponds to the string "task" in the second language category, etc. Based on the semantic information of the candidate first string, an initial second string matching the candidate first string can be determined from the preset database, and multiple initial second strings are obtained. Among them, one candidate first string can correspond to one or more initial second strings. In one example, the strings stored in the preset database can be strings in a preset format or pure strings without format, which can be specifically determined according to the actual application scenario.

[0095] In this embodiment, an initial second string matching a candidate first string is determined from a preset database based on the association between a first language category and a second language category. This achieves string matching, improves the accuracy and efficiency of obtaining the initial second string, ensures the accuracy of subsequent candidate second strings, and reduces the workload of data processing. Determining the corresponding string based on the association between language categories in the preset database enables targeted language category conversion, making it suitable for more application scenarios.

[0096] In one embodiment, such as Figure 6 As shown, the method for determining the preset database also includes:

[0097] Step S610: Obtain historical strings from historical input data, wherein the historical strings include a first historical string for the first language category and a second historical string for the second language category;

[0098] Step S620: Based on the semantic correspondence between the first language category and the second language category, establish the association between the historical first string and the historical second string to obtain the preset database.

[0099] In this embodiment, a preset database can also be determined based on historical input data. Historical strings are obtained from the historical input data, including historical first strings for a first language category and historical second strings for a second language category. Based on the semantic correspondence between the first and second language categories, an association is established between the historical first strings and the historical second strings to obtain the preset database. In one example, the historical input data can be determined based on the historical data corresponding to the program text in the specific scenario where the string processing method in this embodiment is applied, including but not limited to historical input data when a user writes program text to develop an application using that text.

[0100] In this embodiment, a preset database is determined based on historical input data and the semantic correspondence between the first language category and the second language category. Different preset databases can be determined in different application scenarios, so that the preset database can adapt to the string semantics in specific application scenarios. This further improves the accuracy of the initial second string, ensures the accuracy of subsequent candidate second strings, is applicable to more application scenarios, and enhances the user experience.

[0101] In one embodiment, the method further includes:

[0102] If the first string is not found in the preset database, the association between the first string and the second string is stored in the preset database to obtain an updated preset database.

[0103] In this embodiment of the disclosure, when the first string is not present in the preset database, the association between the first string and the second string is stored in the preset database, and the preset database is updated to obtain an updated preset database. In one example, the association between the candidate first string and the corresponding initial second string can also be stored in the preset database, which can be determined according to the actual application scenario. In one example, when storing in the preset database, the corresponding format can be stored together, or the first string and the second string can be converted into unformatted strings and stored in the database, only saving the semantic relationship between the first string and the second string. In one example, the first string and the second string can also be proofread using a preset translation model according to the actual application scenario, and the association between the first string and the second string after proofreading can be stored in the preset database.

[0104] In this embodiment, after determining the second string corresponding to the first string, if the first string is not found in the preset database, the association between the first string and the second string is stored in the preset database, and a new preset database is obtained after updating. This realizes the updating and improvement of the data in the preset database. In practical applications, the preset database is enriched and improved based on the user input data, which effectively improves the reliability of the data in the preset database and improves the accuracy of the candidate second string determined based on the preset database, making it suitable for more application scenarios.

[0105] In one embodiment, such as Figure 7 As shown, the method further includes:

[0106] Step S710: In response to the installation instruction of the string conversion plugin, obtain the plugin file corresponding to the string conversion plugin;

[0107] Step S720: Install the plugin file into the text development application and run it.

[0108] In this embodiment of the disclosure, in response to the installation command of the string conversion plugin, the plugin file corresponding to the string conversion plugin is obtained, and the obtained plugin file is installed into the text development application and run. In one example, multiple string conversion plugins of different categories may be included; the corresponding plugin file is obtained according to the string conversion plugin specified in the installation command. In one example, the plugin file may be stored in a preset local storage area, such as a folder on the local disk; in another example, the plugin file may be published in a plugin marketplace, and in response to the installation command of the string conversion plugin, the corresponding plugin file is obtained from the plugin marketplace and installed. The source and acquisition method of the plugin file can be determined according to the actual application scenario.

[0109] In this embodiment, the corresponding plugin file is obtained and installed according to the installation instructions of the string conversion plugin, thereby enabling text development applications to use the string conversion plugin to achieve the above-mentioned string processing, reducing the workload of string processing. Based on the form of the plugin file, the method described in this embodiment can be applied to more application scenarios, and the implementation method is simple, highly operable, and improves the user experience.

[0110] In one embodiment, such as Figure 8 As shown, the plugin file is generated in the following ways:

[0111] Step S810: In response to the string conversion plugin's generation instruction, generate the initial plugin project;

[0112] Step S820: Obtain the configuration parameters corresponding to the string conversion plugin, wherein the configuration parameters are associated with the first language category, the second language category, and the preset format;

[0113] Step S830: Adjust the initial plugin project according to the configuration parameters to obtain the string conversion plugin project;

[0114] Step S840: Generate the plugin file corresponding to the string conversion plugin project.

[0115] In this embodiment of the disclosure, a plugin file can be generated according to the actual application scenario. Specifically, in response to the generation instruction of the string conversion plugin, an initial plugin project is generated. In one example, the initial plugin project may include initial fixed parameters. Configuration parameters corresponding to the string conversion plugin are obtained. These configuration parameters are associated with a first language category, a second language category, and a preset format. The string conversion plugin is used to convert strings of the first language category into strings of the second language category in the preset format. Therefore, different language categories and preset formats correspond to different configuration parameters. The correspondence between the configuration parameters and the language category and preset format can be pre-set or determined based on the actual application scenario. In one example, the configuration parameters can be determined based on the user's configuration parameter input. The initial plugin project is adjusted according to the obtained configuration parameters to obtain the string conversion plugin project. A corresponding plugin file is generated based on the obtained string conversion plugin project for subsequent installation. In one example, the format of the plugin file can be determined according to the actual application scenario; for example, the plugin file can be a JAR file.

[0116] In this embodiment of the disclosure, when generating a string conversion plugin, the corresponding configuration parameters are configured according to the first language category, the second language category, and the preset format of the string to be generated. The initial plugin project is then adjusted according to the configuration parameters to obtain the corresponding plugin file. This allows for the generation of plugin files based on different string conversion application scenarios by adjusting the configuration parameters. The implementation method is simple, applicable to more application scenarios, ensures the accuracy and efficiency of string generation and conversion, and improves the user experience.

[0117] Figure 9 This is a flowchart illustrating a method for generating and installing a plugin file according to an exemplary embodiment. (Refer to...) Figure 9 As shown, a plugin project is created by filling in basic information and configuring initial parameters according to the application scenario. In one example, the initial plugin project can be obtained by configuring plugin.xml and filling in the plugin information. After writing, configuring, and running the plugin, a string conversion plugin is obtained; the string conversion plugin is packaged to obtain the plugin file. Subsequently, the plugin is installed and used according to user instructions to realize the functionality of the string processing method in the above embodiment. In one example, when determining the configuration parameters, an Action class is created, which by default generates a Java class that inherits from AnAction. This class overrides the actionPerformed method, which is called when the plugin's action is clicked. The logic in this class is the core content, and the function to be implemented is to automatically generate English fields named in camelCase with the first letter lowercase from the input Chinese string.

[0118] In one embodiment, after configuring the aforementioned plugin in IntelliJ IDEA, when creating a POJO file, developers only need to enter the Chinese meaning of the attribute, and the system will automatically suggest English fields named according to camelCase. After entering the Chinese string of the attribute, the system calls a translation interface to retrieve the corresponding English string from a corpus. This corpus automatically stores the translated content, and when there are duplicate or highly similar strings, the corpus searches the saved translations to obtain the closest translation. Through this embodiment, English fields named according to camelCase can be automatically generated based on the Chinese meaning of the attribute, improving automation, saving developers' development time, and increasing development efficiency.

[0119] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0120] Based on the same inventive concept, this application also provides a string processing apparatus for implementing the string processing method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations of one or more string processing apparatus embodiments provided below can be found in the limitations of the string processing method described above, and will not be repeated here.

[0121] In one exemplary embodiment, such as Figure 10 As shown, a string processing device 1000 is provided, which is used in text development applications and includes:

[0122] The first determining module 1010 is used to determine a plurality of candidate first strings in response to an input operation of the first string, wherein the plurality of candidate first strings are determined based on the first string;

[0123] The second determining module 1020 is used to determine an initial second string that matches each candidate first string based on the semantic information of the candidate first string, thereby obtaining multiple initial second strings, wherein the candidate first strings and the initial second strings have different language categories;

[0124] The conversion module 1030 is used to perform format conversion on the plurality of initial second strings to obtain a plurality of candidate second strings;

[0125] The third determining module 1040 is used to determine, in response to the selection operation of the candidate second string, that the candidate second string corresponding to the selection operation is the second string corresponding to the first string.

[0126] In one embodiment, the first determining module includes:

[0127] The first acquisition submodule is used to acquire the string corresponding to the initial input operation in response to the initial input operation of the string;

[0128] The first determining submodule is used to determine the string as the first string if the string category of the string meets the preset conditions;

[0129] The second determining submodule is used to determine multiple candidate first strings based on the first string.

[0130] In one embodiment, the language category of the candidate first string is a first language category, and the second determining module includes:

[0131] The third determining submodule is used to determine a preset database, which includes strings of a first language category and strings of a corresponding second language category;

[0132] The fourth determining submodule is used to determine an initial second string that matches each candidate first string from the preset database based on the semantic information of the candidate first string, thereby obtaining multiple initial second strings.

[0133] In one embodiment, the module for determining the preset database further includes:

[0134] The acquisition unit is used to acquire historical strings from historical input data, wherein the historical strings include a first historical string of the first language category and a second historical string of the second language category;

[0135] The establishment unit is used to establish an association between the first historical string and the second historical string based on the semantic correspondence between the first language category and the second language category, thereby obtaining a preset database.

[0136] In one embodiment, the apparatus further includes:

[0137] The update module is used to store the association between the first string and the second string into the preset database when the first string is not present in the preset database, so as to obtain the updated preset database.

[0138] In one embodiment, the apparatus further includes:

[0139] The second acquisition submodule is used to acquire the plugin file corresponding to the string conversion plugin in response to the installation instruction of the string conversion plugin;

[0140] The installation module is used to install the plugin file into the text development application and run it.

[0141] In one embodiment, the plugin file generation module includes:

[0142] The first generation submodule is used to generate the initial plugin project in response to the generation instructions of the string conversion plugin;

[0143] The third acquisition submodule is used to acquire the configuration parameters corresponding to the string conversion plugin. The configuration parameters are associated with the first language category, the second language category, and the preset format.

[0144] An adjustment module is used to adjust the initial plugin project according to the configuration parameters to obtain a string conversion plugin project;

[0145] The second generation submodule is used to generate the plugin file corresponding to the string conversion plugin project.

[0146] Each module in the aforementioned string processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0147] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 11 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a string processing method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0148] Those skilled in the art will understand that Figure 11The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0149] In one embodiment, a computer device is further provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiments when executing the computer program.

[0150] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0151] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0152] It should be noted that the user information (including but not limited to user device information, user personal information, user input operation information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant regulations.

[0153] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0154] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0155] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A string processing method, characterized in that, The method is applied to text-based application development, including: In response to an input operation of a first string, multiple candidate first strings are determined, wherein the multiple candidate first strings are determined based on the first string; the process of determining multiple candidate first strings in response to an input operation of a first string includes: in response to an initial input operation of a string, obtaining the string corresponding to the initial input operation; if the string category of the string meets a preset condition, determining the string as the first string; and determining multiple candidate first strings based on the first string. Based on the semantic information of the candidate first string, an initial second string that matches each candidate first string is determined, resulting in multiple initial second strings, wherein the candidate first strings and the initial second strings have different language categories; The multiple initial second strings are format-converted to obtain multiple candidate second strings; In response to the selection operation on the candidate second string, the candidate second string corresponding to the selection operation is determined to be the second string corresponding to the first string.

2. The method according to claim 1, characterized in that, The language category of the candidate first string is a first language category. Based on the semantic information of the candidate first string, an initial second string matching each candidate first string is determined, resulting in multiple initial second strings, including: A preset database is determined, which includes strings of a first language category and strings of a corresponding second language category; Based on the semantic information of the candidate first string, an initial second string that matches each candidate first string is determined from the preset database, resulting in multiple initial second strings.

3. The method according to claim 2, characterized in that, The method for determining the preset database also includes: Obtain historical strings from historical input data, wherein the historical strings include a first historical string for the first language category and a second historical string for the second language category; Based on the semantic correspondence between the first language category and the second language category, an association is established between the first historical string and the second historical string to obtain a preset database.

4. The method according to claim 2, characterized in that, The method further includes: If the first string is not found in the preset database, the association between the first string and the second string is stored in the preset database to obtain an updated preset database.

5. The method according to claim 1, wherein The method further includes: In response to the installation command for the string conversion plugin, obtain the plugin file corresponding to the string conversion plugin; Install the plugin file into the text development application and run it.

6. The method according to claim 5, characterized in that, The plugin files are generated in the following ways: In response to the string conversion plugin's generation command, generate the initial plugin project; Obtain the configuration parameters corresponding to the string conversion plugin, wherein the configuration parameters are associated with the first language category, the second language category, and the preset format; Adjust the initial plugin project according to the configuration parameters to obtain the string conversion plugin project; Generate the plugin file corresponding to the string conversion plugin project.

7. A string processing apparatus, characterized in that, The device is used in text development applications and includes: A first determining module is configured to determine multiple candidate first strings in response to an input operation of a first string, wherein the multiple candidate first strings are determined based on the first string; the first determining module includes: a first obtaining submodule, configured to obtain the string corresponding to the initial input operation in response to an initial input operation of a string; a first determining submodule, configured to determine the string as the first string if the string category of the string meets a preset condition; and a second determining submodule, configured to determine multiple candidate first strings based on the first string; The second determining module is used to determine an initial second string that matches each candidate first string based on the semantic information of the candidate first string, thereby obtaining multiple initial second strings, wherein the candidate first strings and the initial second strings have different language categories; The conversion module is used to perform format conversion on the plurality of initial second strings to obtain a plurality of candidate second strings; The third determining module is used to determine, in response to the selection operation of the candidate second string, that the candidate second string corresponding to the selection operation is the second string corresponding to the first string.

8. The apparatus according to claim 7, characterized in that, The language category of the candidate first string is a first language category, and the second determining module includes: The third determining submodule is used to determine a preset database, which includes strings of a first language category and strings of a corresponding second language category; The fourth determining submodule is used to determine an initial second string that matches each candidate first string from the preset database based on the semantic information of the candidate first string, thereby obtaining multiple initial second strings.

9. The apparatus according to claim 8, characterized in that, The module for determining the preset database also includes: The acquisition unit is used to acquire historical strings from historical input data, wherein the historical strings include a first historical string of the first language category and a second historical string of the second language category; The establishment unit is used to establish an association between the first historical string and the second historical string based on the semantic correspondence between the first language category and the second language category, thereby obtaining a preset database.

10. The apparatus according to claim 8, characterized in that, The device further includes: The update module is used to store the association relationship between the first string and the second string into the preset database when the first string is not present in the preset database, so as to obtain the updated preset database.

11. The apparatus according to claim 7, characterized in that, The device further includes: The second acquisition submodule is used to acquire the plugin file corresponding to the string conversion plugin in response to the installation instruction of the string conversion plugin; The installation module is used to install the plugin file into the text development application and run it.

12. The apparatus according to claim 11, characterized in that, The plugin file generation module includes: The first generation submodule is used to generate the initial plugin project in response to the generation instructions of the string conversion plugin; The third acquisition submodule is used to acquire the configuration parameters corresponding to the string conversion plugin. The configuration parameters are associated with the first language category, the second language category, and the preset format. An adjustment module is used to adjust the initial plugin project according to the configuration parameters to obtain a string conversion plugin project; The second generation submodule is used to generate the plugin file corresponding to the string conversion plugin project.

13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

15. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Language conversion method and device applied to code character string

    CN113139390A

  • Pattern matching based character string retrieval

    US20150242537A1