File identification method, device, readable medium, electronic device and product

Through AST analysis and large-model semantic recognition technology, target variables that are not related to amount data in JavaScript program files are filtered out, solving the problem of loss of floating-point number operation accuracy in financial transactions, and achieving efficient and accurate amount exception recognition.

CN118709679BActive Publication Date: 2025-08-15BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410814625.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2025-08-15
Estimated Expiration
2044-06-21

AI Technical Summary

Technical Problem

In the payment and transaction links in financial scenarios, due to the loss of accuracy of floating-point number operations in JavaScript, the existing technology requires scanning and analysis of full code nodes, resulting in high recognition cost and low accuracy.

Method used

Through the abstract syntax tree AST parsing program files, semantic recognition is combined with the big model, target variables that are not related to the amount-class data are identified and filtered, and only the amount abnormality recognition is performed on the remaining variables, reducing the cost of scanning and analysis and improving accuracy.

Benefits of technology

It improves the accuracy of amount variable identification, reduces the cost of amount risk investigation, avoids scanning and analysis of full code nodes, and improves identification efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118709679B_ABST
    Figure CN118709679B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a file identification method, apparatus, readable medium, electronic device, and product. A program file to be identified can be obtained, the program file including multiple variables; a target variable for representing target data is determined from the multiple variables, the target data being data requiring mathematical operations and unrelated to monetary amounts; and monetary amount anomaly identification is performed on variables other than the target variable. The monetary amount anomaly identification is used to determine whether the corresponding variable belongs to a target amount variable, where the monetary amount data represented by the target amount variable is at risk of losing precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular, to a file identification method, device, readable medium, electronic device, and product. Background Art

[0002] Payment and transaction-related processes in financial scenarios often involve interaction between the front-end and back-end. For example, the front-end uses JavaScript to write interaction logic, receives the amount entered by the user, converts the user's input into different currencies based on the JavaScript interaction logic, and then submits it to the back-end for processing.

[0003] Floating-point operations may be involved in the process of fractional conversion. However, due to the storage size limitation of Number type values in JavaScript, some floating-point operations may result in loss of precision, causing asset losses and fund reconciliation problems. Summary of the Invention

[0004] This summary is provided to briefly introduce concepts that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.

[0005] In a first aspect, the present disclosure provides a file identification method, the method comprising:

[0006] Obtaining a program file to be identified, wherein the program file includes a plurality of variables;

[0007] Determining a target variable for representing target data from the plurality of variables, wherein the target data is data that requires mathematical operation and is unrelated to amount data;

[0008] Amount anomaly identification is performed on other variables among the multiple variables except the target variable. The amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable. The amount data corresponding to the target amount variable has the risk of precision loss.

[0009] In a second aspect, a file identification device is provided, the device comprising:

[0010] An acquisition module, configured to acquire a program file to be identified, wherein the program file includes a plurality of variables;

[0011] a determination module, configured to determine a target variable for representing target data from the plurality of variables, wherein the target data is data requiring mathematical operation and unrelated to amount data;

[0012] An identification module is used to identify amount anomalies of other variables among the multiple variables except the target variable. The amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable, and the amount data corresponding to the target amount variable has the risk of losing accuracy.

[0013] In a third aspect, a computer-readable medium is provided, on which a computer program is stored, and when the computer program is executed by a processing device, the steps of the method described in the first aspect of the present disclosure are implemented.

[0014] In a fourth aspect, an electronic device is provided, including:

[0015] a storage device having a computer program stored thereon;

[0016] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.

[0017] In a fifth aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the steps of the method described in the first aspect of the present disclosure.

[0018] Through the above technical solution, a program file to be identified is obtained, the program file including multiple variables; a target variable representing target data is determined from the multiple variables, the target data being data requiring mathematical operations and unrelated to monetary amount data; and monetary amount anomaly identification is performed on variables other than the target variable. The monetary amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable, and the monetary amount data corresponding to the target amount variable is at risk of loss of precision. In this way, when performing monetary amount anomaly identification on variables in the program file, the target variable can be filtered. Because the target data represented by the target variable is data requiring mathematical operations and unrelated to monetary amount data, the target variable can interfere with the identification of the target amount variable. After filtering out the target variable, monetary amount anomaly identification is performed on the other variables other than the target variable, thereby improving the accuracy of identifying the target amount variable in the program file. At the same time, scanning and analyzing the code nodes of the entire program file is avoided, reducing the cost of troubleshooting monetary amount risks.

[0019] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale. In the drawings:

[0021] Figure 1 The figure is a flowchart of a file identification method according to an exemplary embodiment.

[0022] Figure 2 is based on Figure 1 The illustrated embodiment shows a flow chart of a file identification method.

[0023] Figure 3 is based on Figure 1 The illustrated embodiment shows a flow chart of a file identification method.

[0024] Figure 4 is based on Figure 1 The illustrated embodiment shows a flow chart of a file identification method.

[0025] Figure 5 The figure is a block diagram of a file identification device according to an exemplary embodiment.

[0026] Figure 6 is based on Figure 5 The illustrated embodiment shows a block diagram of a file identification device.

[0027] Figure 7 is based on Figure 6 The illustrated embodiment shows a block diagram of a file identification device.

[0028] Figure 8 is based on Figure 5 The illustrated embodiment shows a block diagram of a file identification device.

[0029] Figure 9 The figure is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0030] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.

[0031] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0032] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.

[0033] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0034] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".

[0035] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0036] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0037] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.

[0038] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0039] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0040] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.

[0041] The present disclosure is mainly used for the identification of abnormal amount risks in financial scenarios. For example, in the payment and transaction-related links in financial scenarios, the amount entered by the user needs to be converted into yuan, and then submitted to the back-end for processing after being converted into cents. In order to complete this conversion, BalanceYuan*100 can be used to convert the input amount BalanceYuan in yuan into an amount in cents. Floating-point operations may be performed during the conversion to yuan, but due to the storage size restrictions on values of numerical types in JavaScript, some floating-point operations may cause precision loss, resulting in asset losses and fund reconciliation problems. For example, the front-end calculates 10000.71*100, but due to precision loss, the amount submitted to the back-end becomes 1000070.99999999999. Therefore, it is necessary to identify the risks of the amount variables (i.e., variables representing amount-type data) involved in the JavaScript program file.

[0042] Related technologies use AST (Abstract Syntax Tree) to perform static code analysis on JavaScript. Once nodes with monetary risk calculations (i.e., nodes corresponding to variables with a risk of precision loss) are found, they are identified and reported. For example, if the corresponding node hits any detection rule, such as floating-point arithmetic, large number arithmetic, or division, the node is determined to be a monetary risk calculation node and needs to be reported. However, this approach requires scanning and analyzing all code nodes, which increases the cost of troubleshooting monetary risk. It also results in all variables in the code that hit the detection rules (both monetary and non-monetary variables) being identified and reported. In addition to monetary variables, the variables that hit the detection rules may also include other target variables that also require mathematical operations but are unrelated to monetary data (such as time variables and mathematical variables). Obviously, these target variables will interfere with the identification of monetary variables in the code. Therefore, existing methods for identifying target monetary variables (i.e., variables representing monetary data with a risk of precision loss) have low accuracy.

[0043] To solve the above problems, the present disclosure provides a file identification method, device, readable medium, electronic device and product. Specific implementations of the present disclosure are described in detail below with reference to the accompanying drawings.

[0044] Figure 1 is a flow chart showing a method for file identification according to an exemplary embodiment. Figure 1 As shown, the method includes the following steps:

[0045] In step S101 , a program file to be identified is obtained, wherein the program file includes a plurality of variables.

[0046] The program file here can include the file containing the code used by the front-end to implement interactive logic with the back-end in financial scenarios. For example, the front-end can write interactive logic based on JavaScript, and the program file is the program file containing the JavaScript code. It is understood that JavaScript code can include multiple variables, and different variables are used to represent different data or information. These multiple variables can also have multiple variable types, such as amount variables and time variables. Among them, amount variables are variables that represent amount-related data, and time variables are variables that represent time-related data.

[0047] In step S102 , a target variable for representing target data is determined from the multiple variables. The target data is data that requires mathematical operation and is unrelated to amount data.

[0048] The target variable refers to a variable among multiple variables that requires mathematical operations but is used to represent non-monetary data. Mathematical operations include floating-point operations, large number operations, arithmetic operations, and unit conversion. Obviously, this type of target variable can interfere with the risk identification of monetary variables. For example, target variables can include time variables, mathematical variables, and variables related to CSS (Cascading Style Sheets) properties.

[0049] In one implementation of this step, multiple first preset variables with the same semantics as the target variable can be pre-set, and then the multiple first preset variables can be used as a whitelist. If it is determined that the current variable (any variable among the multiple variables) in the program file to be identified belongs to the variables in the whitelist, or has the same or similar semantics as the variables in the whitelist, the current variable can be determined as the target variable.

[0050] In step S103, amount anomaly identification is performed on the variables other than the target variable in the multiple variables. The amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable. The amount data corresponding to the target amount variable has the risk of precision loss.

[0051] Using this method, when identifying variables in program files for monetary amount anomalies, the target variable can be filtered. Because the target variable represents target data that requires mathematical calculations and is unrelated to monetary amounts, it can interfere with the identification of the target amount variable. After filtering out the target variable, the accuracy of identifying monetary amount anomalies can be improved by performing monetary amount anomaly identification on the remaining variables in the program file. This also avoids scanning and analyzing the entire program file's code nodes, reducing the cost of investigating monetary risk.

[0052] Figure 2 is based on Figure 1 The embodiment shown is a flowchart of a file identification method, as shown in FIG. Figure 2 As shown, the method further includes the following steps:

[0053] In step S104, the program file is parsed through an abstract syntax tree (AST) to obtain a target AST corresponding to the program file. The target AST includes variable nodes, and the variable nodes are used to represent variables in the program file.

[0054] Among them, AST is a data structure used to represent the structure of program source code. In JavaScript, AST can be generated by static code parsing of the source code. For example, the AST generation process can be divided into the following steps: Lexical analysis: decompose the source code into lexical units (tokens), such as identifiers, keywords, operators, etc. Syntax analysis: organize the lexical units into a hierarchical representation, namely AST. The syntax analyzer can convert the lexical units into nodes of the syntax tree according to the grammatical rules of the language, and determine the relationship between the nodes. Semantic analysis: perform semantic checks on the generated AST to verify the legitimacy of the code. In this step, the target AST corresponding to the program file can be generated based on the above steps.

