A semantic processing method based on aerospace MOM software code data warehouse
By using AST technology and CNN deep learning models for semantic processing in aerospace MOM software, the problems of software code complexity and reliability requirements are solved, more efficient development and maintenance are achieved, and the stability and security of the system are improved.
Patent Information
- Application Number
- CN202411672375.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-04-04
AI Technical Summary
Aerospace MOM software faces the problems of high code complexity and reliability requirements during development and maintenance, and it is difficult to deeply understand code logic and potential problems with traditional syntax analysis.
The syntax structure extraction and CNN deep learning model based on AST technology are used to carry out deep semantic understanding, build a unified software code data warehouse, and realize comprehensive code management and multi-perspective analysis.
It improves the efficiency and quality of software development, supports software maintenance and upgrades, enhances the stability and reliability of the system, and meets the high standards for software quality and safety in the aerospace field.
Smart Images

Figure CN119759354A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to software development and data management in the field of aerospace, and in particular to a semantic processing method based on aerospace MOM software code data warehouse. Background Art
[0002] With the rapid development of aerospace technology, the application of MOM software in the aerospace field has become more and more common. This type of software usually carries important missions such as critical mission control, data processing and system management, and its quality and reliability are crucial to the overall performance and safety of aerospace systems.
[0003] However, aerospace MOM software faces many difficulties in development and maintenance. First, the software code is complex and large in scale, containing many logical structures and functional modules, which significantly increases the difficulty of understanding and maintenance. Second, the aerospace field has extremely high requirements for software reliability and security, and any small error may lead to serious consequences.
[0004] Traditional software code processing and analysis methods mostly focus on syntax-level analysis, which makes it difficult to dig deep into the semantic information of the code. This limits software developers' comprehensive understanding of code logic, functional implementation, and potential problems. Moreover, as software scale continues to expand and complexity continues to increase, traditional analysis methods are increasingly unable to meet the high standards of software quality and reliability in the aerospace field.
[0005] In recent years, in order to meet these challenges, semantic processing methods based on deep learning have begun to attract attention. Deep learning technology can automatically extract deep features of data and effectively classify and predict these features by simulating the learning process of the human brain. In terms of software code processing, deep learning technology can be used in code understanding, error detection, code generation and other aspects, and is expected to greatly improve the efficiency and quality of software development. Summary of the invention
[0006] The present invention proposes a semantic processing method based on the aerospace MOM software code data warehouse, extracts the code syntax structure through AST technology, and realizes deep semantic understanding and multi-perspective analysis in combination with the CNN deep learning model. The method improves the efficiency and quality of software development, supports software maintenance and upgrades, realizes comprehensive code management and effective utilization by building a unified data warehouse, ensures system stability and reliability, and provides strong technical support for production and operation in the aerospace field. Lexical analysis and syntax analysis are used to form a standard AST structure, and CNN model training and learning are used to realize code verification and optimization, thereby improving software security and reliability.
[0007] The present invention adopts the following technical solution:
[0008] A semantic processing method based on aerospace MOM software code data warehouse comprises the following steps:
[0009] S1, collects source code information in the field of aerospace MOM software and processes it to obtain processed source code information;
[0010] S2, the processed source code information is subjected to lexical analysis and syntax analysis, and stored in an adjacency list to form a standardized AST structure; the code text is extracted through AST analysis technology, and the code text includes entity, logical structure and attribute information, and the extracted code text is combined with the processed data source to form code data and stored in the data warehouse;
[0011] S3, build a CNN-based semantic processing model, use the code data in the data warehouse to train and learn the semantic processing model, obtain a trained semantic processing model, use the trained semantic processing model to perform semantic processing on the source code information to be tested, and obtain the verification result.
[0012] Preferably, S1 specifically includes:
[0013] S101, processing the source code information includes removing redundancy, correcting format errors, and unifying coding standards to obtain processed source code information.
[0014] Preferably, S2 specifically includes:
[0015] S201, performing lexical analysis on the processed source code information to obtain a lexical unit sequence;
[0016] S202, perform grammatical analysis on the lexical unit sequence, construct and store an adjacency table, and generate a standard AST structure;
[0017] S203, extracting code text from the standard AST structure through AST analysis technology.
[0018] Preferably, S201 specifically includes:
[0019] Using a lexical analyzer, the processed source code information is first converted into a lexical unit sequence consisting of a series of lexical units. A lexical unit is the smallest lexical component in the code; the lexical analyzer identifies lexical units through pattern matching and assigns them to specific categories.
[0020] Preferably, S202 specifically includes:
[0021] The syntax analyzer receives the lexical unit sequence generated by the lexical analyzer and organizes the lexical unit sequence into a specific syntax tree according to the grammatical rules of the programming language. At this stage, the syntax analyzer will identify expressions and statement blocks and generate a specific syntax tree. After generating the specific syntax tree, the compiler will simplify the specific syntax tree, remove unnecessary syntax details, and generate a standard AST structure.
[0022] Preferably, S203 specifically includes:
[0023] Extract code text from the generated standard AST structure through AST analysis technology;
[0024] For the standard AST structure, assume that its adjacency list has a non-leaf node i, which has n child nodes, and the child node is j;
[0025] First, use the word embedding matrix:
[0026] Y i ∈R |V|×d ;
[0027] Among them, Y i is the word embedding matrix, V is the vocabulary, R is the set of real numbers, and d is the embedding dimension of the symbol;
[0028] The lexical vector of non-leaf node i is represented as:
[0029] v i =Y i X i ;
[0030] Among them, v i represents the lexical vector of leaf node i, X i is a one-dimensional vector, X i The element at the index position of the word represented by the non-leaf node i in the vocabulary is 1, and all its elements are 0;
[0031] Word vector h in code text i It is expressed as:
[0032]
[0033] Among them, h j is the updated hidden state of the child node, σ is the RELU activation function, and b n is the bias term, Y i The transposed matrix of .
[0034] Preferably, S3 specifically includes:
[0035] The CNN-based semantic processing model includes input layer, convolution layer and fully connected layer;
[0036] The input layer receives the code text in the data warehouse, which is regarded as a sequence of multiple q-dimensional word vectors, where each word vector belongs to R q space, R represents the set of real numbers, assuming O p is the word vector of the pth word, then a code text T of length n′ is represented as:
[0037]
[0038] in, Represents the connection operation. The convolution layer uses convolution kernels of different sizes (h×m) for convolution operations. h is the height of the convolution kernel, and m is the width of the convolution kernel, which is consistent with the word vector dimension. In the convolution process, O p:p+h-1 represents the word vector matrix in the pth to p+h-1th window, then O p:p+h-1 A feature extracted p It is expressed as:
[0039] d p =f(W·O p:p+h-1 + b);
[0040] Among them, W is a weight matrix of size (h×m), b represents the bias term, and f is a nonlinear activation function;
[0041] The word vector matrix for a short text {o 1:h ,o 2:h+1 ,·····,o n′-h+1:n′}The convolution operation will result in a feature map, expressed as:
[0042] d=[d1,d2,·····d n′-h+1 ];
[0043] Among them, n′ represents the number of words in a code text, h represents the height of the convolution kernel window, and d is the feature map d∈R formed by a short text through a convolution kernel. n′-h+1 , since the height of the convolution kernel is h and the width is the dimension of the word vector, the feature map formed after convolution is a matrix with a height of n′-h+1 and a width of 1. Different convolution kernels can extract features from short texts from different angles. By setting the number of convolution kernels, multiple different feature maps can be obtained;
[0044] All convolutional feature maps are flattened and sent to the fully connected layer for operation. The operation of the fully connected layer is expressed as:
[0045] y=σ(W f p+b f );
[0046] Among them, p is the vector of all convolutional feature maps flattened, W f and b f are the weight and bias of the fully connected layer, σ is the RELU activation function, and y is the probability value of the source code information output by the fully connected layer being verified to be correct.
[0047] Preferably, during the training of the CNN-based semantic processing model, the following loss function is used to measure the difference between the model prediction results and the actual labels:
[0048] L=w1*y true *log (y) +w0*(1-y true )*log(1-y);
[0049] Among them, L is the loss function, w1 and w0 represent weights, y true is the actual label, and y is the probability value of the source code information predicted by the semantic processing model to be correct.
[0050] It can be seen from the above description of the present invention that, compared with the prior art, the present invention has the following beneficial effects:
[0051] (1) The present invention deeply analyzes the MOM software code through abstract syntax tree (AST) analysis technology to construct an accurate code structure representation, which provides a basis for subsequent semantic information extraction and verification.
[0052] (2) The present invention utilizes a convolutional neural network (CNN) deep learning model to achieve automatic verification of the business logic of the MOM system, reduce human errors, and improve the stability and reliability of the system.
[0053] (3) The MOM software code data warehouse constructed by the present invention provides a convenient way for subsequent version management and maintenance, thereby reducing maintenance costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 The figure is a flow chart of a method according to an embodiment of the present invention.
[0055] Figure 2 This is a structural diagram of a data warehouse according to an embodiment of the present invention.
[0056] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. DETAILED DESCRIPTION
[0057] In order to further illustrate the purpose, technical concept and significant advantages of the present invention, we hereby provide a detailed and specific analysis of the present invention with the help of intuitive drawings and practical application examples. It should be clear that the embodiments listed below are only part of the various possible implementations of the present invention and are intended to be inspiring rather than limiting. Within the core concept and protection scope of the present invention, those skilled in the art can conceive and construct a variety of variants and implementation forms based on the basic principles and innovative spirit of the present invention without complex creative efforts.
[0058] The present invention is further described below through specific implementation modes.
[0059] refer to Figure 1 and Figure 2 , the embodiment of the present application proposes a semantic processing method based on the aerospace MOM software code data warehouse, comprising the following steps:
[0060] S1, collects source code information in the field of aerospace MOM software and processes it to obtain processed source code information.
[0061] In a specific embodiment, S1 specifically includes:
[0062] In a specific embodiment, the processing of the source code information includes removing redundancy, correcting format errors, and unifying coding standards to obtain processed source code information.
[0063] Specifically, before the source code information in the field of aerospace MOM software is input into the semantic processing model of CNN, it needs to be processed, including removing redundancy, correcting format errors, and unifying coding standards.
[0064] S2, the processed source code information is subjected to lexical analysis and syntax analysis, and stored in an adjacency list to form a standardized AST structure; the code text is extracted through AST analysis technology, and the code text includes entity, logical structure and attribute information, and the extracted code text is combined with the processed data source to form code data and stored in the data warehouse.
[0065] In a specific embodiment, S2 specifically includes:
[0066] S201, performing lexical analysis on the processed source code information to obtain a lexical unit sequence;
[0067] S202, perform grammatical analysis on the lexical unit sequence, construct and store an adjacency table, and generate a standard AST structure;
[0068] S203, extracting code text from the standard AST structure through AST analysis technology.
[0069] In a specific embodiment, S201 specifically includes:
[0070] Using a lexical analyzer, the processed source code information is first converted into a lexical unit sequence consisting of a series of lexical units. A lexical unit is the smallest lexical component in the code; the lexical analyzer identifies lexical units through pattern matching and assigns them to specific categories.
[0071] In a specific embodiment, S202 specifically includes:
[0072] The syntax analyzer receives the lexical unit sequence generated by the lexical analyzer and organizes the lexical unit sequence into a specific syntax tree according to the grammatical rules of the programming language. At this stage, the syntax analyzer will identify expressions and statement blocks and generate a specific syntax tree. After generating the specific syntax tree, the compiler will simplify the specific syntax tree, remove unnecessary syntax details, and generate a standard AST structure.
[0073] In a specific embodiment, S203 specifically includes:
[0074] Extract code text from the generated standard AST structure through AST analysis technology;
[0075] For the standard AST structure, assume that its adjacency list has a non-leaf node i, which has n child nodes, and the child node is j;
[0076] First, use the word embedding matrix:
[0077] Y i ∈R |V|×d ;
[0078] Among them, Y i is the word embedding matrix, V is the vocabulary, R is the set of real numbers, and d is the embedding dimension of the symbol;
[0079] The lexical vector of non-leaf node i is represented as:
[0080] v i =Y i X i ;
[0081] Among them, v i represents the lexical vector of leaf node i, X i is a one-dimensional vector, X i The element at the index position of the word represented by the non-leaf node i in the vocabulary is 1, and all its elements are 0;
[0082] Word vector h in code text i It is expressed as:
[0083]
[0084] Among them, h j is the updated hidden state of the child node, σ is the RELU activation function, and b n is the bias term, Y i The transposed matrix of .
[0085] Specifically, the specific method of extracting real code text through AST analysis technology includes: building an AST parser, the AST parser includes a lexical analyzer (Lexer) and a syntax analyzer (Parser), parsing the processed source code information into a standard AST structure through the lexical analyzer (Lexer) and the syntax analyzer (Parser); extracting code text containing entity, logical structure and attribute information based on the standard AST structure.
[0086] In the process of obtaining non-leaf nodes, not only the information of non-leaf node i itself is considered, but also the information of its child nodes is integrated. In this way, key information such as entities, logical structures and attribute information can be effectively extracted from the abstract syntax tree (AST), and then a data warehouse can be built and in-depth semantic information processing can be performed.
[0087] S3, build a CNN-based semantic processing model, use the code data in the data warehouse to train and learn the semantic processing model, obtain a trained semantic processing model, use the trained semantic processing model to perform semantic processing on the source code information to be tested, and obtain the verification result.
[0088] In a specific embodiment, S3 specifically includes:
[0089] The CNN-based semantic processing model includes input layer, convolution layer and fully connected layer;
[0090] The input layer receives the code text in the data warehouse, which is regarded as a sequence of multiple q-dimensional word vectors, where each word vector belongs to R q space, R represents the set of real numbers, assuming O p is the word vector of the pth word, then a code text T of length n′ is represented as:
[0091]
[0092] in, Represents the connection operation. The convolution layer uses convolution kernels of different sizes (h×m) for convolution operations. h is the height of the convolution kernel, and m is the width of the convolution kernel, which is consistent with the word vector dimension. In the convolution process, O p:p+h-1 represents the word vector matrix in the pth to p+h-1th window, then O p:p+h-1 A feature extractedp It is expressed as:
[0093] d p =f(W·O p:p+h-1 +b)
[0094] Among them, W is a weight matrix of size (h×m), b represents the bias term, and f is a nonlinear activation function;
[0095] The word vector matrix for a short text {o 1:h ,o 2:h+1 ,·····,o n′-h+1:n′}The convolution operation will result in a feature map, expressed as:
[0096] d=[d1,d2,·····d n′-h+1 ];
[0097] Among them, n′ represents the number of words in a code text, g represents the height of the convolution kernel window, and d is the feature map d∈R formed by a short text through a convolution kernel. n′-h+1 , since the height of the convolution kernel is h and the width is the dimension of the word vector, the feature map formed after convolution is a matrix with a height of n′-h+1 and a width of 1. Different convolution kernels can extract features from short texts from different angles. By setting the number of convolution kernels, multiple different feature maps can be obtained;
[0098] All convolutional feature maps are flattened and sent to the fully connected layer for operation. The operation of the fully connected layer is expressed as:
[0099] y=σ(W f p+b f );
[0100] Among them, p is the vector of all convolutional feature maps flattened, W f and b f are the weight and bias of the fully connected layer, σ is the RELU activation function, and y is the probability value of the source code information output by the fully connected layer being verified to be correct.
[0101] In a specific embodiment, during the training process of the CNN-based semantic processing model, the following loss function is used to measure the difference between the model prediction result and the actual label:
[0102] L=w1*y true *log (y) +w0*(1-y true )*log(1-y);
[0103] Among them, L is the loss function, w1 and w0 represent weights, y trueis the actual label, and y is the probability value of the source code information predicted by the semantic processing model to be correct.
[0104] Specifically, in the training phase of the semantic processing model, the code text in the data warehouse is input into the semantic processing model, and the semantic processing model obtains a prediction result, which is a verification result of whether the source code information is correct. A loss function is constructed based on the actual label and the prediction result. The loss function of this application adopts a cross entropy loss function. The semantic processing model is trained based on the loss function, and the semantic matching ability of the semantic processing model is quantitatively evaluated. The model parameters are adjusted or the model is retrained according to the evaluation results. The trained semantic processing model is used to provide intelligent code data configuration suggestions for the development, testing and maintenance of aerospace MOM software.
[0105] The present invention incorporates AST analysis and convolutional neural network (CNN) models, automatically analyzes the source code information of MOM software and constructs a standard AST structure, and further associates with the convolutional neural network model to achieve more accurate semantic information extraction and processing. This can not only help developers quickly understand the business logic of the code, but also perform in-depth semantic analysis on the code of MOM software, evaluate the correctness and potential risks of the business logic, provide configuration suggestions and early warning information for developers, reduce human errors, and improve development efficiency and system robustness.
[0106] This technological innovation is of great significance in the development and maintenance of MOM software in the aerospace field. It can greatly promote the widespread application of low-code development platforms in the aerospace field and accelerate the digital transformation of manufacturing companies. At the same time, it can also improve the reliability and safety of the system and ensure the efficient and stable operation of the aerospace system throughout its life cycle.
[0107] The above is only a specific implementation of the present invention, but the design concept of the present invention is not limited thereto. Any non-substantial changes to the present invention using this concept shall be deemed as an infringement of the protection scope of the present invention.
Claims
1. A semantic processing method based on aerospace MOM software code data warehouse, characterized in that: The steps include: S1, collects source code information in the field of aerospace MOM software and processes it to obtain processed source code information; S2, the processed source code information is subjected to lexical analysis and syntax analysis, and stored in an adjacency table to form a standardized AST structure; the code text is extracted through AST analysis technology, and the code text includes entity, logical structure and attribute information, and the extracted code text is combined with the processed data source to form code data and stored in a data warehouse; S3, construct a CNN-based semantic processing model, use the code data in the data warehouse to train and learn the semantic processing model, obtain a trained semantic processing model, use the trained semantic processing model to perform semantic processing on the source code information to be tested, and obtain a verification result.
2. A semantic processing method based on aerospace MOM software code data warehouse as claimed in claim 1, characterized in that: The S1 specifically includes: S101, processing the source code information includes removing redundancy, correcting format errors, and unifying coding standards to obtain processed source code information.
3. A semantic processing method based on aerospace MOM software code data warehouse as claimed in claim 1, characterized in that: The S2 specifically includes: S201, performing lexical analysis on the processed source code information to obtain a lexical unit sequence; S202, perform grammatical analysis on the lexical unit sequence, construct and store an adjacency table, and generate a standard AST structure; S203, extracting code text from the standard AST structure by using AST analysis technology.
4. A semantic processing method based on aerospace MOM software code data warehouse as described in claim 3, characterized in that: The S201 specifically includes: The lexical analyzer is used to first convert the processed source code information into a lexical unit sequence consisting of a series of lexical units, where the lexical unit is the smallest lexical component in the code; the lexical analyzer identifies the lexical units through pattern matching and assigns them to specific categories.
5. A semantic processing method based on aerospace MOM software code data warehouse as described in claim 3, characterized in that: The S202 specifically includes: The syntax analyzer receives the lexical unit sequence generated by the lexical analyzer and organizes the lexical unit sequence into a specific syntax tree according to the grammatical rules of the programming language. At this stage, the syntax analyzer will identify expressions and statement blocks and generate a specific syntax tree. After generating the specific syntax tree, the compiler will simplify the specific syntax tree, remove unnecessary syntax details, and generate a standard AST structure.
6. A semantic processing method based on aerospace MOM software code data warehouse as described in claim 3, characterized in that: The S203 specifically includes: Extract code text from the generated standard AST structure through AST analysis technology; For the standard AST structure, assume that its adjacency list has a non-leaf node i, which has n child nodes, and the child node is j; First, use the word embedding matrix: AND i ∈R |V|×d ; Among them, Y i is the word embedding matrix, V is the vocabulary, R is the set of real numbers, and d is the embedding dimension of the symbol; The lexical vector of non-leaf node i is represented as: v i =And i X i ; Among them, v i represents the lexical vector of leaf node i, X i is a one-dimensional vector, X i The element at the index position of the word represented by the non-leaf node i in the vocabulary is 1, and all its elements are 0; The word vector h in the code text i It is expressed as: h i =σ(Y i T v i +∑ j∈[1,n] h j +b n ); Among them, h j is the updated hidden state of the child node, σ is the RELU activation function, and b n is the bias term, Y i T Y i The transposed matrix of .
7. A semantic processing method based on aerospace MOM software code data warehouse as claimed in claim 1, characterized in that: The S3 specifically includes: The CNN-based semantic processing model includes an input layer, a convolutional layer and a fully connected layer; The input layer receives the code text in the data warehouse, which is regarded as a sequence of multiple q-dimensional word vectors, where each word vector belongs to R q space, R represents the set of real numbers, assuming O p is the word vector of the pth word, then a code text T of length n′ is represented as: in, Represents the connection operation. The convolution layer uses convolution kernels of different sizes (h×m) for convolution operations. h is the height of the convolution kernel, and m is the width of the convolution kernel, which is consistent with the word vector dimension. In the convolution process, O p:p+h-1 represents the word vector matrix in the pth to p+h-1th window, then O p:p+h-1 A feature extracted p It is expressed as: d p =f(W·O p:p+h-1 +b); Among them, W is a weight matrix of size (h×m), b represents the bias term, and f is a nonlinear activation function; The word vector matrix for a short text {o 1:h , o 2:h+1 ,·····,o n′-h+1:n′ }The convolution operation will result in a feature map, expressed as: d=[d1,d2,……d n′-h+1 ]; Among them, n′ represents the number of words in a code text, h represents the height of the convolution kernel window, and d is the feature map d∈R formed by a short text through a convolution kernel. n′-h+1 , since the height of the convolution kernel is h and the width is the dimension of the word vector, the feature map formed after convolution is a matrix with a height of n′-h+1 and a width of 1. Different convolution kernels can extract features from short texts from different angles. By setting the number of convolution kernels, multiple different feature maps can be obtained; All convolutional feature maps are flattened and sent to the fully connected layer for operation. The operation of the fully connected layer is expressed as: y=σ(W f p+b f ); Among them, p is the vector of all convolutional feature maps flattened, W f and b f are the weight and bias of the fully connected layer, σ is the RELU activation function, and y is the probability value of the source code information output by the fully connected layer being verified to be correct.
8. A semantic processing method based on aerospace MOM software code data warehouse as claimed in claim 1, characterized in that: During the training process of the CNN-based semantic processing model, the following loss function is used to measure the difference between the model prediction results and the actual labels: L=w1*y true *log (y) +w0*(1-y true )*log(1-y); Among them, L is the loss function, w1 and w0 represent weights, y true is the actual label, and y is the probability value of the source code information predicted by the semantic processing model to be correct.
Citation Information
Cited By
Data management method and device, electronic equipment, storage medium and program product
CN121092533A