File processing method and device, equipment, medium and program product

Through natural language processing and syntax library technology, syntax conversion strategies are determined and applied, and the dynamic adaptation problem of syntax conversion between different SQL dialects is solved, efficient and accurate SQL syntax conversion is achieved, and the smooth execution of database migration is ensured.

CN119415537APending Publication Date: 2025-02-11CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411371585.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

During the database migration process, it is difficult for the prior art to effectively handle syntax conversion between different SQL dialects, especially lacking dynamic adaptability in complex SQL syntax and conversion between multiple SQL dialects.

Method used

Through natural language processing methods, the language characteristics and file semantics of the to be processed are determined, and the syntax conversion strategy is determined based on multiple syntax characteristics in the syntax library, and the strategy is used to syntax conversion of the file content to achieve the target syntax conversion.

Benefits of technology

Fast syntax conversion between different SQL dialects is realized, processing efficiency and accuracy is improved, and the converted target content is consistent with the file semantics of the source file content, thereby ensuring the correctness of the target file.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415537A_ABST
    Figure CN119415537A_ABST
Patent Text Reader

Abstract

The invention provides a file processing method and device, equipment, a medium and a program product, which can be applied to the technical fields of databases, information security and financial science and technology. The method comprises the steps of determining language features and file semantics of a to-be-processed file by utilizing a natural language processing method based on file content of the to-be-processed file; determining a to-be-converted grammar of the to-be-processed file based on the language features; in response to a grammar conversion instruction submitted by a user, determining a target grammar; determining a grammar conversion strategy based on grammar characteristics of the to-be-converted grammar and grammar characteristics of the target grammar under the condition of determining that the grammar library comprises the to-be-converted grammar and the target grammar; performing grammar conversion on the file content of the to-be-processed file by utilizing the grammar conversion strategy to obtain target content; and packaging the target content to obtain a target file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the fields of database, information security, and financial technology, and specifically to a file processing method, device, equipment, medium, and program product. Background Art

[0002] In enterprise information systems, database migration is often required for reasons such as data backup and hardware upgrades. During database migration, it is possible to migrate database tables from a database in a Structured Query Language (SQL) environment to a database in another SQL environment. Due to differences in SQL dialects in different environments, before performing the above migration, it is necessary to perform syntax conversion on the SQL statements in the Extensible Markup Language (XML) file that constructs the database table to ensure that the database migration can be performed smoothly.

[0003] In the process of implementing the present disclosure, the inventors found that the prior art has at least the following problems: when performing syntax conversion between SQL dialects, keyword replacement is usually performed through static rules and regular expressions. Since static rules need to be set in advance, this method lacks dynamic adaptability and cannot effectively handle complex SQL syntax or syntax conversion between multiple SQL dialects. Summary of the invention

[0004] In view of the above problems, the present disclosure provides a file processing method, apparatus, device, medium and program product.

[0005] According to a first aspect of the present disclosure, a file processing method is provided, comprising: determining the language features and file semantics of the file to be processed based on the file content of the file to be processed by using a natural language processing method; determining the grammar to be converted of the file to be processed based on the language features; determining the target grammar in response to a grammar conversion instruction submitted by a user; determining a grammar conversion strategy based on the grammatical features of the grammar to be converted and the grammatical features of the target grammar when it is determined that the grammar library includes the grammar to be converted and the target grammar, wherein the grammar library includes multiple grammars and the grammatical features of each of the multiple grammars, and the grammar library is established after learning sample files written by multiple grammars using a natural language processing method and determining the grammatical features of each of the multiple grammars; performing grammar conversion on the file content of the file to be processed by using the grammar conversion strategy to obtain the target content, wherein the file semantics of the target content is the same as the file semantics of the file to be processed, and the grammar used by the target content is the target grammar; and encapsulating the target content to obtain the target file.

[0006] According to an embodiment of the present disclosure, based on the file content of the file to be processed, a natural language processing method is used to determine the language features and file semantics of the file to be processed, including: based on the file content, a field processing method is used to determine a plurality of statements to be processed included in the file to be processed; a natural language processing method is used to process the plurality of statements to be processed, and sentence features of the plurality of statements to be processed and tree nodes corresponding to a plurality of keywords in each statement to be processed are determined; based on the plurality of sentence features, the language features of the file to be processed are determined; based on the plurality of tree nodes, an abstract syntax tree of each statement to be processed is determined; based on the plurality of abstract syntax trees, sentence characteristics of the statement to be processed are determined; and based on the plurality of sentence characteristics, the file semantics of the file to be processed are determined.

[0007] According to an embodiment of the present disclosure, a syntax conversion strategy is used to perform syntax conversion on the file content of a file to be processed to obtain target content, including: determining the syntax structure of the file content based on an abstract syntax tree; recursively parsing the syntax conversion strategy to obtain a target conversion rule corresponding to the syntax structure, wherein the target conversion rule has a different conversion order from the syntax conversion strategy but the same conversion rule; and using the target conversion rule to process the file content of the file to be processed to obtain the target content.

[0008] According to an embodiment of the present disclosure, each sample file includes one or more sample sentences written by a grammar and sample annotations corresponding to the sample sentences; the grammar library is determined in the following manner: for each grammar, one or more sample files written by the grammar are processed using a natural language processing method to determine the sentence characteristics of each sample sentence, wherein the sentence characteristics are determined based on the sample annotations corresponding to the sample sentence; when the number of sentence characteristics is greater than a preset number, the grammatical characteristics of the grammar are determined based on multiple sentence characteristics; and the grammar library is determined based on the grammatical characteristics of each of the multiple grammars.

[0009] According to an embodiment of the present disclosure, the file processing method also includes: using a reinforcement learning model and a graph neural network to determine the running performance of the target content; when it is determined that the running performance needs to be improved, determining optimization suggestions for the target content based on the reinforcement learning model and the graph neural network; and sending the optimization suggestions to the user.