[0055] The target AST can be composed of a series of nodes, each node represents a grammatical structure in the code, and some of the nodes are variable nodes used to represent variables in the code in the program file.

[0056] The present disclosure uses AST technology to statically scan the code of program files in the warehouse, and can analyze information such as the name, type, sub-elements, and code functions of each code node.

[0057] In step S105 , for each variable node in the target AST, semantic recognition is performed on the variable name of the variable corresponding to the variable node through a preset semantic recognition model to obtain a semantic recognition result of the variable name.

[0058] The preset semantic recognition model may include, for example, a pre-trained large model (such as BERT, GPT, etc.). In other words, in this step, the large model may be used to perform semantic recognition on the variable name corresponding to each variable node.

[0059] The first preset variable name is one or more variable names that are pre-set and have the same semantics as the variable name of the target variable. The semantic recognition result may include a first semantic similarity between each first preset variable name and the variable name of the input model. In addition, the set of first preset variable names can serve as a whitelist. If it is determined that the variable name belongs to a variable name in the whitelist, or is a variable name with a high semantic similarity to a variable name in the whitelist, the variable name is regarded as the variable name of the target variable.

[0060] In a possible implementation of this step, the variable name corresponding to the variable node to be currently identified may be input into a preset semantic recognition model, and then the preset semantic recognition model may be used to output the first semantic similarity corresponding to the variable name.

[0061] It can be understood that the first preset variable name needs to be used as a corpus to pre-train the preset semantic recognition model. In this way, after the variable name to be identified is input into the preset semantic recognition model, the model can calculate the first semantic similarity between each first preset variable name and the input variable name.

[0062] Thus, during the execution of step S102, the target variable can be determined from the multiple variables based on the semantic recognition results corresponding to each variable. In one implementation, for each variable, if the first semantic similarity corresponding to the variable name of the variable is greater than or equal to a first preset similarity threshold (the threshold can be, for example, 80%), the variable can be used as the target variable.

[0063] Through the above method, the target variables contained in multiple variables in the program file can be identified through a large model. Since the target variable will interfere with the risk identification of the amount variable, after identifying the target variable contained in multiple variables, the target variable can be filtered out (which can be called "white list filtering"), thereby filtering out the variables that will interfere with the risk identification of the amount variable, and improving the accuracy of identifying the target amount variable in the program file.

[0064] In addition, using a large model for whitelist filtering can increase the amount of non-monetary whitelist data, thereby further improving the accuracy and efficiency of target variable identification.

[0065] In another possible implementation of the present disclosure, a large model can also be used to accurately identify amount variables included in program files. Amount variables herein refer to variables representing amount-related data determined based on semantic recognition (e.g., variables named money, cent, amount, etc. are such amount variables). For example, an amount variable array can be predefined through initialization, and the amount variable array can store multiple second preset variable names, each of which is a pre-set variable name for representing amount-related data. In this way, the large model can be used to calculate the semantic similarity (i.e., the second semantic similarity) between the variable name of the input model and each of the second preset variable names, so as to identify whether the variable name of the input model is the variable name of an amount variable based on the second semantic similarity.

[0066] Therefore, the semantic recognition result also includes a second semantic similarity between the variable name and each second preset variable name. In the process of semantically identifying the variable name of the variable corresponding to the variable node by the preset semantic recognition model, after the variable name is input into the preset semantic recognition model, the preset semantic recognition model outputs the second semantic similarity corresponding to the variable name. For example, if the variable name input into the model is monneey or moneeyy, the preset semantic recognition model can calculate the second semantic similarity between monneey and the second preset variable name money, and can also calculate the second semantic similarity between moneeyy and the second preset variable name money.

[0067] It can be understood that the second preset variable name also needs to be used as a corpus to pre-train the preset semantic recognition model. In this way, after the variable name to be identified is input into the preset semantic recognition model, the model can calculate the second semantic similarity between each second preset variable name and the input variable name.

[0068] It should be noted that the above-mentioned preset semantic recognition model can calculate the first semantic similarity between the variable name of the input model and each first preset variable name, and can also calculate the second semantic similarity between the variable name of the input model and each second preset variable name. In this way, in the process of pre-training the preset semantic recognition model, the first preset variable name and the second preset variable name can be used together as a corpus to perform model training. In addition, the preset semantic recognition model can also include two models, for example, it can include model one and model two, wherein model one is a large model obtained by training using multiple first preset variable names as a corpus, and model two is a large model obtained by training using multiple second preset variable names as a corpus. In this way, model one can be used to identify the target variable from multiple variables, and model two can be used to identify the amount variable from multiple variables.

[0069] Considering the lack of a unified naming convention for variable names in real-world applications, it is difficult to understand all the amount variables in the entire code repository. To identify as many amount variables as possible, this disclosure can use a large model to expand the corpus used for model training, thereby improving the accuracy of the preset semantic recognition model in identifying amount variables among multiple variables.

