A script processing method and system, computer device and medium

By using a pre-trained code verification model to perform character verification and standardization on script programs, the problem of programming errors caused by the confusion of Chinese and English characters during the development process is solved, thereby improving system development efficiency and program stability.

CN115687136BActive Publication Date: 2026-07-24PING AN PAY ELECTRONIC PAYMENT CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN PAY ELECTRONIC PAYMENT CO LTD
Filing Date
2022-11-09
Publication Date
2026-07-24

Smart Images

  • Figure CN115687136B_ABST
    Figure CN115687136B_ABST
Patent Text Reader

Abstract

The application discloses a script program processing method and system, computer equipment and a medium, the method comprises the following steps: when receiving the save instruction of the script program, generating initial code data according to the to-be-processed script program file; inputting the initial code data into a pre-trained code verification model, and outputting the target verification result corresponding to the to-be-processed script program file; according to the target verification result, the initial code data is standardized, and the executable script program is generated and saved. Since the application receives the save instruction of the script program, the pre-trained code verification model is used to verify each character in the code data corresponding to the script program, and the characters that do not meet the regulations are standardized, so that the final executable script program can normally run after being put online, thereby avoiding spending a lot of time on secondary modification and troubleshooting of the code data when the program runs incorrectly, and improving the system development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a script processing method, system, computer device, and medium. Background Technology

[0002] As business systems gradually expand, developers need to create a large number of scripts for each business function. In the process of script development, most companies now provide developers with online integrated development tools, which allow them to write scripts to meet the specific business requirements of the system.

[0003] In existing technologies, when developing scripts using programming languages, researchers often misspell programming keywords. Furthermore, to facilitate future maintenance, they typically write Chinese comments while coding. This process requires frequent switching between Chinese and English editors. Because researchers are focused on business development, they may neglect to switch editors while editing code, leading to the easy ingestion of Chinese characters in the logic code (e.g., writing Chinese characters instead of English ones). Since Chinese and English symbols are difficult to distinguish visually, scripts containing incorrect programming keywords and Chinese characters may fail to run after being deployed to the engine, thus reducing system development efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide a script processing method, system, computer equipment, and medium to address the problem of low system development efficiency.

[0005] A script processing method includes: upon receiving a script saving instruction, generating initial code data based on the script file to be processed; inputting the initial code data into a pre-trained code verification model and outputting the target verification result corresponding to the script file to be processed; and standardizing the initial code data based on the target verification result to generate an executable script for saving.

[0006] In one embodiment, generating initial code data based on the script program file to be processed includes: acquiring and reading target code data from the script program file to be processed; determining and removing Chinese comment portions existing in the target code data according to preset Chinese comment editing rules to obtain code content portions; and determining the code content portions as initial code data.

[0007] In one embodiment, the pre-trained code verification model includes a word segmentation module, a result partitioning module, and a verification module. Initial code data is input into the pre-trained code verification model, and the target verification result corresponding to the script program file to be processed is output. This includes: the word segmentation module segmenting the initial code data according to a pre-built programming dictionary to generate segmentation results; the result partitioning module dividing the segmentation results into a programming keyword set and a punctuation mark set; the verification module verifying whether each programming keyword in the programming keyword set is correct, generating a first verification result; the verification module verifying whether each punctuation mark in the punctuation mark set is an English punctuation mark, generating a second verification result; and the verification module determining the first and second verification results as the target verification result.

[0008] In one embodiment, a pre-built programming dictionary is generated according to the following steps: determining the target programming language used by the script program file to be processed; collecting programming corpus samples of the target programming language and constructing a cache array; obtaining the target character from the programming corpus samples and constructing a combination character of the target character and any English character in a preset English character library; wherein the target character is any character in the programming corpus samples; calculating the cohesion of the combination character and calculating the randomness of the characters on both sides of the combination character to generate left adjacency entropy and right adjacency entropy; selecting the smaller adjacency entropy between the left and right adjacency entropy and multiplying it with the cohesion to generate a target judgment value; when the target judgment value is greater than a preset threshold, storing the target character in the cache data; and integrating the cache array of stored data and the preset English character library to generate a pre-built programming dictionary.

[0009] In one embodiment, verifying whether each programming keyword in the programming keyword set is correct and generating a first verification result includes: vector encoding each programming keyword in the programming keyword set to obtain a feature vector for each programming keyword; calculating the vector similarity between the feature vector of each programming keyword and each standard keyword in a preset standard programming library, and determining the standard keywords with a similarity greater than a preset value; when the number of standard keywords with a similarity greater than a preset value is 1, generating verification information that all programming keywords in the programming keyword set are correct; and determining all correct verification information as the first verification result.

[0010] In one embodiment, verifying whether each punctuation mark in the punctuation mark set is an English punctuation mark and generating a second verification result includes: creating a sliding window using a sliding window algorithm, mapping and associating a preset standard English punctuation mark as a parameter of the sliding window to obtain a target sliding window; inputting each punctuation mark in the punctuation mark set into the target sliding window one by one to determine whether each punctuation mark is an English punctuation mark; outputting multiple Chinese punctuation marks in the punctuation mark set that are not English punctuation marks; and determining the multiple Chinese punctuation marks that are not English punctuation marks as the second verification result.

[0011] In one embodiment, the initial code data is standardized based on the target verification result, including: when the target verification result contains multiple Chinese punctuation marks that are not English punctuation marks, extracting the English punctuation mark corresponding to each Chinese punctuation mark using a character converter; determining the target position of each Chinese punctuation mark in the initial code data; replacing the English punctuation mark corresponding to each Chinese punctuation mark with its corresponding target position to perform character conversion on the Chinese punctuation mark at the target position; or, when the target verification result determines that there is an erroneous programming keyword, mapping multiple standard keywords associated with each erroneous programming keyword according to each standard keyword in a preset standard programming library; calculating the number of identical letters in each erroneous programming keyword and each standard keyword associated with it to obtain the number of letters in each standard keyword; determining the standard keyword corresponding to the largest number of letters as the target keyword for each erroneous programming keyword; determining the target position of each erroneous programming keyword in the initial code data; replacing the target keyword of each erroneous programming keyword with the target keyword at each erroneous programming keyword to perform character conversion on the erroneous programming keyword at each target position.

[0012] A script processing system includes: an initial code data generation module, used to generate initial code data based on the script file to be processed when a script save instruction is received; a target verification result output module, used to input the initial code data into a pre-trained code verification model and output the target verification result corresponding to the script file to be processed; and an executable script generation module, used to standardize the initial code data based on the target verification result and generate an executable script for saving.

[0013] A computer device includes a memory and a processor. The memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the steps of the script program processing method described above.

[0014] A medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the script program processing method described above.

[0015] The aforementioned script processing method, system, device, and medium involve a script processing system that, upon receiving a save command for a script, first generates initial code data based on the script file to be processed. This initial code data is then input into a pre-trained code verification model, which outputs the target verification result corresponding to the script file. Finally, the initial code data is standardized based on the target verification result to generate an executable script for saving. Because this application verifies each character in the code data corresponding to the script program according to the pre-trained code verification model upon receiving a save command, and standardizes characters that do not meet the requirements, the final executable script program can run normally after deployment. This avoids spending a significant amount of time on secondary modifications and troubleshooting of the code data when program errors occur, while simultaneously improving system development efficiency. Attached Figure Description

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

[0017] Figure 1 This is a diagram illustrating the implementation environment of the script processing method provided in one embodiment of this application.

[0018] Figure 2 This is a schematic diagram of the internal structure of a computer device in one embodiment of this application;

[0019] Figure 3 This is a schematic diagram of a script processing method provided in one embodiment of this application;

[0020] Figure 4 This is a schematic diagram of program annotations provided in one embodiment of this application;

[0021] Figure 5 This is a schematic diagram of program annotations provided in another embodiment of this application;

[0022] Figure 6 This is a schematic diagram of program annotations provided in another embodiment of this application;

[0023] Figure 7 This is a diagram of a script processing system architecture provided in one embodiment of this application;

[0024] Figure 8 This is a schematic diagram of a script processing method provided in another embodiment of this application;

[0025] Figure 9 This is a schematic diagram of the system structure of a script processing system provided in an embodiment of this application. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0027] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.

[0028] Figure 1 This is a diagram illustrating the implementation environment of a script processing method provided in one embodiment, such as... Figure 1 As shown, this implementation environment includes a server 110 and a client 120.

[0029] Server 110 can be a server, specifically a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. For example, it can be a server device for processing script programs. When server 110 receives a save command for a script program from client 120, server 110 generates initial code data based on the script program file to be processed. Server 110 inputs the initial code data into a pre-trained code verification model and outputs the target verification result corresponding to the script program file to be processed. Server 110 then standardizes the initial code data based on the target verification result to generate an executable script program for saving.

[0030] It should be noted that the client 120 can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. The server 110 and the client 120 can connect via Bluetooth, USB (Universal Serial Bus), or other communication connection methods, which are not limited in this invention.

