File naming method and device, electronic equipment, storage medium and program product

By providing a file naming method, the modification of automated processing file names solves the problem of low efficiency caused by frequent modifications of file names in the project, and achieves efficient project development.

CN119377175APending Publication Date: 2025-01-28BANK OF CHINA

Patent Information

Application Number
CN202411593929.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

In project development, because the class file name usually has the project name, it is necessary to frequently modify the class file name manually, resulting in low efficiency in project development and prone to errors.

Method used

Provide a file naming method. By determining whether the file directory input the user input is legal, it is prompted to enter the file name prefix, and to screen the target file based on the file directory and file name prefix. Finally, the target file is renamed based on the file name prefix deal with.

Benefits of technology

The automated batch modification file name is realized, the project development efficiency is improved, and the time and error rate of manual operations are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377175A_ABST
    Figure CN119377175A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a file naming method and device, electronic equipment, a storage medium and a program product. The method can be used in big data field. The method comprises the steps of judging whether a file directory input by a user is legal or not; if the file directory is legal, prompting a user to input a filename prefix; based on the file directory and a filename prefix input by a user, screening out a target class file, the class file including classes and methods used in a project development process; and renaming the target class file based on the filename prefix. The method is used for achieving the effects of modifying class file names in batches and improving the project development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application can be used in the field of big data, and in particular relates to a file naming method, device, electronic device, storage medium and program product. Background Art

[0002] In project development, the new project to be created may be similar to an existing project structure, and most of the class files in the project can be directly referenced. However, because the class file name usually contains the project name, the class file name needs to be redefined.

[0003] Currently, class file names are modified manually. For example, in a certain clearing system, all class file names start with Bcncs, and the new project that needs to be rebuilt needs to remove the prefix Bcncs from the class file name. There are hundreds of files in the project that need to be processed manually. Manual modification takes a lot of time and effort, and is prone to errors. Summary of the invention

[0004] The embodiments of the present application provide a file naming method, device, electronic device, storage medium and program product, which are used to modify class file names in batches and improve project development efficiency.

[0005] In a first aspect, an embodiment of the present application provides a file naming method, the method comprising:

[0006] Determine whether the file directory entered by the user is legal;

[0007] If the file directory is legal, the user is prompted to enter a file name prefix;

[0008] Based on the file directory and the file name prefix input by the user, the target class file is screened out, and the class file contains classes and methods used in the project development process;

[0009] The target class file is renamed based on the file name prefix.

[0010] In a possible implementation, the step of filtering out target class files based on the file directory and the file name prefix input by the user includes:

[0011] If the file directory is legal, the user is prompted to enter the coding language;

[0012] Traversing the files in the file directory and its subdirectories, for each file, determining whether its file extension matches the coding language input by the user;

[0013] If the file extension of the file matches the coding language input by the user, determining whether it starts with the file name prefix input by the user;

[0014] If the file begins with the file name prefix input by the user, the file is determined to be a target class file.

[0015] In a possible implementation, the renaming tool stores a mapping relationship between programming languages ​​and file extensions, and the determining whether the file extension matches the coding language input by the user includes:

[0016] The mapping relationship between the programming language and the file extension is queried to determine whether the file extension of the file matches the coding language input by the user.

[0017] In a possible implementation, the renaming of the target class file based on the file name prefix includes:

[0018] For each of the target class files, the file name prefix is ​​deleted from the file name of the target class file to obtain a new file name, and a new class file is created using the new file name, wherein the new class file contains the file content of the original target class file.

[0019] In a possible implementation, deleting the file name prefix from the file name of the target class file to obtain a new file name includes:

[0020] Get the keywords entered by the user;

[0021] Deleting the file name prefix from the file name of the target class file to obtain a deleted file name;

[0022] Inputting the keyword and the deleted file name into a pre-trained natural language processing model to generate a candidate file name that meets the user's intention;

[0023] The new file name is determined from the candidate file names.

[0024] In a possible implementation, inputting the keyword and the deleted file name into a pre-trained natural language processing model to generate a candidate file name that meets the user's intention includes:

[0025] Converting the keyword into a first vector;

[0026] Converting the deleted file name into a second vector;

[0027] Combining the first vector and the second vector to obtain a target vector;

[0028] The target vector is input into the pre-trained natural language processing model to generate multiple candidate file names that meet the user's intention, and the candidate file names include one or more strategies of position change, word change, language change, adding prefixes or suffixes, and format change.

[0029] In a second aspect, an embodiment of the present application provides a file naming device, the device comprising:

[0030] The judgment module is used to judge whether the file directory input by the user is legal;

[0031] A prompt module, used for prompting the user to input a file name prefix if the file directory is legal;

[0032] A screening module is used to screen out target class files based on the file directory and the file name prefix input by the user, where the class files contain classes and methods used in the project development process;

[0033] A renaming module is used to rename the target class file based on the file name prefix.

[0034] In a possible implementation, the screening module is specifically used for:

[0035] If the file directory is legal, the user is prompted to enter the coding language;

[0036] Traversing the files in the file directory and its subdirectories, for each file, determining whether its file extension matches the coding language input by the user;

[0037] If the file extension of the file matches the coding language input by the user, determining whether it starts with the file name prefix input by the user;

[0038] If the file begins with the file name prefix input by the user, the file is determined to be a target class file.

[0039] In a possible implementation, the renaming tool stores a mapping relationship between programming languages ​​and file extensions, and the screening module is specifically used to:

[0040] The mapping relationship between the programming language and the file extension is queried to determine whether the file extension of the file matches the coding language input by the user.

[0041] In a possible implementation, the renaming module is specifically used to:

[0042] For each of the target class files, the file name prefix is ​​deleted from the file name of the target class file to obtain a new file name, and a new class file is created using the new file name, wherein the new class file contains the file content of the original target class file.

[0043] In a possible implementation, the renaming module is specifically used to:

[0044] Get the keywords entered by the user;

[0045] Deleting the file name prefix from the file name of the target class file to obtain a deleted file name;

[0046] Inputting the keyword and the deleted file name into a pre-trained natural language processing model to generate a candidate file name that meets the user's intention;

[0047] The new file name is determined from the candidate file names.

[0048] In a possible implementation, the renaming module is specifically used to:

[0049] Converting the keyword into a first vector;

[0050] Converting the deleted file name into a second vector;

[0051] Combining the first vector and the second vector to obtain a target vector;

[0052] The target vector is input into the pre-trained natural language processing model to generate multiple candidate file names that meet the user's intention, and the candidate file names include one or more strategies of position change, word change, language change, adding prefixes or suffixes, and format change.

[0053] In a third aspect, an embodiment of the present application provides a file naming device, including: a memory, a processor;

[0054] The memory stores computer-executable instructions;

[0055] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0056] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0057] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0058] The file naming method, device, electronic device, storage medium and program product provided by the embodiments of the present application can determine whether the file directory input by the user is legal. If the file directory is determined to be legal, the user is prompted to enter a file name prefix. Then, based on the file directory and the file name prefix input by the user, the target class file can be screened out. Finally, the target class file can be renamed according to the file name prefix. The embodiments of the present application automatically modify the class file name to achieve the effect of batch modifying the class file name and improving the project development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0060] Figure 1 A schematic diagram of a scenario of the file naming method provided for this application;

[0061] Figure 2 Schematic diagram of the file naming method provided for this application Figure 1 ;

[0062] Figure 3 A process diagram of the file naming method provided for this application;

[0063] Figure 4 Schematic diagram of the file naming method provided for this application Figure 2 ;

[0064] Figure 5 A schematic diagram of the structure of the file naming device provided for this application;

[0065] Figure 6 A schematic diagram of the structure of the file naming device provided for this application.

[0066] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0067] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0068] During the project development process, class file names need to be manually modified. There may be hundreds of files in the project that need to be modified, resulting in low project development efficiency.

[0069] The file naming method provided by the present application can determine whether the file directory input by the user is legal. When it is determined that the file directory is legal, the user is prompted to enter a file name prefix. Then, based on the file directory and the file name prefix input by the user, the target class files can be filtered out. Finally, the target class files can be renamed according to the file name prefix, thereby solving the technical problem of low project development efficiency.

[0070] Figure 1 A schematic diagram of a scenario of the file naming method provided for this application, such as Figure 1 As shown, a renaming tool is installed in the terminal device 101 , and the terminal device 101 can obtain the project development files from the database 102 and perform batch renaming processing on the class files in the project development files.

[0071] It should be noted that the file naming method, device, electronic device, storage medium and program product of the present application can be used in the field of big data, and can also be used in any field except the field of big data. The application field of the file naming method, device, electronic device, storage medium and program product of the present application is not limited.

[0072] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0073] Figure 2 Schematic diagram of the file naming method provided for this application Figure 1 , which is used in renaming tools, such as Figure 2 As shown, the method includes:

[0074] S201. Determine whether the file directory input by the user is legal.

[0075] A text input box and a button may be provided on the user interface of the renaming tool. The text input box is for the user to input the file directory, and the button is used to submit the file directory input by the user.

[0076] For the file directory input by the user, the renaming tool can check whether it is legal, specifically, whether it exists and is a directory. Furthermore, it can verify whether it has access rights.

[0077] S202: If the file directory is legal, prompt the user to enter a file name prefix.

[0078] In an embodiment of the present application, if it is determined that the file directory input by the user is legal, the user may be prompted to input a file name prefix. Specifically, another text input box and button may be provided on the user interface of the renaming tool, the text input box being used for the user to input a file name prefix, and the button being used to submit the file name prefix input by the user. It should be noted that this text input box and the related confirmation button are displayed on the user interface of the renaming tool only after the file directory is verified to be legal.

[0079] S203. Filter out target class files based on the file directory and the file name prefix input by the user. The class files contain classes and methods used in the project development process.

[0080] In an embodiment of the present application, corresponding class files can be screened out from the project development files according to the file directory and file name prefix input by the user to obtain the target class files.

[0081] S204: rename the target class file based on the file name prefix.

[0082] After obtaining the target class files, the target class files can be renamed in batches according to the file name prefix entered by the user. Figure 3 The figure is a schematic diagram of the process of the file naming method provided by the present application.

[0083] The file naming method provided in the embodiment of the present application can determine whether the file directory input by the user is legal. If the file directory is determined to be legal, the user is prompted to enter a file name prefix. Then, based on the file directory and the file name prefix input by the user, the target class file can be screened out. Finally, the target class file can be renamed according to the file name prefix. The embodiment of the present application automatically modifies the class file name, thereby achieving the effect of batch modifying the class file name and improving the project development efficiency.

[0084] Figure 4 Schematic diagram of the file naming method provided for this application Figure 2 , which is used in renaming tools, such as Figure 4 As shown, in this embodiment Figure 2Based on the embodiment, a file naming method is described in detail, and the method includes:

[0085] S401. Determine whether the file directory input by the user is legal.

[0086] S402: If the file directory is legal, prompt the user to enter a file name prefix.

[0087] S403: If the file directory is legal, prompt the user to enter the encoding language.

[0088] In an embodiment of the present application, if it is determined that the file directory input by the user is legal, the user may be prompted to input the coding language. Specifically, another text input box and button may be provided on the user interface of the renaming tool, the text input box is for the user to input the coding language, and the button is used to submit the coding language input by the user. It should be noted that this text input box and the related confirmation button are displayed on the user interface of the renaming tool only after the file directory is verified to be legal.

[0089] S404: traverse the files in the file directory and its subdirectories, and for each file, determine whether its file extension matches the coding language input by the user.

[0090] For each file in the file directory and its subdirectories, its file extension may be checked to see if it matches the encoding language entered by the user.

[0091] The file directory input by the user can be converted into a "File" object, and for each "File" object, it is determined whether the object is a file. If it is a file, the file extension is matched.

[0092] In a possible implementation, the renaming tool stores a mapping relationship between programming languages ​​and file extensions, and determining whether the file extension matches the coding language input by the user may specifically include:

[0093] Query the mapping relationship between programming languages ​​and file extensions to determine whether the file extension matches the coding language input by the user.

[0094] In this embodiment, the renaming tool stores a mapping database, which contains various programming languages ​​and their corresponding standard file extensions, such as Python language corresponding to the ".py" extension, Java corresponding to the ".java" extension, and so on.

[0095] S405: If the file extension of the file matches the coding language input by the user, determine whether it starts with the file name prefix input by the user.

[0096] In an embodiment of the present application, if the file extension of a file matches the coding language input by the user, the renaming tool may further check whether the file name of the file starts with the file name prefix input by the user.

[0097] S406. If the file begins with the file name prefix input by the user, the file is determined to be a target class file, and the class file contains classes and methods used in the project development process.

[0098] If the file name of the file begins with a file name prefix input by the user, then the file can be determined to be a target class file that needs to be renamed. In an embodiment of the present application, all target class files can be searched in a file directory and its subdirectories specified by the user.

[0099] Before performing the renaming process, this application first checks whether the file directory entered by the user is legal and whether there are files in the file directory that match the file name prefix entered by the user. Otherwise, the renaming method will not be called to avoid throwing an exception.

[0100] S407: rename the target class file based on the file name prefix.

[0101] In a possible implementation, renaming the target class file based on the file name prefix may specifically include:

[0102] For each target class file, the file name prefix is ​​deleted from the file name of the target class file to obtain a new file name, and a new class file is created using the new file name. The new class file contains the file content in the original target class file.