[0070] In one implementation method, for each preset variable name, the preset variable name can be input into a preset variable name expansion model, and then the preset variable name expansion model outputs at least one expanded variable name with the same semantics as the preset variable name, and the preset variable name includes a first preset variable name or a second preset variable name; at least one expanded variable name is added to a preset corpus of a preset semantic recognition model, and the preset corpus includes the first preset variable name and / or the second preset variable name.

[0071] The preset variable name expansion model may also be a pre-set large model.

[0072] For example, assuming that the preset variable name of the input preset variable name expansion model is the second preset variable name (that is, the name of the variable that is pre-set to represent amount data), and the second preset variable name is amount, then the model can output the same expanded variable name as the second preset variable name amount, including at least one of the following: total_amount total amount, balance_due balance payable, payment_amount payment amount, invoice_total invoice total amount, transaction_amount transaction amount, withdrawal_amount withdrawal amount, deposit_amount deposit amount, loan_principal loan principal. This is just an example, and the present disclosure does not limit it.

[0073] By adopting the above method and using a large model to expand the corpus for training the semantic recognition model, the accuracy of identifying the nature of the variable (i.e., whether it is an amount variable or a variable in the whitelist) and the comprehensiveness of variable identification can be improved, thereby improving the reliability of the amount anomaly identification rules.

[0074] Figure 3 is based on Figure 1 The embodiment shown is a flowchart of a file identification method, as shown in FIG. Figure 3 As shown, step S103 includes the following sub-steps:

[0075] In step S1031 , for each of the other variables, the variable type of the other variable is determined according to a second semantic similarity between the variable name of the other variable and the second preset variable name.

[0076] In this step, if the second semantic similarity is greater than or equal to a second preset similarity threshold, the variable type of the other variable can be determined to be a first amount variable. Since the preset corpus may include multiple second preset variable names, in one implementation, if the second semantic similarity between the variable name of the other variable and any second preset variable name is determined to be greater than or equal to the second preset similarity threshold, the variable type of the other variable can be determined to be a first amount variable. In addition, the second preset similarity threshold can be, for example, 85%, 90%, etc. The threshold value can be arbitrarily set according to actual needs and is not limited in this disclosure.

[0077] When the second semantic similarity is less than the second preset similarity threshold, the variable type of the other variable is determined to be a second amount variable; it should be noted that the situation where the second semantic similarity is less than the second preset similarity threshold here refers to the situation where the second semantic similarity between the variable name of the other variable and each second preset variable name is less than the second preset similarity threshold.

[0078] It is understood that when the second semantic similarity between the variable name of the other variable and the second preset variable name is greater than or equal to the second preset similarity threshold, it can be determined that the variable name of the other variable and the second preset variable name have a high semantic similarity. Since the second preset variable name is a pre-set variable name representing monetary amount data, the variable name of the other variable can also be considered a variable name representing monetary amount data. Therefore, the first monetary amount variable represents the other variable as a variable that is determined to represent monetary amount data. Conversely, when the second semantic similarity between the variable name of the other variable and the second preset variable name is less than the second preset similarity threshold, it can be determined that the variable name of the other variable and the second preset variable name have a low semantic similarity. In this case, it is impossible to determine whether the other variable is a variable representing monetary amount data. However, it can be determined that the variable type of the other variable does not belong to the first monetary amount variable described above, nor to the target variable described above. Therefore, the second monetary amount variable represents the other variable as any variable other than the target variable and the first monetary amount variable among the multiple variables.

[0079] In step S1032, the amounts of the other variables are identified as abnormal based on the variable types.

[0080] In this step, the target identification rule corresponding to the variable type may be determined; when it is determined that the other variable hits the target identification rule, it is determined that the other variable belongs to the target amount variable.

[0081] That is, this step can determine, for each other variable, a target identification rule for identifying abnormal amounts for that other variable based on the variable type corresponding to that other variable. Different variable types correspond to different target identification rules, so that abnormal amounts for that other variable can be identified using the target identification rule. For example, if the variable type is a first amount variable, the target identification rule includes at least one of floating-point operations, fractional conversion, and a default amount fallback; if the variable type is a second amount variable, the target identification rule includes at least one of floating-point operations and fractional conversion.

[0082] Floating-point operations refer to situations where the data represented by the corresponding variable is subject to floating-point operations (e.g., data containing decimals). Fractional conversion refers to the conversion of data from yuan to cents (e.g., BalanceYuan*100) or cents to yuan (e.g., BalanceYuan / 100). A default amount fallback means that the amount represented by the current variable is set to a preset default value (e.g., 0). As mentioned above, if a variable represents data that requires floating-point operations or fractional conversion, due to JavaScript's storage size limitations for numeric values, this process can result in loss of precision. Therefore, if the data corresponding to an amount variable is subject to floating-point operations and / or fractional conversion, the amount variable is considered a target amount variable. The default amount fallback is designed to account for situations where some amount data is incorrect or not collected. If the amount data directly output to the user is 0, it will be inconsistent with the actual amount data, which can affect the user experience and cause fund reconciliation issues. Therefore, if the amount data represented by an amount variable is 0, it may also be considered a target amount variable.

