Code abstract generation method based on multi-granularity feature fusion
Through multi-grained feature fusion and cross-attention mechanisms, highly accurate and readable code summary is generated, which solves the problems of semantic extraction bias, poor expansion and information fragmentation in the prior art.
Patent Information
- Application Number
- CN202510260828.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2045-03-06
AI Technical Summary
The existing code summary generation methods have problems such as semantic extraction bias, poor scalability and information fragmentation, making it difficult to generate code summary with high accuracy and readability.
Using a method based on multi-grained feature fusion, the source code is preprocessed to obtain three granular features: word sequence, abstract syntax tree and control flow diagram, a multi-grained feature encoder is built, and feature fusion is achieved through the cross attention mechanism, and finally input it into the Transformer decoder to generate a code summary.
It improves the accuracy and readability of code summary, reduces computational overhead, and solves the problems of inaccurate keyword extraction and information fragmentation caused by single granularity processing.