[0031] Figure 2 This is a schematic diagram of the internal structure of a computer device in one embodiment. For example... Figure 2As shown, the computer device includes a processor, media, memory, and network interface connected via a system bus. The media of the computer device stores an operating system, a database, and computer-readable instructions. The database may store a sequence of control information. When the computer-readable instructions are executed by the processor, they enable the processor to implement a script processing method. The processor of the computer device provides computing and control capabilities to support the operation of the entire device. The memory of the computer device may store computer-readable instructions, which, when executed by the processor, enable the processor to execute a script processing method. The network interface of the computer device is used for communication with a terminal. Those skilled in the art will understand that… Figure 2 The 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. A specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. The medium is a readable storage medium.

[0032] The following will be combined with the appendix Figure 3-7 This application provides a detailed description of the script processing method provided in its embodiments. This method can be implemented using a computer program and can run on a script processing system based on the von Neumann architecture. The computer program can be integrated into an application or run as a standalone utility application.

[0033] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0034] Foundational artificial intelligence technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, large script processing technology, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0035] Please see Figure 3 This is a flowchart illustrating a script processing method provided in an embodiment of this application. Figure 3 As shown, the method in this application embodiment may include the following steps:

[0036] S101, upon receiving a save instruction for the script program, generates initial code data based on the script program file to be processed;

[0037] The save command is generated after the developer has finished editing the script and triggered the save function. A script is an executable file written in a specific descriptive language according to a certain format. For example, a script written in Structured Query Language (SQL) is a special-purpose programming language used for database querying and programming, for accessing, querying, updating, and managing relational database systems.

[0038] In this embodiment of the application, when generating initial code data based on the script program file to be processed, the target code data in the script program file to be processed is first obtained and read. Then, according to the preset Chinese comment editing rules, the Chinese comment parts existing in the target code data are determined and removed to obtain the code content part. Finally, the code content part is determined as the initial code data.

[0039] Specifically, the default Chinese comment editing rules are strategies provided by programming languages ​​for writing comments in code. These strategies use fixed identifiers. For example, in the Java programming language, comments are divided into single-line comments, multi-line comments, and documentation comments. Single-line comments are identified by double forward slashes " / / " and can only comment one line of content. They are used where the comment information is short, such as... Figure 4 As shown. Multiline comments are enclosed between " / *" and "* / ", and can comment out content from multiple lines, for example... Figure 5 As shown. Documentation comments are enclosed between " / **" and "* / ", and can comment out multiple lines of content. They are generally used on classes, methods, and variables to describe their function, for example... Figure 6 As shown.

[0040] For example in Figures 4-6 In order to remove the interference caused by comments, all comment content can be removed, so that only the usable code part of the script program (i.e., the initial code data in this application) is retained for code correctness verification.

[0041] In one possible implementation, the user first writes a script program on the platform provided by the client. After all editing is completed, the user generates a save command by triggering the save function button. Then, the user sends the save command and the script program they wrote to the server at the same time. After receiving the save command, the server obtains the target code data in the script program file to be processed corresponding to the command, and then removes the comments in the target code data to obtain the initial code data.

[0042] S102, input the initial code data into the pre-trained code verification model, and output the target verification result corresponding to the script program file to be processed;

[0043] Among them, the pre-trained code verification model is a mathematical model that determines whether the characters in the initial code data conform to the standard characters. This mathematical model can be built based on a convolutional neural network.

[0044] Typically, a pre-trained code verification model includes a word segmentation module, a result partitioning module, and a verification module.

[0045] In this embodiment, when the initial code data is input into the pre-trained code verification model and the target verification result corresponding to the script program file to be processed is output, the word segmentation module first segments the initial code data according to the pre-built programming dictionary to generate word segmentation results. Then, the result division module divides the word segmentation results into a programming keyword set and a punctuation mark set. Next, the verification module verifies whether each programming keyword in the programming keyword set is correct and generates a first verification result. Finally, the verification module verifies whether each punctuation mark in the punctuation mark set is an English punctuation mark and generates a second verification result. The first verification result and the second verification result are determined as the target verification result.

[0046] Specifically, a pre-built programming dictionary can be generated by following these steps: First, determine the target programming language used by the script program file to be processed, collect programming corpus samples of the target programming language, and build a cache array. Then, obtain the target character from the programming corpus samples and construct a combination character between the target character and any English character in the preset English character library. The target character is any character in the programming corpus samples. Next, calculate the cohesion of the combination character and the randomness of the characters on both sides of the combination character to generate the left and right adjacency entropies. Then, select the smaller adjacency entropy between the left and right adjacency entropies and multiply it by the cohesion to generate the target judgment value. Finally, when the target judgment value is greater than a preset threshold, store the target character in the cache data, and integrate the cache array of stored data with the preset English character library to generate the pre-built programming dictionary.