[0083] In addition, the present disclosure can use different target identification rules for variables of different variable types to identify abnormal amounts of other variables. Taking the identification of abnormal amounts of one of the other variables as an example, if the variable type of the other variable is the first amount variable, that is, the other variable is determined to be a variable for representing the amount data, at this time, it is necessary to focus on checking whether the other variable is the target amount variable (that is, a variable with a risk of precision loss in the amount data). Therefore, in order to improve the accuracy of abnormal amount identification of such variables, the target identification rule can be set to include at least one of floating-point operations, fractional conversion, and amount default value. In this way, when it is determined that the first amount variable hits at least one of floating-point operations, fractional conversion, and amount default value, it is deemed that the first amount variable hits the target identification rule, and the first amount variable is the target amount variable. If the variable type of the other variable is the second amount variable, it is not certain whether the other variable represents amount data. Considering that the probability of loss of precision in floating-point operations and fractional conversion is high (that is, the risk level is high), and the risk level corresponding to the default amount is relatively low, and the false alarm rate is high, therefore, when determining that the variable type of the other variable is the second amount variable, the target identification rule can be set to include floating-point operations and / or fractional conversion, that is, when it is determined that the second amount variable satisfies at least one of floating-point operations and fractional conversion, the second amount variable is deemed to hit the target identification rule, and the second amount variable is the target amount variable.

[0084] By adopting the above method, amount anomaly identification is performed on amount variables of different variable types based on different target identification rules, which can give full play to the advantages of different identification rules and take into account the accuracy and efficiency of amount anomaly identification.

[0085] Figure 4 is based on Figure 1 The embodiment shown is a flowchart of a file identification method, as shown in FIG. Figure 4 As shown, the method further includes the following steps:

[0086] In step S106, for at least one program file included in each preset file storage unit, abnormal value statistics are performed on the amount abnormality recognition results of the other variables corresponding to the at least one program file to obtain the amount abnormal value corresponding to the preset file storage unit.

[0087] During the actual code development process, program files can be stored in preset file storage units. A preset file storage unit can include one or more program files. For example, the preset file storage unit can be a code repository or a preset code folder, which is not limited in this disclosure.

[0088] The abnormal value statistics here may include statistics on which types of target amount variables are included in the at least one program file stored in the preset file storage unit and the number of occurrences. The types of the target amount variables may include, for example, amount variables belonging to floating-point operations, amount variables belonging to fractional conversion, and amount variables belonging to the amount default value. In one implementation, different weights may be set for different types of target amount variables (for example, the higher the corresponding risk level, the higher the weight), and then the amount abnormal value corresponding to the preset file storage unit is calculated based on the respective corresponding weights and the number of occurrences of each target amount variable in the current preset file storage unit.

[0089] In step S107 , the plurality of preset file storage units are sorted according to the abnormal amount value corresponding to each preset file storage unit.

[0090] For example, multiple preset file storage units can be sorted by the amount of abnormal value from high to low. The higher the amount of abnormal value, the higher the risk level of the program files stored in the corresponding preset file storage unit. Developers need to focus on these program files and repair them if necessary.

[0091] In step S108, the sorting results and the amount abnormality recognition results corresponding to each of the preset file storage units are sent to the target terminal.

[0092] The target terminal may be a terminal of a developer who maintains the program file. The amount anomaly identification result may also include an identifier of the preset file storage unit containing the target amount variable, the specific storage location of the target amount variable in the preset file storage unit, the code line where the target amount variable is located, the problem point corresponding to the target amount variable, the improvement plan, the identification time, and the person responsible.

[0093] Using the above method, the amount risk data can be aggregated based on the identification results of the target amount variables of the program files stored in different preset file storage units. According to the file information, the risk points under the same file (i.e., a preset file storage unit) can be integrated, and the aggregation results and the amount anomaly identification results can be reported to the target terminal so that developers can follow up and repair them in a timely manner.

[0094] Figure 5 is a block diagram of a file identification device according to an exemplary embodiment. Figure 5 As shown, the device includes:

[0095] An acquisition module 501 is configured to acquire a program file to be identified, wherein the program file includes a plurality of variables;

[0096] A determination module 502 is configured to determine a target variable for representing target data from the plurality of variables, wherein the target data is data that requires mathematical operation and is unrelated to amount data;

[0097] The risk identification module 503 is used to identify amount anomalies of other variables among the multiple variables except the target variable. The amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable, and the amount data corresponding to the target amount variable has the risk of precision loss.

[0098] Optionally, Figure 6 is based on Figure 5 The embodiment shown is a block diagram of a file identification device, such as Figure 6 As shown, the device also includes:

[0099] A program parsing module 504 is configured to parse the program file using an abstract syntax tree (AST) to obtain a target AST corresponding to the program file, wherein the target AST includes variable nodes, and the variable nodes are used to represent variables in the program file;

[0100] A semantic recognition module 505 is configured to perform semantic recognition on the variable name of the variable corresponding to each variable node in the target AST using a preset semantic recognition model to obtain a semantic recognition result of the variable name;

[0101] The determination module 502 is configured to determine the target variable from the multiple variables according to the semantic recognition results corresponding to each variable.

[0102] Optionally, the semantic recognition result includes a first semantic similarity between the variable name and a first preset variable name, where the first preset variable name is a pre-set variable name having the same semantics as the variable name of the target variable;

[0103] The semantic recognition module 505 is configured to input the variable name into the preset semantic recognition model and output the first semantic similarity corresponding to the variable name through the preset semantic recognition model;