[0103] In this embodiment, the specified file directory and its subdirectories are traversed to identify all qualified target class files. For each target class file, its file name is extracted and a specific prefix is ​​deleted. Assuming that the file name is "prefix_filename.ext", the "prefix_" part needs to be removed. This can be achieved using string operation functions. Based on the processed file name, a new file name is generated, a new class file is created in the specified directory using the new file name, and the content of the original target class file is read and written into the newly created class file.

[0104] In a possible implementation, deleting the file name prefix from the file name of the target class file to obtain a new file name may specifically include:

[0105] Get the keywords entered by the user;

[0106] Delete the file name prefix from the file name of the target class file to obtain the deleted file name;

[0107] Input the keywords and the deleted file name into a pre-trained natural language processing model to generate candidate file names that match the user's intent;

[0108] Determine a new file name from among the candidate file names.

[0109] Keywords can be descriptive words related to the new development project. These words can include project name, functional module, technology stack, version number, etc.

[0110] For each target class file, extract its file name and delete the specific prefix. Assuming the file name is "prefix_filename.ext", you need to remove the "prefix_" part to get the deleted file name "filename.ext".

[0111] The keywords and the deleted file name entered by the user are passed as input to a pre-trained natural language processing model. The model can be a generative model based on deep learning, which can generate file names that meet the user's intent. The natural language processing model generates a set of candidate file names based on the input. These candidate file names should reflect the user's keyword intent while maintaining the readability and relevance of the file name. A new file name that best meets the user's intent is selected from the generated candidate file names. The selection criteria can be based on the clarity, uniqueness, and relevance of the file name to the project description, and a new class file is created using the determined new file name.

[0112] In a possible implementation, the keyword and the deleted file name are input into a pre-trained natural language processing model to generate a candidate file name that meets the user's intention, which may specifically include:

[0113] Convert keywords into first vectors;

[0114] Convert the deleted file names into a second vector;

[0115] Merge the first vector and the second vector to obtain the target vector;

[0116] The target vector is input into a pre-trained natural language processing model to generate multiple candidate file names that meet the user's intention. The candidate file names include one or more strategies of position change, word change, language change, adding prefixes or suffixes, and format change.

[0117] In this embodiment, the keyword input by the user can be converted into a first vector, and the keyword can be mapped to a high-dimensional vector space to capture its semantic information. The file name after removing the prefix is ​​converted into a second vector, similar to keyword vectorization. The first vector and the second vector are merged to obtain a target vector, which is input into a pre-trained natural language processing model. The model generates multiple candidate file names, which can include the following change strategies:

[0118] Position Change: Adjust the order of words in the file name.

[0119] Word Variation: Replace or modify certain words in the file name to better match keywords.

[0120] Language changes: Generate file names in different languages ​​as needed.

[0121] Add prefix or suffix: Add appropriate prefix or suffix according to project or user requirements.

[0122] Format changes: adjust the case, separators, or other formats of the file name.

[0123] The file naming method provided in the embodiment of the present application can determine whether the file directory input by the user is legal. If the file directory is determined to be legal, the user is prompted to enter a file name prefix. Then, based on the file directory and the file name prefix input by the user, the target class file can be screened out. Finally, the target class file can be renamed according to the file name prefix. The embodiment of the present application automatically modifies the class file name, thereby achieving the effect of batch modifying the class file name and improving the project development efficiency.

[0124] Figure 5 A schematic diagram of the structure of the file naming device provided in this application, such as Figure 5 As shown, the file naming device 50 provided in this embodiment includes:

[0125] The judging module 501 is used to judge whether the file directory input by the user is legal;

[0126] Prompt module 502, used to prompt the user to enter a file name prefix if the file directory is legal;

[0127] The screening module 503 is used to screen out target class files based on the file directory and the file name prefix input by the user, and the class files contain classes and methods used in the project development process;

[0128] The renaming module 504 is used to rename the target class file based on the file name prefix.

[0129] In a possible implementation, the screening module is specifically used to:

[0130] If the file directory is legal, the user is prompted to enter the encoding language;

[0131] Traverse the files in the file directory and its subdirectories, and for each file, determine whether its file extension matches the encoding language entered by the user;

[0132] If the file extension of the file matches the encoding language entered by the user, determine whether it begins with the file name prefix entered by the user;

[0133] If the file begins with the file name prefix entered by the user, the file is determined to be a target class file.

[0134] In a possible implementation, the renaming tool stores a mapping relationship between programming languages ​​and file extensions, and the screening module is specifically used to:

[0135] Query the mapping relationship between programming languages ​​and file extensions to determine whether the file extension matches the coding language input by the user.

[0136] In a possible implementation, the renaming module is specifically used to:

