CN111290739B - Method, device, equipment and storage medium for determining file reference policy - Google Patents

Method, device, equipment and storage medium for determining file reference policy Download PDF

Info

Publication number
CN111290739B
CN111290739B CN202010085025.1A CN202010085025A CN111290739B CN 111290739 B CN111290739 B CN 111290739B CN 202010085025 A CN202010085025 A CN 202010085025A CN 111290739 B CN111290739 B CN 111290739B
Authority
CN
China
Prior art keywords
file
program
program segment
policy
metadata
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010085025.1A
Other languages
Chinese (zh)
Other versions
CN111290739A (en
Inventor
白广元
周俊
王鹏程
唐闻生
马亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010085025.1A priority Critical patent/CN111290739B/en
Publication of CN111290739A publication Critical patent/CN111290739A/en
Application granted granted Critical
Publication of CN111290739B publication Critical patent/CN111290739B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/22Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computing Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Stored Programmes (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for determining a file reference strategy, which belong to the technical field of artificial intelligence and machine learning, and the method comprises the following steps: acquiring a reference path relation between a statement file and a resource file in a target program; determining metadata information of a first program segment in the target program according to a reference path relation between a statement file and a resource file in the target program; and determining a recommended file reference strategy corresponding to the first program segment according to the metadata information of the first program segment. The technical scheme provided by the embodiment of the application provides an automatic determination method of the file reference strategy, and can reduce the processing overhead of computer equipment and provide a more accurate file reference strategy. In addition, the file reference strategy recommended by a program segment can be directly determined according to the metadata information of the program segment, so that the determination efficiency of the file reference strategy is improved, and the time cost is reduced.

Description

Method, device, equipment and storage medium for determining file reference policy
Technical Field
The embodiment of the application relates to the technical field of artificial intelligence and machine learning, in particular to a method, a device, equipment and a storage medium for determining a file reference strategy.
Background
During software development, particularly during C + +/C language program development, the header files are heavily used or referenced.
In the related art, for the reference of the header file, the resource files required to be referenced by the current program need to be analyzed firstly, then the header files containing the resource files are searched, then all the searched header files are referenced, then manual compilation is continued, namely, one header file is removed one by one, whether the header files are compiled to be passed or not is checked, and if the header files are compiled to be passed, the header files are effectively deleted until the number of the referenced header files is minimum.
Because the related technology adopts a manual compiling mode for the quotation of the header file, the process of compiling and detecting for multiple times is required to be repeated every time the quotation of the header file is carried out, a large amount of time and cost are consumed, and the efficiency is low.
Disclosure of Invention
The embodiment of the application provides a method, a device, equipment and a storage medium for determining a file reference policy, which can be used for automatically determining the file reference policy, improving the reference efficiency of a header file and reducing the time cost for determining the file reference policy. The technical scheme is as follows:
in one aspect, an embodiment of the present application provides a method for determining a file reference policy, where the method includes:
acquiring a reference path relation between a statement file and a resource file in a target program;
according to the reference path relation between the statement file and the resource file in the target program, determining metadata information of a first program segment in the target program, wherein the metadata information of the first program segment is used for representing the characteristics of the first program segment;
and determining a recommended file reference strategy corresponding to the first program segment according to the metadata information of the first program segment.
In another aspect, an embodiment of the present application provides a method for training a policy recommendation model, where the method includes:
obtaining a sample program;
acquiring a reference path relation between a statement file and a resource file in the sample program;
generating at least one training sample according to the reference path relationship, wherein the training sample comprises metadata information and label information of a program segment in the sample program, the metadata information is used for characterizing the program segment, and the label information is used for indicating a file reference strategy actually adopted by the program segment;
and training by adopting the training sample to obtain a strategy recommendation model, wherein the strategy recommendation model is used for providing a recommended file reference strategy.
In another aspect, an embodiment of the present application provides an apparatus for determining a file reference policy, where the apparatus includes:
the relation acquisition module is used for acquiring a reference path relation between a statement file and a resource file in a target program;
the information determining module is used for determining metadata information of a first program segment in the target program according to a reference path relation between a statement file and a resource file in the target program, wherein the metadata information of the first program segment is used for representing characteristics of the first program segment;
and the strategy determining module is used for determining the recommended file reference strategy corresponding to the first program segment according to the metadata information of the first program segment.
In another aspect, an embodiment of the present application provides an apparatus for training a policy recommendation model, where the apparatus includes:
the program acquisition module is used for acquiring a sample program;
the relation acquisition module is used for acquiring a reference path relation between the statement file and the resource file in the sample program;
a sample generating module, configured to generate at least one training sample according to the reference path relationship, where the training sample includes metadata information and tag information of a program segment in the sample program, where the metadata information is used to characterize a feature of the program segment, and the tag information is used to indicate a file reference policy actually adopted by the program segment;
and the model training module is used for training by adopting the training sample to obtain a strategy recommendation model, and the strategy recommendation model is used for providing a recommended file reference strategy.
In yet another aspect, an embodiment of the present application provides a computer device, where the computer device includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or a set of instructions, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by the processor to implement the method for determining the file reference policy or the method for training the policy recommendation model.
In yet another aspect, an embodiment of the present application provides a computer-readable storage medium, where at least one instruction, at least one program, a code set, or a set of instructions is stored in the storage medium, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by a processor to implement the method for determining the file reference policy or the method for training the policy recommendation model.
In a further aspect, an embodiment of the present application provides a computer program product, which, when running on a computer device, causes the computer device to execute the method for determining a file reference policy or the method for training a policy recommendation model.
According to the technical scheme provided by the embodiment of the application, the reference path relation between the statement file of the target program and the resource file is obtained, the metadata information is determined according to the reference path relation, and the recommended file reference strategy is determined according to the metadata information, so that the automatic determination method of the file reference strategy is provided. In addition, in the embodiment of the application, according to the referenced path relationship, metadata information of a certain program segment of the target program is determined, and then according to the metadata information, a recommended file reference policy corresponding to the program segment is determined, so that the target program is analyzed according to the program segment. In addition, according to the technical scheme provided by the embodiment of the application, the file reference policy recommended by a certain program segment can be directly determined according to the metadata information of the program segment, and compared with the process of multiple compiling detection in the related art, the technical scheme provided by the embodiment of the application improves the determination efficiency of the file reference policy and reduces the time cost consumed for determining the file reference policy.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flow chart of a method for determining a file reference policy provided by an embodiment of the present application;
FIG. 2 is a diagram of a reference path relationship provided by one embodiment of the present application;
FIG. 3 is a flow chart of a method for training a policy recommendation model provided in one embodiment of the present application;
FIG. 4 is a flowchart of a method for determining a file reference policy according to another embodiment of the present application;
FIG. 5 is a block diagram of a file reference policy determining apparatus provided by an embodiment of the present application;
FIG. 6 is a block diagram of a file reference policy determining apparatus according to another embodiment of the present application;
FIG. 7 is a block diagram of a training apparatus for a policy recommendation model provided in an embodiment of the present application;
FIG. 8 is a block diagram of a training apparatus for a policy recommendation model according to another embodiment of the present application;
fig. 9 is a block diagram of a computer device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Artificial Intelligence (AI) is a theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human Intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.
The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
Machine Learning (ML) is a multi-domain cross discipline, and relates to a plurality of disciplines such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and the like. The special research on how a computer simulates or realizes the learning behavior of human beings so as to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve the performance of the computer. Machine learning is the core of artificial intelligence, is the fundamental approach for computers to have intelligence, and is applied to all fields of artificial intelligence. Machine learning and deep learning generally include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
The technical scheme provided by the embodiment of the application relates to an artificial intelligence machine learning technology, and is specifically explained by the following embodiment.
In the technical solution provided in this embodiment of the present application, the main body for executing each step may be a Computer device, where the Computer device refers to a device having a data analysis processing function and a storage function, such as a PC (Personal Computer), a server, or other electronic devices having a computing capability, and this is not limited in this embodiment of the present application. Alternatively, the computer device may be one server, a server cluster composed of a plurality of servers, or a cloud computing service center. Optionally, an application IDE (Integrated Development Environment) may be run on the computer device to provide a program Development Environment, for example, the functions of the method example provided by the embodiment of the present application may be Integrated in the IDE, so that a program developer may automatically determine the file reference policy by the computer device when developing the application using the IDE. The IDE generally includes tools such as a code editor, a compiler, a debugger, a graphical user interface, and the like, and is an integrated development software service suite integrating a code writing function, an analysis function, a compiling function, a debugging function, and the like, and all software or software suites (groups) having this characteristic may be called IDEs, such as microsoft VS code series.
Referring to fig. 1, a flowchart of a method for determining a file reference policy according to an embodiment of the present application is shown. The method may be applied in the computer device described above. The method comprises the following steps (110-130):
step 110, obtaining the reference path relation between the declaration file and the resource file in the target program.
The declaration file is a carrier file containing function functions and data interface declarations, and is mainly used for storing declarations of programs. The presentation of the claim file may be different in different programming languages, for example, in the C + +/C programming language, the presentation of the claim file is a header file. The resource file is a file corresponding to a resource actually referenced by the declaration file, and the resource file is mainly used for realizing the saving of the program. Alternatively, the representation of the resource file may be a resource function or a variable.
Illustratively, in the C + +/C programming language, a piece of program generally includes a header file, i.e., a declaration file, and a definition file, i.e., a resource file. The header file is mainly used for function reference of a plurality of definition files and preventing conflict of definitions, gives a description to each referred definition file, does not need to contain logic implementation codes of a program, and only plays a descriptive role. In practical application, the computer device only needs to refer to the related resource file according to the interface declaration in the declaration file, such as the related function or variable, and the linker can find the actual definition code corresponding to the resource file from the database, so that the actual definition code is executed by the computer device to realize the reference to the resource file.
The target program may be any program being compiled, or may be any program that has been opened, and this is not limited in this embodiment of the present application. After the computer device obtains the target program, the computer device can analyze the resource file needed by the target program, and then obtain the reference path relationship between the declaration file and the resource file according to the resource file. The reference path relationship between the declaration file and the resource file refers to a specific implementation mode of referring to the resource file through the declaration file, and the reference path relationship can be used for facilitating computer equipment to obtain a possible implementation mode of referring to the resource file through the declaration file. Alternatively, the reference path relationship may include a user, a declaration document and a resource document, where the user refers to an author of the target program, that is, a user who needs to use the resource document, as shown in fig. 2, which shows a schematic diagram of the reference path relationship, where the reference path relationship 200 includes a user 210, a declaration document 220 and a resource document 230, and the resource document 230 includes: eee.cpp, ddd.cpp, aaa.cpp, bbb.cpp, and ccc.cpp. Cpp, for example, the claim file 220 that may refer to the resource file 230 includes: a2a.h, a2.h and A.h, i.e. the computer device may be referenced to the resource file ddd.cpp in three ways, respectively, by a2a.h, by a2.h and by A.h.
Optionally, the reference path relationship may be established after the resource file is determined by the computer device, that is, the declaration file and the resource file are stored in the computer device, and when the declaration file that can reference the resource file is obtained after the resource file that needs to be used is determined by obtaining the target program, the declaration file that can reference the resource file is obtained, and the reference path relationship between the resource file and all declaration files that can reference the resource file is established. Optionally, the reference path relationship may also be stored in the computer device in advance, that is, reference path relationships between all resource files and all declaration files that can refer to the resource files are stored in the computer device, and when the target program is acquired and a resource file that needs to be used is determined, the reference path relationship corresponding to the resource file that needs to be used may be obtained from the stored reference path relationship.
And 120, determining the metadata information of the first program segment in the target program according to the reference path relation between the declaration file and the resource file in the target program.
The first program segment refers to a certain program segment in the target program, and the first program segment may be a line of code in the target program or a plurality of lines of code in the target program, which is not limited in this embodiment of the present application. After the computer device obtains the target program and the reference path relationship between the declaration file and the resource file in the target program, the computer device may analyze the target program according to the program segments, and determine the metadata information of each program segment. Because the target program usually includes a large number of program codes (e.g., millions of lines), the resource files needed to be used by different program segments are different, and the reference policies of the resource files are also different, by analyzing the target program sub-program segments, the reference policies of the program segments can be more accurately analyzed by the computer device for the specific situations of the different program segments, the processing overhead of the computer device is reduced, and the situation that the computer device is stuck when processing a large target program at a time is avoided.
The metadata information of the first program segment is used to characterize the characteristics of the first program segment, that is, after the computer device acquires the first program segment, the characteristics of the first program segment can be analyzed according to the metadata information of the first program segment, where the characteristics may be specific implementation scenarios of the first program segment, such as which resource files need to be used, how to refer to the resource files, whether to introduce redundant resource files by referring to the resource files, the number of rows of the first program segment, and the like.
In this embodiment of the present application, the metadata information of the first program segment may correspond to a specific file reference policy, that is, the resource file that needs to be used in the first program segment may have at least one file reference policy, each file reference policy has metadata corresponding to the file reference policy, and the metadata information of the first program segment includes metadata corresponding to each available file reference policy. Optionally, the step 120: acquiring at least one available file reference strategy of the first program segment according to the reference path relation between the statement file and the resource file in the target program; respectively acquiring metadata corresponding to each available file reference policy, wherein the metadata comprises at least one of the following items: the method comprises the following steps of citing path depth, directory distance, the number of introduced declaration files, introduced redundancy declaration, the number of introduced files, program file size, directory distribution condition, author and modification record.
For example, as shown in fig. 2, if the first program segment needs to refer to the resource file ddd.cpp, if the resource file ddd.cpp is referred to by using the declaration file a2a.h, the reference path depth is 1, if the resource file ddd.cpp is referred to by using the declaration file A.h, the declaration file a2.h is referred to by using the declaration file A.h, the declaration file a2a.h is referred to by using the declaration file a2.h, and the resource file ddd.cpp is referred to by using the declaration file a2a.h, the reference path depth is 3; the target distance refers to the distance between the directory where a certain resource file is located and the directory where the declaration file that refers to the resource file is located, and the certain resource file and the declaration file that can refer to the resource file can be in the same directory or different directories; the number of incoming declaration files is the number of declaration files used when referring to the resource file needed by a certain program segment, for example, as shown in fig. 2, if the first program segment needs to refer to the resource files ddd.cpp and eee.cpp, and the declaration file a1.h is used to refer to the resource file eee.cpp, and the declaration file a2.h is used to refer to the resource file ddd.cpp, the number of incoming declaration files is 2; introducing a redundancy declaration refers to the number of unnecessary resource files that are introduced while referring to a required resource file, and as shown in fig. 2, if a first program segment needs to refer to a resource file aaa.cpp and the resource file aaa.cpp is referred to by using a declaration file a3.h, since resource files bbb.cpp and ccc.cpp are also introduced by using declaration file a3.h, and resource files bbb.cpp and ccc.cpp are not needed by the first program segment, the redundancy declaration is introduced as 2; the number of import files refers to the number of header files that need to be called when a certain resource file is referred to, for example, as shown in fig. 2, if a first program segment needs to refer to a resource file ddd.cpp, if a declaration file a2.h is used to refer to the resource file ddd.cpp, the resource file ddd.cpp needs to be referred to by the declaration file a2.h through the declaration file a2.h, and then the resource file ddd.cpp is referred to by the declaration file a2a.h through the declaration file a2 h, and the number of import files is 2; the size of the program file is a file size corresponding to the first program segment, and optionally, the size of the program file may be represented by a number of lines, for example, if the first program segment has three lines, the size of the program file of the first program segment is 3; the directory distribution condition refers to the distribution condition of the directories where the resource files and the declaration files which are needed to be used in the first program segment are located; the author refers to a writer of the first program segment, namely a user needing to refer to the resource file; the modification condition refers to the historical change condition of the author to the first program segment.
Because the metadata is various in variety, in practical application, some metadata may not affect the reference decision, and if too much metadata is analyzed, the processing overhead of the computer device is increased, so in order to reduce the processing overhead of the computer device and analyze the first program segment in a targeted manner, after the metadata corresponding to each available file reference policy is respectively obtained, the method further includes: selecting target metadata with influence factors meeting conditions from metadata corresponding to available file reference strategies; wherein the metadata information of the first program segment includes: each available file references target metadata corresponding to a policy. That is, after the metadata is acquired by the computer device, the metadata whose influence factor satisfies the condition may be selected from a large amount of metadata, for example, the reference path depth, the number of incoming declaration files, and the incoming redundant declaration may be selected as the target metadata from the above metadata. Optionally, the process of selecting the target metadata may be performed by an author, for example, the author selects the target metadata from the metadata based on experience, or may be performed automatically by a computer device, for example, the computer device randomly selects the target metadata from the metadata, which is not limited in this embodiment of the application. After the computer device determines the target metadata, the target metadata corresponding to each available file reference policy may be used as the metadata information of the first program segment.
Step 130, determining a recommended file reference policy corresponding to the first program segment according to the metadata information of the first program segment.
After the computer device determines the metadata information of the first program segment, it may determine a recommended file reference policy corresponding to the first program segment according to the metadata information, that is, determine which declaration file to refer to the resource file. Optionally, the computer device may specifically determine the recommended file reference policy through a policy recommendation model or a policy recommendation function, for example, the computer device may output the recommended file reference policy corresponding to the first program segment by calling the policy recommendation function and inputting the metadata information into the policy recommendation function; the computer device may also specifically determine the recommended file reference policy by a screening method, for example, after the computer device determines at least one available file reference policy, the recommended file reference policy corresponding to the first program segment is determined from the available file reference policies by a certain screening index, for example, the number of imported files is the minimum. Optionally, in order to make the recommended file reference policy selected by the computer device conform to the preference of the user and make the computer device quickly and accurately determine the recommended file reference policy, the computer device may process the metadata information of the first program segment through the policy recommendation model to obtain the recommended file reference policy corresponding to the first program segment; the strategy recommendation model is a machine learning model obtained by learning the sample program by adopting a machine learning algorithm. For a specific training process of the policy recommendation model, please refer to the following alternative embodiments, which are not repeated herein.
In a possible implementation, the step 130 further includes, after the step of: generating a reference code corresponding to the first program segment by adopting a recommended file reference strategy; and the reference code is used for referencing a declaration file conforming to the recommended file reference policy for the resource file in the first program segment. After the computer equipment determines the recommended file reference strategy, reference codes corresponding to the first program segment can be generated according to the file reference strategy, then statement files meeting the recommended file reference strategy can be referred through the reference codes, and further the statement files are referred to needed resource files, and therefore the resource files are used.
In another possible embodiment, the step 130 is followed by: comparing the recommended file reference strategy with a file reference strategy actually adopted by the first program segment to generate a strategy evaluation result corresponding to the first program segment; and the strategy evaluation result is used for indicating the fitness of the file reference strategy actually adopted by the first program segment. In the embodiment of the present application, when a user writes a target program, a file reference policy corresponding to a first program segment may have been determined, at this time, the user may input metadata information of the first program segment into a policy recommendation model to obtain a recommended file reference policy, where the recommended file reference policy is an optimal reference policy that meets user preferences, and compare the recommended file reference policy with an actually-used file reference policy, a policy evaluation result corresponding to the first program segment may be generated, that is, a fitness of an actually-used file reference policy is generated, that is, a degree of adapting to user preferences is generated, optionally, the fitness may be represented in a form of score, that is, when a computer device compares the recommended file reference policy with the actually-used file reference policy, the score represents a size of the fitness, optionally, the score and the fitness are in a positive correlation relationship, that is, the higher the score is, the greater the fitness is, that is, the better the fitness is in accordance with the preference of the user.
In summary, the technical solution provided in the embodiment of the present application provides an automatic determination method for a file reference policy by obtaining a reference path relationship between a declaration file of a target program and a resource file, determining metadata information according to the reference path relationship, and determining a recommended file reference policy according to the metadata information. In addition, in the embodiment of the application, according to the referenced path relationship, metadata information of a certain program segment of the target program is determined, and then according to the metadata information, a recommended file reference policy corresponding to the program segment is determined, so that the target program is analyzed according to the program segment. In addition, according to the technical scheme provided by the embodiment of the application, the file reference policy recommended by a certain program segment can be directly determined according to the metadata information of the program segment, and compared with the process of multiple compiling detection in the related art, the technical scheme provided by the embodiment of the application improves the determination efficiency of the file reference policy and reduces the time cost consumed for determining the file reference policy.
In addition, according to the technical scheme provided by the embodiment of the application, the metadata information of a certain program segment is processed through the policy recommendation model, the recommended file reference policy corresponding to the program segment is obtained, and a specific determination mode of the file reference policy is provided. In addition, in the embodiment of the application, the policy recommendation model is reusable, that is, the computer device can repeatedly use the policy recommendation model to determine recommended file reference policies corresponding to different program segments, so that the efficiency of determining the file reference policies by the computer device is improved. In addition, because the strategy recommendation model is a machine learning model obtained by learning according to the sample program selected by the user, the learning style of the strategy recommendation model is in accordance with the preference of the user, namely the file reference strategy obtained by using the strategy recommendation model is in accordance with the file reference strategy preferred by the user, so that the requirement of the user is better met.
In addition, according to the technical scheme provided by the embodiment of the application, the recommended file reference policy corresponding to a certain program segment is compared with the file reference policy actually adopted by the program segment to generate the policy evaluation result corresponding to the program segment, and the policy evaluation result is used for indicating the program which adapts to the user preference to the file reference policy actually adopted by the program segment, so that a mode for prompting a user whether the file reference policy of the certain program segment is optimal or not is provided, and the user can timely adjust the file reference policy of the program segment.
Referring to fig. 3, a flowchart of a training method of a policy recommendation model according to an embodiment of the present application is shown. The method may be applied in the computer device described above. The method comprises the following steps (310-340):
at step 310, a sample procedure is obtained.
The sample program is a program selected by a user from programs that have been sourced, and is used for training a policy recommendation model for providing recommended file reference policies. Wherein, the program which is already open source is the written and public-oriented program. In the embodiment of the application, the sample program selected by the user determines the learning style of the policy recommendation model, and the sample program is selected by the user and has the preference of the user, so the file reference policy recommended by the trained policy recommendation model is also the file reference policy according with the preference of the user. Alternatively, the sample program may be a program that is open source in the whole network, may also be a program that is open source in the field in the industry, and may also be a program that is open source in the company, which is not limited in this embodiment of the present application. Optionally, the user may obtain one sample program or obtain a plurality of sample programs, which is not limited in this embodiment of the application.
Step 320, obtaining the reference path relation between the declaration file and the resource file in the sample program.
In the embodiment of the application, after the computer device obtains the sample program, the sample program can be analyzed to obtain the reference path relationship between the declaration file and the resource file in the sample program. For an introduction description of the declaration file, the resource file, and the reference path relationship between the declaration file and the resource file, please refer to step 110 above, which is not described herein again.
Step 330, generating at least one training sample according to the reference path relation.
The training samples are samples used for training a strategy recommendation model, the computer equipment can generate at least one training sample according to a reference path relation, each training sample comprises metadata information and label information of a program segment in a sample program, wherein the metadata information is used for representing characteristics of the program segment, and the characteristics can be specific implementation scenes of the program segment; the label information is used to indicate the file reference policy actually adopted by the program segment, i.e., what declaration file is actually adopted by the program segment to reference to the resource file. For an introduction description of the program segment, refer to step 120 above, and are not described herein again.
In one example, the step 330 includes: for any program segment in the sample program, acquiring at least one available file reference strategy of the program segment according to the reference path relation; respectively acquiring metadata corresponding to each available file reference policy, wherein the metadata comprises at least one of the following items: depth of reference path, distance of directory, number of introduced declaration files, number of introduced redundant declaration, number of introduced files, size of program file, directory distribution condition, author and modification record; wherein the metadata information of the program segment includes: metadata corresponding to each available file reference policy; and generating a training sample corresponding to the program segment according to the metadata information and the label information of the program segment.
In this embodiment of the present application, a certain program segment of a sample program may correspond to multiple available file reference policies, each file reference policy has metadata corresponding to the file reference policy, and metadata information of the program segment includes metadata corresponding to each available file reference policy. The computer device may generate a training sample corresponding to the program segment according to the metadata information and the tag information of the program segment, where the training sample may indicate that the program segment selects a file reference policy from at least one available file reference policy. For a description of the metadata, please refer to step 120, which is not described herein.
Optionally, after obtaining the metadata corresponding to each available file reference policy, the method further includes: selecting target metadata with influence factors meeting conditions from metadata corresponding to available file reference strategies; wherein the metadata information of the program segment includes: each available file references target metadata corresponding to a policy. That is, after the metadata is acquired by the computer device, the metadata whose influence factor satisfies the condition may be selected from a large amount of metadata, for example, the reference path depth, the number of incoming declaration files, and the incoming redundant declaration may be selected as the target metadata from the above metadata. By selecting target metadata from the metadata for subsequent analysis processing, the processing overhead of computer equipment can be reduced, and a certain program segment can be analyzed in a targeted manner. For a specific selection process of the target metadata, please refer to step 120 above, which is not described herein again. Optionally, in order to enable the policy recommendation model to be used normally, the target metadata included in the metadata information corresponding to the program segment in the training sample selected by the computer device is the same as the target metadata included in the metadata information corresponding to the program segment of the target program.
And 340, training by adopting the training samples to obtain a strategy recommendation model.
After the computer device determines the training sample, a strategy recommendation model can be obtained through learning and training according to the training sample, the input of the strategy recommendation model is metadata information of the program segment, and the output of the strategy recommendation model is label information of the program segment.
Optionally, step 340 includes: acquiring the characteristics of a training sample; for training samples with the same characteristics, determining the types of label information and the use frequency of the label information of each type; for each type of label information, determining a strategy recommendation model corresponding to each type of label information according to metadata information corresponding to each type of label information; and determining the strategy recommendation model corresponding to the training sample with the same characteristics according to the use frequency of the label information of each type and the strategy recommendation model corresponding to the label information of each type. In the embodiment of the application, the metadata information is used for characterizing the characteristics of a certain program segment, and the characteristics of the training sample corresponding to the program segment can be determined according to the metadata information of the program segment. The label information is used to indicate a file reference strategy actually adopted by a certain program segment, and for program segments corresponding to training samples with the same characteristics, different file reference strategies may be actually adopted, so that the training samples may include different types of label information. Then, because each type of label information corresponds to a use frequency, that is, the number of times that the file reference policy corresponding to the label information is used in the actual application, the computer device can determine the policy recommendation model corresponding to the training sample with the same characteristics according to the use frequency and the policy recommendation model under each type. Optionally, the computer device may use the policy recommendation model corresponding to the label information with the highest frequency of use as the policy recommendation model corresponding to the training sample with the same characteristics.
In summary, according to the technical scheme provided by the embodiment of the present application, a sample program and a reference path relationship between a statement file and a resource file in the sample program are obtained, then at least one training sample is generated according to the reference path relationship, a policy recommendation model is obtained according to training of the training sample, and a specific training method of the policy recommendation model is provided.
In addition, according to the technical scheme provided by the embodiment of the application, by obtaining the features of the training samples, the types of the label information and the use frequency of the label information of each type are determined for the training samples with the same features, then for the label information of each type, the policy recommendation model corresponding to the label information of the type is determined according to the metadata corresponding to the label information, and then the policy recommendation model corresponding to the training samples with the same features is determined according to the use frequency of the label information of each type and the policy recommendation model, so that a way for training the policy recommendation model for the training samples with different features is provided. In addition, in the process of writing a sample program, program segments with the same characteristics may correspond to different file reference strategies, that is, label information of training samples with the same characteristics may be different, in the embodiment of the present application, the training samples with the same characteristics are divided into different types according to the label information, and then, a strategy recommendation model corresponding to the training sample with the same characteristics is determined according to the use frequency of each type of label information and the strategy recommendation model, so that the trained strategy recommendation model can better conform to the overall style of a user.
Referring to fig. 4, a flowchart of a method for determining a file reference policy according to an embodiment of the present application is shown. The method may include the steps of:
step 410, obtaining a sample program; the sample program is a program which is selected by a user from programs which are open sources and used for training a strategy recommendation model, and the strategy recommendation model is used for providing recommended file reference strategies;
step 420, obtaining a reference path relation between the statement file and the resource file in the sample program; after the computer equipment acquires the sample program, the sample program can be analyzed to obtain a reference path relation between the statement file and the resource file in the sample program, wherein the reference path relation between the statement file and the resource file refers to a specific implementation mode of referring to the resource file through the statement file;
step 430, generating at least one training sample according to the reference path relation; the training samples are samples used for training a strategy recommendation model, the computer equipment can generate at least one training sample according to the reference path relation, each training sample comprises metadata information and label information of a program segment in a sample program, and the metadata information is used for representing the characteristics of the program segment; the label information is used for indicating the file reference strategy actually adopted by the program segment;
step 440, training by using a training sample to obtain a strategy recommendation model; after the computer equipment determines the training sample, a strategy recommendation model can be obtained according to the training sample learning training, wherein the input of the strategy recommendation model is the metadata information of the program segment, and the output of the strategy recommendation model is the label information of the program segment;
step 450, acquiring a reference path relation between a declaration file and a resource file in the target program; the target program may be any program being compiled or any program having an open source, which is not limited in the embodiment of the present application, and after obtaining the target program, the computer device may analyze a resource file that needs to be used by the target program, and then obtain, according to the resource file, a reference path relationship between the declaration file and the resource file;
step 460, determining metadata information of a first program segment in the target program according to the reference path relationship between the declaration file and the resource file in the target program; after the computer equipment acquires the target program and the reference path relation between the statement file and the resource file in the target program, the target program can be analyzed according to the program segments, and for each program segment, the metadata information of the program segment is determined;
step 470, processing the metadata information of the first program segment through the policy recommendation model to obtain a recommended file reference policy corresponding to the first program segment; after determining the metadata information of the first program segment, the computer device may input the metadata information into the policy recommendation model trained in step 440, and generate a recommended file reference policy corresponding to the first program segment by the policy recommendation model, that is, determine which declaration file the resource file is specifically referenced by.
Referring to fig. 5, a block diagram of a device for determining a file reference policy according to an embodiment of the present application is shown. The device has the function of implementing the above file reference policy determination method example, and the function may be implemented by hardware, or may be implemented by hardware executing corresponding software. The device can be a computer device and can also be arranged in the computer device. The apparatus 500 may comprise: a relationship acquisition module 510, an information determination module 520, and a policy determination module 530.
The relationship obtaining module 510 is configured to obtain a reference path relationship between the declaration file and the resource file in the target program.
An information determining module 520, configured to determine, according to a reference path relationship between a declaration file and a resource file in the target program, metadata information of a first program segment in the target program, where the metadata information of the first program segment is used to characterize a feature of the first program segment.
A policy determining module 530, configured to determine, according to the metadata information of the first program segment, a recommended file reference policy corresponding to the first program segment.
Optionally, the policy determining module 530 is configured to: processing the metadata information of the first program segment through a policy recommendation model to obtain a recommended file reference policy corresponding to the first program segment; the strategy recommendation model is a machine learning model obtained by learning a sample program by adopting a machine learning algorithm.
Optionally, the training process of the policy recommendation model is as follows: obtaining a sample program; acquiring a reference path relation between a statement file and a resource file in the sample program; generating at least one training sample according to a reference path relation between a statement file and a resource file in the sample program, wherein the training sample comprises metadata information and label information of a program segment in the sample program, and the label information is used for indicating a file reference strategy actually adopted by the program segment; and training by adopting the training sample to obtain the strategy recommendation model.
Optionally, the information determining module 520 is configured to: acquiring at least one available file reference strategy of the first program segment according to the reference path relation between the statement file and the resource file in the target program; respectively acquiring metadata corresponding to each available file reference policy, wherein the metadata comprises at least one of the following items: depth of reference path, distance of directory, number of introduced declaration files, introduction of redundant declaration, number of introduced files, size of program file, distribution condition of directory, author and modification record; wherein the metadata information of the first program segment includes: each of the available files references metadata corresponding to a policy.
Optionally, as shown in fig. 6, the apparatus 500 further includes a metadata selecting module 540, configured to: selecting target metadata with influence factors meeting conditions from metadata corresponding to the available file reference strategies; wherein the metadata information of the first program segment includes: and each available file references target metadata corresponding to the policy.
Optionally, as shown in fig. 6, the apparatus 500 further includes a code generation module 550, configured to: generating a reference code corresponding to the first program segment by adopting the recommended file reference strategy; wherein the reference code is used for referencing a declaration file conforming to the recommended file reference policy for the resource file in the first program segment.
Optionally, as shown in fig. 6, the apparatus 500 further includes a result generation module 560, configured to: comparing the recommended file reference strategy with a file reference strategy actually adopted by the first program segment to generate a strategy evaluation result corresponding to the first program segment; and the policy evaluation result is used for indicating the fitness of the file reference policy actually adopted by the first program segment.
In summary, the technical solution provided in the embodiment of the present application provides an automatic determination method for a file reference policy by obtaining a reference path relationship between a declaration file of a target program and a resource file, determining metadata information according to the reference path relationship, and determining a recommended file reference policy according to the metadata information. In addition, in the embodiment of the application, according to the referenced path relationship, metadata information of a certain program segment of the target program is determined, and then according to the metadata information, a recommended file reference policy corresponding to the program segment is determined, so that the target program is analyzed according to the program segment. In addition, according to the technical scheme provided by the embodiment of the application, the file reference policy recommended by a certain program segment can be directly determined according to the metadata information of the program segment, and compared with the process of multiple compiling detection in the related art, the technical scheme provided by the embodiment of the application improves the determination efficiency of the file reference policy and reduces the time cost consumed for determining the file reference policy.
Referring to fig. 7, a block diagram of a training apparatus for a policy recommendation model according to an embodiment of the present application is shown. The device has the function of realizing the training method example of the strategy recommendation model, and the function can be realized by hardware or by hardware executing corresponding software. The device can be a computer device and can also be arranged in the computer device. The apparatus 700 may include: a program acquisition module 710, a relationship acquisition module 720, a sample generation module 730, and a model training module 740.
A program obtaining module 710 for obtaining a sample program.
A relation obtaining module 720, configured to obtain a reference path relation between the declaration file and the resource file in the sample program.
A sample generating module 730, configured to generate at least one training sample according to the reference path relationship, where the training sample includes metadata information and tag information of a program segment in the sample program, where the metadata information is used to characterize a feature of the program segment, and the tag information is used to indicate a file reference policy actually adopted by the program segment.
And the model training module 740 is configured to train the training samples to obtain a policy recommendation model, where the policy recommendation model is used to provide a recommended file reference policy.
Optionally, the sample generating module 730 is configured to: for any program segment in the sample program, acquiring at least one available file reference strategy of the program segment according to the reference path relation; respectively acquiring metadata corresponding to each available file reference policy, wherein the metadata comprises at least one of the following items: depth of reference path, distance of directory, number of introduced declaration files, number of introduced redundant declaration, number of introduced files, size of program file, directory distribution condition, author and modification record; wherein the metadata information of the program segment includes: metadata corresponding to each of the available file reference policies; and generating a training sample corresponding to the program segment according to the metadata information and the label information of the program segment.
Optionally, as shown in fig. 8, the apparatus 700 further includes a metadata selecting module 750, configured to: selecting target metadata with influence factors meeting conditions from metadata corresponding to the available file reference strategies; wherein the metadata information of the program segment includes: and each available file references target metadata corresponding to the policy.
Optionally, the model training module 740 is configured to: obtaining features of the training sample; for training samples with the same characteristics, determining the types of the label information and the use frequency of the label information of each type; for the tag information of each kind, determining a policy recommendation model corresponding to the tag information of each kind according to the metadata information corresponding to the tag information of each kind; and determining the strategy recommendation model corresponding to the training sample with the same characteristics according to the use frequency of the label information of each type and the strategy recommendation model corresponding to the label information of each type.
In summary, according to the technical scheme provided by the embodiment of the present application, a sample program and a reference path relationship between a statement file and a resource file in the sample program are obtained, then at least one training sample is generated according to the reference path relationship, a policy recommendation model is obtained according to training of the training sample, and a specific training method of the policy recommendation model is provided.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
Referring to fig. 9, a block diagram of a computer device provided in an embodiment of the present application is shown, where the computer device may be used to implement the above example of the method for determining the file reference policy or the above function of the example of the method for training the policy recommendation model. Specifically, the method comprises the following steps:
the computer apparatus 900 includes a Processing Unit (e.g., a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), an FPGA (Field Programmable Gate Array), etc.) 901, a system Memory 904 including a RAM (Random-Access Memory) 902 and a ROM (Read-Only Memory) 903, and a system bus 905 connecting the system Memory 904 and the Central Processing Unit 901. The computer device 900 also includes an I/O System (basic Input/Output System) 906 that facilitates transfer of information between devices within the computer device, and a mass storage device 907 for storing an operating System 913, application programs 914, and other program modules 915.
The basic input/output system 906 includes a display 908 for displaying information and an input device 909 such as a mouse, keyboard, etc. for a user to input information. The display 908 and the input device 909 are connected to the central processing unit 901 through an input/output controller 910 connected to the system bus 905. The basic input/output system 906 may also include an input/output controller 910 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input-output controller 910 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 907 is connected to the central processing unit 901 through a mass storage controller (not shown) connected to the system bus 905. The mass storage device 907 and its associated computer-readable media provide non-volatile storage for the computer device 900. That is, the mass storage device 907 may include a computer-readable medium (not shown) such as a hard disk or CD-ROM (Compact disk Read-Only Memory) drive.
Without loss of generality, the computer readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash Memory or other solid state Memory technology, CD-ROM, DVD (Digital Video Disc) or other optical, magnetic, tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. The system memory 904 and mass storage device 907 described above may be collectively referred to as memory.
The computer device 900 may also operate as a remote computer connected to a network via a network, such as the internet, in accordance with embodiments of the present application. That is, the computer device 900 may be connected to the network 912 through the network interface unit 911 attached to the system bus 905, or the network interface unit 911 may be used to connect to other types of networks or remote computer systems (not shown).
The memory also includes at least one instruction, at least one program, set of codes, or set of instructions stored in the memory and configured to be executed by the one or more processors to implement the method for determining the file reference policy or the method for training the policy recommendation model.
In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, and the at least one instruction, the at least one program, the set of codes, or the set of instructions is loaded and executed by a processor to implement the above-mentioned method for determining a file reference policy or the above-mentioned method for training a policy recommendation model.
Optionally, the computer-readable storage medium may include: a Read Only Memory (ROM), a Random Access Memory (RAM), a Solid State Drive (SSD), or an optical disc. The Random Access Memory may include a resistive Random Access Memory (ReRAM) and a Dynamic Random Access Memory (DRAM).
In an exemplary embodiment, a computer program product is further provided, which, when run on a computer device, causes the computer device to execute the above method for determining a file reference policy or the above method for training a policy recommendation model.
It should be understood that reference to "a plurality" herein means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. In addition, the step numbers described herein only exemplarily show one possible execution sequence among the steps, and in some other embodiments, the steps may also be executed out of the numbering sequence, for example, two steps with different numbers are executed simultaneously, or two steps with different numbers are executed in a reverse order to the order shown in the figure, which is not limited by the embodiment of the present application.
The above description is only exemplary of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements and the like that are made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (15)

1. A method for determining a file reference policy, the method comprising:
acquiring a reference path relation between a statement file and a resource file in a target program;
according to a reference path relation between a declaration file and a resource file in the target program, determining metadata information of a first program segment in the target program, wherein the metadata information of the first program segment is used for characterizing the first program segment, the metadata information contains metadata corresponding to at least one file reference policy, and the metadata comprises at least one of the following: depth of reference path, distance of directory, number of introduced declaration files, introduction of redundant declaration, number of introduced files, size of program file, distribution condition of directory, author and modification record;
and determining a recommended file reference policy corresponding to the first program segment according to the metadata information of the first program segment, wherein the file reference policy is used for determining a declaration file used by the first program segment for referring to the resource file.
2. The method of claim 1, wherein determining the recommended file reference policy corresponding to the first program segment according to the metadata information of the first program segment comprises:
processing the metadata information of the first program segment through a policy recommendation model to obtain a recommended file reference policy corresponding to the first program segment;
the strategy recommendation model is a machine learning model obtained by learning a sample program by adopting a machine learning algorithm.
3. The method of claim 2, wherein the training process of the policy recommendation model is as follows:
obtaining a sample program;
acquiring a reference path relation between a statement file and a resource file in the sample program;
generating at least one training sample according to a reference path relation between a statement file and a resource file in the sample program, wherein the training sample comprises metadata information and label information of a program segment in the sample program, and the label information is used for indicating a file reference strategy actually adopted by the program segment;
and training by adopting the training sample to obtain the strategy recommendation model.
4. The method of claim 1, wherein determining metadata information of a first program segment in the target program according to a reference path relationship between a declaration file and a resource file in the target program comprises:
acquiring at least one available file reference strategy of the first program segment according to the reference path relation between the statement file and the resource file in the target program;
and respectively acquiring metadata corresponding to the available file reference strategies.
5. The method according to claim 4, wherein after the obtaining the metadata corresponding to the available file reference policies, further comprises:
selecting target metadata with influence factors meeting conditions from metadata corresponding to the available file reference strategies;
wherein the metadata information of the first program segment includes: and each available file references target metadata corresponding to the policy.
6. The method of any one of claims 1 to 5, wherein after determining the recommended file reference policy corresponding to the first program segment according to the metadata information of the first program segment, the method further comprises:
generating a reference code corresponding to the first program segment by adopting the recommended file reference strategy;
wherein the reference code is used for referencing a declaration file conforming to the recommended file reference policy for the resource file in the first program segment.
7. The method of any one of claims 1 to 5, wherein after determining the recommended file reference policy corresponding to the first program segment according to the metadata information of the first program segment, the method further comprises:
comparing the recommended file reference strategy with a file reference strategy actually adopted by the first program segment to generate a strategy evaluation result corresponding to the first program segment;
and the policy evaluation result is used for indicating the fitness of the file reference policy actually adopted by the first program segment.
8. A method for training a policy recommendation model, the method comprising:
obtaining a sample program;
acquiring a reference path relation between a statement file and a resource file in the sample program;
generating at least one training sample according to the reference path relationship, where the training sample includes metadata information and tag information of a program segment in the sample program, the metadata information is used to characterize the program segment, the metadata information includes metadata corresponding to at least one file reference policy, and the metadata includes at least one of: the method comprises the following steps of quoting path depth, directory distance, the number of introduced declaration files, introduced redundant declaration, the number of introduced files, program file size, directory distribution condition, author and modification record, wherein the label information is used for indicating a file quoting strategy actually adopted by the program segment, and the file quoting strategy is used for determining a declaration file used by the program segment for quoting the resource file;
and training by adopting the training sample to obtain a strategy recommendation model, wherein the strategy recommendation model is used for providing a recommended file reference strategy.
9. The method of claim 8, wherein the generating at least one training sample according to the reference path relationship comprises:
for any program segment in the sample program, acquiring at least one available file reference strategy of the program segment according to the reference path relation;
respectively acquiring metadata corresponding to each available file reference strategy;
and generating a training sample corresponding to the program segment according to the metadata information and the label information of the program segment.
10. The method according to claim 9, wherein after the obtaining the metadata corresponding to the available file reference policies, further comprises:
selecting target metadata with influence factors meeting conditions from metadata corresponding to the available file reference strategies;
wherein the metadata information of the program segment includes: and each available file references target metadata corresponding to the policy.
11. The method according to any one of claims 8 to 10, wherein the training with the training samples results in a strategy recommendation model, comprising:
obtaining features of the training sample;
for training samples with the same characteristics, determining the types of the label information and the use frequency of the label information of each type;
for the tag information of each kind, determining a policy recommendation model corresponding to the tag information of each kind according to the metadata information corresponding to the tag information of each kind;
and determining the strategy recommendation model corresponding to the training sample with the same characteristics according to the use frequency of the label information of each type and the strategy recommendation model corresponding to the label information of each type.
12. An apparatus for determining a file reference policy, the apparatus comprising:
the relation acquisition module is used for acquiring a reference path relation between a statement file and a resource file in a target program;
an information determining module, configured to determine, according to a reference path relationship between a declaration file and a resource file in the target program, metadata information of a first program segment in the target program, where the metadata information of the first program segment is used to characterize a feature of the first program segment, and the metadata information includes metadata corresponding to at least one file reference policy, where the metadata includes at least one of: depth of reference path, distance of directory, number of introduced declaration files, introduction of redundant declaration, number of introduced files, size of program file, distribution condition of directory, author and modification record;
and the policy determining module is used for determining a recommended file reference policy corresponding to the first program segment according to the metadata information of the first program segment, wherein the file reference policy is used for determining a declaration file used by the first program segment for referring to the resource file.
13. An apparatus for training a policy recommendation model, the apparatus comprising:
the program acquisition module is used for acquiring a sample program;
the relation acquisition module is used for acquiring a reference path relation between the statement file and the resource file in the sample program;
a sample generating module, configured to generate at least one training sample according to the reference path relationship, where the training sample includes metadata information and tag information of a program segment in the sample program, where the metadata information is used to characterize features of the program segment, and the metadata information includes metadata corresponding to at least one file reference policy, and the metadata includes at least one of: the method comprises the following steps of quoting path depth, directory distance, the number of introduced declaration files, introduced redundant declaration, the number of introduced files, program file size, directory distribution condition, author and modification record, wherein the label information is used for indicating a file quoting strategy actually adopted by the program segment, and the file quoting strategy is used for determining a declaration file used by the program segment for quoting the resource file;
and the model training module is used for training by adopting the training sample to obtain a strategy recommendation model, and the strategy recommendation model is used for providing a recommended file reference strategy.
14. A computer device comprising a processor and a memory, the memory having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the method of determining a file referencing policy of any of claims 1 to 7 or to implement the method of training a policy recommendation model of any of claims 8 to 11.
15. A computer readable storage medium having stored therein at least one instruction, at least one program, a set of codes, or a set of instructions, which is loaded and executed by a processor to implement the method of determining a file referencing policy of any one of claims 1 to 7 or to implement the method of training a policy recommendation model of any one of claims 8 to 11.
CN202010085025.1A 2020-02-10 2020-02-10 Method, device, equipment and storage medium for determining file reference policy Active CN111290739B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010085025.1A CN111290739B (en) 2020-02-10 2020-02-10 Method, device, equipment and storage medium for determining file reference policy

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010085025.1A CN111290739B (en) 2020-02-10 2020-02-10 Method, device, equipment and storage medium for determining file reference policy

Publications (2)

Publication Number Publication Date
CN111290739A CN111290739A (en) 2020-06-16
CN111290739B true CN111290739B (en) 2022-02-22

Family

ID=71023503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010085025.1A Active CN111290739B (en) 2020-02-10 2020-02-10 Method, device, equipment and storage medium for determining file reference policy

Country Status (1)

Country Link
CN (1) CN111290739B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147797A (en) * 2010-02-08 2011-08-10 阿里巴巴集团控股有限公司 Method and device for managing element files in content management system
CN104866369A (en) * 2015-05-22 2015-08-26 广州华多网络科技有限公司 Data processing method and apparatus
CN109002488A (en) * 2018-06-26 2018-12-14 北京邮电大学 A kind of recommended models training method and device based on first path context
CN109189374A (en) * 2018-06-22 2019-01-11 北京大学 Object formation code generating method and system based on object reference chain
CN109670022A (en) * 2018-12-13 2019-04-23 南京航空航天大学 A kind of java application interface use pattern recommended method based on semantic similarity
CN110147237A (en) * 2019-05-20 2019-08-20 深圳市腾讯网域计算机网络有限公司 A kind of redundant resource minimizing technology and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016190876A1 (en) * 2015-05-28 2016-12-01 Hewlett Packard Enterprise Development Lp Dependency rank based on commit history
US10353676B2 (en) * 2017-11-13 2019-07-16 Bank Of America Corporation Intelligent software compiler dependency fulfillment
CN109885694B (en) * 2019-01-17 2022-10-14 南京邮电大学 Document selection and learning sequence determination method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102147797A (en) * 2010-02-08 2011-08-10 阿里巴巴集团控股有限公司 Method and device for managing element files in content management system
CN104866369A (en) * 2015-05-22 2015-08-26 广州华多网络科技有限公司 Data processing method and apparatus
CN109189374A (en) * 2018-06-22 2019-01-11 北京大学 Object formation code generating method and system based on object reference chain
CN109002488A (en) * 2018-06-26 2018-12-14 北京邮电大学 A kind of recommended models training method and device based on first path context
CN109670022A (en) * 2018-12-13 2019-04-23 南京航空航天大学 A kind of java application interface use pattern recommended method based on semantic similarity
CN110147237A (en) * 2019-05-20 2019-08-20 深圳市腾讯网域计算机网络有限公司 A kind of redundant resource minimizing technology and device

Also Published As

Publication number Publication date
CN111290739A (en) 2020-06-16

Similar Documents

Publication Publication Date Title
US11740876B2 (en) Method and system for arbitrary-granularity execution clone detection
EP2801906B1 (en) Source code flow analysis using information retrieval
Brehmer et al. Visualizing dimensionally-reduced data: Interviews with analysts and a characterization of task sequences
US9098621B2 (en) Modeling software behavior using learned predicates
US8997065B2 (en) Automatic modularization of source code
US7500149B2 (en) Generating finite state machines for software systems with asynchronous callbacks
US20230004368A1 (en) Multi-chip compatible compiling method and device
Pirzadeh et al. Stratified sampling of execution traces: Execution phases serving as strata
Dey et al. Linking prospective and retrospective provenance in scripts
CN112036563A (en) Deep learning model insights using provenance data
US11016745B2 (en) Systems and methods for generating distributed software packages using non-distributed source code
Armengol-Estapé et al. ExeBench: an ML-scale dataset of executable C functions
Tinnes et al. Mining domain-specific edit operations from model repositories with applications to semantic lifting of model differences and change profiling
CN111290739B (en) Method, device, equipment and storage medium for determining file reference policy
Mukelabai et al. Featracer: Locating features through assisted traceability
Neto et al. TRANSMUT-SPARK: Transformation Mutation for Apache Spark
Mineeva et al. ResMiCo: Increasing the quality of metagenome-assembled genomes with deep learning
Feitosa Applying patterns in embedded systems design for managing quality attributes and their trade-offs
Cao et al. Software multi-fault localization via Chameleon clustering in parallel
Wang et al. Autobahn: using genetic algorithms to infer strictness annotations
Openja An Empirical Study of Testing and Release Practices for Machine Learning Software Systems
Kazeem et al. Bug pattern analysis of codes produced by beginner programmers using association rule mining technique
Paiva et al. Clustering source code from automated assessment of programming assignments
Brandt Cuneiform: A Functional Language for Large-Scale Data Analysis
Duque-Torres Selecting and Constraining Metamorphic Relations

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40023583

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant