WO2020228183A1 - Code processing method and apparatus, computer device and storage medium - Google Patents
Code processing method and apparatus, computer device and storage medium Download PDFInfo
- Publication number
- WO2020228183A1 WO2020228183A1 PCT/CN2019/103451 CN2019103451W WO2020228183A1 WO 2020228183 A1 WO2020228183 A1 WO 2020228183A1 CN 2019103451 W CN2019103451 W CN 2019103451W WO 2020228183 A1 WO2020228183 A1 WO 2020228183A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- conversion
- keyword
- word
- words
- vocabulary
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
Definitions
- This application relates to the field of computer technology, in particular to a code processing method, device, computer equipment and storage medium.
- the main purpose of this application is to provide a code processing method, device, computer equipment and storage medium. It aims to solve the problem that the code submitted by each developer does not have a unified writing specification during the development process of an existing software project, which is likely to cause Technical problem of low efficiency of code maintenance process.
- this application proposes a code processing method, which includes the steps:
- the standard vocabulary does not contain the first non-keyword, it is determined whether the first non-keyword is included in the preset conversion vocabulary, wherein multiple custom words are stored in the conversion vocabulary , And the conversion words corresponding to each of the custom words;
- the first conversion word corresponding to the first non-keyword is selected from the conversion vocabulary
- This application also provides a code processing device, including:
- the first judgment module is used to traverse all non-keywords in the source code. When a non-keyword is traversed, it is judged whether the preset standard thesaurus contains the non-keyword currently traversed, wherein the current traversal The arrived non-keyword is marked as the first non-keyword, and multiple English words and/or combined nouns are stored in the standard dictionary;
- the second judgment module is used for judging whether the first non-keyword is contained in the preset conversion vocabulary if the standard vocabulary does not contain the first non-keyword, wherein the conversion vocabulary contains A plurality of custom words are stored, and conversion words corresponding to each of the custom words are stored;
- the first screening module is configured to filter out the first conversion word corresponding to the first non-keyword from the conversion dictionary if the first non-keyword is included in the conversion dictionary;
- the first replacement module is configured to rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
- the application also provides a computer device, including a memory and a processor, the memory stores computer readable instructions, and the processor implements the steps of the above method when the computer readable instructions are executed.
- the present application also provides a computer non-volatile readable storage medium on which computer readable instructions are stored, and when the computer readable instructions are executed by a processor, the steps of the above method are realized.
- the code processing method, device, computer equipment and storage medium provided in this application traverse all non-keywords of the source code, and each time a non-keyword is traversed, it is judged whether the preset standard dictionary contains the non-keywords currently traversed.
- Keywords if the first non-keyword is not included in the standard thesaurus, it is determined whether the first non-keyword is included in the preset conversion thesaurus, where multiple custom words are stored in the conversion thesaurus, and their definitions The conversion word corresponding to each word; if the conversion dictionary contains the first non-keyword, the first conversion word corresponding to the first non-keyword is filtered out from the conversion dictionary; the first conversion word is compared according to the preset writing specification Rewrite and replace the first non-keyword with the rewritten first conversion word.
- This application replaces the user-defined non-keywords in the source code with the corresponding conversion words through the preset conversion dictionary, so as to convert the non-keywords into complete standard words, so that the user can clearly understand the non-keywords
- the source code needs to be maintained in the future, it can reduce the reading workload of the maintainer, reduce the reading difficulty of the maintainer, and improve the work efficiency of the maintainer.
- non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
- FIG. 1 is a schematic flowchart of a code processing method according to an embodiment of the present application
- FIG. 2 is a schematic diagram of the structure of a code processing device according to an embodiment of the present application.
- Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
- the code processing method of an embodiment of the present application includes:
- S1 Traverse all the non-keywords of the source code, each time a non-keyword is traversed, determine whether the preset standard thesaurus contains the non-keywords currently traversed, where the non-keywords currently traversed Marked as the first non-keyword, multiple English words and/or combined nouns are stored in the standard thesaurus;
- S4 Rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
- the source code is formed by many words, the words include programming language keywords and non-programming language keywords, and the non-keywords refer to non-programming language keywords in the source code, namely Words other than the programming language keywords in the above source code.
- the general form of source code includes method body code, method body internal code, and method body external code.
- non-keywords of source code include non-keywords in the method body, non-keywords in the method body, and outside the method body. Non-keywords. Among them, all non-keywords of the source code can be traversed in a preset order.
- the preset order mentioned above can be set according to the order of each part of the method body, for example, from the method body itself to the inside of the method body.
- the sequence to the outside of the method body traverses all non-keywords of the source code.
- the aforementioned preset sequence can also be in other forms, for example, it can be set according to the user's wishes, which is not specifically limited here.
- each time a non-keyword is traversed first determine whether the preset standard dictionary contains The first non-keyword currently traversed, that is, the first non-keyword is matched with all standard words in the standard thesaurus.
- the standard thesaurus contains the first non-keyword, it indicates that the first non-keyword
- the word is a standard word
- the first non-keyword is not included in the standard thesaurus, it indicates that the first non-keyword is not a standard word.
- the above-mentioned standard vocabulary includes a standard English word vocabulary and/or a common combined noun vocabulary.
- the above-mentioned standard English vocabulary can be created in advance, and then a certain number of commonly used English words in the code can be searched out through network resources.
- the searched English words are stored in the standard English word vocabulary to form the final standard English word vocabulary, and the number of stored English words is not specifically limited.
- the above-mentioned common compound noun thesaurus can be created in advance, then a certain number of commonly used compound nouns in the code can be searched out through network resources, and then the searched compound nouns can be stored in the common compound noun vocabulary to form The final common compound noun thesaurus, and the number of stored compound nouns is not specifically limited.
- the first non-keyword when the first non-keyword is not included in the standard thesaurus, it indicates that the current first non-keyword is not a standard word, but may be a custom word created by the user. For example, the user-defined abbreviation ap. It is necessary to further determine whether the first non-keyword is included in the preset conversion dictionary, that is, the first non-keyword is matched and compared with all the custom words in the conversion dictionary. If the conversion dictionary contains and The first conversion word corresponding to the first non-keyword, wherein a certain number of custom words are stored in the conversion dictionary, and conversion words corresponding to each of the custom words, the custom words and the conversion words It can be written by the developer and input into the conversion word.
- the first conversion word is a complete standard word corresponding to the first non-keyword.
- the conversion vocabulary stores (custom words) ap ⁇ (conversion words) application
- the first conversion word corresponding to the first non-keyword will be filtered from the conversion vocabulary first, and the first conversion word corresponding to the first non-keyword will be filtered out according to the preset
- the writing specification rewrites the first conversion word, and then replaces the first non-keyword with the rewritten first conversion word to complete the reconstruction process for the first non-keyword.
- the above-mentioned preset writing specification refers to a standard form created for non-keywords in the source code.
- the above writing specification may be to change the first letter of each word to uppercase, or to change the first letter of each word to lowercase, and so on. After completing the reconstruction of the first non-keyword, start the reconstruction of the next non-keyword, and stop traversal until all the non-keywords are processed, and then complete the reconstruction of the source code. .
- the user-defined non-keywords in the source code are replaced with corresponding conversion words through the preset conversion dictionary, so that the non-keywords are converted into complete standard words, so that the user can clearly understand the The meaning of non-keywords, and when the source code needs to be maintained later, it reduces the reading workload of the maintainer, reduces the reading difficulty of the maintainer, and improves the work efficiency of the maintainer.
- non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
- the standard word database contains the first non-keyword, it indicates that the first non-keyword is a standard word.
- the first non-keyword can be directly processed according to the preset writing specifications.
- the keyword is rewritten, and the first rewritten word obtained after the rewriting replaces the first non-keyword.
- the first non-keyword belongs to a standard word
- the first non-keyword is rewritten by using the above-mentioned writing specification, and the obtained first rewritten word is performed on the first non-keyword
- the replacement process makes the rewritten source code have the advantages of simplicity, beauty and readability, which is conducive to forming a unified code writing style suitable for all developers.
- step S1 the method includes:
- S101 Add tags to all keywords in the source code to determine all non-keywords in the source code, where the non-keywords are words in the source code that do not have the tag.
- the step of traversing all the non-keywords of the source code before the step of traversing all the non-keywords of the source code, it also includes the step of filtering out all the non-keywords of the source code. Specifically, first according to the preset programming language keyword thesaurus To filter out all keywords in the source code, and then add tags to all keywords in the source code to determine all non-keywords in the source code, so the non-keywords in the source code are not in the source code. Marked words. This embodiment distinguishes keywords from non-keywords by adding tags to all keywords in the source code, which helps users to clearly understand that the type corresponding to each word in the source code is the key when consulting the source code.
- Words are still non-keywords, and when all non-keywords in the source code are processed, the marked non-keywords can be quickly selected for processing, ensuring the accuracy of non-keyword processing and preventing the occurrence of non-keywords.
- the key words of the code are mishandled.
- the above-mentioned programming language keyword thesaurus can be pre-selected, and then a certain number of programming language keyword thesaurus commonly used in the code can be searched through network resources.
- the programming language official website and other related resources can be searched, and then the The searched programming language keywords are stored in the programming language keyword lexicon to form the final programming language keyword lexicon, and the programming language keyword lexicon is also provided with an update function, which can be used in a certain period of time
- the inward programming language keyword lexicon adds new programming language keywords or deletes some programming language keywords to complete the update of the programming language keyword lexicon.
- the above step of firstly filtering out all keywords in the source code according to the preset programming language keyword thesaurus is specifically: separately combining all the words in the source code with those in the programming language keyword thesaurus
- the programming language keywords are matched and compared, wherein a plurality of different programming language keywords are pre-stored in the programming language keyword lexicon; all words in the source code that match the programming language keywords are filtered out Designated words, wherein the number of the designated words is one or more; the designated words are determined as the keywords.
- the method before the foregoing step S3, the method includes:
- S300 Receive word conversion data input by all developers, where the word conversion data includes a plurality of custom words and conversion words corresponding to each of the custom words;
- the above-mentioned conversion dictionary is a conversion dictionary in which data is shared by all developers.
- the conversion dictionary stores word conversion data input by each developer, and each word conversion data It contains multiple custom words recorded by each developer, and conversion words corresponding to each custom word.
- the number of conversion words corresponding to the custom word is not limited, for example, it can be one or more .
- it before the step of determining whether the first non-keyword is included in the preset conversion vocabulary, it further includes a process of forming the conversion vocabulary. Specifically, a conversion vocabulary is created in advance, and after receiving After the word conversion data respectively input by each developer, the word conversion data is stored in the conversion dictionary.
- the conversion dictionary After the conversion dictionary is formed, in the process of processing non-keywords in the source code, when the current first non-keyword is not included in the standard dictionary, it indicates that the first non-keyword
- the word can be a custom word created by the user.
- the first non-keyword corresponding to the first non-keyword can be filtered out.
- the reading workload reduces the reading difficulty of maintenance personnel and improves the work efficiency of maintenance personnel.
- an update function is also provided for the above conversion dictionary, which can add new word conversion data to the conversion dictionary within a certain period of time, or delete some word conversion data, or modify certain word conversion data. Complete the update of the conversion lexicon so that more updated word conversion data can be stored in the conversion lexicon.
- step S3 includes:
- S312 According to the priority information, determine the first designated conversion word with the highest priority as the first conversion word.
- the custom word ap corresponds to the three conversion words appointment, apply and application
- the priority of the conversion word appointment is the first priority
- the priority of the conversion word apply is the second priority
- the priority of the word application is the third priority
- the first priority is higher than the second priority
- the second priority is higher than the third priority.
- the setting form of the above priority is not specifically limited, such as the above priority It can be pre-marked in the input word conversion data by the user, or the above-mentioned priority is set by the code processing device according to the historical use times of each conversion word, and so on.
- the first non-keyword when the first non-keyword is processed, if the first non-keyword is included in the preset conversion vocabulary, it is first necessary to determine whether the conversion vocabulary is related to the first non-keyword. If there are multiple conversion words corresponding to the first non-keyword, then the priority information of the multiple conversion words is acquired, and the priority is changed according to the priority information. The highest first designated conversion word is determined as the first conversion word, and the conversion to the first non-keyword is completed.
- the priority will be the first priority
- the appointment is determined as the first conversion word mentioned above.
- the first designated conversion word with the highest priority can be selected intelligently according to the priority information of the multiple conversion words for subsequent follow-up By processing, the first conversion word can be quickly extracted from multiple conversion words, which improves the user experience.
- Step S3 includes:
- S321 Receive feedback information on the second designated conversion word returned by the user, where the feedback information includes that the second designated conversion word is accurate or the second designated conversion word is inaccurate;
- S323 Receive a third designated conversion word selected by the user from the other specific conversion words, and determine the third designated conversion word as the first conversion word.
- the first non-keyword when the first non-keyword is app, if the first conversion word is selected only according to the priority information of each conversion word corresponding to the first non-keyword ap, only The first priority conversion word appointment is used to complete the subsequent processing of the first non-keyword ap.
- the conversion word appointment is the highest priority among all conversion words corresponding to ap, it may appear in the current source code.
- the correct meaning of the non-keyword ap is actually a special case corresponding to application or apply, so the first priority conversion word selected according to the priority information is wrong.
- the conversion word with the highest priority among the plurality of specific conversion words is set as the second designated conversion word.
- the second designated conversion word with the highest priority will be selected from the multiple specific conversion words corresponding to the first non-keyword, and the second designated conversion word will be displayed to the current user, so that The user judges the accuracy of the above-mentioned second designated conversion word.
- the user can determine the highest priority by placing the second designated conversion word with the highest priority in the position of the first non-keyword, and combining the context information
- the user will return feedback information corresponding to the second specified conversion word, where the user can be the staff who wrote the source code, and the feedback information includes the accuracy of the second specified conversion word or the second specified conversion word Inaccurate.
- the feedback information is that the second designated conversion word is inaccurate, the user will be shown other specific conversion words except the second designated conversion word, so that the user can choose from the above other specific conversion words
- a third designated conversion word is generated, and the third designated conversion word is a conversion word corresponding to the correct meaning of the first non-keyword.
- the third designated conversion word After receiving the third designated conversion word, the third designated conversion word is determined as the first conversion And complete the subsequent processing of the first non-keyword according to the first conversion word.
- the accuracy of the second designated conversion word is determined by obtaining the user's feedback information. If the second designated conversion word is inaccurate, the user's selection from multiple specific conversion words is used to determine the first non-specific conversion word.
- the third designated conversion word for the correct meaning of the keyword, thereby effectively ensuring the correctness of the conversion of the first non-keyword, and avoiding the user's understanding of the source code due to the wrong conversion of the first non-keyword .
- the method includes:
- S201 Determine whether the second conversion word input by the user is received
- S203 Store the first non-keyword and the second conversion word in a one-to-one correspondence in the conversion vocabulary.
- the conversion dictionary does not contain the first Non-keywords, in order to complete the subsequent replacement process for the first non-keywords, that is, to replace the first non-keywords with complete standard words, at this time, the user will be sent a second conversion corresponding to the first non-keyword The reminder information of the word, so that the user manually input the second conversion word corresponding to the first non-keyword, wherein the user may be the staff who wrote the source code.
- the second conversion word After receiving the second conversion word, it will rewrite the second conversion word according to the above writing specifications, replace the first non-keyword with the rewritten second conversion word, and further combine the first non-keyword with
- the second conversion word is stored in the conversion dictionary in a one-to-one correspondence to complete the data update of the conversion dictionary, so that when the first non-keyword is subsequently processed, the data can be updated from the conversion dictionary
- the second conversion word corresponding to the first non-keyword is extracted and replaced, thereby eliminating the need for the user to manually input the second conversion word again, reducing the user's workload and improving the user experience.
- the method includes:
- S401 Store the source code processing file and the source code backup file together, where the source code backup file is obtained by backing up the unprocessed source code.
- the source code file will be backed up first to obtain the source code backup file corresponding to the source code.
- the processed source code will also be backed up to obtain the corresponding source code processing file.
- the source code processing file and the unprocessed source code backup file are stored together, for example, the source code processing file and the source code backup file are stored together in a pre-generated designated folder, so that subsequent maintenance personnel When performing maintenance processing on the source code, you can extract the source code backup file from the above specified folder when you have doubts about reading the refactored source code processing file, and further refer to the source code backup file
- the original data is used to manually correct errors in the source code processing file.
- the code processing method of the embodiment of this application replaces the non-keywords customized by the user in the source code with the corresponding conversion words through the preset conversion dictionary, thereby converting the non-keywords into complete standard words, so that the user can Clearly understand the meaning of this non-keyword, and when the source code needs to be maintained in the future, it can reduce the reading workload of the maintainer, reduce the difficulty of reading for the maintainer, and improve the work efficiency of the maintainer.
- non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
- an embodiment of the present application also provides a code processing device, including:
- the first judging module 1 is used to traverse all non-keywords in the source code, and each time a non-keyword is traversed, it is judged whether the preset standard thesaurus contains the non-keyword currently traversed, wherein the current The traversed non-keyword is marked as the first non-keyword, and multiple English words and/or combined nouns are stored in the standard thesaurus;
- the second judgment module 2 is used for judging whether the first non-keyword is included in the preset conversion vocabulary if the standard vocabulary does not contain the first non-keyword, wherein the conversion vocabulary A plurality of custom words and conversion words corresponding to each of the custom words are stored therein;
- the first screening module 3 is configured to filter out the first conversion word corresponding to the first non-keyword from the conversion dictionary if the first non-keyword is included in the conversion dictionary;
- the first replacement module 4 is configured to rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
- the implementation process of the functions and roles of the first judgment module, the second judgment module, the first screening module, and the first replacement module in the code processing device is detailed in the corresponding step S1- in the code processing method.
- the implementation process of S4 will not be repeated here.
- the aforementioned code processing device includes:
- the second screening module is used to screen out all keywords in the source code according to a preset programming language keyword thesaurus;
- the tagging module is used to add tags to all keywords in the source code to determine all non-keywords in the source code, wherein the non-keywords are those that do not have the tag in the source code word.
- the implementation process of the functions and roles of the second screening module and the marking module in the above-mentioned code processing device is detailed in the implementation process of corresponding steps S100-S101 in the above-mentioned code processing method, which will not be repeated here.
- the aforementioned code processing device includes:
- the first receiving module is configured to receive word conversion data input by all developers, where the word conversion data includes a plurality of custom words and conversion words corresponding to each of the custom words;
- the first storage module is used to store the word conversion data in the conversion vocabulary.
- the implementation process of the functions and roles of the first receiving module, creation module, and first storage module in the above code processing apparatus is detailed in the implementation process corresponding to steps S300-S302 in the above code processing method. Repeat it again.
- the above-mentioned first screening module includes:
- the first determining unit is configured to determine whether there are multiple conversion words corresponding to the first non-keyword in the conversion dictionary if the first non-keyword is included in the conversion dictionary;
- An obtaining unit configured to obtain priority information of each conversion word if so;
- the first determining unit is configured to determine the first designated conversion word with the highest priority as the first conversion word according to the priority information.
- the implementation process of the functions and roles of the first judging unit, the acquiring unit and the first determining unit included in the first screening module in the code processing device is detailed in the corresponding steps S310-S312 in the code processing method. The realization process of this will not be repeated here.
- the first non-keyword is correspondingly provided with a plurality of specific conversion words, and the conversion word with the highest priority among the plurality of specific conversion words is set as the second designated conversion word.
- the first screening module includes:
- the screening unit is configured to filter out the second designated conversion word with the highest priority among all the specific conversion words if the conversion word database contains the first non-keyword, and display the second designated conversion word to the current user Conversion words, so that the user can judge the accuracy of the second designated conversion words;
- a receiving unit configured to receive feedback information on the second designated conversion word returned by the user, wherein the feedback information includes that the second designated conversion word is accurate or the second designated conversion word is inaccurate;
- a display unit configured to, if the feedback information is that the second designated conversion word is inaccurate, display other specific conversion words other than the second designated conversion word to the user;
- the second determining unit is configured to receive a third designated conversion word selected by the user from the other specific conversion words, and determine the third designated conversion word as the first conversion word.
- the functions and functions of the screening unit, receiving unit, display unit, and second determining unit included in the first screening module in the code processing device are realized in detail in the corresponding step S320- in the code processing method.
- the implementation process of S323 will not be repeated here.
- the aforementioned code processing device includes:
- a sending module configured to send a reminder to the current user to input a second conversion word corresponding to the first non-keyword if the conversion word database does not contain the first non-keyword;
- the third judgment module is used to judge whether the second conversion word input by the user is received
- the second replacement module is configured to, if yes, rewrite the second conversion word according to the writing specification, and replace the first non-keyword with the rewritten second conversion word;
- the second storage module is configured to store the first non-keyword and the second conversion word in a one-to-one correspondence to the conversion vocabulary.
- the implementation process of the functions and roles of the sending module, the third judgment module, the second replacement module, and the second storage module in the above code processing device is detailed in the implementation of corresponding steps S200-S203 in the above code processing method. The process will not be repeated here.
- the foregoing code processing device further includes:
- the backup module is used to back up the processed source code after processing all the non-keywords in the source code to obtain a source code processing file;
- the third storage module is configured to store the source code processing file and the source code backup file together, wherein the source code backup file is obtained by backing up the unprocessed source code.
- the code processing device of the embodiment of the present application replaces the non-keywords customized by the user in the source code with the corresponding conversion words through the preset conversion lexicon, thereby converting the non-keywords into complete standard words, so that the user can Clearly understand the meaning of this non-keyword, and when the source code needs to be maintained in the future, it can reduce the reading workload of the maintainer, reduce the difficulty of reading for the maintainer, and improve the work efficiency of the maintainer.
- non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
- an embodiment of the present application also provides a computer device.
- the computer device may be a server, and its internal structure may be as shown in FIG. 3.
- the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed for the computer equipment is used to provide computing and control capabilities.
- the memory of the computer device includes a non-volatile storage medium and an internal memory.
- the non-volatile storage medium stores an operating system, computer readable instructions, and a database.
- the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium.
- the database of the computer equipment is used to store data such as non-keywords and conversion words.
- the network interface of the computer device is used to communicate with an external terminal through a network connection.
- the computer readable instruction is executed by the processor, the code processing method shown in any of the above exemplary embodiments is implemented.
- FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the devices and computer equipment to which the solution of the present application is applied.
- An embodiment of the present application further provides a computer non-volatile readable storage medium, on which computer readable instructions are stored.
- the computer readable instructions are executed by one or more processors, the one or more processors. The steps in the foregoing code processing method embodiment are implemented during execution.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Machine Translation (AREA)
Abstract
A code processing method and apparatus, a computer device and a storage medium. Said method comprises: traversing all non-keywords of a source code, and determining whether a standard word library contains the non-keywords currently traversed; if not, determining whether a conversion word library contains a first non-keyword; if so, obtaining, by means of screening, a corresponding first conversion word from the conversion word library; rewriting the first conversion word, and replacing the first non-keyword with the rewritten first conversion word, thereby achieving the reconstruction processing of the non-keyword.
Description
本申请要求于2019年05月13日提交中国专利局、申请号为201910394542.4,发明名称为“代码处理方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on May 13, 2019, the application number is 201910394542.4, and the invention title is "Code processing method, device, computer equipment and storage medium", the entire content of which is incorporated by reference In this application.
本申请涉及计算机技术领域,具体涉及一种代码处理方法、装置、计算机设备和存储介质。This application relates to the field of computer technology, in particular to a code processing method, device, computer equipment and storage medium.
当前的软件项目在开发过程中,需要由不同的开发人员协助来完成软件项目开发的不同阶段的代码或者不同功能的代码,但在代码的编写过程中,不同的开发人员可能存在不同的代码编程习惯,每一个开发人员提交的代码没有统一的编写规范,使得代码维护过程效率较低。且在一般情况下,为了个人的方便撰写和查看,某些特定开发人员在编写代码时会使用一些自定义单词来替代某些复杂的单词,例如将使用自定义单词ap来替代标准的英文单词appointment,且一般不会附上对自定义单词ap的注解。后续维护人员在进行代码维护处理时,在查看到由上述特定开发人员所编写的代码时会无法理解那些自定义单词的含义,这样会对维护人员造成阅读困难,使得维护人员需要找到上述特定开发人员进行沟通交流来了解自定义单词的正确含义,导致了维护人员的工作效率低下,另外也可能会出现上述特定开发人员忘记了自己所使用的自定义单词的含义或者这些特定开发人员已经离职的情况,从而进一步加大了代码维护的工作难度。In the current software project development process, different developers need to assist in completing the code of different stages of software project development or code of different functions, but in the process of writing the code, different developers may have different code programming It is customary that the code submitted by each developer does not have a unified writing specification, which makes the code maintenance process inefficient. And in general, for personal convenience to write and view, some specific developers will use some custom words to replace some complex words when writing code, for example, the custom word ap will be used to replace standard English words Appointment, and generally do not attach a comment on the custom word ap. When the subsequent maintainers are performing code maintenance processing, they will not be able to understand the meaning of those custom words when viewing the code written by the above-mentioned specific developers. This will cause difficulty for the maintainers to read and make the maintainers need to find the above-mentioned specific developers. Personnel communicate to understand the correct meaning of custom words, resulting in low efficiency of maintenance personnel. In addition, it may also happen that the above-mentioned specific developers forget the meaning of the custom words they use or these specific developers have left their jobs. Circumstances, thereby further increasing the difficulty of code maintenance.
本申请的主要目的为提供一种代码处理方法、装置、计算机设备和存储介质,旨在解决在现有的软件项目在开发过程中,每一个开发人员提交的代码没有统一的编写规范,容易造成代码维护过程效率较低的技术问题。The main purpose of this application is to provide a code processing method, device, computer equipment and storage medium. It aims to solve the problem that the code submitted by each developer does not have a unified writing specification during the development process of an existing software project, which is likely to cause Technical problem of low efficiency of code maintenance process.
为了实现上述申请目的,本申请提出一种代码处理方法,所述方法包括步骤:In order to achieve the purpose of the above application, this application proposes a code processing method, which includes the steps:
遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;Traverse all the non-keywords of the source code, and each time a non-keyword is traversed, determine whether the preset standard thesaurus contains the non-keywords currently traversed, where the non-keywords currently traversed are marked as The first non-keyword, multiple English words and/or combined nouns are stored in the standard thesaurus;
若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,其中所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;If the standard vocabulary does not contain the first non-keyword, it is determined whether the first non-keyword is included in the preset conversion vocabulary, wherein multiple custom words are stored in the conversion vocabulary , And the conversion words corresponding to each of the custom words;
若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;If the first non-keyword is included in the conversion vocabulary, the first conversion word corresponding to the first non-keyword is selected from the conversion vocabulary;
按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。Rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
本申请还提供一种代码处理装置,包括:This application also provides a code processing device, including:
第一判断模块,用于遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;The first judgment module is used to traverse all non-keywords in the source code. When a non-keyword is traversed, it is judged whether the preset standard thesaurus contains the non-keyword currently traversed, wherein the current traversal The arrived non-keyword is marked as the first non-keyword, and multiple English words and/or combined nouns are stored in the standard dictionary;
第二判断模块,用于若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,其中所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;The second judgment module is used for judging whether the first non-keyword is contained in the preset conversion vocabulary if the standard vocabulary does not contain the first non-keyword, wherein the conversion vocabulary contains A plurality of custom words are stored, and conversion words corresponding to each of the custom words are stored;
第一筛选模块,用于若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;The first screening module is configured to filter out the first conversion word corresponding to the first non-keyword from the conversion dictionary if the first non-keyword is included in the conversion dictionary;
第一替换模块,用于按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。The first replacement module is configured to rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
本申请还提供一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现上述方法的步骤。The application also provides a computer device, including a memory and a processor, the memory stores computer readable instructions, and the processor implements the steps of the above method when the computer readable instructions are executed.
本申请还提供一种计算机非易失性可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述方法的步骤。The present application also provides a computer non-volatile readable storage medium on which computer readable instructions are stored, and when the computer readable instructions are executed by a processor, the steps of the above method are realized.
本申请中提供的代码处理方法、装置、计算机设备和存储介质,遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词;若标准词库内不包含第一非关键词,则判断预设的转换词库内是否包含第一非关键词,其中转换词库内存储有多个自定义单词,以及与各自定义单词分别对应的转换词;若转换词库内包含第一非关键词,则从转换词库筛选出与第一非关键词对应的第一转换词;按照预设的编写规范对第一转换词进行改写,并将改写后的第一转换词替换第一非关键词。本申请通过预设的转换词库将用户在源代码中自定义的非关键词替换成对应的转换词,从而将非关键词转换成完整的标准单词,从而用户能清楚地了解该非关键词的含义,并且在后续需要对源代码进行维护时,能够减少维护人员的阅读工作量,降低了维护人员的阅读困难,并提高维护人员的工作效率。另外,通过预设的编写规范对非关键词或转换词进行改写,使得改写后的源代码具有简洁美观可读性强的优点,有利于形成一种适用于所有开发人员的统一的代码编写风格。The code processing method, device, computer equipment and storage medium provided in this application traverse all non-keywords of the source code, and each time a non-keyword is traversed, it is judged whether the preset standard dictionary contains the non-keywords currently traversed. Keywords; if the first non-keyword is not included in the standard thesaurus, it is determined whether the first non-keyword is included in the preset conversion thesaurus, where multiple custom words are stored in the conversion thesaurus, and their definitions The conversion word corresponding to each word; if the conversion dictionary contains the first non-keyword, the first conversion word corresponding to the first non-keyword is filtered out from the conversion dictionary; the first conversion word is compared according to the preset writing specification Rewrite and replace the first non-keyword with the rewritten first conversion word. This application replaces the user-defined non-keywords in the source code with the corresponding conversion words through the preset conversion dictionary, so as to convert the non-keywords into complete standard words, so that the user can clearly understand the non-keywords When the source code needs to be maintained in the future, it can reduce the reading workload of the maintainer, reduce the reading difficulty of the maintainer, and improve the work efficiency of the maintainer. In addition, non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
图1是本申请一实施例的代码处理方法的流程示意图;FIG. 1 is a schematic flowchart of a code processing method according to an embodiment of the present application;
图2是本申请一实施例的代码处理装置的结构示意图;2 is a schematic diagram of the structure of a code processing device according to an embodiment of the present application;
图3是本申请一实施例的计算机设备的结构示意图。Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the application, and are not used to limit the application.
参照图1,本申请一实施例的代码处理方法,包括:1, the code processing method of an embodiment of the present application includes:
S1:遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;S1: Traverse all the non-keywords of the source code, each time a non-keyword is traversed, determine whether the preset standard thesaurus contains the non-keywords currently traversed, where the non-keywords currently traversed Marked as the first non-keyword, multiple English words and/or combined nouns are stored in the standard thesaurus;
S2:若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;S2: If the first non-keyword is not included in the standard thesaurus, it is determined whether the first non-keyword is included in the preset conversion thesaurus, and a plurality of customized words are stored in the conversion thesaurus. Words, and conversion words corresponding to each of the custom words;
S3:若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;S3: If the first non-keyword is included in the conversion vocabulary, filter out the first conversion word corresponding to the first non-keyword from the conversion vocabulary;
S4:按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。S4: Rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
如上述步骤S1所述,上述源代码是由许多的单词形成的,上述单词包括编程语言关键词和非编程语言关键词,上述非关键词是指源代码内的的非编程语言关键词,即为除上述源代码内的编程语言关键词之外的其它单词。源代码的一般形式包括方法体本身代码、方法体内部代码以及方法体外部代码,对应的,源代码的非关键词包括方法体本身的非关键词、方法体内部的非关键词以及方法体外部的非关键词。其中,可按照预设的顺序来对源代码的所有非关键词进行遍历,上述预设的顺序可根据方法体各部分的先后顺序进行设定,例如是根据从方法体本身到方法体内部再到方法体外部的顺序对源代码的所有非关键词进行遍历,另外上述预设的顺序还可以为其它的形式,例如可根据用户的意愿进行设定,在此不作具体限定。先将当前遍历到的非关键词标记为第一非关键词,在遍历源代码的所有非关键词的过程中,每遍历到一个非关键词时,首先判断预设的标准词库内是否包含当前遍历到的第一非关键词,即将第一非关键词与标准词库内的所有标准词进行匹配比对,如果标准词库内包含该第一非关键词,则表明该第一非关键词为一个标准的单词,而如果标准词库内不包含该第一非关键词,则表明该第一非关键词不是一个标准的单词。其中,上述标准词库包括标准英文单词词库和/或常见组合名词词库,可预先创建出上述标准英文单词词库,然后通过网络资源搜寻出在代码中常用的一定数量的英文单词,再将搜寻得到的该英文单词存储到该标准英文单词词库内,以形成最终的标准英文单词词库,且对存储的英文单词的数量不作具体限定。同理可预先创建出上述常见组合名词词库,然后通过网络资源搜寻出在代码中常用的一定数量的组合名词,再将搜寻得到的该组合名词存储到该常见组合名词词库内,以形成最终的常见组合名词词库,且对存储的组合名词的数量不作具体限定。As described in step S1 above, the source code is formed by many words, the words include programming language keywords and non-programming language keywords, and the non-keywords refer to non-programming language keywords in the source code, namely Words other than the programming language keywords in the above source code. The general form of source code includes method body code, method body internal code, and method body external code. Correspondingly, non-keywords of source code include non-keywords in the method body, non-keywords in the method body, and outside the method body. Non-keywords. Among them, all non-keywords of the source code can be traversed in a preset order. The preset order mentioned above can be set according to the order of each part of the method body, for example, from the method body itself to the inside of the method body. The sequence to the outside of the method body traverses all non-keywords of the source code. In addition, the aforementioned preset sequence can also be in other forms, for example, it can be set according to the user's wishes, which is not specifically limited here. First mark the non-keyword currently traversed as the first non-keyword. In the process of traversing all non-keywords in the source code, each time a non-keyword is traversed, first determine whether the preset standard dictionary contains The first non-keyword currently traversed, that is, the first non-keyword is matched with all standard words in the standard thesaurus. If the standard thesaurus contains the first non-keyword, it indicates that the first non-keyword The word is a standard word, and if the first non-keyword is not included in the standard thesaurus, it indicates that the first non-keyword is not a standard word. Among them, the above-mentioned standard vocabulary includes a standard English word vocabulary and/or a common combined noun vocabulary. The above-mentioned standard English vocabulary can be created in advance, and then a certain number of commonly used English words in the code can be searched out through network resources. The searched English words are stored in the standard English word vocabulary to form the final standard English word vocabulary, and the number of stored English words is not specifically limited. In the same way, the above-mentioned common compound noun thesaurus can be created in advance, then a certain number of commonly used compound nouns in the code can be searched out through network resources, and then the searched compound nouns can be stored in the common compound noun vocabulary to form The final common compound noun thesaurus, and the number of stored compound nouns is not specifically limited.
如上述步骤S2至S4所述,当标准词库内不包含该第一非关键词,则表明当前的第一非关键词不是一个标准的单词,而可能是一个由用户创建的自定义单词,例如为自定义的简写词ap。则需要进一步判断在预设的转换词库内是否包含所述第一非关键词,即将第一非关键词与转换词库内的所有自定义单词进行匹配比对,如果转换词库内包含与所述第一非关键词对应的第一转换词,其中上述转换词库内存储有一定数量的自定义单词,以及与各所述自定义单词分别对应的转换词,上述自定义单词与转换词可由开发人员编写得到并输入到该转换词内,上述第一转换词为与第一非关键词对应的完整的标准单词。举例地,假如转换词库存储有(自定义单词)ap→(转换词)application,则首先会从转换词库筛选出与该第一非关键词对应的第一转换词,并按照预设的编写规范对该第一转换词进行改写,之后再将改写后的第一转换词替换该第一非关键词,以完成对于第一非关键词的重构处理。其中,上述预设的编写规范,是指为源代码内的非关键词创建的一种标准形式,通过该编写规范将源代码内的所有非关键词都统一更换成上述标准形式,有利于形成统一的代码编写风格,也方便各个开发人员的查阅。举例地,上述编写规范可为将每个单词的首字母变为大写,或者为将每个单词的首字母变为小写,等等。在完成对第一非关键词的重构处理后开始进行下一个非关键词的重构处理,直至完成对所有所述非关键词的处理后,停止遍历,进而完成对源代码的重构处理。在本实施例,通过预设的转换词库将用户在源代码中自定义的非关键词替换成对应的转换词,从而将非关键词转换成完整的标准单词,从而用户能清楚地了解该非关键词的含义,并且在后续需要对源代码进行维护时,减少了维护人员的阅读工作量,降低了维护人员的阅读困难,并提高维护人员的工作效率。另外,通过预设的编写规范对非关键词或转换词进行改写,使得改写后的源代码具有简洁美观可读性强的优点,有利于形成一种适用于所有开发人员的统一的代码编写风格。As mentioned in the above steps S2 to S4, when the first non-keyword is not included in the standard thesaurus, it indicates that the current first non-keyword is not a standard word, but may be a custom word created by the user. For example, the user-defined abbreviation ap. It is necessary to further determine whether the first non-keyword is included in the preset conversion dictionary, that is, the first non-keyword is matched and compared with all the custom words in the conversion dictionary. If the conversion dictionary contains and The first conversion word corresponding to the first non-keyword, wherein a certain number of custom words are stored in the conversion dictionary, and conversion words corresponding to each of the custom words, the custom words and the conversion words It can be written by the developer and input into the conversion word. The first conversion word is a complete standard word corresponding to the first non-keyword. For example, if the conversion vocabulary stores (custom words) ap → (conversion words) application, the first conversion word corresponding to the first non-keyword will be filtered from the conversion vocabulary first, and the first conversion word corresponding to the first non-keyword will be filtered out according to the preset The writing specification rewrites the first conversion word, and then replaces the first non-keyword with the rewritten first conversion word to complete the reconstruction process for the first non-keyword. Among them, the above-mentioned preset writing specification refers to a standard form created for non-keywords in the source code. Through this writing specification, all non-keywords in the source code are uniformly replaced with the above-mentioned standard form, which is beneficial to the formation The unified coding style is also convenient for various developers to consult. For example, the above writing specification may be to change the first letter of each word to uppercase, or to change the first letter of each word to lowercase, and so on. After completing the reconstruction of the first non-keyword, start the reconstruction of the next non-keyword, and stop traversal until all the non-keywords are processed, and then complete the reconstruction of the source code. . In this embodiment, the user-defined non-keywords in the source code are replaced with corresponding conversion words through the preset conversion dictionary, so that the non-keywords are converted into complete standard words, so that the user can clearly understand the The meaning of non-keywords, and when the source code needs to be maintained later, it reduces the reading workload of the maintainer, reduces the reading difficulty of the maintainer, and improves the work efficiency of the maintainer. In addition, non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
在另一个实施例中,如果标准词库内包含上述第一非关键词,则表明该第一非关键词为一个标准的单词,此时可直接按照预设的编写规范对所述第一非关键词进行改写,并改写后得到的第一改写词替换所述第一非关键词。在本实施例,在第一非关键词属于标准的单词的情况下,通过利用上述编写规范对该第一非关键词进行改写,并将得到的第一改写词对该第一非关键词进行替换处理,使得改写后的源代码具有简洁美观可读性强的优点,有利于形成一种适用于所有开发人员的统一的代码编写风格。In another embodiment, if the standard word database contains the first non-keyword, it indicates that the first non-keyword is a standard word. In this case, the first non-keyword can be directly processed according to the preset writing specifications. The keyword is rewritten, and the first rewritten word obtained after the rewriting replaces the first non-keyword. In this embodiment, in the case that the first non-keyword belongs to a standard word, the first non-keyword is rewritten by using the above-mentioned writing specification, and the obtained first rewritten word is performed on the first non-keyword The replacement process makes the rewritten source code have the advantages of simplicity, beauty and readability, which is conducive to forming a unified code writing style suitable for all developers.
进一步地,本申请一实施例中,上述步骤S1之前,包括:Further, in an embodiment of the present application, before step S1, the method includes:
S100:根据预设的编程语言关键词词库,筛选出所述源代码内的所有关键词;S100: Filter out all keywords in the source code according to a preset programming language keyword thesaurus;
S101:对所述源代码内的所有关键词添加标记,以确定出所述源代码内的所有非关键词,其中所述非关键词为所述源代码中不具有所述标记的单词。S101: Add tags to all keywords in the source code to determine all non-keywords in the source code, where the non-keywords are words in the source code that do not have the tag.
如上述步骤S100和S101所述,在遍历源代码的所有非关键词的步骤之前,还包括筛选出源代码的所有非关键词的步骤,具体地,首先根据预设的编程语言关键词词库来筛选出源代码内的所有关键词,然后对源代码内的所有关键词添加标记,以确定出源代码内的所有非关键词,因此源代码内的非关键词为源代码中不具有上述标记的单词。本实施例通过对源代码内的所有关键词添加标记来将关键词与非关键词加以区分,有助于用户在查阅源代码的时候可以清楚地了解源代码内每个单词对应的类型是关键词还是非关键词,而对源代码内的所有非关键词进行处理时,便可快捷地挑选出具有标记的非关键词进行处理,保证了对于非关键词处理的准确性,防止出现对源代码的关键词进行了误处理的情形。其中,可预选创建出上述编程语言关键词词库,然后通过网络资源搜寻出在代码中常用的一定数量的编程语言关键词词库,例如可通过编程语言官方网站等相关资源进行搜寻,再将搜寻得到的编程语言关键词存储到该编程语言关键词词库内,以形成最终的编程语言关键词词库,并且对该编程语言关键词词库还设置有更新功能,可在一定的时间周期内向编程语言关键词词库增加新的编程语言关键词或者删除一些编程语言关键词,以完成对编程语言关键词词库的更新。另外,上述首先根据预设的编程语言关键词词库来筛选出源代码内的所有关键词的步骤,具体为:分别将所述源代码的所有单词与所述编程语言关键词词库中的编程语言关键词进行匹配比对,其中所述编程语言关键词词库内预先存储有多个不同的编程语言关键词;筛选出所述源代码的所有单词中与所述编程语言关键词匹配的指定单词,其中所述指定单词的数量为一个或多个;将所述指定单词确定为所述关键词。通过上述编程语言关键词词库可快速地筛选出源代码内的关键词,进而可快速得到源代码内的所有非关键词。As described in the above steps S100 and S101, before the step of traversing all the non-keywords of the source code, it also includes the step of filtering out all the non-keywords of the source code. Specifically, first according to the preset programming language keyword thesaurus To filter out all keywords in the source code, and then add tags to all keywords in the source code to determine all non-keywords in the source code, so the non-keywords in the source code are not in the source code. Marked words. This embodiment distinguishes keywords from non-keywords by adding tags to all keywords in the source code, which helps users to clearly understand that the type corresponding to each word in the source code is the key when consulting the source code. Words are still non-keywords, and when all non-keywords in the source code are processed, the marked non-keywords can be quickly selected for processing, ensuring the accuracy of non-keyword processing and preventing the occurrence of non-keywords. The key words of the code are mishandled. Among them, the above-mentioned programming language keyword thesaurus can be pre-selected, and then a certain number of programming language keyword thesaurus commonly used in the code can be searched through network resources. For example, the programming language official website and other related resources can be searched, and then the The searched programming language keywords are stored in the programming language keyword lexicon to form the final programming language keyword lexicon, and the programming language keyword lexicon is also provided with an update function, which can be used in a certain period of time The inward programming language keyword lexicon adds new programming language keywords or deletes some programming language keywords to complete the update of the programming language keyword lexicon. In addition, the above step of firstly filtering out all keywords in the source code according to the preset programming language keyword thesaurus is specifically: separately combining all the words in the source code with those in the programming language keyword thesaurus The programming language keywords are matched and compared, wherein a plurality of different programming language keywords are pre-stored in the programming language keyword lexicon; all words in the source code that match the programming language keywords are filtered out Designated words, wherein the number of the designated words is one or more; the designated words are determined as the keywords. Through the above-mentioned programming language keyword thesaurus, keywords in the source code can be quickly screened out, and all non-keywords in the source code can be quickly obtained.
进一步地,本申请一实施例中,上述步骤S3之前,包括:Further, in an embodiment of the present application, before the foregoing step S3, the method includes:
S300:接收所有开发人员分别输入的单词转换数据,其中所述单词转换数据包括多个自定义单词,以及与各所述自定义单词分别对应的转换词;S300: Receive word conversion data input by all developers, where the word conversion data includes a plurality of custom words and conversion words corresponding to each of the custom words;
S301:创建所述转换词库;S301: Create the conversion word database;
S302:将所述单词转换数据存储于所述转换词库内。S302: Store the word conversion data in the conversion vocabulary.
如上述步骤S300至S302所述,上述的转换词库是一个由所有的开发人员共享数据的转换词库,该转换词库内存储有每一个开发人员输入的单词转换数据,每一个单词转换数据内包含有每一个开发人员记录的多个自定义单词,以及与每一个自定义单词分别对应的转换词,其中,对自定义单词对应的转换词的数量不作限定,例如可为一个或多个。在本实施例,上述判断在预设的转换词库内是否包含所述第一非关键词的步骤之前,还包括形成该转换词库的过程,具体地,预先创建一个转换词库,在接收到各开发人员分别输入的单词转换数据后,再将该单词转换数据存储到该转换词库内。在形成上述转换词库后,在对源代码中的非关键词进行处理过程中,当出现在上述标准词库内不包含当前的第一非关键词的情形时,则表明该第一非关键词可为用户创建的自定义单词,此时通过将该第一非关键词与该转换词库内所有的自定义单词进行匹配比对,进而可筛选出与该第一非关键词对应的第一转换词,进而实现将第一非关键词转换成完整的标准词,从而用户能清楚地了解该第一非关键词的含义,并且在后续需要对源代码进行维护时,减少了维护人员的阅读工作量,降低了维护人员的阅读困难,并提高维护人员的工作效率。进一步地,对上述转换词库还设置有更新功能,可在一定的时间周期内向转换词库增加新的单词转换数据,或者删除一些单词转换数据,或者对某一些单词转换数据进行数据修改,以完成对转换词库的更新,使得转换词库内能存储更多更新的单词转换数据。As described in the above steps S300 to S302, the above-mentioned conversion dictionary is a conversion dictionary in which data is shared by all developers. The conversion dictionary stores word conversion data input by each developer, and each word conversion data It contains multiple custom words recorded by each developer, and conversion words corresponding to each custom word. The number of conversion words corresponding to the custom word is not limited, for example, it can be one or more . In this embodiment, before the step of determining whether the first non-keyword is included in the preset conversion vocabulary, it further includes a process of forming the conversion vocabulary. Specifically, a conversion vocabulary is created in advance, and after receiving After the word conversion data respectively input by each developer, the word conversion data is stored in the conversion dictionary. After the conversion dictionary is formed, in the process of processing non-keywords in the source code, when the current first non-keyword is not included in the standard dictionary, it indicates that the first non-keyword The word can be a custom word created by the user. At this time, by matching and comparing the first non-keyword with all the custom words in the conversion dictionary, the first non-keyword corresponding to the first non-keyword can be filtered out. A conversion word, and then realize the conversion of the first non-keyword into a complete standard word, so that the user can clearly understand the meaning of the first non-keyword, and when the source code needs to be maintained in the future, the maintenance staff is reduced The reading workload reduces the reading difficulty of maintenance personnel and improves the work efficiency of maintenance personnel. Further, an update function is also provided for the above conversion dictionary, which can add new word conversion data to the conversion dictionary within a certain period of time, or delete some word conversion data, or modify certain word conversion data. Complete the update of the conversion lexicon so that more updated word conversion data can be stored in the conversion lexicon.
进一步地,本申请一实施例中,上述步骤S3,包括:Further, in an embodiment of the present application, the above step S3 includes:
S310:若所述转换词库内包含所述第一非关键词,判断所述转换词库内是否存在与所述第一非关键词对应的多个转换词;S310: If the conversion vocabulary contains the first non-keyword, determine whether there are multiple conversion words corresponding to the first non-keyword in the conversion vocabulary;
S311:若是,获取各所述转换词的优先级信息;S311: If yes, obtain priority information of each conversion word;
S312:根据所述优先级信息,将优先级最高的第一指定转换词确定为所述第一转换词。S312: According to the priority information, determine the first designated conversion word with the highest priority as the first conversion word.
如上述步骤S310至S312所述,对于转换词库内不同的自定义单词,可能会出现一个自定义单词对应多个转换词的情形,对于这种情形,会预先设置出与该多个转换词分别对应的优先级信息,例如自定义单词ap对应了三个转换词appointment、apply与application,且转换词appointment的优先级为第一优先级,转换词apply的优先级为第二优先级,转换词application的优先级为第三优先级,第一优先级高于第二优先级,第二优先级高于第三优先级,其中对上述优先级的设置形式不作具体的限定,例如上述优先级可为用户在输入的单词转换数据内预先标记好的,或者上述优先级是由代码处理装置根据每一个转换词的历史被使用次数进行设置的,等等。在本实施例,当对上述第一非关键词进行处理时,如果在预设的转换词库内包含上述第一非关键词时,首先要判断转换词库内是否存在与所述第一非关键词对应的多个转换词,如果存在与所述第一非关键词对应的多个转换词,则对该多个转换词的优先级信息进行获取,根据所述优先级信息,将优先级最高的第一指定转换词确定为所述第一转换词,进而完成对第一非关键词的转换,如上述举例,如果第一非关键词为ap,则会将优先级为第一优先级的appointment确定为上述的第一转换词。在本实施例,当出现某一个非关键词对应多个转换词的情况时,可根据该多个转换词的优先级信息来智能地筛选出优先级最高的第一指定转换词来进行后续的处理,从而可以快速地从多个转换词提取出第一转换词,提高了用户的使用体验。As described in the above steps S310 to S312, for different custom words in the conversion lexicon, there may be a situation where one custom word corresponds to multiple conversion words. In this case, it will be preset with the multiple conversion words. The corresponding priority information, for example, the custom word ap corresponds to the three conversion words appointment, apply and application, and the priority of the conversion word appointment is the first priority, and the priority of the conversion word apply is the second priority. The priority of the word application is the third priority, the first priority is higher than the second priority, and the second priority is higher than the third priority. The setting form of the above priority is not specifically limited, such as the above priority It can be pre-marked in the input word conversion data by the user, or the above-mentioned priority is set by the code processing device according to the historical use times of each conversion word, and so on. In this embodiment, when the first non-keyword is processed, if the first non-keyword is included in the preset conversion vocabulary, it is first necessary to determine whether the conversion vocabulary is related to the first non-keyword. If there are multiple conversion words corresponding to the first non-keyword, then the priority information of the multiple conversion words is acquired, and the priority is changed according to the priority information. The highest first designated conversion word is determined as the first conversion word, and the conversion to the first non-keyword is completed. As the above example, if the first non-keyword is ap, the priority will be the first priority The appointment is determined as the first conversion word mentioned above. In this embodiment, when a certain non-keyword corresponds to multiple conversion words, the first designated conversion word with the highest priority can be selected intelligently according to the priority information of the multiple conversion words for subsequent follow-up By processing, the first conversion word can be quickly extracted from multiple conversion words, which improves the user experience.
进一步地,本申请一实施例中,所述第一非关键词对应设置有多个特定转换词,设定多个所述特定转换词中优先级最高的转换词为第二指定转换词,上述步骤S3,包括:Further, in an embodiment of the present application, the first non-keyword is correspondingly provided with a plurality of specific conversion words, and the conversion word with the highest priority among the plurality of specific conversion words is set as the second designated conversion word. Step S3 includes:
S320:若所述转换词库内包含所述第一非关键词,筛选出所有所述特定转换词中优先级最高的第二指定转换词,并向当前用户展示所述第二指定转换词,以使所述用户对所述第二指定转换词的准确性进行判别;S320: If the conversion word database contains the first non-keyword, filter out the second designated conversion word with the highest priority among all the specific conversion words, and display the second designated conversion word to the current user. So that the user can judge the accuracy of the second designated conversion word;
S321:接收所述用户返回的对所述第二指定转换词的反馈信息,其中所述反馈信息包括所述第二指定转换词准确或所述第二指定转换词不准确;S321: Receive feedback information on the second designated conversion word returned by the user, where the feedback information includes that the second designated conversion word is accurate or the second designated conversion word is inaccurate;
S322:若所述反馈信息为所述第二指定转换词不准确,则向所述用户展示除所述第二指定转换词外的其它特定转换词;S322: If the feedback information is that the second designated conversion word is inaccurate, show other specific conversion words except the second designated conversion word to the user;
S323:接收所述用户从所述其它特定转换词中选择的第三指定转换词,并将所述第三指定转换词确定为所述第一转换词。S323: Receive a third designated conversion word selected by the user from the other specific conversion words, and determine the third designated conversion word as the first conversion word.
如上述步骤S320至S323所述,当第一非关键词为app时,如果仅仅按照第一非关键词ap对应的各转换词的优先级信息来筛选出第一转换词,则会只选择出第一优先级的转换词appointment来完成后续对第一非关键词ap的处理,虽然转换词appointment是ap对应的所有转换词中优先级最高的,但可能出现在当前的源代码中,第一非关键词ap的正确含义其实是与application或apply对应的特殊情况,因此根据优先级信息选出的第一优先级的转换词是错误的。在本实施例,假设第一非关键词对应设置有多个特定转换词,并设定多个所述特定转换词中优先级最高的转换词为第二指定转换词,当对上述第一非关键词进行处理时,首先会从与该第一非关键词对应的多个特定转换词中筛选出优先级最高的第二指定转换词,并向当前用户展示该第二指定转换词,以使得用户对上述第二指定转换词的准确性进行判别,用户可通过将该优先级最高的第二指定转换词放到第一非关键词所在的位置,并结合上下文信息来判断该优先级最高的转换词的准确性,之后用户会返回与第二指定转换词对应的反馈信息,其中上述用户可为撰写上述源代码的工作人员,上述反馈信息包括第二指定转换词准确或第二指定转换词不准确。在接收到该反馈信息后,如果该反馈信息为第二指定转换词不准确,则会向用户展示除第二指定转换词外的其它特定转换词,以使得用户从上述其它特定转换词中选择出第三指定转换词,该第三指定转换词为对应于第一非关键词的正确含义的转换词,在接收到第三指定转换词后,便将第三指定转换词确定为第一转换词,并根据该第一转换词来完成后续对第一非关键词的处理。在本实施例,通过获取用户的反馈信息来判别第二指定转换词的准确性,如果第二指定转换词不准确,再根据用户从多个特定转换词的选择来确定出对应于第一非关键词的正确含义的第三指定转换词,从而有效地保证了对第一非关键词的转换的正确性,避免由于对第一非关键词的错误转换而导致用户出现对于源代码的理解错误。As described in the above steps S320 to S323, when the first non-keyword is app, if the first conversion word is selected only according to the priority information of each conversion word corresponding to the first non-keyword ap, only The first priority conversion word appointment is used to complete the subsequent processing of the first non-keyword ap. Although the conversion word appointment is the highest priority among all conversion words corresponding to ap, it may appear in the current source code. The correct meaning of the non-keyword ap is actually a special case corresponding to application or apply, so the first priority conversion word selected according to the priority information is wrong. In this embodiment, it is assumed that a plurality of specific conversion words are set corresponding to the first non-keyword, and the conversion word with the highest priority among the plurality of specific conversion words is set as the second designated conversion word. When the keyword is processed, the second designated conversion word with the highest priority will be selected from the multiple specific conversion words corresponding to the first non-keyword, and the second designated conversion word will be displayed to the current user, so that The user judges the accuracy of the above-mentioned second designated conversion word. The user can determine the highest priority by placing the second designated conversion word with the highest priority in the position of the first non-keyword, and combining the context information After the accuracy of the conversion word, the user will return feedback information corresponding to the second specified conversion word, where the user can be the staff who wrote the source code, and the feedback information includes the accuracy of the second specified conversion word or the second specified conversion word Inaccurate. After receiving the feedback information, if the feedback information is that the second designated conversion word is inaccurate, the user will be shown other specific conversion words except the second designated conversion word, so that the user can choose from the above other specific conversion words A third designated conversion word is generated, and the third designated conversion word is a conversion word corresponding to the correct meaning of the first non-keyword. After receiving the third designated conversion word, the third designated conversion word is determined as the first conversion And complete the subsequent processing of the first non-keyword according to the first conversion word. In this embodiment, the accuracy of the second designated conversion word is determined by obtaining the user's feedback information. If the second designated conversion word is inaccurate, the user's selection from multiple specific conversion words is used to determine the first non-specific conversion word. The third designated conversion word for the correct meaning of the keyword, thereby effectively ensuring the correctness of the conversion of the first non-keyword, and avoiding the user's understanding of the source code due to the wrong conversion of the first non-keyword .
进一步地,本申请一实施例中,上述步骤S2之后,包括:Further, in an embodiment of the present application, after the above step S2, the method includes:
S200:若所述转换词库内不包含所述第一非关键词,向当前用户发送输入与所述第一非关键词对应的第二转换词的提醒信息;S200: If the first non-keyword is not included in the conversion vocabulary, send a reminder to the current user to input a second conversion word corresponding to the first non-keyword;
S201:判断是否接收到所述用户输入的所述第二转换词;S201: Determine whether the second conversion word input by the user is received;
S202:若是,按照所述编写规范对所述第二转换词进行改写,并将改写后的所述第二转换词替换所述第一非关键词;S202: If yes, rewrite the second conversion word according to the writing specification, and replace the first non-keyword with the rewritten second conversion word;
S203:将所述第一非关键词与所述第二转换词一一对应的存储到所述转换词库内。S203: Store the first non-keyword and the second conversion word in a one-to-one correspondence in the conversion vocabulary.
如上述步骤S200至S203所述,在将第一非关键词与转换词库内的所有自定义单词进行匹配比对时,如果出现匹配失败的情况,则表明转换词库内不包含该第一非关键词,为了完成后续的对于第一非关键词的替换处理,即将第一非关键词替换成完整的标准单词,此时会向用户发送输入与该第一非关键词对应的第二转换词的提醒信息,以使得用户手动输入与该第一非关键词对应的第二转换词,其中上述用户可为撰写上述源代码的工作人员。在接收到该第二转换词后,便会按照上述编写规范对第二转换词进行改写,并将改写后的第二转换词替换上述第一非关键词,并进一步将第一非关键词与第二转换词一一对应的存储到转换词库内,来完成对转换词库的数据更新,从而在后续对该第一非关键词进行处理时,能够从经过数据更新后的转换词库内提取出与该第一非关键词对应的第二转换词进行替换,从而不需要用户再次手动输入一次第二转换词,减少用户的工作量,提高用户的使用体验。As described in the above steps S200 to S203, when the first non-keyword is matched with all the custom words in the conversion dictionary, if the matching fails, it means that the conversion dictionary does not contain the first Non-keywords, in order to complete the subsequent replacement process for the first non-keywords, that is, to replace the first non-keywords with complete standard words, at this time, the user will be sent a second conversion corresponding to the first non-keyword The reminder information of the word, so that the user manually input the second conversion word corresponding to the first non-keyword, wherein the user may be the staff who wrote the source code. After receiving the second conversion word, it will rewrite the second conversion word according to the above writing specifications, replace the first non-keyword with the rewritten second conversion word, and further combine the first non-keyword with The second conversion word is stored in the conversion dictionary in a one-to-one correspondence to complete the data update of the conversion dictionary, so that when the first non-keyword is subsequently processed, the data can be updated from the conversion dictionary The second conversion word corresponding to the first non-keyword is extracted and replaced, thereby eliminating the need for the user to manually input the second conversion word again, reducing the user's workload and improving the user experience.
进一步地,本申请一实施例中,上述步骤S4之后,包括:Further, in an embodiment of the present application, after the above step S4, the method includes:
S400:在完成对所述源代码内的所有所述非关键词的处理后,对经过处理后的源代码进行备份,得到源代码处理文件;S400: After processing all the non-keywords in the source code, back up the processed source code to obtain a source code processing file;
S401:将所述源代码处理文件与源代码备份文件共同进行存储,其中所述源代码备份文件为通过对未经过处理的所述源代码进行备份得到。S401: Store the source code processing file and the source code backup file together, where the source code backup file is obtained by backing up the unprocessed source code.
如上述步骤S400和S401所述,在对源代码进行重构处理,即替换和/或转换处理之前,会先对源代码文件进行备份处理,来得到与源代码对应的源代码备份文件。另外,在完成对所述源代码中的所有非关键词的处理后,也会对处理后的源代码进行备份,得到对应的源代码处理文件。之后,再将所述源代码处理文件与未经过处理的源代码备份文件共同进行存储,例如将源代码处理文件与源代码备份文件一起存储到预先生成的指定文件夹内,以使得后续维护人员对该源代码进行维护处理时,能够在阅读经过重构处理后的源代码处理文件出现疑惑时,能够从上述指定文件夹内来提取出源代码备份文件,并进一步参考源代码备份文件中的原始数据来对源代码处理文件中出现的错误进行人工修正。通过上述源代码备份文件的辅助,有利于维护人员在阅读源代码处理文件时,能够加快对源代码的理解速度,减少维护人员的维护工作量。As described in the above steps S400 and S401, before the source code is reconstructed, that is, the replacement and/or conversion process, the source code file will be backed up first to obtain the source code backup file corresponding to the source code. In addition, after the processing of all non-keywords in the source code is completed, the processed source code will also be backed up to obtain the corresponding source code processing file. After that, the source code processing file and the unprocessed source code backup file are stored together, for example, the source code processing file and the source code backup file are stored together in a pre-generated designated folder, so that subsequent maintenance personnel When performing maintenance processing on the source code, you can extract the source code backup file from the above specified folder when you have doubts about reading the refactored source code processing file, and further refer to the source code backup file The original data is used to manually correct errors in the source code processing file. With the aid of the above-mentioned source code backup file, it is helpful for maintenance personnel to speed up the understanding of the source code when reading the source code processing file, and reduce the maintenance workload of the maintenance personnel.
本申请实施例的代码处理方法,通过预设的转换词库将用户在源代码中自定义的非关键词替换成对应的转换词,从而将非关键词转换成完整的标准单词,从而用户能清楚地了解该非关键词的含义,并且在后续需要对源代码进行维护时,能够减少维护人员的阅读工作量,降低了维护人员的阅读困难,并提高维护人员的工作效率。另外,通过预设的编写规范对非关键词或转换词进行改写,使得改写后的源代码具有简洁美观可读性强的优点,有利于形成一种适用于所有开发人员的统一的代码编写风格。The code processing method of the embodiment of this application replaces the non-keywords customized by the user in the source code with the corresponding conversion words through the preset conversion dictionary, thereby converting the non-keywords into complete standard words, so that the user can Clearly understand the meaning of this non-keyword, and when the source code needs to be maintained in the future, it can reduce the reading workload of the maintainer, reduce the difficulty of reading for the maintainer, and improve the work efficiency of the maintainer. In addition, non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
参照图2,本申请一实施例中还提供了一种代码处理装置,包括:2, an embodiment of the present application also provides a code processing device, including:
第一判断模块1,用于遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;The first judging module 1 is used to traverse all non-keywords in the source code, and each time a non-keyword is traversed, it is judged whether the preset standard thesaurus contains the non-keyword currently traversed, wherein the current The traversed non-keyword is marked as the first non-keyword, and multiple English words and/or combined nouns are stored in the standard thesaurus;
第二判断模块2,用于若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,其中所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;The second judgment module 2 is used for judging whether the first non-keyword is included in the preset conversion vocabulary if the standard vocabulary does not contain the first non-keyword, wherein the conversion vocabulary A plurality of custom words and conversion words corresponding to each of the custom words are stored therein;
第一筛选模块3,用于若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;The first screening module 3 is configured to filter out the first conversion word corresponding to the first non-keyword from the conversion dictionary if the first non-keyword is included in the conversion dictionary;
第一替换模块4,用于按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。The first replacement module 4 is configured to rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
在本实施例中,上述代码处理装置中的第一判断模块、第二判断模块、第一筛选模块与第一替换模块的功能和作用的实现过程具体详见上述代码处理方法中对应步骤S1-S4的实现过程,在此不再赘述。In this embodiment, the implementation process of the functions and roles of the first judgment module, the second judgment module, the first screening module, and the first replacement module in the code processing device is detailed in the corresponding step S1- in the code processing method. The implementation process of S4 will not be repeated here.
进一步地,本申请一实施例中,上述代码处理装置,包括:Further, in an embodiment of the present application, the aforementioned code processing device includes:
第二筛选模块,用于根据预设的编程语言关键词词库,筛选出所述源代码内的所有关键词;The second screening module is used to screen out all keywords in the source code according to a preset programming language keyword thesaurus;
标记模块,用于对所述源代码内的所有关键词添加标记,以确定出所述源代码内的所有非关键词,其中所述非关键词为所述源代码中不具有所述标记的单词。The tagging module is used to add tags to all keywords in the source code to determine all non-keywords in the source code, wherein the non-keywords are those that do not have the tag in the source code word.
本实施例中,上述代码处理装置中的第二筛选模块与标记模块的功能和作用的实现过程具体详见上述代码处理方法中对应步骤S100-S101的实现过程,在此不再赘述。In this embodiment, the implementation process of the functions and roles of the second screening module and the marking module in the above-mentioned code processing device is detailed in the implementation process of corresponding steps S100-S101 in the above-mentioned code processing method, which will not be repeated here.
进一步地,本申请一实施例中,上述代码处理装置,包括:Further, in an embodiment of the present application, the aforementioned code processing device includes:
第一接收模块,用于接收所有开发人员分别输入的单词转换数据,其中所述单词转换数据包括多个自定义单词,以及与各所述自定义单词分别对应的转换词;The first receiving module is configured to receive word conversion data input by all developers, where the word conversion data includes a plurality of custom words and conversion words corresponding to each of the custom words;
创建模块,用于创建所述转换词库;A creation module for creating the conversion dictionary;
第一存储模块,用于将所述单词转换数据存储于所述转换词库内。The first storage module is used to store the word conversion data in the conversion vocabulary.
本实施例中,上述代码处理装置中的第一接收模块、创建模块与第一存储模块的功能和作用的实现过程具体详见上述代码处理方法中对应步骤S300-S302的实现过程,在此不再赘述。In this embodiment, the implementation process of the functions and roles of the first receiving module, creation module, and first storage module in the above code processing apparatus is detailed in the implementation process corresponding to steps S300-S302 in the above code processing method. Repeat it again.
进一步地,本申请一实施例中,上述第一筛选模块,包括:Further, in an embodiment of the present application, the above-mentioned first screening module includes:
第一判断单元,用于若所述转换词库内包含所述第一非关键词,判断所述转换词库内是否存在与所述第一非关键词对应的多个转换词;The first determining unit is configured to determine whether there are multiple conversion words corresponding to the first non-keyword in the conversion dictionary if the first non-keyword is included in the conversion dictionary;
获取单元,用于若是,获取各所述转换词的优先级信息;An obtaining unit, configured to obtain priority information of each conversion word if so;
第一确定单元,用于根据所述优先级信息,将优先级最高的第一指定转换词确定为所述第一转换词。The first determining unit is configured to determine the first designated conversion word with the highest priority as the first conversion word according to the priority information.
本实施例中,上述代码处理装置中的第一筛选模块内包括的第一判断单元、获取单元与第一确定单元的功能和作用的实现过程具体详见上述代码处理方法中对应步骤S310-S312的实现过程,在此不再赘述。In this embodiment, the implementation process of the functions and roles of the first judging unit, the acquiring unit and the first determining unit included in the first screening module in the code processing device is detailed in the corresponding steps S310-S312 in the code processing method. The realization process of this will not be repeated here.
进一步地,本申请一实施例中,所述第一非关键词对应设置有多个特定转换词,设定多个所述特定转换词中优先级最高的转换词为第二指定转换词,上述第一筛选模块,包括:Further, in an embodiment of the present application, the first non-keyword is correspondingly provided with a plurality of specific conversion words, and the conversion word with the highest priority among the plurality of specific conversion words is set as the second designated conversion word. The first screening module includes:
筛选单元,用于若所述转换词库内包含所述第一非关键词,筛选出所有所述特定转换词中优先级最高的第二指定转换词,并向当前用户展示所述第二指定转换词,以使所述用户对所述第二指定转换词的准确性进行判别;The screening unit is configured to filter out the second designated conversion word with the highest priority among all the specific conversion words if the conversion word database contains the first non-keyword, and display the second designated conversion word to the current user Conversion words, so that the user can judge the accuracy of the second designated conversion words;
接收单元,用于接收所述用户返回的对所述第二指定转换词的反馈信息,其中所述反馈信息包括所述第二指定转换词准确或所述第二指定转换词不准确;A receiving unit, configured to receive feedback information on the second designated conversion word returned by the user, wherein the feedback information includes that the second designated conversion word is accurate or the second designated conversion word is inaccurate;
展示单元,用于若所述反馈信息为所述第二指定转换词不准确,则向所述用户展示除所述第二指定转换词外的其它特定转换词;A display unit, configured to, if the feedback information is that the second designated conversion word is inaccurate, display other specific conversion words other than the second designated conversion word to the user;
第二确定单元,用于接收所述用户从所述其它特定转换词中选择的第三指定转换词,并将所述第三指定转换词确定为所述第一转换词。The second determining unit is configured to receive a third designated conversion word selected by the user from the other specific conversion words, and determine the third designated conversion word as the first conversion word.
本实施例中,上述代码处理装置中的第一筛选模块内包括的筛选单元、接收单元、展示单元与第二确定单元的功能和作用的实现过程具体详见上述代码处理方法中对应步骤S320-S323的实现过程,在此不再赘述。In this embodiment, the functions and functions of the screening unit, receiving unit, display unit, and second determining unit included in the first screening module in the code processing device are realized in detail in the corresponding step S320- in the code processing method. The implementation process of S323 will not be repeated here.
进一步地,本申请一实施例中,上述代码处理装置,包括:Further, in an embodiment of the present application, the aforementioned code processing device includes:
发送模块,用于若所述转换词库内不包含所述第一非关键词,向当前用户发送输入与所述第一非关键词对应的第二转换词的提醒信息;A sending module, configured to send a reminder to the current user to input a second conversion word corresponding to the first non-keyword if the conversion word database does not contain the first non-keyword;
第三判断模块,用于判断是否接收到所述用户输入的所述第二转换词;The third judgment module is used to judge whether the second conversion word input by the user is received;
第二替换模块,用于若是,按照所述编写规范对所述第二转换词进行改写,并将改写后的所述第二转换词替换所述第一非关键词;The second replacement module is configured to, if yes, rewrite the second conversion word according to the writing specification, and replace the first non-keyword with the rewritten second conversion word;
第二存储模块,用于将所述第一非关键词与所述第二转换词一一对应的存储到所述转换词库内。The second storage module is configured to store the first non-keyword and the second conversion word in a one-to-one correspondence to the conversion vocabulary.
本实施例中,上述代码处理装置中的发送模块、第三判断模块、第二替换模块与第二存储模块的功能和作用的实现过程具体详见上述代码处理方法中对应步骤S200-S203的实现过程,在此不再赘述。In this embodiment, the implementation process of the functions and roles of the sending module, the third judgment module, the second replacement module, and the second storage module in the above code processing device is detailed in the implementation of corresponding steps S200-S203 in the above code processing method. The process will not be repeated here.
进一步地,本申请一实施例中,上述代码处理装置,还包括:Further, in an embodiment of the present application, the foregoing code processing device further includes:
备份模块,用于在完成对所述源代码内的所有所述非关键词的处理后,对经过处理后的源代码进行备份,得到源代码处理文件;The backup module is used to back up the processed source code after processing all the non-keywords in the source code to obtain a source code processing file;
第三存储模块,用于将所述源代码处理文件与源代码备份文件共同进行存储,其中所述源代码备份文件为通过对未经过处理的所述源代码进行备份得到。The third storage module is configured to store the source code processing file and the source code backup file together, wherein the source code backup file is obtained by backing up the unprocessed source code.
本实施例中,上述代码处理装置中的备份模块与第三存储模块的功能和作用的实现过程具体详见上述代码处理方法中对应步骤S400-S401的实现过程,在此不再赘述。In this embodiment, the implementation process of the functions and roles of the backup module and the third storage module in the foregoing code processing device is detailed in the implementation process of the corresponding steps S400-S401 in the foregoing code processing method, which will not be repeated here.
本申请实施例的代码处理装置,通过预设的转换词库将用户在源代码中自定义的非关键词替换成对应的转换词,从而将非关键词转换成完整的标准单词,从而用户能清楚地了解该非关键词的含义,并且在后续需要对源代码进行维护时,能够减少维护人员的阅读工作量,降低了维护人员的阅读困难,并提高维护人员的工作效率。另外,通过预设的编写规范对非关键词或转换词进行改写,使得改写后的源代码具有简洁美观可读性强的优点,有利于形成一种适用于所有开发人员的统一的代码编写风格。The code processing device of the embodiment of the present application replaces the non-keywords customized by the user in the source code with the corresponding conversion words through the preset conversion lexicon, thereby converting the non-keywords into complete standard words, so that the user can Clearly understand the meaning of this non-keyword, and when the source code needs to be maintained in the future, it can reduce the reading workload of the maintainer, reduce the difficulty of reading for the maintainer, and improve the work efficiency of the maintainer. In addition, non-keywords or conversion words are rewritten through preset writing specifications, so that the rewritten source code has the advantages of concise, beautiful, and readable, which is conducive to forming a unified code writing style suitable for all developers .
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储非关键词以及转换词等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现上述任一个示例性实施例所示出的代码处理方法。本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的装置、计算机设备的限定。3, an embodiment of the present application also provides a computer device. The computer device may be a server, and its internal structure may be as shown in FIG. 3. The computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed for the computer equipment is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium. The database of the computer equipment is used to store data such as non-keywords and conversion words. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer readable instruction is executed by the processor, the code processing method shown in any of the above exemplary embodiments is implemented. Those skilled in the art can understand that the structure shown in FIG. 3 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the devices and computer equipment to which the solution of the present application is applied.
本申请一实施例还提供一种计算机非易失性可读存储介质,其上存储有计算机可读指令,该计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行时实现上述代码处理方法实施例中的步骤。An embodiment of the present application further provides a computer non-volatile readable storage medium, on which computer readable instructions are stored. When the computer readable instructions are executed by one or more processors, the one or more processors The steps in the foregoing code processing method embodiment are implemented during execution.
以上所述仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only the preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of this application description and drawings, or directly or indirectly applied to other related The technical field is equally included in the scope of patent protection of this application.
Claims (20)
- 一种代码处理方法,其特征在于,包括:A code processing method, characterized by comprising:遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;Traverse all the non-keywords of the source code, and each time a non-keyword is traversed, determine whether the preset standard thesaurus contains the non-keywords currently traversed, where the non-keywords currently traversed are marked as The first non-keyword, multiple English words and/or combined nouns are stored in the standard thesaurus;若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,其中所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;If the standard vocabulary does not contain the first non-keyword, it is determined whether the first non-keyword is included in the preset conversion vocabulary, wherein multiple custom words are stored in the conversion vocabulary , And the conversion words corresponding to each of the custom words;若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;If the first non-keyword is included in the conversion vocabulary, the first conversion word corresponding to the first non-keyword is selected from the conversion vocabulary;按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。Rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
- 根据权利要求1所述的代码处理方法,其特征在于,所述遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词的步骤之前,包括:The code processing method according to claim 1, wherein the traversal of all non-keywords in the source code, each time a non-keyword is traversed, it is determined whether the preset standard vocabulary contains the non-keywords currently traversed Before the keyword step, include:根据预设的编程语言关键词词库,筛选出所述源代码内的所有关键词;Filter out all keywords in the source code according to the preset programming language keyword thesaurus;对所述源代码内的所有关键词添加标记,以确定出所述源代码内的所有非关键词,其中所述非关键词为所述源代码中不具有所述标记的单词。Add tags to all keywords in the source code to determine all non-keywords in the source code, where the non-keywords are words in the source code that do not have the tag.
- 根据权利要求1所述的代码处理方法,其特征在于,所述若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词的步骤之前,包括:4. The code processing method according to claim 1, wherein if the first non-keyword is included in the conversion vocabulary, then filtering out the conversion vocabulary and the first non-keyword Before the corresponding first conversion word step, it includes:接收所有开发人员分别输入的单词转换数据,其中所述单词转换数据包括多个自定义单词,以及与各所述自定义单词分别对应的转换词;Receiving word conversion data input by all developers, wherein the word conversion data includes multiple custom words and conversion words corresponding to each of the custom words;创建所述转换词库;Creating the conversion lexicon;将所述单词转换数据存储于所述转换词库内。The word conversion data is stored in the conversion vocabulary.
- 根据权利要求1所述的代码处理方法,其特征在于,所述若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词的步骤,包括:4. The code processing method according to claim 1, wherein if the first non-keyword is included in the conversion vocabulary, then filtering out the conversion vocabulary and the first non-keyword The corresponding steps of the first conversion word include:若所述转换词库内包含所述第一非关键词,判断所述转换词库内是否存在与所述第一非关键词对应的多个转换词;If the conversion vocabulary contains the first non-keyword, determining whether there are multiple conversion words corresponding to the first non-keyword in the conversion vocabulary;若是,获取各所述转换词的优先级信息;If yes, obtain priority information of each conversion word;根据所述优先级信息,将优先级最高的第一指定转换词确定为所述第一转换词。According to the priority information, the first designated conversion word with the highest priority is determined as the first conversion word.
- 根据权利要求1所述的代码处理方法,其特征在于,所述第一非关键词对应设置有多个特定转换词,设定多个所述特定转换词中优先级最高的转换词为第二指定转换词,所述若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词的步骤,包括:The code processing method according to claim 1, wherein the first non-keyword is correspondingly set with a plurality of specific conversion words, and the conversion word with the highest priority among the plurality of specific conversion words is set as the second Specifying a conversion word, and if the conversion word database contains the first non-keyword, the step of filtering out the first conversion word corresponding to the first non-keyword from the conversion word database includes:若所述转换词库内包含所述第一非关键词,筛选出所有所述特定转换词中优先级最高的第二指定转换词,并向当前用户展示所述第二指定转换词,以使所述用户对所述第二指定转换词的准确性进行判别;If the conversion vocabulary contains the first non-keyword, the second designated conversion word with the highest priority among all the specific conversion words is filtered out, and the second designated conversion word is displayed to the current user, so that The user judges the accuracy of the second designated conversion word;接收所述用户返回的对所述第二指定转换词的反馈信息,其中所述反馈信息包括所述第二指定转换词准确或所述第二指定转换词不准确;Receiving feedback information on the second designated conversion word returned by the user, where the feedback information includes that the second designated conversion word is accurate or the second designated conversion word is inaccurate;若所述反馈信息为所述第二指定转换词不准确,则向所述用户展示除所述第二指定转换词外的其它特定转换词;If the feedback information is that the second designated conversion word is inaccurate, show the user other specific conversion words except the second designated conversion word;接收所述用户从所述其它特定转换词中选择的第三指定转换词,并将所述第三指定转换词确定为所述第一转换词。Receive a third designated conversion word selected by the user from the other specific conversion words, and determine the third designated conversion word as the first conversion word.
- 根据权利要求1所述的代码处理方法,其特征在于,所述按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词的步骤之后,包括:The code processing method according to claim 1, wherein the first conversion word is rewritten according to a preset writing specification, and the rewritten first conversion word is replaced with the first non- After the keyword step, include:在完成对所述源代码内的所有所述非关键词的处理后,对经过处理后的源代码进行备份,得到源代码处理文件;After processing all the non-keywords in the source code, back up the processed source code to obtain a source code processing file;将所述源代码处理文件与源代码备份文件共同进行存储,其中所述源代码备份文件为通过对未经过处理的所述源代码进行备份得到。The source code processing file and the source code backup file are stored together, where the source code backup file is obtained by backing up the unprocessed source code.
- 一种代码处理装置,其特征在于,包括:A code processing device, characterized by comprising:第一判断模块,用于遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;The first judgment module is used to traverse all non-keywords in the source code. When a non-keyword is traversed, it is judged whether the preset standard thesaurus contains the non-keyword currently traversed, wherein the current traversal The arrived non-keyword is marked as the first non-keyword, and multiple English words and/or combined nouns are stored in the standard dictionary;第二判断模块,用于若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,其中所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;The second judgment module is used for judging whether the first non-keyword is contained in the preset conversion vocabulary if the standard vocabulary does not contain the first non-keyword, wherein the conversion vocabulary contains A plurality of custom words are stored, and conversion words corresponding to each of the custom words are stored;第一筛选模块,用于若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;The first screening module is configured to filter out the first conversion word corresponding to the first non-keyword from the conversion dictionary if the first non-keyword is included in the conversion dictionary;第一替换模块,用于按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。The first replacement module is configured to rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
- 根据权利要求7所述的代码处理装置,其特征在于,所述装置包括:The code processing device according to claim 7, wherein the device comprises:第二筛选模块,用于根据预设的编程语言关键词词库,筛选出所述源代码内的所有关键词;The second screening module is used to screen out all keywords in the source code according to a preset programming language keyword thesaurus;标记模块,用于对所述源代码内的所有关键词添加标记,以确定出所述源代码内的所有非关键词,其中所述非关键词为所述源代码中不具有所述标记的单词。The tagging module is used to add tags to all keywords in the source code to determine all non-keywords in the source code, wherein the non-keywords are those that do not have the tag in the source code word.
- 根据权利要求7所述的代码处理装置,其特征在于,所述装置包括:The code processing device according to claim 7, wherein the device comprises:第一接收模块,用于接收所有开发人员分别输入的单词转换数据,其中所述单词转换数据包括多个自定义单词,以及与各所述自定义单词分别对应的转换词;The first receiving module is configured to receive word conversion data input by all developers, where the word conversion data includes a plurality of custom words and conversion words corresponding to each of the custom words;创建模块,用于创建所述转换词库;A creation module for creating the conversion dictionary;第一存储模块,用于将所述单词转换数据存储于所述转换词库内。The first storage module is used to store the word conversion data in the conversion vocabulary.
- 根据权利要求7所述的代码处理装置,其特征在于,所述第一筛选模块包括:The code processing device according to claim 7, wherein the first screening module comprises:第一判断单元,用于若所述转换词库内包含所述第一非关键词,判断所述转换词库内是否存在与所述第一非关键词对应的多个转换词;The first determining unit is configured to determine whether there are multiple conversion words corresponding to the first non-keyword in the conversion dictionary if the first non-keyword is included in the conversion dictionary;获取单元,用于若是,获取各所述转换词的优先级信息;An obtaining unit, configured to obtain priority information of each conversion word if so;第一确定单元,用于根据所述优先级信息,将优先级最高的第一指定转换词确定为所述第一转换词。The first determining unit is configured to determine the first designated conversion word with the highest priority as the first conversion word according to the priority information.
- 根据权利要求7所述的代码处理装置,其特征在于,所述第一非关键词对应设置有多个特定转换词,设定多个所述特定转换词中优先级最高的转换词为第二指定转换词,所述第一筛选模块,包括:The code processing device according to claim 7, wherein the first non-keyword is correspondingly provided with a plurality of specific conversion words, and the conversion word with the highest priority among the plurality of specific conversion words is set as the second To specify a conversion word, the first screening module includes:筛选单元,用于若所述转换词库内包含所述第一非关键词,筛选出所有所述特定转换词中优先级最高的第二指定转换词,并向当前用户展示所述第二指定转换词,以使所述用户对所述第二指定转换词的准确性进行判别;The screening unit is configured to filter out the second designated conversion word with the highest priority among all the specific conversion words if the conversion word database contains the first non-keyword, and display the second designated conversion word to the current user Conversion words, so that the user can judge the accuracy of the second designated conversion words;接收单元,用于接收所述用户返回的对所述第二指定转换词的反馈信息,其中所述反馈信息包括所述第二指定转换词准确或所述第二指定转换词不准确;A receiving unit, configured to receive feedback information on the second designated conversion word returned by the user, wherein the feedback information includes that the second designated conversion word is accurate or the second designated conversion word is inaccurate;展示单元,用于若所述反馈信息为所述第二指定转换词不准确,则向所述用户展示除所述第二指定转换词外的其它特定转换词;A display unit, configured to, if the feedback information is that the second designated conversion word is inaccurate, display other specific conversion words other than the second designated conversion word to the user;第二确定单元,用于接收所述用户从所述其它特定转换词中选择的第三指定转换词,并将所述第三指定转换词确定为所述第一转换词。The second determining unit is configured to receive a third designated conversion word selected by the user from the other specific conversion words, and determine the third designated conversion word as the first conversion word.
- 根据权利要求7所述的代码处理装置,其特征在于,所述装置包括:The code processing device according to claim 7, wherein the device comprises:备份模块,用于在完成对所述源代码内的所有所述非关键词的处理后,对经过处理后的源代码进行备份,得到源代码处理文件;The backup module is used to back up the processed source code after processing all the non-keywords in the source code to obtain a source code processing file;第三存储模块,用于将所述源代码处理文件与源代码备份文件共同进行存储,其中所述源代码备份文件为通过对未经过处理的所述源代码进行备份得到。The third storage module is configured to store the source code processing file and the source code backup file together, wherein the source code backup file is obtained by backing up the unprocessed source code.
- 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现代码处理方法,该代码处理方法,包括:A computer device includes a memory and a processor, the memory stores computer readable instructions, and is characterized in that when the processor executes the computer readable instructions, a code processing method is implemented, and the code processing method includes:遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;Traverse all the non-keywords of the source code, and each time a non-keyword is traversed, determine whether the preset standard thesaurus contains the non-keywords currently traversed, where the non-keywords currently traversed are marked as The first non-keyword, multiple English words and/or combined nouns are stored in the standard thesaurus;若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,其中所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;If the standard vocabulary does not contain the first non-keyword, it is determined whether the first non-keyword is included in the preset conversion vocabulary, wherein multiple custom words are stored in the conversion vocabulary , And the conversion words corresponding to each of the custom words;若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;If the first non-keyword is included in the conversion vocabulary, the first conversion word corresponding to the first non-keyword is selected from the conversion vocabulary;按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。Rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
- 根据权利要求13所述的计算机设备,其特征在于,所述遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词的步骤之前,包括:The computer device according to claim 13, wherein the traversal of all non-keywords in the source code, each time a non-keyword is traversed, it is determined whether the preset standard vocabulary contains the non-keywords currently traversed Before the word steps, include:根据预设的编程语言关键词词库,筛选出所述源代码内的所有关键词;Filter out all keywords in the source code according to the preset programming language keyword thesaurus;对所述源代码内的所有关键词添加标记,以确定出所述源代码内的所有非关键词,其中所述非关键词为所述源代码中不具有所述标记的单词。Add tags to all keywords in the source code to determine all non-keywords in the source code, where the non-keywords are words in the source code that do not have the tag.
- 根据权利要求13所述的计算机设备,其特征在于,所述若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词的步骤之前,包括:The computer device according to claim 13, wherein if the first non-keyword is included in the conversion vocabulary, the conversion corresponding to the first non-keyword is selected from the conversion vocabulary Before the first conversion word step, include:接收所有开发人员分别输入的单词转换数据,其中所述单词转换数据包括多个自定义单词,以及与各所述自定义单词分别对应的转换词;Receiving word conversion data input by all developers, wherein the word conversion data includes multiple custom words and conversion words corresponding to each of the custom words;创建所述转换词库;Creating the conversion lexicon;将所述单词转换数据存储于所述转换词库内。The word conversion data is stored in the conversion vocabulary.
- 根据权利要求13所述的计算机设备,其特征在于,所述若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词的步骤,包括:The computer device according to claim 13, wherein if the first non-keyword is included in the conversion vocabulary, the conversion corresponding to the first non-keyword is selected from the conversion vocabulary The first conversion word steps include:若所述转换词库内包含所述第一非关键词,判断所述转换词库内是否存在与所述第一非关键词对应的多个转换词;If the conversion vocabulary contains the first non-keyword, determining whether there are multiple conversion words corresponding to the first non-keyword in the conversion vocabulary;若是,获取各所述转换词的优先级信息;If yes, obtain priority information of each conversion word;根据所述优先级信息,将优先级最高的第一指定转换词确定为所述第一转换词。According to the priority information, the first designated conversion word with the highest priority is determined as the first conversion word.
- 一种计算机非易失性可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现代码处理方法,该代码处理方法,包括:A computer nonvolatile readable storage medium having computer readable instructions stored thereon, wherein the computer readable instructions are executed by a processor to implement a code processing method, and the code processing method includes:遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词,其中,将所述当前遍历到的非关键词标记为第一非关键词,所述标准词库内存储有多个英文单词和/或组合名词;Traverse all the non-keywords of the source code, and each time a non-keyword is traversed, determine whether the preset standard thesaurus contains the non-keywords currently traversed, where the non-keywords currently traversed are marked as The first non-keyword, multiple English words and/or combined nouns are stored in the standard thesaurus;若所述标准词库内不包含所述第一非关键词,则判断预设的转换词库内是否包含所述第一非关键词,其中所述转换词库内存储有多个自定义单词,以及与各所述自定义单词分别对应的转换词;If the standard vocabulary does not contain the first non-keyword, it is determined whether the first non-keyword is included in the preset conversion vocabulary, wherein multiple custom words are stored in the conversion vocabulary , And the conversion words corresponding to each of the custom words;若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词;If the first non-keyword is included in the conversion vocabulary, the first conversion word corresponding to the first non-keyword is selected from the conversion vocabulary;按照预设的编写规范对所述第一转换词进行改写,并将改写后的所述第一转换词替换所述第一非关键词。Rewrite the first conversion word according to a preset writing specification, and replace the first non-keyword with the rewritten first conversion word.
- 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述遍历源代码的所有非关键词,每遍历到一个非关键词时,判断预设的标准词库内是否包含当前遍历到的非关键词的步骤之前,包括:The computer non-volatile readable storage medium according to claim 17, wherein the traversal of all non-keywords in the source code, each time a non-keyword is traversed, it is determined whether the preset standard dictionary is Before the step including the non-keyword currently traversed, include:根据预设的编程语言关键词词库,筛选出所述源代码内的所有关键词;Filter out all keywords in the source code according to the preset programming language keyword thesaurus;对所述源代码内的所有关键词添加标记,以确定出所述源代码内的所有非关键词,其中所述非关键词为所述源代码中不具有所述标记的单词。Add tags to all keywords in the source code to determine all non-keywords in the source code, where the non-keywords are words in the source code that do not have the tag.
- 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词的步骤之前,包括:The computer non-volatile readable storage medium according to claim 17, wherein if the first non-keyword is included in the conversion vocabulary, then the conversion vocabulary is filtered out from the conversion vocabulary and all Before the step of describing the first conversion word corresponding to the first non-keyword, it includes:接收所有开发人员分别输入的单词转换数据,其中所述单词转换数据包括多个自定义单词,以及与各所述自定义单词分别对应的转换词;Receiving word conversion data input by all developers, wherein the word conversion data includes multiple custom words and conversion words corresponding to each of the custom words;创建所述转换词库;Creating the conversion lexicon;将所述单词转换数据存储于所述转换词库内。The word conversion data is stored in the conversion vocabulary.
- 根据权利要求17所述的计算机非易失性可读存储介质,其特征在于,所述若所述转换词库内包含所述第一非关键词,则从所述转换词库筛选出与所述第一非关键词对应的第一转换词的步骤,包括:The computer non-volatile readable storage medium according to claim 17, wherein if the first non-keyword is included in the conversion vocabulary, then the conversion vocabulary is filtered out from the conversion vocabulary and all The step of describing the first conversion word corresponding to the first non-keyword includes:若所述转换词库内包含所述第一非关键词,判断所述转换词库内是否存在与所述第一非关键词对应的多个转换词;If the conversion vocabulary contains the first non-keyword, determining whether there are multiple conversion words corresponding to the first non-keyword in the conversion vocabulary;若是,获取各所述转换词的优先级信息;If yes, obtain priority information of each conversion word;根据所述优先级信息,将优先级最高的第一指定转换词确定为所述第一转换词。According to the priority information, the first designated conversion word with the highest priority is determined as the first conversion word.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910394542.4A CN110231955B (en) | 2019-05-13 | 2019-05-13 | Code processing method, device, computer equipment and storage medium |
CN201910394542.4 | 2019-05-13 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020228183A1 true WO2020228183A1 (en) | 2020-11-19 |
Family
ID=67860541
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/103451 WO2020228183A1 (en) | 2019-05-13 | 2019-08-29 | Code processing method and apparatus, computer device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110231955B (en) |
WO (1) | WO2020228183A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112257389A (en) * | 2020-10-29 | 2021-01-22 | 湖南星汉数智科技有限公司 | Multi-language alphanumeric to Arabic numeral conversion method and device, computer device and computer readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070245326A1 (en) * | 2006-04-12 | 2007-10-18 | Fujitsu Limited | Software/hardware partitioning program and method |
CN103646017A (en) * | 2013-12-11 | 2014-03-19 | 南京大学 | Acronym generating system for naming and working method thereof |
CN104298752A (en) * | 2014-10-15 | 2015-01-21 | 扬州大学 | Automatic program code abbreviation expanding method based on web page resources |
CN104991909A (en) * | 2015-06-19 | 2015-10-21 | 扬州大学 | Automatic thesaurus construction method for specific software historical code library |
Family Cites Families (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
AUPQ811500A0 (en) * | 2000-06-09 | 2000-07-06 | Educational And Computing Software Pty Ltd | System for program source code conversion |
US20030200535A1 (en) * | 2000-06-09 | 2003-10-23 | Mcnamara Benedict Bede | System for program source code conversion |
KR20110094563A (en) * | 2010-02-17 | 2011-08-24 | 주식회사 티앤엘아이앤티 | The apparatus and method for searching related keyword of user-defined search keyword based using relationship of link-keywords in web documents |
CN102819524B (en) * | 2011-09-08 | 2015-06-03 | 金蝶软件(中国)有限公司 | Key-based segmentation method and device for character sequences |
CN102929852B (en) * | 2012-10-15 | 2016-05-04 | 福建榕基软件股份有限公司 | A kind ofly in RichText Edition device, realize the method and system that the simple complex form of Chinese characters turns mutually |
CN106649308B (en) * | 2015-10-28 | 2020-05-01 | 卓望数码技术(深圳)有限公司 | Word segmentation and word library updating method and system |
US20170344636A1 (en) * | 2016-05-31 | 2017-11-30 | International Business Machines Corporation | Determining web-page keyword relevance based on social media |
CN107544988B (en) * | 2016-06-27 | 2021-03-19 | 百度在线网络技术(北京)有限公司 | Method and device for acquiring public opinion data |
CN107784014A (en) * | 2016-08-30 | 2018-03-09 | 广州市动景计算机科技有限公司 | Information search method, equipment and electronic equipment |
CN106951270B (en) * | 2017-04-06 | 2023-04-07 | 腾讯科技(深圳)有限公司 | Code processing method, system and server |
CN107562919B (en) * | 2017-09-13 | 2020-07-17 | 云南大学 | Multi-index integrated software component retrieval method and system based on information retrieval |
CN109144493A (en) * | 2018-07-18 | 2019-01-04 | 平安科技(深圳)有限公司 | Generation method, electronic device and the readable storage medium storing program for executing of business rule |
CN109271168A (en) * | 2018-08-09 | 2019-01-25 | 上海鲸鱼机器人科技有限公司 | A kind of code conversion method, device and equipment, storage medium |
-
2019
- 2019-05-13 CN CN201910394542.4A patent/CN110231955B/en active Active
- 2019-08-29 WO PCT/CN2019/103451 patent/WO2020228183A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070245326A1 (en) * | 2006-04-12 | 2007-10-18 | Fujitsu Limited | Software/hardware partitioning program and method |
CN103646017A (en) * | 2013-12-11 | 2014-03-19 | 南京大学 | Acronym generating system for naming and working method thereof |
CN104298752A (en) * | 2014-10-15 | 2015-01-21 | 扬州大学 | Automatic program code abbreviation expanding method based on web page resources |
CN104991909A (en) * | 2015-06-19 | 2015-10-21 | 扬州大学 | Automatic thesaurus construction method for specific software historical code library |
Also Published As
Publication number | Publication date |
---|---|
CN110231955B (en) | 2024-05-07 |
CN110231955A (en) | 2019-09-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11100154B2 (en) | Data integration tool | |
US9870205B1 (en) | Storing logical units of program code generated using a dynamic programming notebook user interface | |
CN108762743B (en) | Data table operation code generation method and device | |
CN103718155A (en) | Runtime system | |
US9009175B2 (en) | System and method for database migration and validation | |
US8997037B2 (en) | User customizable queries to populate model diagrams | |
CN111061475A (en) | Software code generation method and device, computer equipment and storage medium | |
WO2020119099A1 (en) | Service rule processing method, server, and computer readable storage medium | |
CN104731588B (en) | Page layout document generating method and page layout file creating apparatus | |
WO2021051501A1 (en) | Sql extraction method and apparatus, computer device, and storage medium | |
CN110489401B (en) | Method and device for deploying database objects | |
WO2020228183A1 (en) | Code processing method and apparatus, computer device and storage medium | |
JP4724387B2 (en) | Program conversion program, program conversion apparatus, and program conversion method | |
JP4957043B2 (en) | Information processing apparatus, program, and business application introduction method | |
Fateh et al. | Relation between Metadata and Voice Search Results | |
JP2001273125A (en) | Method and system for automatically generating source program, and program recording medium therefor | |
JP2003303100A (en) | Information processing system, method for constructing information processing system, and program therefor | |
CN112347122B (en) | SQL workflow processing method, device, electronic equipment and storage medium | |
CN113448617B (en) | Data object management method and device, computer equipment and storage medium | |
EP4261678A1 (en) | Generation of a technical instruction | |
WO2023150275A1 (en) | Systems and methods for extracting data using flow graphs | |
Lano et al. | Development Methods | |
CN115934751A (en) | Data retrieval method, device and medium | |
CN118377489A (en) | Time sequence control code generation method and device and computer equipment | |
CN118200402A (en) | Communication protocol processing method and device, storage medium and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19929048 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19929048 Country of ref document: EP Kind code of ref document: A1 |