[0010] According to an embodiment of the present disclosure, when it is determined that the running performance needs to be improved, based on the reinforcement learning model and the graph neural network, optimization suggestions for the target content are determined, including: based on the reinforcement learning model, determining the reinforcement reward of each of multiple alternative grammar conversion strategies; from the multiple alternative grammar conversion strategies, determining a conversion optimization suggestion, wherein the reinforcement reward of the conversion optimization suggestion is the largest among the reinforcement rewards of each of the multiple alternative grammar conversion strategies; based on the graph neural network, determining multiple index generation strategies and the improvement of the running performance of each of the multiple index generation strategies; based on the multiple improvement situations, determining the index optimization suggestion from the multiple index generation strategies; and determining the optimization suggestion for the target content based on the conversion optimization suggestion and the index optimization suggestion.

[0011] According to an embodiment of the present disclosure, the file processing method also includes: performing static code analysis on the target content to determine the correctness analysis result of the target content; when the correctness analysis result indicates that there is an error in the target content, using an error detection method corresponding to the target grammar to determine the error category of the error; based on the error category and the target grammar, determining repair suggestions for the target content; and sending the repair suggestions to the user.

[0012] A second aspect of the present disclosure provides a file processing device, comprising:

[0013] A semantic determination module, used to determine the language features and file semantics of the file to be processed based on the file content of the file to be processed by using a natural language processing method;

[0014] A first grammar determination module, used for determining the grammar to be converted of the file to be processed based on the language features;

[0015] A second grammar determination module, configured to determine a target grammar in response to a grammar conversion instruction submitted by a user;

[0016] a strategy determination module, for determining a grammar conversion strategy based on the grammar characteristics of the grammar to be converted and the grammar characteristics of the target grammar when it is determined that the grammar library includes a grammar to be converted and a target grammar, wherein the grammar library includes a plurality of grammars and the grammar characteristics of each of the plurality of grammars, and the grammar library is established after learning sample files written by the plurality of grammars using a natural language processing method and determining the grammar characteristics of each of the plurality of grammars;

[0017] A syntax conversion module, used for performing syntax conversion on the file content of the to-be-processed file using the syntax conversion strategy to obtain target content, wherein the file semantics of the target content is the same as the file semantics of the to-be-processed file, and the syntax used by the target content is the target syntax; and

[0018] The file encapsulation module is used to encapsulate the target content to obtain the target file.

[0019] A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.

[0020] The fourth aspect of the present disclosure further provides a computer-readable storage medium having a computer program or instructions stored thereon, which implements the steps of the above method when the above computer program or instructions are executed by a processor.

[0021] The fifth aspect of the present disclosure further provides a computer program product, including a computer program or instructions, which implement the steps of the above method when the above computer program or instructions are executed by a processor.

[0022] According to an embodiment of the present disclosure, a natural language processing method is used to process the file content of a file to be processed, determine the language features and file semantics of the file to be processed, and determine the grammar to be converted. The target grammar is determined according to the grammar conversion instruction of the user. According to the grammar library, the grammar conversion strategy required to convert the file content from the grammar to be converted to the target grammar is determined, and the file content is subjected to grammar conversion to obtain the target content and encapsulate the target file. By using a grammar library including multiple grammars, conversion between multiple dialects of the same programming language can be achieved, making the conversion range wider and the application more flexible. By using a grammar conversion strategy, fast grammar conversion between different dialects can be achieved, improving processing efficiency and accuracy. In addition, it can also ensure that the converted target content is consistent with the file semantics of the file content, thereby ensuring the correctness of the target file. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The above contents and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0024] Figure 1 The application scenario diagram of the file processing method, apparatus, device, medium and program product according to the embodiment of the present disclosure is schematically shown;

[0025] Figure 2 A flowchart of a file processing method according to an embodiment of the present disclosure is schematically shown;

[0026] Figure 3 A schematic diagram of an abstract syntax tree according to an embodiment of the present disclosure is schematically shown;

[0027] Figure 4 A structural block diagram schematically shows a file processing device according to an embodiment of the present disclosure; and

[0028] Figure 5A block diagram of an electronic device suitable for implementing a file processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0029] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.

[0030] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0031] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0032] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0033] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0034] In the technical solution of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0035] In the scenario of using personal information for automated decision-making, the methods, devices, and systems provided by the embodiments of the present disclosure provide users with corresponding operation portals for users to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered. The expression "automated decision-making" here refers to the activity of automatically analyzing and evaluating a person's behavioral habits, interests and hobbies, or economic, health, credit status, etc. through computer programs, and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by people who specialize in a certain field, have specialized experience, knowledge and skills, and have reached a certain level of professionalism.

[0036] An embodiment of the present disclosure provides a file processing method, which determines the language features and file semantics of the file to be processed based on the file content of the file to be processed by using a natural language processing method; determines the grammar to be converted of the file to be processed based on the language features; determines the target grammar in response to a grammar conversion instruction submitted by a user; when it is determined that a grammar library includes the grammar to be converted and the target grammar, determines a grammar conversion strategy based on the grammatical characteristics of the grammar to be converted and the grammatical characteristics of the target grammar, wherein the grammar library includes multiple grammars and the grammatical characteristics of each of the multiple grammars, and the grammar library is established after learning sample files written by multiple grammars using a natural language processing method and determining the grammatical characteristics of each of the multiple grammars; performs grammar conversion on the file content of the file to be processed using the grammar conversion strategy to obtain the target content, wherein the file semantics of the target content is the same as the file semantics of the file to be processed, and the grammar used by the target content is the target grammar; and encapsulates the target content to obtain the target file.

[0037] Figure 1 The application scenario diagram of the file processing method, apparatus, device, medium and program product according to the embodiments of the present disclosure is schematically shown.

[0038] like Figure 1As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0039] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0040] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0041] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.

[0042] It should be noted that the file processing method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the file processing device provided in the embodiment of the present disclosure can generally be set in the server 105. The file processing method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Accordingly, the file processing device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.