[0047] Specifically, when verifying the correctness of each programming keyword in the programming keyword set and generating the first verification result, each programming keyword in the programming keyword set is first vector-encoded to obtain the feature vector of each programming keyword. Then, the vector similarity between the feature vector of each programming keyword and the standard keywords in the preset standard programming library is calculated, and standard keywords with a similarity greater than the preset value are identified. Next, when the number of standard keywords with a similarity greater than the preset value is 1, verification information is generated that all programming keywords in the programming keyword set are correct. Finally, all correct verification information is determined as the first verification result.

[0048] Specifically, for example, the Chinese semicolon ";" and the English semicolon ";" are very similar. Using the Chinese semicolon ";" will cause the program to malfunction. When verifying whether each punctuation mark in the punctuation set is an English punctuation mark and generating a second verification result, a sliding window algorithm is first used to create a sliding window. Preset standard English punctuation marks are used as parameters for the sliding window to obtain the target sliding window. Then, each punctuation mark in the punctuation set is input into the target sliding window one by one to determine whether each punctuation mark is an English punctuation mark. Next, multiple Chinese punctuation marks in the punctuation set that are not English punctuation marks are output. Finally, the multiple Chinese punctuation marks that are not English punctuation marks are determined as the second verification result.

[0049] In one possible implementation, the server first initializes a pre-trained code verification model, then performs verification processing on the initial code data based on the pre-trained code verification model to identify the erroneous characters present in the initial code data. After the model finishes processing, it outputs the target verification result corresponding to the script program file to be processed.

[0050] Furthermore, when generating the pre-trained code verification model, the process first involves obtaining all programming keywords and standard punctuation marks of the target programming language. Then, positive samples are constructed based on these keywords and punctuation marks. These positive samples are then annotated to generate negative samples. The positive and negative samples are then mixed randomly to obtain the model training samples. A convolutional neural network is used to build the model, and a word segmentation logic module, a result partitioning module, and a verification module are set up to obtain the code verification model. Finally, the model training samples are input into the code verification model for training, and the pre-trained code verification model is generated.

[0051] S103, Based on the target verification results, the initial code data is standardized and an executable script program is generated and saved.

[0052] In one possible implementation, when the target verification result contains multiple Chinese punctuation marks that are not English punctuation marks, the English punctuation mark corresponding to each Chinese punctuation mark is first extracted using a character converter. Then, the target position of each Chinese punctuation mark is determined in the initial code data. Finally, the English punctuation mark corresponding to each Chinese punctuation mark is replaced with the corresponding target position to convert the Chinese punctuation mark at the target position and generate an executable script program for saving.

[0053] In another possible implementation, firstly, when the existence of erroneous programming keywords is determined based on the target verification result, multiple standard keywords associated with each erroneous programming keyword are mapped according to each standard keyword in the preset standard programming library. Then, the number of identical letters in each erroneous programming keyword and each standard keyword associated with it is calculated to obtain the number of letters in each standard keyword. Secondly, the standard keyword corresponding to the largest number of letters is determined as the target keyword for each erroneous programming keyword, and the target position of each erroneous programming keyword is determined in the initial code data. Finally, the target keyword of each erroneous programming keyword is replaced with the target position of each erroneous programming keyword to perform character conversion on the erroneous programming keyword at each target position, generating an executable script program for saving.

[0054] For example Figure 7 As shown, Figure 7 This is a diagram of a script processing system architecture provided in this application. Figure 7 Taking the Structured Query Language (SQL) as an example, after a user writes an SQL script file on the editing platform, if the file contains Chinese characters, the user can trigger the SQL command to check the SQL script. The detected Chinese characters are then converted and saved to the script file library. Finally, only scripts with normal characters that meet the requirements are saved. The script files in the script file library are then assigned to the parsing engine for processing, which returns normal business results to the user. This avoids the situation where the SQL script will not run properly due to Chinese characters, and greatly improves the running efficiency of the SQL script.

[0055] In this embodiment, the script processing system first generates initial code data based on the script file to be processed upon receiving a save command. Then, it inputs the initial code data into a pre-trained code verification model, outputs the target verification result corresponding to the script file, and finally standardizes the initial code data based on the target verification result to generate an executable script for saving. Because this application verifies each character in the code data corresponding to the script program according to the pre-trained code verification model upon receiving a save command, and standardizes characters that do not meet the requirements, the final executable script program can run normally after deployment. This avoids spending a lot of time on secondary modifications and troubleshooting of the code data when program errors occur, and improves system development efficiency.

[0056] Please see Figure 8 This is a flowchart illustrating a script processing method provided in an embodiment of this application. Figure 8 As shown, the method in this application embodiment may include the following steps:

[0057] S201, Upon receiving a save instruction for the script program, generate initial code data based on the script program file to be processed;