[0137] For each target class file, the file name prefix is ​​deleted from the file name of the target class file to obtain a new file name, and a new class file is created using the new file name. The new class file contains the file content in the original target class file.

[0138] In a possible implementation, the renaming module is specifically used to:

[0139] Get the keywords entered by the user;

[0140] Delete the file name prefix from the file name of the target class file to obtain the deleted file name;

[0141] Input the keywords and the deleted file name into a pre-trained natural language processing model to generate candidate file names that match the user's intent;

[0142] Determine a new file name from among the candidate file names.

[0143] In a possible implementation, the renaming module is specifically used to:

[0144] Convert keywords into first vectors;

[0145] Convert the deleted file names into a second vector;

[0146] Merge the first vector and the second vector to obtain the target vector;

[0147] The target vector is input into a pre-trained natural language processing model to generate multiple candidate file names that meet the user's intention. The candidate file names include one or more strategies of position change, word change, language change, adding prefixes or suffixes, and format change.

[0148] The file naming device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0149] Figure 6 This is a schematic diagram of the file naming device provided for this application. Figure 6 As shown, the file naming device 60 provided in this embodiment includes: at least one processor 601 and a memory 602. Optionally, the device 60 also includes a communication component 603. The processor 601, the memory 602 and the communication component 603 are connected via a bus.

[0150] In a specific implementation process, at least one processor 601 executes the computer execution instructions stored in the memory 602, so that at least one processor 601 executes the above method.

[0151] The specific implementation process of the processor 601 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0152] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0153] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0154] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0155] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0156] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0157] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0158] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0159] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0160] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0161] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0162] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0163] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0164] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application, are not limited to the precise structures described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A file naming method, characterized in that: The method comprises: Determine whether the file directory entered by the user is legal; If the file directory is legal, the user is prompted to enter a file name prefix; Based on the file directory and the file name prefix input by the user, the target class file is screened out, and the class file contains the classes and methods used in the project development process; The target class file is renamed based on the file name prefix.

2. The method according to claim 1, characterized in that: The method of filtering out target class files based on the file directory and the file name prefix input by the user includes: If the file directory is legal, the user is prompted to enter the coding language; Traversing the files in the file directory and its subdirectories, for each file, determining whether its file extension matches the coding language input by the user; If the file extension of the file matches the coding language input by the user, determining whether it starts with the file name prefix input by the user; If the file begins with the file name prefix input by the user, the file is determined to be a target class file.

3. The method according to claim 2, characterized in that The renaming tool stores a mapping relationship between programming languages ​​and file extensions, and the step of determining whether the file extension matches the coding language input by the user includes: The mapping relationship between the programming language and the file extension is queried to determine whether the file extension of the file matches the coding language input by the user.

4. The method according to any one of claims 1 to 3, characterized in that: The renaming process of the target class file based on the file name prefix includes: For each of the target class files, the file name prefix is ​​deleted from the file name of the target class file to obtain a new file name, and a new class file is created using the new file name, wherein the new class file contains the file content of the original target class file.

5. The method according to claim 4, characterized in that The step of deleting the file name prefix from the file name of the target class file to obtain a new file name includes: Get the keywords entered by the user; Deleting the file name prefix from the file name of the target class file to obtain a deleted file name; Inputting the keyword and the deleted file name into a pre-trained natural language processing model to generate a candidate file name that meets the user's intention; The new file name is determined from the candidate file names.

6. The method according to claim 5, characterized in that The step of inputting the keyword and the deleted file name into a pre-trained natural language processing model to generate a candidate file name that meets the user's intention includes: Converting the keyword into a first vector; Converting the deleted file name into a second vector; Combining the first vector and the second vector to obtain a target vector; The target vector is input into the pre-trained natural language processing model to generate multiple candidate file names that meet the user's intention, and the candidate file names include one or more strategies of position change, word change, language change, adding prefixes or suffixes, and format change.

7. A file naming device, characterized in that: The device comprises: The judgment module is used to judge whether the file directory input by the user is legal; A prompt module, used for prompting the user to input a file name prefix if the file directory is legal; A screening module, used to screen out target class files based on the file directory and the file name prefix input by the user, wherein the class files contain classes and methods used in the project development process; A renaming module is used to rename the target class file based on the file name prefix.

8. A file naming device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • File naming method and electronic device

    CN103514231A

  • Project filename batch automatic replacement method

    CN111198712A

  • Method and system for renaming resource files of Android engineering project in batches,equipment and medium

    CN113157651A

  • Standard file naming method and device

    CN114003557A

  • Installation package processing method and device, electronic equipment and computer readable storage medium

    CN114461234A

Cited By

  • File naming method and device

    CN120723732A