[0043] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0044] The following will be based on Figure 1 The scene described by Figure 2~Figure 3 The file processing method of the disclosed embodiment is described in detail.

[0045] Figure 2 The flowchart of the file processing method according to the embodiment of the present disclosure is schematically shown.

[0046] like Figure 2 As shown, the file processing method of this embodiment includes operations S210 to S260.

[0047] In operation S210, based on the file content of the file to be processed, a natural language processing method is used to determine the language features and file semantics of the file to be processed.

[0048] According to an embodiment of the present disclosure, the file format of the to-be-processed file may be an XML file. XML is a markup language that allows users to define their own tags. An XML file may include tags. Different tags define different structures and meanings of the data inside the tags. The file content of an XML file may include tags and tag sub-contents inside the tags.

[0049] According to an embodiment of the present disclosure, a file to be processed is read, and the file content of the file to be processed is obtained, and the file content is first extracted according to the tags using a string processing method to obtain multiple sub-contents. A natural language processing method is used to process the multiple sub-contents, determine the language features of the sub-content applications, and determine the meanings represented by the sub-contents, thereby determining the language features and file semantics of the file to be processed.

[0050] In operation S220 , based on the language features, a grammar to be converted of the file to be processed is determined.

[0051] According to an embodiment of the present disclosure, language features can be used to determine the dialect category of a language. For example, language features can include grammatical rules, functions and operators, data types, etc. used in the language. According to the operator of the language, it is determined that the operator is specific to a certain dialect, thereby determining the dialect category of the language. Therefore, based on the language features of the file to be processed, the grammar to be converted of the file to be processed can be determined.

[0052] In operation S230, a target grammar is determined in response to a grammar conversion instruction submitted by a user.

[0053] According to an embodiment of the present disclosure, the grammar conversion instruction submitted by the user may include converting the file to be converted into a target file of other dialect categories. Therefore, according to the grammar conversion instruction, the target grammar may be determined.

[0054] In operation S240, when it is determined that the grammar library includes a grammar to be converted and a target grammar, a grammar conversion strategy is determined based on grammatical characteristics of the grammar to be converted and grammatical characteristics of the target grammar.

[0055] According to an embodiment of the present disclosure, the grammar library includes multiple grammars and grammatical characteristics of each of the multiple grammars. The grammar library is established by learning sample files written by multiple grammars using a natural language processing method and determining the grammatical characteristics of each of the multiple grammars.

[0056] According to an embodiment of the present disclosure, it is determined whether the grammar library includes the grammar to be converted and the target grammar. In the case that the grammar library includes the grammar to be converted or the target grammar, the grammar library is used to respectively determine the grammatical characteristics of the grammar to be converted and the grammatical characteristics of the target grammar, and a grammar conversion strategy is determined based on the grammatical characteristics of the grammar to be converted and the grammatical characteristics of the target grammar, wherein the grammar conversion strategy includes the correspondence between multiple semantic statements in the grammar to be converted and the target grammar.

[0057] In operation S250, a syntax conversion strategy is used to perform syntax conversion on the file content of the to-be-processed file to obtain target content.

[0058] According to an embodiment of the present disclosure, a syntax conversion strategy is used to perform syntax conversion on the file content of the file to be processed. Since the syntax conversion strategy includes the correspondence between statements of multiple semantics, it is possible to determine the expression of the semantics corresponding to the content under the target syntax based on the file content of the file to be processed, so that the file semantics of the target content are the same as those of the file to be processed, and the syntax used by the target content is the target syntax.

[0059] In operation S260, the target content is packaged to obtain a target file.

[0060] According to an embodiment of the present disclosure, in a file to be processed, the file content is replaced with target content having the same semantics as the file content, and the replaced file is then saved and encapsulated according to the same file structure as the file to be processed to obtain a target file, wherein the target file includes the target content, and the file format of the target file is the same as the file format of the file to be processed.

[0061] According to an embodiment of the present disclosure, a natural language processing method is used to process the file content of a file to be processed, determine the language features and file semantics of the file to be processed, and determine the grammar to be converted. The target grammar is determined according to the grammar conversion instruction of the user. According to the grammar library, the grammar conversion strategy required to convert the file content from the grammar to be converted to the target grammar is determined, and the file content is subjected to grammar conversion to obtain the target content and encapsulate the target file. By using a grammar library including multiple grammars, conversion between multiple dialects of the same programming language can be achieved, making the conversion range wider and the application more flexible. By using a grammar conversion strategy, fast grammar conversion between different dialects can be achieved, improving processing efficiency and accuracy. In addition, it can also ensure that the converted target content is consistent with the file semantics of the file content, thereby ensuring the correctness of the target file.

[0062] According to an embodiment of the present disclosure, based on the file content of the file to be processed, a natural language processing method is used to determine the language features and file semantics of the file to be processed, including: based on the file content, a field processing method is used to determine a plurality of statements to be processed included in the file to be processed; a natural language processing method is used to process the plurality of statements to be processed, and sentence features of the plurality of statements to be processed and tree nodes corresponding to a plurality of keywords in each statement to be processed are determined; based on the plurality of sentence features, the language features of the file to be processed are determined; based on the plurality of tree nodes, an abstract syntax tree of each statement to be processed is determined; based on the plurality of abstract syntax trees, sentence characteristics of the statement to be processed are determined; and based on the plurality of sentence characteristics, the file semantics of the file to be processed are determined.

[0063] According to an embodiment of the present disclosure, a field processing method is used to segment the file content to obtain a plurality of to-be-processed statements included in the to-be-processed file. For example, when the to-be-processed file is an XML file, the plurality of to-be-processed statements are divided by a start tag and an end tag, so the field processing method can be used to identify the start tag and the end tag, and the file content between the start tag and the end tag can be determined as the to-be-processed statement.

[0064] According to an embodiment of the present disclosure, a plurality of sentences to be processed are processed using a natural language processing method to determine keywords of each of the plurality of sentences to be processed, wherein the keywords may include identifiers.

