CN110231955B - Code processing method, device, computer equipment and storage medium - Google Patents

Code processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN110231955B
CN110231955B CN201910394542.4A CN201910394542A CN110231955B CN 110231955 B CN110231955 B CN 110231955B CN 201910394542 A CN201910394542 A CN 201910394542A CN 110231955 B CN110231955 B CN 110231955B
Authority
CN
China
Prior art keywords
conversion
word
words
keywords
keyword
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910394542.4A
Other languages
Chinese (zh)
Other versions
CN110231955A (en
Inventor
易杉峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910394542.4A priority Critical patent/CN110231955B/en
Priority to PCT/CN2019/103451 priority patent/WO2020228183A1/en
Publication of CN110231955A publication Critical patent/CN110231955A/en
Application granted granted Critical
Publication of CN110231955B publication Critical patent/CN110231955B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a code processing method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: traversing all non-keywords of the source code, and judging whether a preset standard word stock contains the currently traversed non-keywords when traversing to one non-keyword; if not, judging whether a preset conversion word stock contains a first non-keyword or not; if yes, screening out a first conversion word corresponding to the first non-key word from the conversion word stock; and rewriting the first conversion word according to a preset writing specification, and replacing the first non-keyword with the rewritten first conversion word. According to the application, by carrying out reconstruction processing on the non-keywords in the source code, namely by converting the non-keywords into complete standard words, the reading workload can be effectively reduced when maintenance personnel subsequently need to maintain the source code, the working efficiency of the maintenance personnel is improved, and the method is beneficial to forming a unified code writing style suitable for all developers.

Description

Code processing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a code processing method, a code processing device, a computer device, and a storage medium.
Background
In the development process of the current software project, different developers are required to assist in completing codes of different stages or codes of different functions of the software project development, but in the code writing process, different developers may have different code programming habits, and codes submitted by each developer have no unified writing specification, so that the code maintenance process is low in efficiency. And in general, for personal convenience in writing and viewing, some specific developers will use custom words to replace some complex words when writing code, for example will use custom word ap to replace standard english word app, and will typically not attach notes to custom word ap. When a subsequent maintainer performs code maintenance processing, the meaning of the custom words cannot be understood when the code written by the specific developer is checked, so that the maintainer is difficult to read, the maintainer needs to find the specific developer to communicate to know the correct meaning of the custom words, the working efficiency of the maintainer is low, and in addition, the situation that the specific developer forgets the meaning of the custom words used by the maintainer or the specific developer is out of duty can also occur, so that the working difficulty of code maintenance is further increased.
Disclosure of Invention
The application mainly aims to provide a code processing method, a device, computer equipment and a storage medium, and aims to solve the technical problem that in the development process of the existing software project, codes submitted by each developer have no unified writing specification, and the efficiency of the code maintenance process is low.
The application provides a code processing method, which comprises the following steps:
Traversing all non-keywords of a source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
If the standard word stock does not contain the first non-key words, judging whether a preset conversion word stock contains the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
if the conversion word stock contains the first non-key words, screening out first conversion words corresponding to the first non-key words from the conversion word stock;
and rewriting the first conversion word according to a preset writing specification, and replacing the first non-keyword with the rewritten first conversion word.
Optionally, before the step of traversing all the non-keywords of the source code, each time traversing to one non-keyword, determining whether the preset standard word bank contains the currently traversed non-keyword includes:
Screening all keywords in the source code according to a preset programming language keyword lexicon;
and adding marks to all keywords in the source code to determine all non-keywords in the source code, wherein the non-keywords are words without the marks in the source code.
Optionally, before the step of screening the first converted word corresponding to the first non-keyword from the converted word stock if the converted word stock includes the first non-keyword, the method includes:
Receiving word conversion data respectively input by all developers, wherein the word conversion data comprises a plurality of custom words and conversion words respectively corresponding to the custom words;
Creating the conversion word stock;
And storing the word conversion data in the conversion word stock.
Optionally, if the converted word stock includes the first non-keyword, the step of screening the converted word corresponding to the first non-keyword from the converted word stock includes:
If the conversion word stock contains the first non-key word, judging whether a plurality of conversion words corresponding to the first non-key word exist in the conversion word stock;
if yes, acquiring priority information of each conversion word;
and according to the priority information, determining a first appointed conversion word with the highest priority as the first conversion word.
Optionally, the first non-keyword is correspondingly provided with a plurality of specific conversion words, a conversion word with the highest priority among the plurality of specific conversion words is set as a second specific conversion word, and if the conversion word stock includes the first non-keyword, the step of screening the first conversion word corresponding to the first non-keyword from the conversion word stock includes:
If the conversion word library contains the first non-key words, screening out second specified conversion words with highest priority in all the specific conversion words, and displaying the second specified conversion words to a current user so as to judge the accuracy of the second specified conversion words by the user;
receiving feedback information of the second specified conversion word returned by the user, wherein the feedback information comprises that the second specified conversion word is accurate or the second specified conversion word is inaccurate;
if the feedback information is that the second specified conversion word is inaccurate, displaying other specific conversion words except the second specified conversion word to the user;
and receiving a third specified conversion word selected by the user from the other specific conversion words, and determining the third specified conversion word as the first conversion word.
Optionally, after the step of determining whether the preset converted word stock includes the first non-keyword if the standard word stock does not include the first non-keyword, the method includes:
if the conversion word stock does not contain the first non-key word, sending prompt information for inputting a second conversion word corresponding to the first non-key word to a current user;
judging whether the second conversion word input by the user is received or not;
if yes, rewriting the second conversion word according to the writing specification, and replacing the first non-keyword with the rewritten second conversion word;
And storing the first non-keywords and the second converted words in the converted word stock in a one-to-one correspondence manner.
Optionally, after the step of rewriting the first conversion word according to a preset writing specification and replacing the first non-keyword with the rewritten first conversion word, the method includes:
After the processing of all the non-keywords in the source code is completed, the processed source code is backed up to obtain a source code processing file;
And storing 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 application also provides a code processing device, which comprises:
The first judging module is used for traversing all the non-keywords of the source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
the second judging module is used for judging whether the preset conversion word stock contains the first non-key words or not if the standard word stock does not contain the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
The first screening module is used for screening a first conversion word corresponding to the first non-key word from the conversion word stock if the first non-key word is contained in the conversion word stock;
and the first replacing module is used for rewriting the first conversion word according to a preset writing specification and replacing the first non-keyword with the rewritten first conversion word.
The application also provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor realizes the steps of the method when executing the computer program.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the above method.
The code processing method, the code processing device, the computer equipment and the storage medium provided by the application have the following steps
The beneficial effects are that:
The method, the device, the computer equipment and the storage medium for processing the codes provided by the application are used for traversing all the non-keywords of the source codes, judging whether a preset standard word bank contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word bank; if the standard word stock does not contain the first non-key words, judging whether a preset conversion word stock contains the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock; if the conversion word stock contains the first non-key words, screening out first conversion words corresponding to the first non-key words from the conversion word stock; and rewriting the first conversion word according to a preset writing specification, and replacing the first non-keyword with the rewritten first conversion word. According to the application, the user-defined non-keywords in the source code are replaced by the corresponding conversion words through the preset conversion word library, so that the non-keywords are converted into complete standard words, the user can clearly know the meaning of the non-keywords, and when the source code is required to be maintained later, the reading workload of maintenance personnel can be reduced, the reading difficulty of the maintenance personnel is reduced, and the working efficiency of the maintenance personnel is improved. In addition, non-key words or conversion words are rewritten through preset writing specifications, so that the rewritten source codes have the advantages of simplicity, attractive appearance and strong readability, and a unified code writing style suitable for all developers is formed.
Drawings
FIG. 1 is a flow chart of a code processing method according to an embodiment of the application;
FIG. 2 is a schematic diagram of a code processing apparatus 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 achievement of the objects, functional features and advantages of the present application will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
It should be noted that, in the embodiments of the present application, all directional indicators (such as up, down, left, right, front, and rear … …) are merely used to explain the relative positional relationship, movement conditions, and the like between the components in a specific posture (as shown in the drawings), if the specific posture is changed, the directional indicators correspondingly change, and the connection may be a direct connection or an indirect connection.
Referring to fig. 1, a code processing method according to an embodiment of the present application includes:
S1: traversing all non-keywords of a source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
S2: if the standard word stock does not contain the first non-key words, judging whether a preset conversion word stock contains the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
S3: if the conversion word stock contains the first non-key words, screening out first conversion words corresponding to the first non-key words from the conversion word stock;
S4: and rewriting the first conversion word according to a preset writing specification, and replacing the first non-keyword with the rewritten first conversion word.
As described in the above step S1, the source code is formed of a plurality of words including programming language keywords and non-programming language keywords, and the non-keywords are non-programming language keywords in the source code, that is, words other than the programming language keywords in the source code. The general form of the source code comprises a method body self code, a method body internal code and a method body external code, and the corresponding non-keywords of the source code comprise non-keywords of the method body, non-keywords of the method body internal and non-keywords of the method body external. The foregoing preset sequence may be set according to the sequence of the parts of the method, for example, the sequence from the method body to the inside of the method body and then to the outside of the method body, or may be other forms, for example, may be set according to the user's wish, which is not limited herein. Firstly marking the currently traversed non-keywords as first non-keywords, and judging whether the preset standard word stock contains the currently traversed first non-keywords or not when traversing all the non-keywords of the source code, namely matching the first non-keywords with all the standard words in the standard word stock, wherein if the standard word stock contains the first non-keywords, the first non-keywords are indicated to be standard words, and if the standard word stock does not contain the first non-keywords, the first non-keywords are indicated to be not standard words. The standard word stock comprises a standard English word stock and/or a common combined noun word stock, the standard English word stock can be created in advance, a certain number of English words commonly used in codes are searched out through network resources, the English words obtained through searching are stored in the standard English word stock, so that a final standard English word stock is formed, and the number of stored English words is not particularly limited. Similarly, the common combined noun word library can be created in advance, then a certain number of common combined nouns in the codes are searched out through network resources, the searched combined nouns are stored in the common combined noun word library to form a final common combined noun word library, and the number of the stored combined nouns is not particularly limited.
As described in the above steps S2 to S4, when the first non-keyword is not included in the standard word library, 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, a custom shorthand word ap. Whether the first non-keyword is contained in a preset conversion word bank or not is further judged, namely, matching and matching are carried out on the first non-keyword and all custom words in the conversion word bank, if the conversion word bank contains the first conversion words corresponding to the first non-keyword, a certain number of custom words and conversion words corresponding to the custom words are stored in the conversion word bank, the custom words and the conversion words can be written by a developer and input into the conversion words, and the first conversion words are complete standard words corresponding to the first non-keyword. For example, if the converted word library stores (custom word) ap→ (converted word) application, first, a first converted word corresponding to the first non-keyword is selected from the converted word library, and is rewritten according to a preset writing specification, and then the rewritten first converted word is replaced with the first non-keyword, so as to complete the reconstruction processing of the first non-keyword. The preset writing specification is a standard form created for non-keywords in the source code, and all the non-keywords in the source code are uniformly replaced by the standard form through the writing specification, so that a uniform code writing style is formed, and the review of all developers is facilitated. For example, the above composition specification may be to capitalize the first letter of each word, or to capitalize the first letter of each word, and so on. And after the reconstruction processing of the first non-key words is completed, starting the reconstruction processing of the next non-key words until the processing of all the non-key words is completed, stopping traversing, and further completing the reconstruction processing of the source codes. In this embodiment, the preset conversion word library is used to replace the non-keyword customized by the user in the source code with the corresponding conversion word, so that the non-keyword is converted into a complete standard word, and the user can clearly understand the meaning of the non-keyword. In addition, non-key words or conversion words are rewritten through preset writing specifications, so that the rewritten source codes have the advantages of simplicity, attractive appearance and strong readability, and a unified code writing style suitable for all developers is formed.
In another embodiment, if the standard word library includes the first non-keyword, it indicates that the first non-keyword is a standard word, and at this time, the first non-keyword may be directly rewritten according to a preset writing specification, and the first rewritten word obtained after the rewriting replaces the first non-keyword. In this embodiment, under the condition that the first non-keyword belongs to a standard word, the first non-keyword is rewritten by using the writing specification, and the obtained first rewritten word is used for replacing the first non-keyword, so that the rewritten source code has the advantages of simplicity, attractive appearance and strong readability, and a unified code writing style suitable for all developers is formed.
Further, in an embodiment of the present application, before the step S1, the method includes:
S100: screening all keywords in the source code according to a preset programming language keyword lexicon;
s101: and adding marks to all keywords in the source code to determine all non-keywords in the source code, wherein the non-keywords are words without the marks in the source code.
As described in the above steps S100 and S101, before the step of traversing all the non-keywords of the source code, the step of screening all the non-keywords of the source code is further included, specifically, all the keywords in the source code are screened out according to a preset programming language keyword lexicon, and then marks are added to all the keywords in the source code to determine all the non-keywords in the source code, so that the non-keywords in the source code are words in the source code without the marks. According to the method and the device, the keywords and the non-keywords are distinguished by adding the marks to all the keywords in the source code, so that a user can clearly know whether the type corresponding to each word in the source code is the keywords or the non-keywords when looking up the source code, and when all the non-keywords in the source code are processed, the marked non-keywords can be quickly selected for processing, the accuracy of processing the non-keywords is guaranteed, and the situation that the keywords of the source code are processed by mistake is prevented. The method comprises the steps of pre-selecting and creating the word stock of the programming language keywords, searching a certain number of word stocks of the programming language keywords commonly used in codes through network resources, searching related resources such as a official website of the programming language, storing the searched programming language keywords into the word stock of the programming language keywords to form a final word stock of the programming language keywords, and providing an updating function for the word stock of the programming language keywords, wherein new programming language keywords can be added to the word stock of the programming language keywords or some programming language keywords can be deleted in a certain time period, so that the word stock of the programming language keywords is updated. In addition, the step of screening all keywords in the source code according to the preset programming language keyword lexicon comprises the following specific steps: matching and matching all words of the source code with programming language keywords in the programming language keyword word stock respectively, wherein a plurality of different programming language keywords are prestored in the programming language keyword word stock; screening out specified words matched with the programming language keywords in all words of the source code, wherein the number of the specified words is one or more; and determining the specified word as the keyword. The keywords in the source code can be rapidly screened out through the programming language keyword lexicon, and all non-keywords in the source code can be rapidly obtained.
Further, in an embodiment of the present application, before the step S3, the method includes:
S300: receiving word conversion data respectively input by all developers, wherein the word conversion data comprises a plurality of custom words and conversion words respectively corresponding to the custom words;
s301: creating the conversion word stock;
S302: and storing the word conversion data in the conversion word stock.
As described in steps S300 to S302, the above-mentioned conversion word library is a conversion word library in which all developers share data, word conversion data input by each developer is stored in the conversion word library, each word conversion data includes a plurality of custom words recorded by each developer, and conversion words respectively corresponding to each custom word, where the number of conversion words corresponding to the custom words is not limited, and may be one or more. In this embodiment, before the step of determining whether the preset conversion word bank includes the first non-keyword, the method further includes a process of forming the conversion word bank, specifically, creating a conversion word bank in advance, and after receiving word conversion data input by each developer respectively, storing the word conversion data in the conversion word bank. After the converted word library is formed, in the process of processing the non-keywords in the source code, when the situation that the standard word library does not contain the current first non-keywords is shown, the first non-keywords can be user-created custom words, at the moment, the first non-keywords and all custom words in the converted word library are matched and matched, so that the first converted words corresponding to the first non-keywords can be screened out, the first non-keywords are converted into complete standard words, the meaning of the first non-keywords can be clearly known by a user, and when the source code is required to be maintained later, the reading workload of maintenance personnel is reduced, the reading difficulty of the maintenance personnel is reduced, and the working efficiency of the maintenance personnel is improved. Further, the conversion word stock is further provided with an updating function, new word conversion data can be added to the conversion word stock in a certain time period, or some word conversion data can be deleted, or some word conversion data can be subjected to data modification, so that the conversion word stock is updated, and more updated word conversion data can be stored in the conversion word stock.
Further, in an embodiment of the present application, the step S3 includes:
S310: if the conversion word stock contains the first non-key word, judging whether a plurality of conversion words corresponding to the first non-key word exist in the conversion word stock;
s311: if yes, acquiring priority information of each conversion word;
S312: and according to the priority information, determining a first appointed conversion word with the highest priority as the first conversion word.
As described in steps S310 to S312, for the case where a plurality of conversion words corresponding to one custom word may occur for different custom words in the conversion word library, for this case, priority information corresponding to each of the plurality of conversion words may be preset, for example, the custom word ap corresponds to three conversion words appointment, apply and application, and the priority of the conversion word application is a first priority, the priority of the conversion word application is a second priority, the priority of the conversion word application is a third priority, the first priority is higher than the second priority, the second priority is higher than the third priority, where the setting form of the priority is not specifically limited, for example, the priority may be marked in advance in the input word conversion data by the user, or the priority may be set by the code processing apparatus according to the number of times each conversion word is used, and so on. In this embodiment, when the first non-keyword is processed, if the first non-keyword is included in a preset conversion word library, it is first determined whether there are a plurality of conversion words corresponding to the first non-keyword in the conversion word library, if there are a plurality of conversion words corresponding to the first non-keyword, priority information of the plurality of conversion words is obtained, according to the priority information, a first designated conversion word with the highest priority is determined as the first conversion word, and then conversion of the first non-keyword is completed, and if the first non-keyword is ap, an app with the first priority is determined as the first conversion word. In this embodiment, when a situation that a certain non-keyword corresponds to a plurality of conversion words occurs, a first designated conversion word with the highest priority can be intelligently screened according to the priority information of the plurality of conversion words to perform subsequent processing, so that the first conversion word can be rapidly extracted from the plurality of conversion words, and the use experience of a user is improved.
Further, in an embodiment of the present application, the first non-keyword is correspondingly provided with a plurality of specific conversion words, and a conversion word with a highest priority among the plurality of specific conversion words is set as a second specific conversion word, where the step S3 includes:
S320: if the conversion word library contains the first non-key words, screening out second specified conversion words with highest priority in all the specific conversion words, and displaying the second specified conversion words to a current user so as to judge the accuracy of the second specified conversion words by the user;
S321: receiving feedback information of the second specified conversion word returned by the user, wherein the feedback information comprises that the second specified conversion word is accurate or the second specified conversion word is inaccurate;
s322: if the feedback information is that the second specified conversion word is inaccurate, displaying other specific conversion words except the second specified conversion word to the user;
S323: and receiving a third specified conversion word selected by the user from the other specific conversion words, and determining the third specified conversion word as the first conversion word.
As described in the above steps S320 to S323, when the first non-keyword is app, if the first conversion word is screened out only according to the priority information of each conversion word corresponding to the first non-keyword ap, only the conversion word application of the first priority is selected to complete the subsequent processing of the first non-keyword ap, and although the conversion word application is highest in priority among all the conversion words corresponding to the ap, the correct meaning of the first non-keyword ap may appear in the current source code, which is actually a special case corresponding to the application or the apply, and therefore the conversion word of the first priority selected according to the priority information is wrong. In this embodiment, it is assumed that a plurality of specific conversion words are correspondingly provided for a first non-keyword, a conversion word with the highest priority among the plurality of specific conversion words is set as a second specific conversion word, when the first non-keyword is processed, the second specific conversion word with the highest priority is first selected from the plurality of specific conversion words corresponding to the first non-keyword, and the second specific conversion word is presented to a current user, so that the user can determine the accuracy of the second specific conversion word, and the user can determine the accuracy of the conversion word with the highest priority by placing the second specific conversion word with the highest priority at the position of the first non-keyword and combining with context information, and then the user returns feedback information corresponding to the second specific conversion word, where the user may be a staff writing the source code, and the feedback information includes that the second specific conversion word is accurate or the second specific conversion word is inaccurate. After receiving the feedback information, if the feedback information is inaccurate in the second specified conversion word, other specific conversion words except the second specified conversion word are displayed to the user, so that the user selects a third specified conversion word from the other specific conversion words, the third specified conversion word is a conversion word corresponding to the correct meaning of the first non-keyword, after receiving the third specified conversion word, the third specified conversion word is determined to be the first conversion word, and the subsequent processing of the first non-keyword is completed according to the first conversion word. In this embodiment, the accuracy of the second specified conversion word is determined by acquiring the feedback information of the user, and if the second specified conversion word is inaccurate, then the third specified conversion word corresponding to the correct meaning of the first non-keyword is determined according to the selection of the user from the plurality of specific conversion words, thereby effectively ensuring the accuracy of the conversion of the first non-keyword and avoiding the error of the user in understanding the source code due to the error conversion of the first non-keyword.
Further, in an embodiment of the present application, after the step S2, the method includes:
S200: if the conversion word stock does not contain the first non-key word, sending prompt information for inputting a second conversion word corresponding to the first non-key word to a current user;
s201: judging whether the second conversion word input by the user is received or not;
s202: if yes, rewriting the second conversion word according to the writing specification, and replacing the first non-keyword with the rewritten second conversion word;
s203: and storing the first non-keywords and the second converted words in the converted word stock in a one-to-one correspondence manner.
As described in the above steps S200 to S203, when the first non-keyword is matched with all the custom words in the converted word stock, if the matching fails, it is indicated that the converted word stock does not contain the first non-keyword, and in order to complete the subsequent replacement processing of the first non-keyword, that is, the first non-keyword is replaced with a complete standard word, at this time, a reminder for inputting a second converted word corresponding to the first non-keyword is sent to the user, so that the user manually inputs the second converted word corresponding to the first non-keyword, where the user may be a staff writing the source code. After the second conversion word is received, the second conversion word is rewritten according to the writing specification, the rewritten second conversion word is used for replacing the first non-keyword, the first non-keyword and the second conversion word are further stored in the conversion word stock in a one-to-one correspondence mode, and data updating of the conversion word stock is completed, so that when the first non-keyword is processed subsequently, the second conversion word corresponding to the first non-keyword can be extracted from the conversion word stock after data updating to replace, the user does not need to manually input the second conversion word again, the workload of the user is reduced, and the use experience of the user is improved.
Further, in an embodiment of the present application, after the step S4, the method includes:
S400: after the processing of all the non-keywords in the source code is completed, the processed source code is backed up to obtain a source code processing file;
S401: and storing 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.
As described in the above steps S400 and S401, before the reconstruction process, that is, the replacement and/or conversion process, is performed on the source code, the backup process is performed on the source code file to obtain the source code backup file corresponding to the source code. In addition, after the processing of all the non-keywords in the source code is completed, the processed source code is backed up to obtain a corresponding source code processing file. And then, 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 when a subsequent maintainer maintains the source code, the source code backup file can be extracted from the designated folder when the source code processing file after the reconstruction processing is read and the error in the source code processing file is confused, and the original data in the source code backup file is further referred to manually correct. By the aid of the source code backup file, maintenance personnel can be facilitated to understand the source code faster when reading the source code processing file, and maintenance workload of the maintenance personnel is reduced.
Referring to fig. 2, in an embodiment of the present application, there is further provided a code processing apparatus including:
The first judging module is used for traversing all the non-keywords of the source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
the second judging module is used for judging whether the preset conversion word stock contains the first non-key words or not if the standard word stock does not contain the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
The first screening module is used for screening a first conversion word corresponding to the first non-key word from the conversion word stock if the first non-key word is contained in the conversion word stock;
and the first replacing module is used for rewriting the first conversion word according to a preset writing specification and replacing the first non-keyword with the rewritten first conversion word.
In this embodiment, the implementation process of the functions and roles of the first judging module, the second judging module, the first screening module and the first replacing module in the code processing apparatus is specifically described in the implementation process corresponding to steps S1-S4 in the code processing method, and will not be described herein.
Further, in an embodiment of the present application, the code processing apparatus includes:
The second screening module is used for screening all keywords in the source code according to a preset programming language keyword lexicon;
And the marking module is used for adding marks to all keywords in the source code to determine all non-keywords in the source code, wherein the non-keywords are words without the marks in the source code.
In this embodiment, the implementation process of the functions and roles of the second screening module and the marking module in the code processing apparatus is specifically described in the implementation process corresponding to steps S100-S101 in the code processing method, and will not be described herein.
Further, in an embodiment of the present application, the code processing apparatus includes:
The first receiving module is used for receiving word conversion data respectively input by all developers, wherein the word conversion data comprises a plurality of custom words and conversion words respectively corresponding to the custom words;
the creation module is used for creating the conversion word stock;
And the first storage module is used for storing the word conversion data in the conversion word stock.
In this embodiment, the implementation process of the functions and roles of the first receiving module, the creating module and the first storage module in the code processing apparatus is specifically described in the implementation process corresponding to steps S300-S302 in the code processing method, and will not be described herein.
Further, in an embodiment of the present application, the first screening module includes:
The first judging unit is used for judging whether a plurality of conversion words corresponding to the first non-key words exist in the conversion word stock or not if the first non-key words are contained in the conversion word stock;
The acquisition unit is used for acquiring the priority information of each conversion word if yes;
And the first determining unit is used for determining a first appointed conversion word with the highest priority as the first conversion word according to the priority information.
In this embodiment, the implementation process of the functions and actions of the first judging unit, the acquiring unit and the first determining unit included in the first screening module in the code processing apparatus is specifically described in the implementation process corresponding to steps S310 to S312 in the code processing method, and will not be described herein.
Further, in an embodiment of the present application, the first non-keyword is correspondingly provided with a plurality of specific conversion words, and a conversion word with a highest priority among the plurality of specific conversion words is set as a second specific conversion word, and the first filtering module includes:
The screening unit is used for screening out second specified conversion words with highest priority in all the specific conversion words if the first non-key words are contained in the conversion word library, and displaying the second specified conversion words to a current user so that the user can judge the accuracy of the second specified conversion words;
the receiving unit is used for receiving feedback information of the second specified conversion word returned by the user, wherein the feedback information comprises that the second specified conversion word is accurate or the second specified conversion word is inaccurate;
The display unit is used for displaying other specific conversion words except the second specified conversion word to the user if the feedback information is that the second specified conversion word is inaccurate;
and a second determining unit configured to receive a third specified conversion word selected by the user from the other specified conversion words, and determine the third specified conversion word as the first conversion word.
In this embodiment, the implementation process of the functions and actions of the screening unit, the receiving unit, the display unit and the second determining unit included in the first screening module in the code processing apparatus is specifically described in the implementation process corresponding to steps S320-S323 in the code processing method, which is not described herein.
Further, in an embodiment of the present application, the code processing apparatus includes:
The sending module is used for sending reminding information for inputting a second conversion word corresponding to the first non-keyword to a current user if the conversion word stock does not contain the first non-keyword;
the third judging module is used for judging whether the second conversion word input by the user is received or not;
The second replacing module is used for if yes, rewriting the second conversion word according to the writing specification, and replacing the first non-keyword with the rewritten second conversion word;
And the second storage module is used for storing the first non-keywords and the second conversion words in the conversion word stock in a one-to-one correspondence manner.
In this embodiment, the implementation process of the functions and roles of the sending module, the third judging module, the second replacing module and the second storage module in the code processing apparatus is specifically described in the implementation process corresponding to steps S200-S203 in the code processing method, and will not be described herein.
Further, in an embodiment of the present application, the code processing apparatus further includes:
The backup module is used for backing up the processed source codes after completing the processing of all the non-keywords in the source codes to obtain source code processing files;
And the third storage module is used for storing 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.
In this embodiment, the implementation process of the functions and roles of the backup module and the third storage module in the code processing apparatus is specifically described in the implementation process corresponding to steps S400-S401 in the code processing method, and will not be described herein.
Referring to fig. 3, in an embodiment of the present application, there is further provided a computer device, which may be a server, and an internal structure thereof may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured 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 programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing data such as non-keywords and converted words. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement the code processing method shown in any one of the above-described exemplary embodiments.
The processor executes the steps of the code processing method:
Traversing all non-keywords of a source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
If the standard word stock does not contain the first non-key words, judging whether a preset conversion word stock contains the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
if the conversion word stock contains the first non-key words, screening out first conversion words corresponding to the first non-key words from the conversion word stock;
and rewriting the first conversion word according to a preset writing specification, and replacing the first non-keyword with the rewritten first conversion word.
It will be appreciated by those skilled in the art that the structure shown in fig. 3 is merely a block diagram of a portion of the structure associated with the present application and is not intended to limit the apparatus, or computer device, to which the present application is applied.
An embodiment of the present application further provides a computer readable storage medium having stored thereon a computer program which, when executed by one or more processors, causes the one or more processors to perform the steps in the code processing method embodiment described above.
The computer program, when executed by a processor, implements a code processing method, specifically:
Traversing all non-keywords of a source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
If the standard word stock does not contain the first non-key words, judging whether a preset conversion word stock contains the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
if the conversion word stock contains the first non-key words, screening out first conversion words corresponding to the first non-key words from the conversion word stock;
and rewriting the first conversion word according to a preset writing specification, and replacing the first non-keyword with the rewritten first conversion word.
In summary, the code processing method, the device, the computer equipment and the storage medium provided in the embodiments of the present application traverse all non-keywords of a source code, and when traversing to one non-keyword, judge whether a preset standard word stock contains the currently traversed non-keyword, wherein the currently traversed non-keyword is marked as a first non-keyword, and a plurality of english words and/or combined nouns are stored in the standard word stock; if the standard word stock does not contain the first non-key words, judging whether a preset conversion word stock contains the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock; if the conversion word stock contains the first non-key words, screening out first conversion words corresponding to the first non-key words from the conversion word stock; and rewriting the first conversion word according to a preset writing specification, and replacing the first non-keyword with the rewritten first conversion word. According to the application, the user-defined non-keywords in the source code are replaced by the corresponding conversion words through the preset conversion word library, so that the non-keywords are converted into complete standard words, the user can clearly know the meaning of the non-keywords, and when the source code is required to be maintained later, the reading workload of maintenance personnel can be reduced, the reading difficulty of the maintenance personnel is reduced, and the working efficiency of the maintenance personnel is improved. In addition, non-key words or conversion words are rewritten through preset writing specifications, so that the rewritten source codes have the advantages of simplicity, attractive appearance and strong readability, and a unified code writing style suitable for all developers is formed.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by hardware associated with a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present application and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (SYNCHLINK) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the application.

Claims (8)

1. A code processing method, comprising:
Screening all keywords in the source code according to a preset programming language keyword lexicon, and then adding marks to all keywords in the source code to determine all non-keywords in the source code; wherein the non-keywords are words in the source code without the marks;
Traversing all non-keywords of a source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
If the standard word stock does not contain the first non-key words, judging whether a preset conversion word stock contains the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
if the conversion word stock contains the first non-key words, screening out first conversion words corresponding to the first non-key words from the conversion word stock; the first conversion word is a complete standard word corresponding to the first non-key word;
the first conversion word is rewritten according to a preset writing specification, and the rewritten first conversion word is used for replacing the first non-keyword;
If the standard word stock does not contain the first non-keyword, the step of judging whether the preset conversion word stock contains the first non-keyword comprises the following steps:
if the conversion word stock does not contain the first non-key word, sending prompt information for inputting a second conversion word corresponding to the first non-key word to a current user;
judging whether the second conversion word input by the user is received or not;
if yes, rewriting the second conversion word according to the writing specification, and replacing the first non-keyword with the rewritten second conversion word;
And storing the first non-keywords and the second converted words in the converted word stock in a one-to-one correspondence manner.
2. The code processing method according to claim 1, wherein, before the step of screening out the first converted word corresponding to the first non-keyword from the converted word stock if the first non-keyword is included in the converted word stock, the code processing method comprises:
Receiving word conversion data respectively input by all developers, wherein the word conversion data comprises a plurality of custom words and conversion words respectively corresponding to the custom words;
Creating the conversion word stock;
And storing the word conversion data in the conversion word stock.
3. The code processing method according to claim 1, wherein the step of screening out the first converted word corresponding to the first non-keyword from the converted word stock if the first non-keyword is included in the converted word stock includes:
If the conversion word stock contains the first non-key word, judging whether a plurality of conversion words corresponding to the first non-key word exist in the conversion word stock;
if yes, acquiring priority information of each conversion word;
and according to the priority information, determining a first appointed conversion word with the highest priority as the first conversion word.
4. The code processing method according to claim 1, wherein the first non-keyword is provided with a plurality of specific conversion words, a conversion word with a highest priority among the plurality of specific conversion words is set as a second specific conversion word, and the step of screening out the first conversion word corresponding to the first non-keyword from the conversion word stock if the first non-keyword is included in the conversion word stock includes:
If the conversion word library contains the first non-key words, screening out second specified conversion words with highest priority in all the specific conversion words, and displaying the second specified conversion words to a current user so as to judge the accuracy of the second specified conversion words by the user;
receiving feedback information of the second specified conversion word returned by the user, wherein the feedback information comprises that the second specified conversion word is accurate or the second specified conversion word is inaccurate;
if the feedback information is that the second specified conversion word is inaccurate, displaying other specific conversion words except the second specified conversion word to the user;
and receiving a third specified conversion word selected by the user from the other specific conversion words, and determining the third specified conversion word as the first conversion word.
5. The code processing method according to claim 1, wherein after the step of rewriting the first converted word according to a preset writing specification and replacing the first non-keyword with the rewritten first converted word, the method comprises:
After the processing of all the non-keywords in the source code is completed, the processed source code is backed up to obtain a source code processing file;
And storing 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.
6. A code processing apparatus for performing the code processing method of any one of claims 1 to 5, comprising:
The first judging module is used for traversing all the non-keywords of the source code, judging whether a preset standard word stock contains the currently traversed non-keywords or not when traversing to one non-keyword, wherein the currently traversed non-keywords are marked as first non-keywords, and a plurality of English words and/or combined nouns are stored in the standard word stock;
the second judging module is used for judging whether the preset conversion word stock contains the first non-key words or not if the standard word stock does not contain the first non-key words, wherein a plurality of custom words and conversion words respectively corresponding to the custom words are stored in the conversion word stock;
The first screening module is used for screening a first conversion word corresponding to the first non-key word from the conversion word stock if the first non-key word is contained in the conversion word stock;
and the first replacing module is used for rewriting the first conversion word according to a preset writing specification and replacing the first non-keyword with the rewritten first conversion word.
7. A computer device comprising a memory and a processor, the memory having stored therein a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 5.
8. A storage medium having a computer program stored thereon, characterized in that the computer program
The steps of the method of any one of claims 1 to 5 when executed by a processor.
CN201910394542.4A 2019-05-13 2019-05-13 Code processing method, device, computer equipment and storage medium Active CN110231955B (en)

Priority Applications (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
PCT/CN2019/103451 WO2020228183A1 (en) 2019-05-13 2019-08-29 Code processing method and apparatus, computer device and storage medium

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN110231955A CN110231955A (en) 2019-09-13
CN110231955B true CN110231955B (en) 2024-05-07

Family

ID=67860541

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910394542.4A Active CN110231955B (en) 2019-05-13 2019-05-13 Code processing method, device, computer equipment and storage medium

Country Status (2)

Country Link
CN (1) CN110231955B (en)
WO (1) WO2020228183A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
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 (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001095108A1 (en) * 2000-06-09 2001-12-13 Educational And Computing Software Pty Ltd 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
CN102819524A (en) * 2011-09-08 2012-12-12 金蝶软件(中国)有限公司 Key-based segmentation method and device for character sequences
CN102929852A (en) * 2012-10-15 2013-02-13 福建榕基软件股份有限公司 Method and system for realizing conversion of simplified and traditional Chinese characters in rich text editor
CN106649308A (en) * 2015-10-28 2017-05-10 卓望数码技术(深圳)有限公司 Updating method and system of word segmentation library
CN106951270A (en) * 2017-04-06 2017-07-14 腾讯科技(深圳)有限公司 A kind of code process method, system and server
CN107544988A (en) * 2016-06-27 2018-01-05 百度在线网络技术(北京)有限公司 A kind of method and apparatus for obtaining public sentiment data
CN107562919A (en) * 2017-09-13 2018-01-09 云南大学 A kind of more indexes based on information retrieval integrate software component retrieval method and system
CN107784014A (en) * 2016-08-30 2018-03-09 广州市动景计算机科技有限公司 Information search method, equipment and electronic equipment
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

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030200535A1 (en) * 2000-06-09 2003-10-23 Mcnamara Benedict Bede System for program source code conversion
JP2007286671A (en) * 2006-04-12 2007-11-01 Fujitsu Ltd Software/hardware division program and division method
CN103646017B (en) * 2013-12-11 2017-01-04 南京大学 Acronym generating system for naming and working method thereof
CN104298752B (en) * 2014-10-15 2017-08-08 扬州大学 The automatic extending method of program code initialism based on web page resource
CN104991909B (en) * 2015-06-19 2018-02-27 扬州大学 A kind of dictionary method for auto constructing for specific software history codes storehouse
US20170344636A1 (en) * 2016-05-31 2017-11-30 International Business Machines Corporation Determining web-page keyword relevance based on social media

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001095108A1 (en) * 2000-06-09 2001-12-13 Educational And Computing Software Pty Ltd 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
CN102819524A (en) * 2011-09-08 2012-12-12 金蝶软件(中国)有限公司 Key-based segmentation method and device for character sequences
CN102929852A (en) * 2012-10-15 2013-02-13 福建榕基软件股份有限公司 Method and system for realizing conversion of simplified and traditional Chinese characters in rich text editor
CN106649308A (en) * 2015-10-28 2017-05-10 卓望数码技术(深圳)有限公司 Updating method and system of word segmentation library
CN107544988A (en) * 2016-06-27 2018-01-05 百度在线网络技术(北京)有限公司 A kind of method and apparatus for obtaining public sentiment data
CN107784014A (en) * 2016-08-30 2018-03-09 广州市动景计算机科技有限公司 Information search method, equipment and electronic equipment
CN106951270A (en) * 2017-04-06 2017-07-14 腾讯科技(深圳)有限公司 A kind of code process method, system and server
CN107562919A (en) * 2017-09-13 2018-01-09 云南大学 A kind of more indexes based on information retrieval integrate software component retrieval method and system
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

Also Published As

Publication number Publication date
CN110231955A (en) 2019-09-13
WO2020228183A1 (en) 2020-11-19

Similar Documents

Publication Publication Date Title
CN109901834B (en) Document page generation method, device, computer equipment and storage medium
CN108762743B (en) Data table operation code generation method and device
US20030131342A1 (en) Debugger with activity alert
CN111666740A (en) Flow chart generation method and device, computer equipment and storage medium
CN111191410A (en) System and method for computing a notebook interface and computer readable medium thereof
CN111414377B (en) Method, device and storage medium for processing structured query statement
CN111061475A (en) Software code generation method and device, computer equipment and storage medium
EP2869195B1 (en) Application coordination system, application coordination method, and application coordination program
EP3314409B1 (en) Tracing dependencies between development artifacts in a software development project
US20090259928A1 (en) Systems and methods for employee compensation planning
CN112486828A (en) Test case generation method and device, computer equipment and storage medium
CN110597714A (en) Kafka message testing method and device, computer equipment and storage medium
CN110231955B (en) Code processing method, device, computer equipment and storage medium
CN111739136B (en) Rendering method, computer device, and storage medium
US10878185B2 (en) Annotation-based dependency calculations
CN117389562A (en) Front-end code visual configuration and intelligent generation method and system based on Vue
EP3425510B1 (en) Automated testing method for application program user interface, electronic device, system, and storage medium
CN115757411A (en) Stock market information data management method, system, equipment and storage medium
US11301246B2 (en) Automatically generating continuous integration pipelines
CN111930387B (en) Integration method and device of integration package, electronic equipment and storage medium
CN109871214B (en) Program code generation method, program code generation device, computer device, and storage medium
JP6551082B2 (en) Test support apparatus, test support method, and test support program
US20160224918A1 (en) Business influenced part extraction method and business influenced part extraction device based on business variation
CN109019217B (en) Elevator control software field debugging system
CN111612098A (en) Method and device for predicting milestone completion time in collaborative development community

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant