Methods and arrangements to process comments
Described herein are embodiments for managing comments in a program code file. A system may select program code and compile it to an intermediary code. The system may compare the intermediary code to a library of intermediary code snippets associated with comments. Based on the comparison, a system may recognize the code to be obsolete. In some embodiments, a system may generate one or more recommendations to update a code. Based on received feedback regarding a recommendation, a system may accordingly update a code.
1. A computer implemented method to process comments, comprising:
identifying a program code segment with a comment;
determining an intermediate code segment during compiling of the program code segment;
identifying a library code segment corresponding to the intermediate code segment;
identifying a set of one or more comments based on an association between the library code segment and the set of one or more comments;
comparing the comment with the set of one or more comments to determine that a deviation between the comment and the set of one or more comments exceeds a deviation threshold; and
outputting an indication that the comment might be obsolete.
2. The method of claim 1 , comprising generating the intermediate code segment by compilation of the program code segment to an intermediate stage of compilation.
3. The method of claim 1 , comprising comparing the intermediate code segment to the library code segment to identify the library code segment.
4. The method of claim 1 , comprising implementing a model, the model to identify the library code segment based on the intermediate code segment.
5. The method of claim 4 , wherein the model to compare the comment with the set of one or more comments to determine the deviation based on a lack of an exact match.
6. The method of claim 4 , wherein the model to determine Levenshtein distance metrics based on the comment and the set of one or more comments to determine the deviation.
7. The method of claim 4 , wherein the model to perform natural language processing based on the associated comment and the set of one or more comments to determine the deviation.
8. An apparatus, comprising:
memory; and
logic circuitry coupled with the memory to:
determine a program code segment;
parse the program code segment to generate a training code segment, the training code segment includes at least one comment;
compile the training code segment to generate an intermediate code segment associated with the training code segment and the at least one comment of the training code segment; and
train a machine learning model with the intermediate code segment to detect similarities between input comments and comments in a library.
9. The apparatus of claim 8 , the logic circuitry to generate the intermediate code segment by compilation of the program code segment to an intermediate stage of compilation.
10. The apparatus of claim 8 , the logic circuitry to:
determine an input intermediate code segment and an input comment;
apply the model to the input comment and one or more comments in the library; and
determine the input comment may be obsolete based on the model applied to the input comment and the one or more comments.
11. The apparatus of claim 10 , wherein the model to identify a library code segment based on the input intermediate code segment, the library code segment associated with the one or more comments in the library.
12. The apparatus of claim 10 , wherein the model to compare the input comment with the one or more comments to determine a deviation based on a lack of an exact match, and the logic circuitry to determine the input comment may be obsolete based on the deviation exceeding a deviation threshold.
13. The apparatus of claim 10 , wherein the model to determine Levenshtein distance metrics based on the input comment and the one or more comments to determine a deviation, and the logic circuitry to determine the input comment may be obsolete based on the deviation exceeding a deviation threshold.
14. The apparatus of claim 10 , wherein the model to perform natural language processing based on the input comment and the one or more comments to determine a deviation, and the logic circuitry to determine the input comment may be obsolete based on the deviation exceeding a deviation threshold.
15. A computer-implemented method, comprising:
determining a program code segment;
parsing the program code segment to generate a training code segment, the training code segment includes at least one comment;
compiling the training code segment to generate an intermediate code segment associated with the training code segment and the at least one comment of the training code segment; and
training a machine learning model with the intermediate code segment to detect similarities between input comments and comments in a library.
16. The method of claim 15 , comprising:
determining an input intermediate code segment and an input comment;
applying the model to the input comment and one or more comments in the library; and
determining the input comment may be obsolete based on the applying of the model.
17. The method of claim 16 , wherein the model to identify a library code segment based on the input intermediate code segment, the library code segment associated with the one or more comments in the library.
18. The method of claim 16 , wherein the model to compare the input comment with the one or more comments to determine a deviation based on a lack of an exact match, and the method comprising determining the input comment may be obsolete based on the deviation exceeding a deviation threshold.
19. The method of claim 16 , wherein the model to determine Levenshtein distance metrics based on the input comment and the one or more comments to determine a deviation, and the method comprising determining the input comment may be obsolete based on the deviation exceeding a deviation threshold.
20. The method of claim 16 , wherein the model to perform natural language processing based on the input comment and the one or more comments to determine a deviation, and the method comprising determining the input comment may be obsolete based on the deviation exceeding a deviation threshold.