[0058] S202, the word segmentation module segments the initial code data according to the pre-built programming dictionary and generates word segmentation results;

[0059] S203, the result segmentation module divides the word segmentation results into a set of programming keywords and a set of punctuation marks;

[0060] S204, The verification module verifies whether each programming keyword in the programming keyword set is correct and generates the first verification result;

[0061] S205, The verification module verifies whether each punctuation mark in the punctuation mark set is an English punctuation mark and generates a second verification result;

[0062] S206, The verification module determines the first verification result and the second verification result as the target verification result;

[0063] S207. Based on the target verification results, the initial code data is standardized and an executable script program is generated and saved.

[0064] In this embodiment, the script processing system first generates initial code data based on the script file to be processed upon receiving a save command. Then, it inputs the initial code data into a pre-trained code verification model, outputs the target verification result corresponding to the script file, and finally standardizes the initial code data based on the target verification result to generate an executable script for saving. Because this application verifies each character in the code data corresponding to the script program according to the pre-trained code verification model upon receiving a save command, and standardizes characters that do not meet the requirements, the final executable script program can run normally after deployment. This avoids spending a lot of time on secondary modifications and troubleshooting of the code data when program errors occur, and improves system development efficiency.

[0065] The following are system embodiments of the present invention, which can be used to execute the method embodiments of the present invention. For details not disclosed in the system embodiments of the present invention, please refer to the method embodiments of the present invention.

[0066] Please see Figure 9 This illustration shows a schematic diagram of a script processing system provided by an exemplary embodiment of the present invention. This script processing system can be implemented as all or part of a device through software, hardware, or a combination of both. System 1 includes an initial code data generation module 10, a target verification result output module 20, and an executable script generation module 30.

[0067] The initial code data generation module 10 is used to generate initial code data based on the script program file to be processed when a save instruction for the script program is received.

[0068] The target verification result output module 20 is used to input the initial code data into the pre-trained code verification model and output the target verification result corresponding to the script program file to be processed.

[0069] The executable script generation module 30 is used to standardize the initial code data according to the target verification result and generate an executable script for saving.

[0070] It should be noted that the script processing system provided in the above embodiments is only illustrated by the division of the above functional modules when executing the script processing method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the script processing system and script processing method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0071] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0072] In this embodiment, the script processing system first generates initial code data based on the script file to be processed upon receiving a save command. Then, it inputs the initial code data into a pre-trained code verification model, outputs the target verification result corresponding to the script file, and finally standardizes the initial code data based on the target verification result to generate an executable script for saving. Because this application verifies each character in the code data corresponding to the script program according to the pre-trained code verification model upon receiving a save command, and standardizes characters that do not meet the requirements, the final executable script program can run normally after deployment. This avoids spending a lot of time on secondary modifications and troubleshooting of the code data when program errors occur, and improves system development efficiency.

[0073] In one embodiment, a computer device is provided, the device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0074] Upon receiving a save command for the script program, initial code data is generated based on the script program file to be processed;

[0075] Input the initial code data into the pre-trained code verification model, and output the target verification result corresponding to the script program file to be processed;

[0076] Based on the target verification results, the initial code data is standardized and an executable script is generated and saved.

[0077] In one embodiment, when the processor executes the initial code data generated based on the script program file to be processed, it specifically performs the following operations:

[0078] Acquire and read target code data from the script program file to be processed;

[0079] Based on the preset Chinese comment editing rules, the Chinese comment portions existing in the target code data are identified and removed to obtain the code content portion;

[0080] The code content portion is designated as the initial code data.

[0081] In one embodiment, when the processor inputs initial code data into a pre-trained code verification model and outputs the target verification result corresponding to the script program file to be processed, it specifically performs the following operations:

[0082] The word segmentation module segments the initial code data according to a pre-built programming dictionary and generates segmentation results;

[0083] The result segmentation module divides the word segmentation results into a set of programming keywords and a set of punctuation marks.

[0084] The verification module verifies whether each programming keyword in the programming keyword set is correct and generates the first verification result.

[0085] The verification module verifies whether each punctuation mark in the punctuation mark set is an English punctuation mark and generates a second verification result.

[0086] The verification module determines the first verification result and the second verification result as the target verification result.

[0087] In one embodiment, when the processor generates a pre-built programming dictionary, it performs the following operations:

[0088] Determine the target programming language used by the script program file to be processed;

[0089] Collect programming language samples of the target programming language and build a cache array;

[0090] Obtain the target character from the programming corpus sample and construct a combination character of the target character and any English character from the preset English character library; wherein, the target character is any character in the programming corpus sample;