[0104] The determining module 502 is configured to, for each of the variables, use the variable as the target variable if the first semantic similarity corresponding to the variable name of the variable is greater than or equal to a first preset similarity threshold.

[0105] Optionally, the semantic recognition result includes a second semantic similarity between the variable name and a second preset variable name, where the second preset variable name is a preset variable name for representing amount data;

[0106] The semantic recognition module 505 is configured to input the variable name into the preset semantic recognition model and output the second semantic similarity corresponding to the variable name through the preset semantic recognition model;

[0107] The risk identification module 503 is configured to determine, for each of the other variables, the variable type of the other variable based on the second semantic similarity between the variable name of the other variable and the second preset variable name; and identify abnormal amounts of the other variables based on the variable type.

[0108] Optionally, the risk identification module 503 is used to determine that the variable type of the other variable is a first amount variable when the second semantic similarity is greater than or equal to a second preset similarity threshold; and to determine that the variable type of the other variable is a second amount variable when the second semantic similarity is less than the second preset similarity threshold; wherein, the first amount variable represents that the other variable is a determined variable representing amount-type data, and the second amount variable represents that the other variable is any other variable among the multiple variables except the target variable and the first amount variable.

[0109] Optionally, the risk identification module 503 is configured to determine a target identification rule corresponding to the variable type; and when it is determined that the other variable matches the target identification rule, determine that the other variable belongs to the target amount variable.

[0110] Optionally, when the variable type is the first amount variable, the target identification rule includes at least one of floating-point operations, fractional conversion, and amount default value fallback; when the variable type is the second amount variable, the target identification rule includes at least one of the floating-point operations and fractional conversion.

[0111] Optionally, Figure 7 is based on Figure 6 The embodiment shown is a block diagram of a file identification device, such as Figure 7 As shown, the device also includes:

[0112] The corpus expansion module 506 is used to input each preset variable name into a preset variable name expansion model, and then output at least one expanded variable name with the same semantics as the preset variable name through the preset variable name expansion model, where the preset variable name includes a first preset variable name or a second preset variable name; and add the at least one expanded variable name to the preset corpus of the preset semantic recognition model, where the preset corpus includes the first preset variable name and / or the second preset variable name.

[0113] Optionally, Figure 8 is based on Figure 5 The embodiment shown is a block diagram of a file identification device, such as Figure 8 As shown, the device also includes:

[0114] The recognition result statistics module 507 is configured to perform outlier value statistics on the amount abnormality recognition results of the other variables corresponding to the at least one program file included in each preset file storage unit, to obtain the amount abnormality value corresponding to the preset file storage unit; and to sort the plurality of preset file storage units according to the amount abnormality value corresponding to each preset file storage unit;

[0115] The risk reporting module 508 is configured to send the sorting results and the amount abnormality identification results corresponding to each of the preset file storage units to a target terminal.

[0116] Reference below Figure 9 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (such as in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 9The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.

[0117] like Figure 9 As shown, the electronic device 900 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. Various programs and data required for the operation of the electronic device 900 are also stored in the RAM 903. The processing device 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0118] Typically, the following devices may be connected to the I / O interface 905: an input device 906 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 907 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 908 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic device 900 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 9 The electronic device 900 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.

[0119] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 909, or installed from the storage device 908, or installed from the ROM 902. When the computer program is executed by the processing device 901, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.

[0120] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.

[0121] In some embodiments, the client can communicate using any currently known or later developed network protocol, such as HTTP (HyperText Transfer Protocol), and can interconnect with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or later developed network.

[0122] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.

[0123] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains a program file to be identified, and the program file includes multiple variables; determines a target variable used to represent target data from the multiple variables, and the target data is data that requires mathematical operations and is not related to amount data; performs amount anomaly identification on other variables among the multiple variables except the target variable, and the amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable, and there is a risk of loss of accuracy in the amount data corresponding to the target amount variable.

[0124] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0125] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation 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 flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of 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 than that 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 and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0126] The modules described in the embodiments of the present disclosure may be implemented in software or hardware. In some cases, the name of a module does not necessarily limit the module itself. For example, an acquisition module may also be described as a "module for acquiring program files."

[0127] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0128] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, 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), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0129] According to one or more embodiments of the present disclosure, Example 1 provides a file identification method, including:

[0130] Obtaining a program file to be identified, wherein the program file includes a plurality of variables;

[0131] Determining a target variable for representing target data from the plurality of variables, wherein the target data is data that requires mathematical operation and is unrelated to amount data;

[0132] Amount anomaly identification is performed on other variables among the multiple variables except the target variable. The amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable. The amount data corresponding to the target amount variable has the risk of precision loss.

[0133] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, further comprising:

[0134] Parsing the program file through an abstract syntax tree (AST) to obtain a target AST corresponding to the program file, wherein the target AST includes variable nodes, and the variable nodes are used to represent variables in the program file;

[0135] For each variable node in the target AST, semantic recognition is performed on the variable name of the variable corresponding to the variable node using a preset semantic recognition model to obtain a semantic recognition result of the variable name;

[0136] Determining a target variable for representing target data from the plurality of variables includes:

[0137] The target variable is determined from the multiple variables according to the semantic recognition results corresponding to each variable.

[0138] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 2, wherein the semantic recognition result includes a first semantic similarity between the variable name and a first preset variable name, where the first preset variable name is a preset variable name having the same semantics as the variable name of the target variable;

[0139] The performing semantic recognition on the variable name of the variable corresponding to the variable node by using a preset semantic recognition model includes:

[0140] After inputting the variable name into the preset semantic recognition model, outputting the first semantic similarity corresponding to the variable name through the preset semantic recognition model;

[0141] Determining the target variable from the multiple variables according to the semantic recognition results corresponding to each variable includes:

[0142] For each of the variables, if the first semantic similarity corresponding to the variable name of the variable is greater than or equal to a first preset similarity threshold, the variable is used as the target variable.

[0143] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 2, wherein the semantic recognition result includes a second semantic similarity between the variable name and a second preset variable name, where the second preset variable name is a preset variable name for representing amount data;

[0144] The performing semantic recognition on the variable name of the variable corresponding to the variable node by using a preset semantic recognition model includes:

[0145] After inputting the variable name into the preset semantic recognition model, outputting the second semantic similarity corresponding to the variable name through the preset semantic recognition model;

[0146] The step of identifying abnormal amounts of other variables except the target variable in the plurality of variables includes:

[0147] For each of the other variables, determining the variable type of the other variable according to a second semantic similarity between the variable name of the other variable and the second preset variable name;

[0148] Amount anomalies of the other variables are identified based on the variable type.

[0149] According to one or more embodiments of the present disclosure, Example 5 provides the method of Example 4, wherein determining the variable type of the other variable based on the second semantic similarity between the variable name of the other variable and the second preset variable name includes:

[0150] When the second semantic similarity is greater than or equal to a second preset similarity threshold, determining that the variable type of the other variable is a first amount variable;

[0151] When the second semantic similarity is less than the second preset similarity threshold, determining the variable type of the other variable to be a second amount variable;

[0152] The first amount variable represents that the other variables are determined variables representing amount data, and the second amount variable represents that the other variables are any other variables among the multiple variables except the target variable and the first amount variable.

[0153] According to one or more embodiments of the present disclosure, Example 6 provides the method of Example 5, wherein identifying abnormal amounts of the other variables based on the variable type includes:

[0154] Determining a target recognition rule corresponding to the variable type;

[0155] When it is determined that the other variables hit the target identification rule, it is determined that the other variables belong to the target amount variable.

[0156] According to one or more embodiments of the present disclosure, Example 7 provides the method of Example 6, wherein, when the variable type is the first amount variable, the target identification rule includes at least one of floating-point operation, fractional conversion, and amount default value fallback;

[0157] When the variable type is the second amount variable, the target identification rule includes at least one of the floating-point operation and the fractional conversion.

[0158] According to one or more embodiments of the present disclosure, Example 8 provides the method of Example 2, further comprising:

[0159] For each preset variable name, after inputting the preset variable name into a preset variable name expansion model, the preset variable name expansion model outputs at least one expanded variable name having the same semantics as the preset variable name, wherein the preset variable name includes a first preset variable name or a second preset variable name;

[0160] The at least one expanded variable name is added to a preset corpus of the preset semantic recognition model, where the preset corpus includes the first preset variable name and / or the second preset variable name.

[0161] According to one or more embodiments of the present disclosure, Example 9 provides the method of any one of Examples 1-8, further comprising:

[0162] For at least one program file included in each preset file storage unit, performing abnormal value statistics on the amount abnormality recognition results of the other variables corresponding to the at least one program file to obtain an abnormal amount value corresponding to the preset file storage unit;

[0163] sorting the plurality of preset file storage units according to the abnormal amount value corresponding to each of the preset file storage units;

[0164] The sorting result and the amount abnormality identification result corresponding to each preset file storage unit are sent to the target terminal.

[0165] According to one or more embodiments of the present disclosure, Example 10 provides a file identification device, the device comprising:

[0166] An acquisition module, configured to acquire a program file to be identified, wherein the program file includes a plurality of variables;

[0167] a determination module, configured to determine a target variable for representing target data from the plurality of variables, wherein the target data is data requiring mathematical operation and unrelated to amount data;

[0168] An identification module is used to identify amount anomalies of other variables among the multiple variables except the target variable. The amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable, and the amount data corresponding to the target amount variable has the risk of losing accuracy.

[0169] According to one or more embodiments of the present disclosure, Example 11 provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in any one of Examples 1-9 when executed by a processing device.

[0170] According to one or more embodiments of the present disclosure, Example 12 provides an electronic device, including:

[0171] a storage device having a computer program stored thereon;

[0172] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in any one of Examples 1-9.

[0173] According to one or more embodiments of the present disclosure, Example 13 provides a computer program product, including a computer program, which implements the steps of any one of the methods of Examples 1-9 when executed by a processor.

[0174] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.

[0175] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0176] Although the subject matter has been described using language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims. Regarding the apparatus in the above-described embodiments, the specific manner in which each module performs operations has been described in detail in the embodiments related to the method and will not be elaborated upon here.

Claims

