Pattern extraction visualization device, pattern extraction visualization method, and pattern extraction visualization program
The pattern extraction and visualization device addresses the challenge of infrequently occurring coding patterns by analyzing, classifying, and visualizing source code to enhance API adapter development efficiency.
Patent Information
- Application Number
- JP2023542042
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2021-08-16
- Publication Date
- 2025-01-23
- Estimated Expiration
- 2041-08-16
AI Technical Summary
Existing methods struggle to comprehensively extract and visualize infrequently occurring coding patterns in source code, making it difficult to understand the structure of the entire code and create effective rules for API adapter development.
A pattern extraction and visualization device that analyzes source code, classifies it into patterns, abstracts these patterns, and generates alignments and visualizations to facilitate recognition of common patterns across multiple source codes.
Enables comprehensive extraction and visualization of common coding patterns, reducing the effort required for API adapter development by providing clear insights into the structure and rules of the source code.
Smart Images

Figure 0007620248000001 
Figure 0007620248000002 
Figure 0007620248000003
Abstract
Description
[Technical Field]
[0001] The present invention relates to a pattern extraction visualization device, a pattern extraction visualization method, and a pattern extraction visualization program that extract, classify, and further visualize patterns in source code. [Background technology]
[0002] To simplify the development of API adapters using orchestrators, it is common to analyze existing API adapters and automatically generate the standardized parts. However, when there are a large number of existing API adapters, there is a problem in that manually analyzing all of them requires a lot of effort.
[0003] Non-Patent Document 1 discloses a method for automatically extracting coding patterns from source code using a sequential pattern mining method, and supporting developers in maintaining the coding patterns. [Prior art documents] [Non-patent literature]
[0004] [Non-Patent Document 1] Takashi Ishio, Hironori Date, Tatsuya Miyake, Katsuro Inoue, "Coding Pattern Extraction Using Sequential Pattern Mining," Transactions of Information Processing Society of Japan, Vol. 50, No. 2, pp. 860-871 (Feb. 2009) Summary of the Invention [Problem to be solved by the invention]
[0005] However, although the above-mentioned Non-Patent Document 1 can extract coding patterns that appear frequently in source code, it is difficult to extract coding patterns that appear less frequently. As a result, there is a problem in that it is not possible to comprehensively grasp the structure of the entire source code and create rules.
[0006] The present invention has been made in consideration of the above circumstances, and its purpose is to provide a pattern extraction visualization device, a pattern extraction visualization method, and a pattern extraction visualization program that are capable of comprehensively extracting common coding patterns from existing source code and visualizing them in a way that is easy for users to recognize. [Means for solving the problem]
[0007] A pattern extraction visualization device according to one embodiment of the present invention is a pattern extraction visualization device that extracts and visualizes patterns contained in a plurality of source codes, and includes a syntax analysis unit that analyzes each source code and classifies it into a plurality of patterns, a preprocessing unit that abstracts each pattern classified by the syntax analysis unit, an alignment derivation unit that derives alignments between each source code for each abstracted pattern contained in each source code, a visualization unit that generates an image showing the alignment in a predetermined format, and a display unit that displays the image showing the alignment.
[0008] A pattern extraction visualization method according to one aspect of the present invention is a pattern extraction visualization method for visualizing patterns contained in a plurality of source codes, and includes the steps of analyzing each source code and classifying it into a plurality of patterns, abstracting each classified pattern, deriving alignments between each source code for each abstracted pattern contained in each source code, generating an image showing the alignment in a predetermined format, and displaying the image showing the alignment.
[0009] One aspect of the present invention is a pattern extraction visualization program for causing a computer to function as a pattern extraction visualization device. [Effects of the Invention]
[0010] According to the present invention, it is possible to comprehensively extract common coding patterns from existing source code and visualize them in a way that is easy for users to recognize. [Brief explanation of the drawings]
[0011] [Figure 1] FIG. 1 is an explanatory diagram showing an example of generating source code for an API adapter from a southbound specification. [Figure 2] FIG. 2 is a block diagram showing the configuration of the pattern extraction visualization device according to the embodiment. [Figure 3A] FIG. 3A is an explanatory diagram showing variable names / identifiers included in source code. [Figure 3B] FIG. 3B is an explanatory diagram showing an example of abstracting a pattern by masking variable names / identifiers included in source code. [Figure 4A] FIG. 4A is an explanatory diagram illustrating a first example of source code including a preprocessing unit, a parameter refilling unit, and an API execution unit. [Figure 4B] FIG. 4B is an explanatory diagram illustrating a second example of source code including a pre-processing unit, a parameter refilling unit, and an API execution unit. [Figure 5A] FIG. 5A is an explanatory diagram showing an example in which the parameter refilling units shown in FIG. 4A are replaced with symbols. [Figure 5B] FIG. 5B is an explanatory diagram showing an example in which the parameter refilling units shown in FIG. 4B are replaced with symbols. [Figure 6] FIG. 6 is an explanatory diagram showing an example of a process of replacing a parameter refilled portion of a source code with a symbol. [Figure 7] FIG. 7 is an explanatory diagram showing an example of a data dependency diagram. [Figure 8] FIG. 8 is an explanatory diagram showing conversion patterns for each parameter. [Figure 9] FIG. 9 is an explanatory diagram showing patterns contained in four source codes N1 to N4. [Figure 10] FIG. 10 is an explanatory diagram showing an example of displaying the alignment of four source code elements N1 to N4 in diff format. [Figure 11] FIG. 11 is an explanatory diagram showing an example of displaying the alignment of four source code elements N1 to N4 in a graph format. [Figure 12A] FIG. 12A is an explanatory diagram showing the procedure for creating a graph-format alignment of four source code elements N1 to N4. [Figure 12B] FIG. 12B is an explanatory diagram showing the procedure for creating a graph-format alignment of four source code elements N1 to N4. [Figure 13] FIG. 13 is an explanatory diagram showing patterns displayed by drilling down. [Figure 14] FIG. 14 is a flowchart showing the processing procedure of the pattern extraction visualization device according to this embodiment. [Figure 15] FIG. 15 is a block diagram illustrating a hardware configuration of the embodiment. DETAILED DESCRIPTION OF THE INVENTION
[0012] Hereinafter, an embodiment will be described with reference to the drawings. First, an outline of this embodiment will be described. In order to facilitate the development of a new API adapter, an orchestrator may analyze the source code of an existing API adapter and consider establishing rules for the overall structure of the source code and individual processes, thereby reducing the development scope when developing a new API adapter.
[0013] In other words, the system supports the development of new API adapters by classifying source code into multiple coding patterns and considering rules for each coding pattern. Here, a "coding pattern" refers to a piece of code that makes up the source code, such as a single statement included in the source code or a single program. In the following, "coding pattern" will be abbreviated to simply "pattern."
[0014] For example, consider the case where there are existing southbound API specifications Q1 and Q2, and source code Q3 and Q4 of API adapters created based on the specifications Q1 and Q2, as shown in Figure 1. Assume that specification Q1 describes "type;array" and specification Q2 describes "type;int".
[0015] Source code Q3 is analyzed and divided into patterns A, B, and C. Source code Q4 is analyzed and divided into patterns A, D, and C. As a result, a conversion rule can be found that states that if a certain item "type" in the southbound API specification is "array," then process B is performed, and if the item "type" is anything other than "array," then process D is performed. By incorporating such rules in advance into the SDK (Software Development Kit) used for adapter development, the development scope can be reduced when developing a new API adapter.
[0016] The pattern extraction visualization device according to this embodiment extracts multiple patterns from the source code of an API adapter. Specifically, the pattern extraction visualization device classifies the source code of the API adapter into multiple patterns and abstracts each pattern. Based on the abstracted patterns, the device then classifies them into common patterns and individual patterns, and visualizes them for easy user recognition. For example, the source code Q3 and Q4 shown in FIG. 1 are analyzed to extract patterns such as process A, process B, and process C, which are then visualized. Note that "abstracting" refers to abstracting a pattern by replacing part of the pattern with an arbitrary symbol or masking it, and regarding patterns that differ only in part as identical.
[0017] The pattern extraction visualization device according to this embodiment will be described in detail below. Fig. 2 is a block diagram showing the configuration of the pattern extraction visualization device 1 according to this embodiment. As shown in Fig. 2, the pattern extraction visualization device 1 includes a storage unit 11, a syntax analysis unit 12, a preprocessing unit 13, a graph derivation unit 14, an alignment derivation unit 15, a visualization unit 16, and a display unit 17.
[0018] The storage unit 11 acquires the source code of an existing API adapter from the outside and stores the acquired source code. The storage unit 11 also stores information on the analysis results by the syntax analysis unit 12 and the processing results by the preprocessing unit 13, which will be described later.
[0019] The syntax analysis unit 12 analyzes each source code stored in the storage unit 11 and classifies it into a plurality of patterns. The syntax analysis unit 12 performs, for example, static analysis on each source code stored in the storage unit 11 and converts it into an AST (Abstract Syntax Tree) format. The source code converted into the AST format is output to the preprocessing unit 13 and the graph derivation unit 14.
[0020] The preprocessing unit 13 abstracts each pattern classified by the syntax analysis unit 12. The preprocessing unit 13 extracts unpreprocessed source code from the source code stored in the storage unit 11, and abstracts the patterns included in the extracted source code by applying preprocessing such as masking. The preprocessing unit 13 stores the preprocessed source code back in the storage unit 11. The preprocessing unit 13 abstracts the patterns included in the source code, and recognizes patterns that can be considered identical through abstraction as common patterns. For example, as shown in FIG. 9 described later, the preprocessing unit 13 classifies source code N1 to N4 into multiple patterns. In this case, common patterns are indicated by the same symbol.
[0021] The preprocessing unit 13 may lexically analyze the pattern and mask at least one of the variable names and identifiers included in the pattern. The preprocessing unit 13 may classify the source code into patterns of a preprocessing unit (see L1 in FIG. 4A), a parameter refilling unit (see L2 in FIG. 4A), and an API execution unit (see L3 in FIG. 4A), and replace the pattern of the parameter refilling unit with a symbol. When using the graph derivation unit 14, the preprocessing unit 13 reads the data dependency diagram from the graph derivation unit 14 and performs processing to identify the parameter refilling unit and masking processing.
[0022] The graph derivation unit 14 generates a data dependency diagram based on the parameter refilling part included in the source code. The graph derivation unit 14 creates the data dependency diagram using the AST calculated by the syntax analysis unit 12. Specifically, the graph derivation unit 14 generates a "data dependency diagram" shown in FIG. 7 (details will be described later).
[0023] The detailed processing of the preprocessing unit 13 and the graph derivation unit 14 will be described below. FIG. 3A is an explanatory diagram showing an example in which the preprocessing unit 13 performs lexical analysis of source code and masks variable names / identifiers contained in the source code. FIGS. 3A(a), (b), and (c) differ only in the variable names / identifiers (indicated by wavy lines in the figure) of "VM," "Disks," and "Availability Sets," respectively; the other lexical elements are identical. To recognize these patterns as common, the preprocessing unit 13 replaces the elements of each pattern with a symbol. For example, as shown in FIG. 3B, it replaces them with a pattern using the symbol "$." As a result, the left and right sides of FIG. 3B become the same pattern, and each pattern can be made common.
[0024] 4A and 4B are explanatory diagrams showing examples of source code classified into multiple patterns by the pre-processing unit 13. FIG. 4A shows the source code for "Linux Machine." FIG. 4B shows the source code for "Managed Disk." Each source code shown in FIG. 4A and FIG. 4B is composed of pre-processing units L1 and L11, parameter refilling units L2 and L12, and API execution units L3 and L13. The pre-processing units L1 and L11 set timeouts and check existing resources.
[0025] The parameter repackaging units L2 and L12 extract parameters from the order for the northbound IF and repackage / convert them into a structure for executing the southbound API.
[0026] The API execution units L3 and L13 execute the API using the parameters created by the parameter refill units L2 and L12.
[0027] For the parameter refilling units L2 and L12, the number of parameters differs for each API adapter, or the processing content differs for each parameter, so a direct comparison of the source code of the two adapters may not yield a correct correspondence. For example, comparing Figures 4A and 4B, the parameter refilling units L2 and L12 have different numbers of parameters and different processing for each parameter, which may result in inaccurate matching.
[0028] 4A and 4B, the preceding processing units L1 and L11 may not be able to obtain a correct correspondence relationship due to the influence of inaccurate matching by the parameter refilling units L2 and L12. Similarly, the API execution units L3 and L13 may not be able to obtain a correct correspondence relationship due to the influence of inaccurate matching by the parameter refilling units L2 and L12.
[0029] Furthermore, the parameter refilling sections L2 and L12 may not be able to obtain the correct correspondence because there is a high probability of coincidental matches due to the frequent repetition of syntactically similar descriptions or the effect of abstraction (masking) caused by lexical analysis.
[0030] The preprocessing unit 13 recognizes the processing parts of the parameter refilling units L2 and L12 in the adapter source code, and abstracts them by replacing them with any commonly set characters (for example, "%%%"), making it easier to determine the correspondence of the overall structure.
[0031] 5A and 5B, the parameter refilling sections L22 and L32 are replaced with the phrase "%%%." This allows the parameter refilling sections L22 and L32 present in each source code to be correctly associated and recognized, and the API execution sections L23 and L33 of each source code to be accurately associated with each other without being affected by the parameter refilling sections L22 and L32.
[0032] Specifically, as shown in Figure 6, the line in the API execution process that executes the "Client.CreateOrUpdate" method, indicated by the wavy underline, is searched for. Next, the variable "params" used as an input parameter is identified.
[0033] From the above information, a data dependency diagram is created using, for example, a static analysis technique for the program. Specifically, the parameter refilling unit Z1 shown in Fig. 6 describes phrases such as "adminUsername," "planRaw," "plan," "priority," "parms," etc. The graph derivation unit 14 extracts the above phrases to create a data dependency diagram as shown in Fig. 7.
[0034] The preprocessing unit 13 follows the variable "params" in the data dependency diagram shown in Fig. 7 and extracts all parts that define and set parameters. As shown in Fig. 5A and Fig. 5B, the preprocessing unit 13 replaces the extracted parameter refilling part Z1 with the characters "%%%". In this way, the parameter refilling part Z1 can be easily replaced with the characters "%%%".
[0035] The API execution unit shown in Fig. 6 can be made to correspond without being affected by the parameter refilling unit Z1. That is, for example, in Fig. 5A and Fig. 5B, the API execution units L23 and L33 can be made to correspond to each other.
[0036] Furthermore, the parameter refilling unit may recognize and present a conversion pattern for each parameter. For example, "A1," "A2," and "A3" shown in Fig. 8(a) may be converted to "B1," "B2," and "B3" shown in Fig. 8(b), respectively. "B2" is the rule when the parameter includes a hierarchy. "B3" is the rule when the parameter type is a constant.
[0037] This allows the user to recognize the repackaging and conversion patterns for each parameter, which makes it possible to study conversion rules more efficiently.
[0038] Returning to FIG. 2, the alignment derivation unit 15 derives alignments between each source code for abstracted patterns contained in each source code. "Alignment" refers to the correspondence between the sequences of multiple patterns. For example, as shown in FIG. 10 (described later), it refers to the correspondence between patterns "A to G" contained in multiple source codes N1 to N4. To derive the alignment, existing multiple alignment algorithms such as multiple alignment programs "ClustalW," "T-COFFEE," and "MAFFT" can be used. Note that these algorithms are well-known technologies, so detailed explanations will be omitted.
[0039] By using the above algorithm, the alignment derivation unit 15 derives alignments between each source code for the abstract patterns contained in each source code N1 to N4. For example, assume that there are four API adapter source codes N1 to N4 as shown in Figure 9, and the preprocessing unit 13 has classified them into patterns A to G. The alignment derivation unit 15 derives alignments that indicate the correspondence between each of patterns "A" to "F" for the source codes N1 to N4 of the four API adapters.
[0040] Specifically, since the three patterns "A, B, C" shown in symbol K1 and the two patterns "E, F" shown in symbol K2 match in each source code N1 to N4, the alignment derivation unit 15 derives an alignment so that these patterns correspond to each other.
[0041] The visualization unit 16 shown in FIG. 2 generates an image showing the alignment in a predetermined format. The display unit 17 displays the image showing the alignment generated by the visualization unit 16. The visualization unit 16 may generate an image showing the alignment in at least one of a diff format and a graph format. That is, the visualization unit 16 generates an image of the alignment of each pattern derived by the alignment derivation unit 15 in a format that is easy for the user to recognize, such as a diff format or a graph format, and displays it on the display unit 17. The visualization unit 16 visualizes the alignment by displaying the alignment on the display unit 17.
[0042] The visualization unit 16 generates alignment images in diff format and graph format based on the patterns of each of the source code sets N1 to N4 shown in Fig. 9. For example, as shown in Fig. 10, the visualization unit 16 displays the patterns included in each of the source code sets N1 to N4 in diff format, which allows the differences between the source code sets N1 to N4 to be recognized. As another example, the visualization unit 16 displays the patterns included in each of the source code sets N1 to N4 in graph format, as shown in Fig. 11.
[0043] Fig. 10 is an explanatory diagram showing an example of a display image in the diff format. As shown in Fig. 10, the patterns "A, B, C" and "E, F" match in each of the source codes N1 to N4. In the diff format, these patterns "A, B, C, E, F" are aligned horizontally in the image, allowing the user to easily recognize the patterns that are common to each of the source codes N1 to N4.
[0044] Fig. 11 is an explanatory diagram showing an example of a display image in a graph format. As shown in Fig. 11, the matching patterns in each of the source codes N1 to N4 are displayed as an image in a graph format. By using the graph format, the user can easily recognize the patterns that are common to each of the source codes N1 to N4 and the patterns that are not common to each other.
[0045] 12A and 12B are explanatory diagrams showing the procedure for generating the graph-format display image shown in Fig. 11. The visualization unit 16 compares the nth source code with the (n-1)th source code, aggregates common patterns, and generates new nodes and edges.
[0046] The visualization unit 16 graphs the source code N1 as it is, in a chained fashion, as shown in FIG. 12A(a).
[0047] The visualization unit 16 generates graph-format data M1 by comparing source code N2 with N1, as shown in Fig. 12A(b). Comparing source code N1 with N2, it is found that "A to D" and "E, F" match, and "A, B" in the middle has been changed to "G". Therefore, as shown in Fig. 12A(b), data M1 is generated by adding nodes of pattern "G" and edges connecting nodes of pattern "G" to source code N1 shown in Fig. 12(a).
[0048] The visualization unit 16 generates graph-format data M2 by comparing source code N3 with N2, as shown in Fig. 12B(c). Comparing source code N3 with N2 reveals that "A to C" and "E, F" match, and "D, G" has been changed to "E, H, H, G". Therefore, data M2 shown in Fig. 12B(c) is generated.
[0049] The visualization unit 16 generates graph-format data M3 by comparing source code N4 with N3, as shown in FIG. 12B(d). Comparing source code N4 with N3, it is found that "A to C" and "E, F" match, "E" has been added, and "H, H, G" has been changed to "B, D". Therefore, data M3 shown in FIG. 12B(d) is generated. The syntax analysis unit 12 generates graph-format data M3 by abstracting the four source codes N1 to N4 using the above procedure.
[0050] By visually checking the alignment displayed on display unit 17, the user can recognize the alignment of the source code of each API adapter.
[0051] When a selection input is made for a pattern displayed on the display unit 17, the visualization unit 16 generates an image by drilling down on the selected pattern and displays it on the display unit 17. That is, when a predetermined pattern (node) is selected from the alignment displayed on the display unit 17, the visualization unit 16 has a function of drilling down on the selected pattern and displaying it. For example, when a user selects pattern "A" from the patterns displayed in the graph shown in FIG. 12B(d), the visualization unit 16 drills down on this pattern and displays it on the display unit 17. By drilling down, the original program can be confirmed.
[0052] For example, when the graph-format data M3 shown in Fig. 12B(d) is displayed on the display unit 17 and the user selects pattern "A" in this display image, "$=$.(*$.$).$.$" is displayed as shown in Fig. 13(a). The user can recognize the format of pattern "A" by looking at this display.
[0053] Furthermore, by selecting the display (a) displayed on the display unit 17, a specific coding pattern is displayed as shown in Fig. 13(b). By looking at this display, the user can recognize the specific program.
[0054] Next, the processing procedure of the pattern extraction visualization device 1 according to this embodiment configured as described above will be described with reference to the flowchart shown in FIG.
[0055] First, in step S11 of FIG. 14, the storage unit 11 acquires and stores a plurality of source codes.
[0056] In step S12, the syntax analysis unit 12 performs syntax analysis on each source code stored in the storage unit 11. The syntax analysis unit 12 performs, for example, a process of converting the source code into an AST format. The source code converted into the AST format is output to the preprocessing unit 13 and the graph derivation unit 14.
[0057] In step S13, the graph derivation unit 14 derives a data dependency diagram, for example, the data dependency diagram shown in FIG.
[0058] In step S14, the preprocessing unit 13 performs preprocessing on each source code stored in the storage unit 11. Specifically, the preprocessing unit 13 extracts source code that has not been preprocessed from the source code stored in the storage unit 11, performs preprocessing such as masking on patterns included in the extracted source code to abstract it, and stores it again in the storage unit 11. As a result, for example, as shown in Fig. 9, each source code N1 to N4 is classified into patterns A to G. In Fig. 9, patterns with the same symbols indicate common patterns.
[0059] In step S15, the alignment derivation unit 15 derives an alignment of the patterns abstracted by the preprocessing unit 13. For example, as shown in Fig. 10, the alignment derivation unit 15 derives an alignment that indicates the correspondence between patterns included in the source codes N1 to N4 of the four API adapters in a diff format.
[0060] In step S16, the visualization unit 16 generates an image in which each pattern is displayed in a predetermined format based on the alignment derived by the alignment derivation unit 15. For example, an image in the diff format shown in Fig. 10 or the graph format shown in Fig. 11 is generated.
[0061] In step S17, the visualization unit 16 visualizes the image generated in the processing of step S16 by displaying it on the display unit 17. By visually checking this image, the user can recognize common patterns contained in the source code of multiple API adapters.
[0062] As described above, the pattern extraction visualization device 1 according to this embodiment is a pattern extraction visualization device that extracts and visualizes patterns contained in multiple source codes, and includes a syntax analysis unit 12 that analyzes each source code and classifies it into multiple patterns, a preprocessing unit 13 that abstracts each pattern classified by the syntax analysis unit 12, an alignment derivation unit 15 that derives alignments between each source code for each abstracted pattern contained in each source code, a visualization unit 16 that generates an image showing the alignment in a predetermined format, and a display unit 17 that displays the image showing the alignment.
[0063] The pattern extraction visualization device 1 according to the present embodiment classifies the source code of an existing API adapter into multiple patterns, and then abstracts each pattern to extract common parts. The pattern extraction visualization device 1 according to the present embodiment displays and visualizes common patterns in each source code in a manner that is easy for the user to recognize on the display unit 17. By viewing this display, the user can easily recognize common patterns and individual patterns contained in multiple source code.
[0064] When displaying the alignment, the visualization unit 16 displays it on the display unit 17 in diff format or graph format, making it possible to visualize common patterns and individual patterns in a manner that makes them easier to recognize.
[0065] The preprocessing unit 13 analyzes the syntax contained in the source code and masks the variable names and identifiers contained in the patterns, thereby making it possible to easily abstract a plurality of patterns.
[0066] The preprocessing unit 13 classifies the source code into patterns of a preprocessing unit, a parameter refilling unit, and an API execution unit, and replaces the parameter refilling unit patterns with symbols. Specifically, as shown in Figures 5A and 5B, the parameter refilling unit is replaced with "%%%". This makes it possible to accurately associate common patterns contained in two source codes without the preprocessing unit and the API execution unit being affected by the parameter refilling unit.
[0067] When a selection input is made for a pattern displayed on the display unit 17, the visualization unit 16 displays an image of the selected and input pattern drilled down on the display unit 17. This allows the user to easily recognize the detailed content of each pattern.
[0068] 15, for example, a general-purpose computer system including a CPU (Central Processing Unit, processor) 901, a memory 902, a storage 903 (HDD: Hard Disk Drive, SSD: Solid State Drive), a communication device 904, an input device 905, and an output device 906 can be used for the pattern extraction visualization device 1 of this embodiment described above. The memory 902 and the storage 903 are storage devices. In this computer system, the CPU 901 executes a predetermined program loaded on the memory 902, thereby realizing each function of the pattern extraction visualization device 1.
[0069] The pattern extraction visualization device 1 may be implemented in one computer or in multiple computers. Furthermore, the pattern extraction visualization device 1 may be a virtual machine implemented in a computer.
[0070] The program for the pattern extraction visualization device 1 can be stored on a computer-readable recording medium such as an HDD, SSD, USB (Universal Serial Bus) memory, CD (Compact Disc), or DVD (Digital Versatile Disc), or can be distributed via a network.
[0071] The present invention is not limited to the above-described embodiment, and various modifications are possible within the scope of the present invention. [Explanation of symbols]
[0072] 1. Pattern extraction and visualization device 11 Storage section 12 Parser 13 Pretreatment section 14 Graph derivation part 15 Alignment derivation part 16 Visualization section 17 Display
Claims
1. A pattern extraction and visualization device that extracts and visualizes patterns included in a plurality of source codes, comprising: A syntax analysis unit that analyzes each source code and classifies it into a plurality of patterns; a preprocessing unit that abstracts each pattern classified by the syntax analysis unit; an alignment deriving unit that derives an alignment between each source code for each abstract pattern included in each source code; a visualization unit for generating an image showing the alignment in a predetermined format; a display unit that displays an image showing the alignment; A pattern extraction visualization device comprising:
2. The pattern extraction and visualization device according to claim 1 , wherein the predetermined format is at least one of a diff format and a graph format.
3. 3. The pattern extraction visualization device according to claim 1, wherein the preprocessing unit performs lexical analysis on the pattern and masks at least one of a variable name and an identifier included in the pattern.
4. The pattern extraction visualization device according to any one of claims 1 to 3, wherein the pre-processing unit classifies the source code into patterns of a pre-processing unit, a parameter refilling unit, and an API execution unit, and replaces the patterns of the parameter refilling unit with symbols.
5. a graph derivation unit that generates a data dependency diagram based on a parameter refilling unit included in the source code; 5. The pattern extraction visualization device according to claim 4, wherein the preprocessing unit abstracts each of the patterns classified by the syntax analysis unit with reference to the data dependency diagram.
6. The pattern extraction visualization device according to any one of claims 1 to 5, wherein when a selection input is made for a pattern displayed on the display unit, the visualization unit generates an image by drilling down on the selected and input pattern and displays the image on the display unit.
7. A pattern extraction and visualization method for extracting and visualizing patterns included in a plurality of source codes, the method comprising: Analyzing and classifying each source code into a plurality of patterns; Abstracting each classified pattern; deriving an alignment between each of the source codes for each of the abstract patterns included in each of the source codes; generating an image indicative of said alignment in a predetermined format; displaying an image indicative of the alignment; A pattern extraction visualization method comprising:
8. A pattern extraction visualization program that causes a computer to function as the pattern extraction visualization device according to any one of claims 1 to 6.
Citation Information
Patent Citations
Analysis device, analysis program and analysis method
JP2019003385A