[0065] According to an embodiment of the present disclosure, regular expressions and finite state machines may also be used to perform lexical analysis, thereby determining keywords of each of the plurality of statements to be processed.

[0066] According to the embodiments of the present disclosure, the sentence features of the sentence to be processed can be determined according to the category of the keyword, and the positional relationship and hierarchical relationship between the multiple tree nodes after the multiple keywords are abstracted as tree nodes can be determined according to the relationship between the multiple keywords. The sentence features of the sentence to be processed can be used to characterize the grammar that may be applied to the sentence to be processed.

[0067] According to the embodiments of the present disclosure, since multiple languages ​​may have the same expression method on a certain clause, using only the sentence features of one sentence to be processed may not accurately determine the grammar of the file to be processed. The language features of the file to be processed can be determined based on multiple sentence features, wherein the language features can be used to characterize the grammar of the file to be processed. The sentence features of multiple sentences to be processed can better reflect the characteristics of the grammar of the file to be processed, thereby accurately determining the sentence to be processed and the grammar of the file to be processed.

[0068] According to an embodiment of the present disclosure, a tree structure is constructed based on a plurality of tree nodes and a positional relationship and a hierarchical relationship between the plurality of tree nodes, so as to determine an abstract syntax tree for each statement to be processed, wherein an abstract syntax tree (AST) is a tree-like representation of source code, which can be used to represent the structure and relationship of building blocks of a programming language in the code.

[0069] According to an embodiment of the present disclosure, based on multiple abstract syntax trees, the grammatical structure of each statement to be processed can be analyzed, and based on the grammatical structure and keywords, the hierarchical relationship of each statement to be processed when it is executed can be intuitively determined, thereby determining the statement characteristics of the statement to be processed, wherein the statement characteristics can be used to characterize the execution target of the statement to be processed.

[0070] According to an embodiment of the present disclosure, based on multiple statement characteristics, the effects achieved when multiple statements to be processed in a file to be processed are executed can be determined, thereby determining the file semantics of the file to be processed.

[0071] According to an embodiment of the present disclosure, a file to be processed is processed, a plurality of sentences to be processed are determined, and the sentences to be processed are analyzed using a natural language processing method, so as to accurately determine the sentence features of the sentences to be processed and the tree nodes corresponding to the plurality of keywords in the sentences to be processed, and the language features of the file to be processed are determined according to the sentence features. An abstract syntax tree of the sentences to be processed is constructed according to the plurality of tree nodes, and the sentence features of the sentences to be processed are determined based on the abstract syntax tree, and the semantics of the files to be processed are further determined. The language structure of the sentences to be processed can be determined more clearly through the abstract syntax tree, thereby improving the accuracy of the sentence features and the file semantics.

[0072] According to an embodiment of the present disclosure, a syntax conversion strategy is used to perform syntax conversion on the file content of a file to be processed to obtain target content, including: determining the syntax structure of the file content based on an abstract syntax tree; recursively parsing the syntax conversion strategy to obtain a target conversion rule corresponding to the syntax structure, wherein the target conversion rule has a different conversion order from the syntax conversion strategy but the same conversion rule; and using the target conversion rule to process the file content of the file to be processed to obtain the target content.

[0073] According to an embodiment of the present disclosure, based on an abstract syntax tree, the grammatical structure of the file content is determined, and according to the grammatical structure, the grammatical conversion strategy is recursively parsed from top to bottom, and from the grammatical conversion strategy, multiple sub-conversion rules corresponding to the hierarchical relationship of the grammatical structure are determined one by one, and according to the multiple sub-conversion rules and the order between the multiple sub-conversion rules, the target conversion rule corresponding to the grammatical structure is determined, and the file content of the file to be processed is processed using the target conversion rule to obtain the target content.

[0074] According to an embodiment of the present disclosure, an abstract syntax tree can also be constructed through a context-free grammar, and the abstract syntax tree can be converted into a file structure of a file to be processed. Then, according to the grammatical characteristics of the target grammar, pattern matching technology can be used to convert the file content of the file to be processed into target content based on the file structure of the file to be processed.

[0075] According to the embodiments of the present disclosure, the grammatical structure of the file content is determined using an abstract syntax tree, and the syntax conversion strategy is adjusted based on the syntax structure to determine the target conversion rule so as to process the file content to obtain the target content. Through the abstract syntax tree, the grammatical structure can be determined more accurately and quickly, so that the target conversion rule obtained based on the grammatical structure adjustment accurately corresponds to the file content, thereby ensuring that the file content can be accurately processed using the target conversion rule, and improving the efficiency and accuracy of file processing.

[0076] Figure 3 The figure schematically shows a schematic diagram of an abstract syntax tree according to an embodiment of the present disclosure.

[0077] like Figure 3As shown in the figure, an abstract syntax tree is constructed based on the statement to be processed "select username,ismale from userInfo whereage>20 and ROWNUM<=5 and 1=1", where the function of the SQL statement can be determined to be a query based on the keyword "select", so the root node of the abstract syntax tree is "query statement". Through analysis, it can be determined that characters such as select, from, where, and, >, <=, =, etc. are keywords of the SQL statement, username and ismale are the contents introduced by select, which are the result columns corresponding to the query, userinfo is the content introduced by from, which is the target data table for the query, age, 20, ROWNUM, 5, 1, 1 are the contents introduced by where, which are the query conditions, so multiple tree nodes of the SQL statement and the hierarchical relationship between multiple tree nodes can be determined, thereby constructing an abstract syntax tree.

[0078] According to the abstract syntax tree, the syntax structure of the SQL statement can be determined. Further analysis shows that ROWNUM is a syntax specific to Oracle, so the syntax of the statement to be processed is Oracle. When it is converted to the target syntax MySQL, according to the syntax characteristics of the two syntaxes saved in the syntax library, it can be determined that "ROWNUM<=" is semantically equivalent to LIMIT in MySQL. Therefore, the syntax of the statement to be processed can be converted to obtain the target content "select username, ismailefrom userInfo where age>20 and 1=1 LIMIT 5".

[0079] According to an embodiment of the present disclosure, each sample file includes one or more sample sentences written by a grammar and sample annotations corresponding to the sample sentences; the grammar library is determined in the following manner: for each grammar, one or more sample files written by the grammar are processed using a natural language processing method to determine the sentence characteristics of each sample sentence, wherein the sentence characteristics are determined based on the sample annotations corresponding to the sample sentence; when the number of sentence characteristics is greater than a preset number, the grammatical characteristics of the grammar are determined based on multiple sentence characteristics; and the grammar library is determined based on the grammatical characteristics of each of the multiple grammars.

[0080] According to an embodiment of the present disclosure, for each grammar, one or more sample files are used to determine the grammatical characteristics of the grammar, so as to add the grammar to the grammar library. A natural language processing method is used to determine the sentence characteristics of each of the multiple sample sentences based on the sample annotations of each of the multiple sample sentences, and to determine the keywords in the sample sentences based on the sample sentences with the same sentence characteristics.

[0081] According to an embodiment of the present disclosure, when the number of sentence features is greater than a preset number, the grammatical features of the grammar are determined based on the multiple sentence features using a natural language processing method. When the grammar library has not yet been determined, the grammar library is determined based on the grammatical features of the multiple grammars. When the grammar library has been determined, the grammatical features of one or more grammars are added to the grammar library.

[0082] According to an embodiment of the present disclosure, when the grammar library does not include the grammar to be converted or the target grammar, the above operations can be used to use a sample file written by the grammar to be converted or the target grammar to determine the grammatical characteristics of the grammar to be converted or the target grammar, and expand the types of dialects included in the grammar library.

[0083] According to an embodiment of the present disclosure, a sample file is analyzed to determine the grammatical characteristics of a grammar, and a grammar library is determined based on the grammatical characteristics of multiple grammars, so that the grammatical characteristics in the grammar library can accurately correspond to the grammar. When the number of sentence characteristics is greater than a preset number, the grammatical characteristics are further determined, thereby ensuring that the grammatical characteristics include sufficient sentence characteristics, thereby improving the accuracy of the grammatical characteristics in the grammar library.

[0084] According to an embodiment of the present disclosure, the file processing method also includes: using a reinforcement learning model and a graph neural network to determine the running performance of the target content; when it is determined that the running performance needs to be improved, determining optimization suggestions for the target content based on the reinforcement learning model and the graph neural network; and sending the optimization suggestions to the user.

[0085] According to an embodiment of the present disclosure, a reinforcement learning model is used to process target content and determine the operating performance of the target content, wherein the input parameters of the reinforcement learning may include reinforcement state, reinforcement action, and reinforcement reward, the reinforcement state includes the file to be processed or the statement to be processed, the reinforcement action includes the target conversion rule, and the reinforcement reward includes the performance improvement of executing the target content relative to executing the content to be processed. Therefore, after the reinforcement state and reinforcement action are input into the reinforcement learning model, the model can output the predicted performance improvement of executing the target content relative to executing the content to be processed, and the operating performance of the target content can be determined according to the performance of executing the content to be processed and the output result of the model.

[0086] According to an embodiment of the present disclosure, a graph neural network is used to process target content, and a target abstract syntax tree corresponding to the target content is established, wherein the tree nodes of the target abstract syntax tree include keywords, operators, etc., and the edges between the tree nodes represent the relationship between elements such as keywords and operators. The tree nodes may also include elements such as database tables and database columns. Based on the database tables and database columns, the graph neural network may determine the indexing performance of the target content after indexing different database columns.

[0087] According to the embodiments of the present disclosure, the running performance of the target content obtained by the reinforcement learning model and the graph neural network and the index running performance of the target content are compared. When the index running performance is better than the running performance, it can be determined that the running performance needs to be improved, and based on the reinforcement learning model and the graph neural network, optimization suggestions for the target content are determined and sent to the user.

[0088] According to an embodiment of the present disclosure, a reinforcement learning model and a graph neural network are used to determine the operating performance of the target content, and to determine whether the operating performance needs to be improved. When it is determined that the operating performance needs to be improved, optimization suggestions for the target content are determined based on the operating results of the reinforcement learning and graph neural network. The model can accurately calculate the operating performance of the target content, and accurately determine whether the operating performance needs to be improved. Further, when the operating performance needs to be improved, optimization suggestions for the target content can be determined based on the operating results of the model. Without manual analysis and experimentation, optimization suggestions can be obtained through automated analysis, which can reduce labor costs and improve the efficiency and automation of file processing.

[0089] According to an embodiment of the present disclosure, when it is determined that the running performance needs to be improved, based on the reinforcement learning model and the graph neural network, optimization suggestions for the target content are determined, including: based on the reinforcement learning model, determining the reinforcement reward of each of multiple alternative grammar conversion strategies; from the multiple alternative grammar conversion strategies, determining a conversion optimization suggestion, wherein the reinforcement reward of the conversion optimization suggestion is the largest among the reinforcement rewards of each of the multiple alternative grammar conversion strategies; based on the graph neural network, determining multiple index generation strategies and the improvement of the running performance of each of the multiple index generation strategies; based on the multiple improvement situations, determining the index optimization suggestion from the multiple index generation strategies; and determining the optimization suggestion for the target content based on the conversion optimization suggestion and the index optimization suggestion.

[0090] According to an embodiment of the present disclosure, the reinforcement learning model can also determine multiple alternative grammar conversion strategies based on the grammar conversion strategy, wherein the multiple alternative grammar conversion strategies have a different conversion order from the grammar conversion strategy but the same conversion rules, and the order of multiple conversion rules in the grammar conversion strategy can be arbitrarily adjusted to determine the alternative grammar conversion strategy.

[0091] According to an embodiment of the present disclosure, an alternative grammar conversion strategy is input as a reinforcement action into a reinforcement learning model, and a reinforcement reward is output, that is, the performance improvement of executing the content converted by the alternative grammar conversion strategy relative to executing the content to be processed. In the case where the reinforcement reward of the alternative grammar conversion strategy is higher than the reinforcement reward of the target conversion rule, a conversion optimization suggestion is determined based on the alternative grammar conversion strategy with the largest reinforcement reward.

[0092] According to an embodiment of the present disclosure, based on an abstract syntax tree, multiple columns of a database are determined, and multiple index generation strategies are determined based on the multiple columns, wherein the index generation strategy includes establishing an index based on one or more columns in the database. Using a graph neural network, the respective index operation performance after establishing the index according to the multiple index generation strategies is determined, and based on the index operation performance and the operation performance of the target operation, the improvement of the operation performance by each of the multiple index generation strategies is determined.

[0093] According to an embodiment of the present disclosure, when there is a positive improvement in the running performance among multiple improvement situations, the improvement situation that represents the greatest positive improvement is determined. From multiple index generation strategies, an index generation strategy corresponding to the improvement situation with the greatest positive improvement is determined, and an index optimization suggestion is generated based on the index generation strategy.

[0094] According to an embodiment of the present disclosure, optimization suggestions for target content are determined based on conversion optimization suggestions and index optimization suggestions.

[0095] According to the embodiments of the present disclosure, a reinforcement learning model is used to determine conversion optimization suggestions, a graph neural network is used to determine index optimization suggestions, and further based on the conversion optimization suggestions and the index optimization suggestions, optimization suggestions for the target content are determined. Since both the optimization suggestions for the grammatical conversion strategy and the optimization suggestions for indexing are considered at the same time, the comprehensiveness of the optimization suggestions can be ensured, thereby improving the execution performance of the target content after the target content is optimized based on the optimization suggestions.

[0096] According to an embodiment of the present disclosure, the file processing method also includes: performing static code analysis on the target content to determine the correctness analysis result of the target content; when the correctness analysis result indicates that there is an error in the target content, using an error detection method corresponding to the target grammar to determine the error category of the error; based on the error category and the target grammar, determining repair suggestions for the target content; and sending the repair suggestions to the user.

[0097] According to an embodiment of the present disclosure, static code analysis technology is used to detect the target content and determine the correctness analysis result of the target content. When the correctness analysis result indicates that there are errors in the target content, an error detection method corresponding to the target syntax is used to determine the error category of the error, where the error category may include syntax errors, data type errors, etc.

[0098] According to an embodiment of the present disclosure, based on the error category and the target grammar, repair suggestions for the target content are determined and sent to the user, wherein, in the case where the error category is a syntax error, the repair suggestion may include an error code where the syntax error exists and a corrected code corresponding to the error code, and in the case where the error category is a data type error, the repair suggestion may include a database column or database table where the data type error exists and the correct data type of the data type of the database column or database table.

[0099] According to an embodiment of the present disclosure, correctness analysis is performed to determine whether there are errors in the target content and the category of the error so that repair suggestions can be sent to the user based on the error category and the target syntax. This can repair errors caused in the file processing process or errors originally contained in the file to be processed, avoid errors in the processed target file, and improve the accuracy of file processing.

[0100] According to an embodiment of the present disclosure, a user can perform various file processing operations through a file processing interface, wherein the file processing interface may include an input area, a selection area, an output area, a correctness analysis area, an optimization suggestion area, and a repair suggestion area, etc. A user can upload a file by dragging the file to be processed to the input area, the selection area includes multiple syntaxes, and the user can select the target syntax therein, and after the file processing is completed, the target file is output to the output area, the correctness analysis area can be used to display the correctness analysis results, the optimization suggestion area can be used to display optimization suggestions for the target content, and the repair suggestion area can be used to display repair suggestions for the target content.

[0101] Based on the above-mentioned file processing method, the present disclosure also provides a file processing device. Figure 4 The device is described in detail.

[0102] Figure 4 The structural block diagram of a file processing device according to an embodiment of the present disclosure is schematically shown.

[0103] like Figure 4 As shown, the file processing device 400 of this embodiment includes a semantic determination module 410 , a first grammar determination module 420 , a second grammar determination module 430 , a policy determination module 440 , a grammar conversion module 450 and a file encapsulation module 460 .

[0104] The semantic determination module 410 is used to determine the language features and file semantics of the file to be processed based on the file content of the file to be processed by using a natural language processing method. In one embodiment, the semantic determination module 410 can be used to perform the operation S210 described above, which will not be repeated here.

[0105] The first grammar determination module 420 is used to determine the grammar to be converted of the to-be-processed file based on the language features. In one embodiment, the first grammar determination module 420 can be used to perform the operation S220 described above, which will not be described in detail here.

[0106] The second grammar determination module 430 is used to determine the target grammar in response to the grammar conversion instruction submitted by the user. In one embodiment, the second grammar determination module 430 can be used to perform the operation S230 described above, which will not be described in detail here.

[0107] The strategy determination module 440 is used to determine the grammar conversion strategy based on the grammar characteristics of the grammar to be converted and the grammar characteristics of the target grammar when it is determined that the grammar library includes the grammar to be converted and the target grammar, wherein the grammar library includes multiple grammars and the grammar characteristics of each of the multiple grammars, and the grammar library is established after learning sample files written by multiple grammars using a natural language processing method and determining the grammar characteristics of each of the multiple grammars. In one embodiment, the strategy determination module 440 can be used to perform the operation S240 described above, which will not be repeated here.

[0108] The syntax conversion module 450 is used to perform syntax conversion on the file content of the to-be-processed file using the syntax conversion strategy to obtain the target content, wherein the file semantics of the target content is the same as the file semantics of the to-be-processed file, and the syntax used by the target content is the target syntax. In one embodiment, the syntax conversion module 450 can be used to perform the operation S250 described above, which will not be repeated here.