[0091] Calculate the cohesion of the combined characters and the randomness of the characters on both sides of the combined characters to generate the left and right adjacency entropy.

[0092] The smaller of the left and right neighbor entropies is selected and multiplied by the cohesion to generate the target judgment value;

[0093] When the target value is greater than the preset threshold, the target character is stored in the cache data;

[0094] The cache array containing the stored data and the preset English character library are integrated to generate a pre-built programming dictionary.

[0095] In one embodiment, when the processor verifies the correctness of each programming keyword in the set of programming keywords and generates a first verification result, it specifically performs the following operations:

[0096] Each programming keyword in the set of programming keywords is vector-encoded to obtain the feature vector of each programming keyword;

[0097] Calculate the feature vector of each programming keyword and the vector similarity between each standard keyword in the preset standard programming library, and determine the standard keywords with a similarity greater than the preset value;

[0098] When the number of standard keywords with a similarity greater than the preset value is 1, generate verification information that all programming keywords in the programming keyword set are correct.

[0099] All correct verification information is selected as the first verification result.

[0100] In one embodiment, when the processor performs a check to verify whether each punctuation mark in the punctuation mark set is an English punctuation mark and generates a second verification result, it specifically performs the following operations:

[0101] A sliding window algorithm is used to create a sliding window, and preset standard English punctuation marks are used as parameters of the sliding window for mapping and association to obtain the target sliding window;

[0102] Each punctuation mark in the punctuation mark set is entered into the target sliding window one by one to determine whether each punctuation mark is an English punctuation mark;

[0103] Output multiple Chinese punctuation marks that are not English punctuation marks from the punctuation mark set;

[0104] Multiple Chinese punctuation marks that are not English punctuation marks are identified as the second verification result.

[0105] In one embodiment, when the processor performs the normalization process on the initial code data based on the target verification result, it specifically performs the following operations:

[0106] When the target verification result contains multiple Chinese punctuation marks that are not English punctuation marks, the English punctuation mark corresponding to each Chinese punctuation mark is extracted using a character converter;

[0107] Determine the target position for each Chinese punctuation mark in the initial code data;

[0108] Replace the corresponding English punctuation mark for each Chinese punctuation mark with its corresponding target position to convert the Chinese punctuation mark at the target position into a single character.

[0109] or,

[0110] When the target verification results indicate the existence of erroneous programming keywords, multiple standard keywords associated with each erroneous programming keyword are mapped from the standard keywords in the preset standard programming library.

[0111] Calculate the number of identical letters in each erroneous programming keyword and each standard keyword associated with it, and obtain the number of letters in each standard keyword;

[0112] The standard keyword corresponding to the largest number of letters is determined as the target keyword for each erroneous programming keyword;

[0113] Determine the target location for each erroneous programming keyword in the initial code data;

[0114] Replace the target keyword of each erroneous programming keyword with the target position of each erroneous programming keyword to perform character conversion on the erroneous programming keyword at each target position.

[0115] In this embodiment, the script processing system first generates initial code data based on the script file to be processed upon receiving a save command. Then, it inputs the initial code data into a pre-trained code verification model, outputs the target verification result corresponding to the script file, and finally standardizes the initial code data based on the target verification result to generate an executable script for saving. Because this application verifies each character in the code data corresponding to the script program according to the pre-trained code verification model upon receiving a save command, and standardizes characters that do not meet the requirements, the final executable script program can run normally after deployment. This avoids spending a lot of time on secondary modifications and troubleshooting of the code data when program errors occur, and improves system development efficiency.

[0116] In one embodiment, a medium storing computer-readable instructions is provided, which, when executed by one or more processors, cause the one or more processors to perform the following steps:

[0117] Upon receiving a save command for the script program, initial code data is generated based on the script program file to be processed;

[0118] Input the initial code data into the pre-trained code verification model, and output the target verification result corresponding to the script program file to be processed;

[0119] Based on the target verification results, the initial code data is standardized and an executable script is generated and saved.

[0120] In one embodiment, when the processor executes the initial code data generated based on the script program file to be processed, it specifically performs the following operations:

[0121] Acquire and read target code data from the script program file to be processed;

[0122] Based on the preset Chinese comment editing rules, the Chinese comment portions existing in the target code data are identified and removed to obtain the code content portion;

[0123] The code content portion is designated as the initial code data.

[0124] In one embodiment, when the processor inputs initial code data into a pre-trained code verification model and outputs the target verification result corresponding to the script program file to be processed, it specifically performs the following operations:

[0125] The word segmentation module segments the initial code data according to a pre-built programming dictionary and generates segmentation results;

[0126] The result segmentation module divides the word segmentation results into a set of programming keywords and a set of punctuation marks.