1. A file identification method, characterized in that: The method comprises: Obtaining a program file to be identified, wherein the program file includes a plurality of variables; Determining a target variable for representing target data from the plurality of variables, wherein the target data is data that requires mathematical operation and is unrelated to amount data; Performing amount anomaly identification on variables other than the target variable among the multiple variables, wherein the amount anomaly identification is used to identify whether the corresponding variable belongs to the target amount variable, and the amount data corresponding to the target amount variable has a risk of precision loss; The method further comprises: Parsing the program file through an abstract syntax tree (AST) to obtain a target AST corresponding to the program file, wherein the target AST includes variable nodes, and the variable nodes are used to represent variables in the program file; For each variable node in the target AST, semantic recognition is performed on the variable name of the variable corresponding to the variable node using a preset semantic recognition model to obtain a semantic recognition result of the variable name; Determining a target variable for representing target data from the plurality of variables includes: The target variable is determined from the multiple variables according to the semantic recognition results corresponding to each variable.

2. The method according to claim 1, characterized in that The semantic recognition result includes a first semantic similarity between the variable name and a first preset variable name, where the first preset variable name is a pre-set variable name with the same semantics as the variable name of the target variable; The performing semantic recognition on the variable name of the variable corresponding to the variable node by using a preset semantic recognition model includes: After inputting the variable name into the preset semantic recognition model, outputting the first semantic similarity corresponding to the variable name through the preset semantic recognition model; Determining the target variable from the multiple variables according to the semantic recognition results corresponding to each variable includes: For each of the variables, if the first semantic similarity corresponding to the variable name of the variable is greater than or equal to a first preset similarity threshold, the variable is used as the target variable.

3. The method according to claim 1, characterized in that The semantic recognition result includes a second semantic similarity between the variable name and a second preset variable name, where the second preset variable name is a preset variable name for representing amount data; The performing semantic recognition on the variable name of the variable corresponding to the variable node by using a preset semantic recognition model includes: After inputting the variable name into the preset semantic recognition model, outputting the second semantic similarity corresponding to the variable name through the preset semantic recognition model; The step of identifying abnormal amounts of other variables except the target variable in the plurality of variables includes: For each of the other variables, determining the variable type of the other variable according to a second semantic similarity between the variable name of the other variable and the second preset variable name; Amount anomalies of the other variables are identified based on the variable type.

4. The method according to claim 3, characterized in that The determining the variable type of the other variable according to the second semantic similarity between the variable name of the other variable and the second preset variable name includes: When the second semantic similarity is greater than or equal to a second preset similarity threshold, determining that the variable type of the other variable is a first amount variable; When the second semantic similarity is less than the second preset similarity threshold, determining the variable type of the other variable to be a second amount variable; The first amount variable represents that the other variables are determined variables representing amount data, and the second amount variable represents that the other variables are any other variables among the multiple variables except the target variable and the first amount variable.

5. The method according to claim 4, characterized in that The identifying of abnormal amounts of the other variables according to the variable type includes: Determining a target recognition rule corresponding to the variable type; When it is determined that the other variables hit the target identification rule, it is determined that the other variables belong to the target amount variable.

6. The method according to claim 5, characterized in that When the variable type is the first amount variable, the target identification rule includes at least one of floating-point operation, conversion to a fractional value, and a default amount value. When the variable type is the second amount variable, the target identification rule includes at least one of the floating-point operation and the fractional conversion.

7. The method according to claim 1, characterized in that The method further comprises: For each preset variable name, after inputting the preset variable name into a preset variable name expansion model, the preset variable name expansion model outputs at least one expanded variable name having the same semantics as the preset variable name, wherein the preset variable name includes a first preset variable name or a second preset variable name; The at least one expanded variable name is added to a preset corpus of the preset semantic recognition model, where the preset corpus includes the first preset variable name and / or the second preset variable name.

8. The method according to any one of claims 1 to 7, characterized in that The method further comprises: For at least one program file included in each preset file storage unit, performing abnormal value statistics on the amount abnormality recognition results of the other variables corresponding to the at least one program file to obtain an abnormal amount value corresponding to the preset file storage unit; sorting the plurality of preset file storage units according to the abnormal amount value corresponding to each of the preset file storage units; The sorting result and the amount abnormality identification result corresponding to each preset file storage unit are sent to the target terminal.

9. A file recognition device, characterized in that: The device comprises: An acquisition module, configured to acquire a program file to be identified, wherein the program file includes a plurality of variables; a determination module, configured to determine a target variable for representing target data from the plurality of variables, wherein the target data is data requiring mathematical operation and unrelated to amount data; an identification module for identifying amount anomalies for variables other than the target variable among the plurality of variables, wherein the amount anomaly identification module is used to identify whether the corresponding variable belongs to a target amount variable, and whether the amount data corresponding to the target amount variable has a risk of precision loss; The device further comprises: A program parsing module is used to parse the program file through an abstract syntax tree (AST) to obtain a target AST corresponding to the program file, wherein the target AST includes variable nodes, and the variable nodes are used to represent variables in the program file; A semantic recognition module is used to perform semantic recognition on the variable name of the variable corresponding to each variable node in the target AST through a preset semantic recognition model to obtain a semantic recognition result of the variable name; The determination module is used to determine the target variable from the multiple variables according to the semantic recognition results corresponding to each variable.

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

11. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 8.

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

Citation Information

Patent Citations

  • Digital currency wallet security detection method and apparatus, and electronic device

    CN116738432A