[0109] The file encapsulation module 460 is used to encapsulate the target content to obtain the target file. In one embodiment, the file encapsulation module 460 can be used to perform the operation S260 described above, which will not be described in detail here.

[0110] According to an embodiment of the present disclosure, the semantic determination module 410 includes a sentence determination submodule, a node determination submodule, a feature determination submodule, a syntax tree determination submodule, a property determination submodule, and a semantic determination submodule.

[0111] The statement determination submodule is used to determine multiple statements to be processed included in the file to be processed based on the file content and using a field processing method.

[0112] The node determination submodule is used to process multiple sentences to be processed using a natural language processing method, determine the sentence features of each of the multiple sentences to be processed and the tree nodes corresponding to the multiple keywords in each sentence to be processed.

[0113] The feature determination submodule is used to determine the language features of the file to be processed based on multiple sentence features.

[0114] The syntax tree determination submodule is used to determine the abstract syntax tree of each statement to be processed based on multiple tree nodes.

[0115] The feature determination submodule is used to determine the statement features of the statement to be processed based on multiple abstract syntax trees.

[0116] The semantic determination submodule is used to determine the file semantics of the file to be processed based on multiple statement features.

[0117] According to an embodiment of the present disclosure, the grammar conversion module 450 includes a structure determination submodule, a rule determination submodule and a grammar conversion submodule.

[0118] The structure determination submodule is used to determine the grammatical structure of the file content based on the abstract syntax tree.

[0119] The rule determination submodule is used to recursively parse the grammar conversion strategy to obtain a target conversion rule corresponding to the grammar structure, wherein the target conversion rule and the grammar conversion strategy have different conversion orders but the same conversion rules.

[0120] The grammar conversion submodule is used to process the file content of the to-be-processed file using the target conversion rule to obtain the target content.

[0121] According to an embodiment of the present disclosure, the grammar library is determined by using the following modules: a natural language processing module, a grammar characteristic determination module, and a grammar library determination module.

[0122] The natural language processing module is used to process one or more sample files written by the grammar using a natural language processing method for each grammar, and determine the sentence characteristics of each sample sentence, wherein the sentence characteristics are determined based on sample annotations corresponding to the sample sentences.

[0123] The grammatical characteristic determination module is used to determine the grammatical characteristic of the grammar based on the plurality of sentence characteristics when the number of sentence characteristics is greater than a preset number.

[0124] The grammar library determination module is used to determine the grammar library based on the grammar characteristics of each of the multiple grammars.

[0125] According to an embodiment of the present disclosure, the file processing device further includes a performance determination module, a first suggestion generation module and a first suggestion sending module.

[0126] The performance determination module is used to determine the operating performance of the target content using a reinforcement learning model and a graph neural network.

[0127] The first suggestion generation module is used to determine optimization suggestions for target content based on the reinforcement learning model and graph neural network when it is determined that the operating performance needs to be improved.

[0128] The first suggestion sending module is used to send optimization suggestions to the user.

[0129] According to an embodiment of the present disclosure, the first suggestion generation module includes a reward determination submodule, a conversion suggestion determination submodule, a promotion determination submodule, an index suggestion determination submodule and a first suggestion generation submodule.

[0130] The reward determination submodule is used to determine the reinforcement rewards of multiple alternative grammar conversion strategies based on the reinforcement learning model.

[0131] The conversion suggestion determination submodule is used to determine a conversion optimization suggestion from a plurality of candidate grammar conversion strategies, wherein the reinforcement reward of the conversion optimization suggestion is the largest among the reinforcement rewards of the plurality of candidate grammar conversion strategies.

[0132] The improvement determination submodule is used to determine multiple index generation strategies and the improvement of the operating performance of each of the multiple index generation strategies based on the graph neural network.

[0133] The index suggestion determination submodule is used to determine index optimization suggestions from multiple index generation strategies based on multiple improvement situations.

[0134] The first suggestion generation submodule is used to determine optimization suggestions for target content based on the conversion optimization suggestions and the index optimization suggestions.

[0135] According to an embodiment of the present disclosure, the file processing device further includes a correctness analysis module, an error category determination module, a second suggestion generation module and a second suggestion sending module.

[0136] The correctness analysis module is used to perform static code analysis on the target content and determine the correctness analysis result of the target content.

[0137] The error category determination module is used to determine the error category of the error by using an error detection method corresponding to the target grammar when the correctness analysis result indicates that there is an error in the target content.

[0138] The second suggestion generation module is used to determine repair suggestions for the target content based on the error category and the target grammar.

[0139] The second suggestion sending module is used to send the repair suggestion to the user.

[0140] According to an embodiment of the present disclosure, any multiple modules of the semantic determination module 410, the first grammar determination module 420, the second grammar determination module 430, the policy determination module 440, the grammar conversion module 450 and the file encapsulation module 460 can be combined in one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the semantic determination module 410, the first grammar determination module 420, the second grammar determination module 430, the policy determination module 440, the grammar conversion module 450 and the file encapsulation module 460 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of the semantic determination module 410, the first grammar determination module 420, the second grammar determination module 430, the policy determination module 440, the grammar conversion module 450 and the file encapsulation module 460 can be at least partially implemented as a computer program module, which can perform the corresponding function when the computer program module is executed.

[0141] Figure 5 A block diagram of an electronic device suitable for implementing a file processing method according to an embodiment of the present disclosure is schematically shown.

[0142] like Figure 5 As shown, the electronic device 500 according to an embodiment of the present disclosure includes a processor 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 to a random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an onboard memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0143] In RAM 503, various programs and data required for the operation of electronic device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.

[0144] According to an embodiment of the present disclosure, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The electronic device 500 may further include one or more of the following components connected to the input / output (I / O) interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.

[0145] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0146] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 502 and / or RAM 503 described above and / or one or more memories other than ROM 502 and RAM 503.