[0127] The verification module verifies whether each programming keyword in the programming keyword set is correct and generates the first verification result.

[0128] The verification module verifies whether each punctuation mark in the punctuation mark set is an English punctuation mark and generates a second verification result.

[0129] The verification module determines the first verification result and the second verification result as the target verification result.

[0130] In one embodiment, when the processor generates a pre-built programming dictionary, it performs the following operations:

[0131] Determine the target programming language used by the script program file to be processed;

[0132] Collect programming language samples of the target programming language and build a cache array;

[0133] Obtain the target character from the programming corpus sample and construct a combination character of the target character and any English character from the preset English character library; wherein, the target character is any character in the programming corpus sample;

[0134] Calculate the cohesion of the combined characters and the randomness of the characters on both sides of the combined characters to generate the left and right adjacency entropy.

[0135] The smaller of the left and right neighbor entropies is selected and multiplied by the cohesion to generate the target judgment value;

[0136] When the target value is greater than the preset threshold, the target character is stored in the cache data;

[0137] The cache array containing the stored data and the preset English character library are integrated to generate a pre-built programming dictionary.

[0138] In one embodiment, when the processor verifies the correctness of each programming keyword in the set of programming keywords and generates a first verification result, it specifically performs the following operations:

[0139] Each programming keyword in the set of programming keywords is vector-encoded to obtain the feature vector of each programming keyword;

[0140] Calculate the feature vector of each programming keyword and the vector similarity between each standard keyword in the preset standard programming library, and determine the standard keywords with a similarity greater than the preset value;

[0141] When the number of standard keywords with a similarity greater than the preset value is 1, generate verification information that all programming keywords in the programming keyword set are correct.

[0142] All correct verification information is selected as the first verification result.

[0143] In one embodiment, when the processor performs a check to verify whether each punctuation mark in the punctuation mark set is an English punctuation mark and generates a second verification result, it specifically performs the following operations:

[0144] A sliding window algorithm is used to create a sliding window, and preset standard English punctuation marks are used as parameters of the sliding window for mapping and association to obtain the target sliding window;

[0145] Each punctuation mark in the punctuation mark set is entered into the target sliding window one by one to determine whether each punctuation mark is an English punctuation mark;

[0146] Output multiple Chinese punctuation marks that are not English punctuation marks from the punctuation mark set;

[0147] Multiple Chinese punctuation marks that are not English punctuation marks are identified as the second verification result.

[0148] In one embodiment, when the processor performs the normalization process on the initial code data based on the target verification result, it specifically performs the following operations:

[0149] When the target verification result contains multiple Chinese punctuation marks that are not English punctuation marks, the English punctuation mark corresponding to each Chinese punctuation mark is extracted using a character converter;

[0150] Determine the target position for each Chinese punctuation mark in the initial code data;

[0151] Replace the corresponding English punctuation mark for each Chinese punctuation mark with its corresponding target position to convert the Chinese punctuation mark at the target position into a single character.

[0152] or,

[0153] When the target verification results indicate the existence of erroneous programming keywords, multiple standard keywords associated with each erroneous programming keyword are mapped from the standard keywords in the preset standard programming library.

[0154] Calculate the number of identical letters in each erroneous programming keyword and each standard keyword associated with it, and obtain the number of letters in each standard keyword;

[0155] The standard keyword corresponding to the largest number of letters is determined as the target keyword for each erroneous programming keyword;

[0156] Determine the target location for each erroneous programming keyword in the initial code data;

[0157] Replace the target keyword of each erroneous programming keyword with the target position of each erroneous programming keyword to perform character conversion on the erroneous programming keyword at each target position.

[0158] In this embodiment, the script processing system first generates initial code data based on the script file to be processed upon receiving a save command. Then, it inputs the initial code data into a pre-trained code verification model, outputs the target verification result corresponding to the script file, and finally standardizes the initial code data based on the target verification result to generate an executable script for saving. Because this application verifies each character in the code data corresponding to the script program according to the pre-trained code verification model upon receiving a save command, and standardizes characters that do not meet the requirements, the final executable script program can run normally after deployment. This avoids spending a lot of time on secondary modifications and troubleshooting of the code data when program errors occur, and improves system development efficiency.

[0159] 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. This computer program can be stored in a computer-readable medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned medium can be a non-volatile medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).

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

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

Claims

1. A method for processing a script program, characterized in that The method includes: When receiving a save instruction for a script program, generating initial code data according to the script program file to be processed; Inputting the initial code data into a pre-trained code verification model, and outputting a target verification result corresponding to the script program file to be processed; Performing standardization processing on the initial code data according to the target verification result, and generating an executable script program for saving; The pre-trained code verification model includes a word segmentation processing module, a result division module, and a verification module; The step of inputting the initial code data into a pre-trained code verification model and outputting a target verification result corresponding to the script program file to be processed includes: The word segmentation processing module performs word segmentation on the initial code data according to a pre-constructed programming dictionary, generating a word segmentation result; the result division module divides the word segmentation result into a programming keyword set and a punctuation symbol set; the verification module verifies whether each programming keyword in the programming keyword set is correct, generating a first verification result; the verification module verifies whether each punctuation symbol in the punctuation symbol set is an English punctuation symbol, generating a second verification result; the verification module determines the first verification result and the second verification result as the target verification result.

2. The method according to claim 1, wherein The step of generating initial code data according to the script program file to be processed includes: Obtaining and reading the target code data in the script program file to be processed; Determining and removing the Chinese comment part existing in the target code data according to a preset Chinese comment editing rule, obtaining a code content part; Determining the code content part as the initial code data.

3. The method according to claim 1, wherein Generating a pre-constructed programming dictionary according to the following steps, including: Determining the target programming language used in the script program file to be processed; Collecting programming corpus samples of the target programming language and constructing a cache array; Obtaining a target character in the programming corpus sample, and constructing a combined character of the target character and any English character in a preset English character library; wherein, the target character is any character in the programming corpus sample; Calculating the cohesion degree of the combined character, and calculating the randomness of the characters on both sides of the combined character, generating a left adjacent entropy and a right adjacent entropy; Selecting the product of the smaller adjacent entropy of the left adjacent entropy and the right adjacent entropy and the cohesion degree, generating a target determination value; When the target determination value is greater than a preset threshold, storing the target character in the cache data; Performing integration processing on the cache array storing data and the preset English character library, generating a pre-constructed programming dictionary.

4. The method according to claim 1, wherein The step of verifying whether each programming keyword in the programming keyword set is correct and generating a first verification result includes: Performing vector encoding on each programming keyword in the programming keyword set, obtaining a feature vector of each programming keyword; Calculating the vector similarity between the feature vector of each programming keyword and each standard keyword in a preset standard programming library, and determining the standard keywords greater than a preset similarity; When the number of standard keywords greater than the preset similarity is 1, generating verification information that all programming keywords in the programming keyword set are correct; Determine all correct verification information as the first verification result.

5. The method according to claim 1, characterized in that, Verifying whether each punctuation mark in the punctuation mark set is an English punctuation mark and generating a second verification result includes: Create a sliding window using the sliding window algorithm and map and associate a preset standard English punctuation mark as a parameter of the sliding window to obtain a target sliding window; Input each punctuation mark in the punctuation mark set into the target sliding window one by one to determine whether each punctuation mark is an English punctuation mark; Output multiple Chinese punctuation marks in the punctuation mark set that are not English punctuation marks; Determine the multiple Chinese punctuation marks that are not English punctuation marks as the second verification result.

6. The method according to claim 5, wherein Standardizing the initial code data according to the target verification result includes: When there are multiple Chinese punctuation marks that are not English punctuation marks in the target verification result, extract the English punctuation mark corresponding to each Chinese punctuation mark according to the character converter; Determine the target position of each Chinese punctuation mark in the initial code data; Replace the English punctuation mark corresponding to each Chinese punctuation mark at its corresponding target position to perform character conversion on the Chinese punctuation mark at the target position; Or, When it is determined that there are incorrect programming keywords according to the target verification result, map multiple standard keywords associated with each incorrect programming keyword from each standard keyword in the preset standard programming library; Calculate the number of identical letters between each incorrect programming keyword and each standard keyword associated with it to obtain the number of letters of each standard keyword; Determine the standard keyword corresponding to the largest number of letters as the target keyword of each incorrect programming keyword; Determine the target position of each incorrect programming keyword in the initial code data; Replace the target keyword of each incorrect programming keyword at the target position of each incorrect programming keyword to perform character conversion on the incorrect programming keyword at each target position.

7. A script program processing system implemented by using the method according to any one of claims 1-6, characterized in that The system includes: An initial code data generation module, configured to generate initial code data according to a to-be-processed script program file when receiving a save instruction of a script program; A target verification result output module, configured to input the initial code data into a pre-trained code verification model and output a target verification result corresponding to the to-be-processed script program file; An executable script program generation module, configured to standardize the initial code data according to the target verification result, generate an executable script program and save it.

8. A computer device, characterized in that, It includes a memory and a processor. Computer-readable instructions are stored in the memory. When the computer-readable instructions are executed by the processor, the processor executes the steps of the script program processing method according to any one of claims 1 to 6.

9. A medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, one or more processors execute the steps of the script program processing according to any one of claims 1 to 6.