[0147] The embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the file processing method provided by the embodiment of the present disclosure.

[0148] The above functions defined in the system / device of the embodiment of the present disclosure are performed when the computer program is executed by the processor 501. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0149] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 509, and / or installed from the removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0150] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above functions defined in the system of the embodiment of the present disclosure are performed. According to the embodiment of the present disclosure, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.

[0151] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).

[0152] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0153] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.

[0154] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.

Claims

1. A file processing method, characterized in that: The method comprises: Based on the file content of the to-be-processed file, using a natural language processing method, determining the language features and file semantics of the to-be-processed file; Based on the language features, determining the grammar to be converted of the file to be processed; In response to a grammar conversion instruction submitted by a user, determining a target grammar; In the case where it is determined that the grammar library includes the grammar to be converted and the target grammar, a grammar conversion strategy is determined based on the grammatical characteristics of the grammar to be converted and the grammatical characteristics of the target grammar, wherein the grammar library includes a plurality of grammars and the grammatical characteristics of each of the plurality of grammars, and the grammar library is established after learning sample files written by the plurality of grammars using the natural language processing method and determining the grammatical characteristics of each of the plurality of grammars; Performing syntax conversion on the file content of the to-be-processed file using the syntax conversion strategy to obtain target content, wherein the file semantics of the target content is the same as the file semantics of the to-be-processed file, and the syntax used by the target content is the target syntax; and The target content is packaged to obtain a target file.

2. The method according to claim 1, characterized in that The determining of the language features and file semantics of the file to be processed by using a natural language processing method based on the file content of the file to be processed includes: Based on the file content, determine a plurality of to-be-processed statements included in the to-be-processed file using a field processing method; Processing the plurality of sentences to be processed by the natural language processing method, determining sentence features of the plurality of sentences to be processed and tree nodes corresponding to a plurality of keywords in each of the sentences to be processed; Determining the language features of the file to be processed based on the plurality of sentence features; Based on the multiple tree nodes, determining an abstract syntax tree of each of the statements to be processed; Determining the statement characteristics of the statement to be processed based on the plurality of abstract syntax trees; and Based on the plurality of statement characteristics, the file semantics of the file to be processed is determined.

3. The method according to claim 2, characterized in that The step of using the syntax conversion strategy to perform syntax conversion on the file content of the to-be-processed file to obtain target content includes: Based on the abstract syntax tree, determining the grammatical structure of the file content; Recursively parsing the grammar conversion strategy to obtain a target conversion rule corresponding to the grammar structure, wherein the target conversion rule and the grammar conversion strategy have a different conversion order and the same conversion rule; and The target conversion rule is used to process the file content of the to-be-processed file to obtain the target content.

4. The method according to claim 1, characterized in that: Each of the sample files includes one or more sample sentences written in a grammar and sample comments corresponding to the sample sentences; The grammar library is determined in the following manner: For each grammar, Using the natural language processing method, one or more sample files written by the grammar are processed to determine the sentence characteristics of each sample sentence, wherein the sentence characteristics are determined according to sample annotations corresponding to the sample sentences; In a case where the number of the sentence characteristics is greater than a preset number, determining a grammatical characteristic of the grammar based on a plurality of the sentence characteristics; and The grammar library is determined based on grammar characteristics of each of the plurality of grammars.

5. The method according to claim 4, characterized in that The method further comprises: Determine the operational performance of the target content using a reinforcement learning model and a graph neural network; In the case where it is determined that the operating performance needs to be improved, determining optimization suggestions for the target content based on the reinforcement learning model and the graph neural network; and The optimization suggestion is sent to the user.

6. The method according to claim 5, characterized in that In the case where it is determined that the operating performance needs to be improved, determining optimization suggestions for the target content based on the reinforcement learning model and the graph neural network, including: Based on the reinforcement learning model, determining the reinforcement rewards of multiple candidate grammar transformation strategies; Determining a conversion optimization suggestion from the plurality of candidate grammar conversion strategies, wherein the reinforcement reward of the conversion optimization suggestion is the largest among the reinforcement rewards of the plurality of candidate grammar conversion strategies; Based on the graph neural network, determine multiple index generation strategies and the improvement of the operating performance by each of the multiple index generation strategies; Based on the plurality of improvement situations, determining index optimization suggestions from the plurality of index generation strategies; and Based on the conversion optimization suggestion and the index optimization suggestion, an optimization suggestion for the target content is determined.

7. The method according to claim 1, characterized in that The method further comprises: Performing static code analysis on the target content to determine a correctness analysis result of the target content; In the case where the correctness analysis result indicates that there is an error in the target content, using an error detection method corresponding to the target grammar to determine the error category of the error; Determining a repair suggestion for the target content based on the error category and the target grammar; and The repair suggestion is sent to the user.

8. A file processing device, characterized in that: The device comprises: A semantic determination module, used to determine the language features and file semantics of the file to be processed based on the file content of the file to be processed by using a natural language processing method; A first grammar determination module, used for determining the grammar to be converted of the file to be processed based on the language feature; A second grammar determination module, configured to determine a target grammar in response to a grammar conversion instruction submitted by a user; a strategy determination module, configured to determine a grammar conversion strategy based on the grammar characteristics of the grammar to be converted and the grammar characteristics of the target grammar when it is determined that the grammar library includes the grammar to be converted and the target grammar, wherein the grammar library includes a plurality of grammars and the grammar characteristics of each of the plurality of grammars, and the grammar library is established after learning sample files written by the plurality of grammars using the natural language processing method and determining the grammar characteristics of each of the plurality of grammars; a syntax conversion module, configured to perform syntax conversion on the file content of the to-be-processed file using the syntax conversion strategy to obtain target content, wherein the file semantics of the target content is the same as the file semantics of the to-be-processed file, and the syntax used by the target content is the target syntax; and The file encapsulation module is used to encapsulate the target content to obtain a target file.

9. An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

11. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.