Method and device for analyzing software development kit
By parsing the software development kit (SDK) using abstract syntax trees and large language models, and generating and binding code snippets, the problem of inaccurate API code snippet retrieval in enterprise-level scenarios using large language models is solved, achieving high-precision code retrieval.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-22
- Publication Date
- 2026-03-27
AI Technical Summary
Existing large language models struggle to accurately recall API code snippets in enterprise-level scenarios, resulting in generated code that appears disorienting. This is mainly due to training data failing to cover SDK updates, excessively long input contexts, and missing or outdated enterprise-level documentation.
Different parsing methods are used to parse the Software Development Kit (SDK), including abstract syntax tree parsing and large language model parsing, to identify code snippets, which are then bound to the SDK to generate version information and saved to the search engine to improve recall accuracy.
By employing differentiated parsing strategies and version binding mechanisms, the accuracy of API code snippet retrieval has been significantly improved, meeting enterprise-level accuracy requirements and solving the retrieval difficulties of large language models in enterprise-level scenarios.
Smart Images

Figure CN121742883A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and more specifically, to a method and apparatus for parsing software development kits. Background Technology
[0002] With the rapid development of artificial intelligence (AI), AI-based programming is widely used in enterprise scenarios.
[0003] In existing technologies, Large Language Models (LLMs) are used for programming tasks such as code generation. For example, in enterprise-level scenarios, enterprise-level documents are input into the LLM to generate code. However, due to issues such as the expiration date of the training data for the LLM, which cannot cover subsequent SDK or version updates, the difficulty for the LLM to accurately locate keywords when the input context is too long, the missing or outdated enterprise-level documents, and the difficulty for the LLM to accurately identify the Application Programming Interface (API) corresponding to the SDK, the LLM cannot accurately recall API code fragments, resulting in the generated code exhibiting a "phantom" phenomenon.
[0004] In conclusion, improving the accuracy of API code snippet retrieval is a problem that needs to be solved. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and apparatus for parsing software development kits, which uses different parsing methods to parse SDKs of different package types and binds the parsed code snippets to the SDKs, thereby improving the accuracy of code snippet retrieval during subsequent retrieval processes.
[0006] In a first aspect, embodiments of the present invention provide a method for parsing a software development kit (SDK). The method includes: obtaining a software development kit (SDK); determining the package type of the SDK; determining a corresponding parsing method based on the package type of the SDK, wherein the parsing method includes abstract syntax tree parsing and large language model parsing; parsing the SDK using the parsing method corresponding to the SDK to determine the code snippet corresponding to the SDK; binding the code snippet to the SDK to generate SDK version information; and saving the SDK version information to a search engine.
[0007] Optionally, in response to the SDK package type being a Maven package, the step of parsing the SDK using the corresponding parsing method to determine the code segment corresponding to the SDK specifically includes: parsing the SDK using the abstract syntax tree parsing method to determine the code segment corresponding to the SDK.
[0008] Optionally, the step of parsing the SDK using the abstract syntax tree parsing method to determine the code snippet corresponding to the SDK specifically includes: parsing the SDK using the abstract syntax tree parsing method to determine the application programming interface (API) information and class definition information; and performing semantic enhancement on the API information and class definition information using a large language model to generate the code snippet corresponding to the SDK.
[0009] Optionally, in response to the SDK package type being an NPM package or a PyPI package, the step of parsing the SDK using the corresponding parsing method to determine the code segment corresponding to the SDK specifically includes: parsing the SDK using the large language model parsing method to determine the code segment corresponding to the SDK.
[0010] Optionally, the step of parsing the SDK using the large language model parsing method to determine the code snippet corresponding to the SDK specifically includes: parsing the SDK using the large language model parsing method to determine the source code content, API interfaces, and dependencies; and performing deep parsing of the source code content, API interfaces, and dependencies using the large language model to generate the code snippet corresponding to the SDK.
[0011] Optionally, after binding the code snippet to the SDK to generate SDK version information, the method further includes: vectorizing the SDK version information to generate vectorized SDK version information; and saving the vectorized SDK version information to a search engine.
[0012] Optionally, the method further includes: obtaining user query information; performing keyword extraction or semantic understanding on the user query information to generate keywords or semantics; retrieving the search engine based on the keywords or semantics to determine the SDK version information; and recalling the corresponding code snippet based on the SDK version information.
[0013] Secondly, embodiments of the present invention provide an apparatus for parsing a software development kit (SDK). The apparatus includes: an acquisition unit for acquiring a software development kit (SDK); a determination unit for determining the package type of the SDK; the determination unit is further configured to determine a corresponding parsing method based on the package type of the SDK, wherein the parsing method includes abstract syntax tree parsing and large language model parsing; a parsing unit for parsing the SDK using the parsing method corresponding to the SDK to determine the code snippet corresponding to the SDK; a binding unit for binding the code snippet to the SDK to generate SDK version information; and a saving unit for saving the SDK version information to a search engine.
[0014] Optionally, in response to the SDK's package type being a Maven package, the parsing unit is specifically used to: parse the SDK using the abstract syntax tree parsing method to determine the code segment corresponding to the SDK.
[0015] Optionally, the parsing unit is specifically used to: parse the SDK using the abstract syntax tree parsing method to determine the application programming interface (API) information and class definition information; and to perform semantic enhancement on the API information and class definition information using a large language model to generate code snippets corresponding to the SDK.
[0016] Optionally, in response to the SDK package type being an NPM package or a PyPI package, the parsing unit is specifically used to: parse the SDK using the large language model parsing method to determine the code segment corresponding to the SDK.
[0017] Optionally, the parsing unit is specifically used to: parse the SDK using the large language model parsing method to determine the source code content, API interfaces, and dependencies; and perform deep parsing of the source code content, API interfaces, and dependencies using the large language model to generate code snippets corresponding to the SDK.
[0018] Optionally, the device further includes: a processing unit, configured to vectorize the SDK version information to generate vectorized SDK version information; the storage unit is further configured to: save the vectorized SDK version information to the search engine.
[0019] Optionally, the acquisition unit is further configured to: acquire user query information; the device further includes: a generation unit, configured to extract keywords or perform semantic understanding on the user query information to generate keywords or semantics; a retrieval unit, configured to retrieve the search engine based on the keywords or semantics to determine the SDK version information; and a recall unit, configured to recall the corresponding code segment based on the SDK version information.
[0020] Thirdly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in the first aspect or any one of the possible methods of the first aspect.
[0021] Fourthly, embodiments of the present invention provide a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the method as described in the first aspect or any one of the possibilities of the first aspect.
[0022] In this embodiment of the invention, the following steps are taken: A Software Development Kit (SDK) is obtained; the package type of the SDK is determined; a corresponding parsing method is determined based on the package type of the SDK, wherein the parsing method includes abstract syntax tree parsing and large language model parsing; the SDK is parsed using the parsing method corresponding to the SDK to determine the code snippet corresponding to the SDK; the code snippet is bound to the SDK to generate SDK version information; and the SDK version information is saved to a search engine. Through this method, different parsing methods can be used to parse the SDK according to different package types, and the parsed code snippets can be bound to the SDK to improve the accuracy of code snippet retrieval in subsequent retrieval processes. Attached Figure Description
[0023] The above and other objects, features and advantages of the present invention will become clearer from the following description of embodiments of the invention with reference to the accompanying drawings, in which: Figure 1 This is a flowchart of a method for parsing a software development kit according to an embodiment of the present invention; Figure 2 This is a flowchart of a method for static analysis of Java AST in an embodiment of the present invention; Figure 3 This is a flowchart of a large language model parsing embodiment of the present invention; Figure 4 This is a flowchart of another software development kit (SDK) parsing embodiment of the present invention; Figure 5 This is a flowchart of a vectorization process in an embodiment of the present invention; Figure 6 This is a flowchart of a user query in an embodiment of the present invention; Figure 7 This is a schematic diagram of an MCP retrieval process in an embodiment of the present invention; Figure 8 This is a flowchart of a product interaction interface in an embodiment of the present invention; Figure 9 This is a flowchart illustrating the process of parsing a software development kit in an embodiment of the present invention; Figure 10 This is a schematic diagram of a device for parsing a software development kit according to an embodiment of the present invention; Figure 11 This is a schematic diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0024] The present application is described below based on embodiments, but it is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without these details. To avoid obscuring the substance of the present application, well-known methods, processes, flows, elements, and circuits are not described in detail.
[0025] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.
[0026] Unless the context explicitly requires it, words such as "including" or "contains" throughout the application should be interpreted as including rather than exclusive or exhaustive; that is, meaning "including but not limited to".
[0027] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this application, unless otherwise stated, "a plurality of" means two or more.
[0028] In existing technologies, code context extraction schemes based on document parsing or Large Language Models (LLMs) are used for programming tasks such as code generation. However, the document parsing-based code context extraction scheme heavily relies on the document quality of public repositories like GitHub, resulting in insufficient adaptability to enterprise-level scenarios and inaccurate version inference based on documents. As for LLMs used for code generation, in enterprise-level scenarios, enterprise-level documents are input into the LLM for code generation. However, due to issues such as training data deadlines (failing to cover subsequent SDK or version updates), excessively long input contexts leading to difficulties in accurate keyword localization, missing or outdated enterprise-level documents, and the inability of the LLM to accurately identify the corresponding APIs for SDKs, the LLM cannot accurately recall API code snippets, resulting in "illusory" code generated by the LLM. Therefore, improving the accuracy of API code snippet recall is a problem that needs to be solved.
[0029] In this embodiment of the invention, to solve the above problems, a method for parsing software development kits is proposed, specifically as follows: Figure 1 As shown, the method includes: Step S101: Obtain the Software Development Kit (SDK).
[0030] Specifically, the software development kit (SDK) is a set of development tools provided for a specific platform, programming language, or functional scenario to help developers quickly build applications that conform to the platform's specifications without having to implement underlying functions from scratch. The SDK includes library files, development tools, documentation, and sample projects, etc. The documentation includes API descriptions, development guidelines, sample code, debugging tutorials, etc., which are only illustrative examples here.
[0031] Step S102: Determine the package type of the SDK.
[0032] Specifically, the package type can be a Maven package, a Node.js Package Manager (NPM) package, or a PyPI package. A Maven package is a project build and dependency management tool for Java Virtual Machine (JVM) languages such as Java / Scala. It is an SDK packaged according to the Maven specification, typically with a .jar file as its core file, and is stored in the Maven Central Repository. An NPM package is a JavaScript / TypeScript SDK that conforms to the NPM specification, stored in the NPM public repository, and its core consists of .js / .ts code files and a package.json file describing dependencies. A PyPI package is the official Python package repository. It is an SDK that conforms to the Python packaging specification and exists in .whl or .tar.gz format. This is only an illustrative example; other package types can also be used in actual applications.
[0033] Step S103: Determine the corresponding parsing method according to the package type of the SDK.
[0034] Specifically, the parsing methods include abstract syntax tree parsing and large language model (LLM) parsing.
[0035] In one possible implementation, the Abstract Syntax Tree (AST) parsing can specifically be a Java Abstract Syntax Tree, used for static analysis of Java source code structure to extract structured information such as method signatures, class definitions, and dependencies; the LLM parsing method is to parse the SDK using LLM.
[0036] Step S104: Parse the SDK using the parsing method corresponding to the SDK to determine the code segment corresponding to the SDK.
[0037] In one possible implementation, in response to the SDK's package type being a Maven package, the step of parsing the SDK using the corresponding parsing method to determine the corresponding code snippet specifically includes: parsing the SDK using the abstract syntax tree parsing method to determine the corresponding code snippet; specifically, parsing the SDK using the abstract syntax tree parsing method to determine the application programming interface (API) information and class definition information; and semantically enhancing the API information and class definition information using a large language model to generate the corresponding code snippet.
[0038] In one possible implementation, a Java Parser can be used for static syntax analysis to extract structured information such as method signatures, return types, and import dependencies. The method signatures and return types mentioned above are the API information, and the structured information such as import dependencies is the class definition information. This is only an illustrative example, and the specific information extracted and the classification should be determined according to the actual situation.
[0039] For example, such as Figure 2 As shown, the Figure 2This is a flowchart of the Java AST static analysis method. Specifically, it describes the Java AST static analysis of a Maven package. First, it extracts method signatures, return type, and import dependencies, and handles wildcard imports. The wildcard handling process is as follows: For wildcard scenarios such as `import com.aoao.tc.domain.query.*`, all possible source paths are listed, generating a candidate class name list. Then, dependency analysis, identification of external dependency SDKs, and deep analysis of key dependency classes are performed sequentially. The dependency analysis is implemented by combining artifact metadata information to analyze the external dependency class paths referenced by all methods in the SDK, identifying the dependency source SDKs, constructing a complete dependency graph, and performing deep analysis of key dependency classes to provide more comprehensive and accurate dependency information, ensuring the integrity of dependency information. Next, SDK size is determined (also known as class definition). If the SDK is small-scale, for example, less than 1000 classes, a full analysis strategy is adopted. If the class size is <1.5KB, all content is retained to ensure information integrity; if the class size is >1.5KB... If the class size exceeds the limit (e.g., class declaration, inheritance relationship, public fields / methods, etc.), priority is given to extracting core information. If the class size exceeds the limit, over-limit processing is performed, specifically by truncating and displaying the first 1.5KB of content and indicating the source SDK. If the SDK is a large-scale SDK, for example, with more than 1000 classes, an on-demand parsing strategy is adopted. For example, POJO classes, exception classes, constant classes, or enumeration classes are parsed in a focused manner. The above on-demand parsing strategy ensures that the core information retention coverage reaches more than 80%, avoids redundant information, and improves processing efficiency. The parsed information is input into the LLM for semantic enhancement to generate the code snippets corresponding to the SDK. Specifically, the semantic enhancement is to supplement the existing API signatures and class definitions with semantics (e.g., method descriptions, SDK overviews, etc.) to improve the richness of the context.
[0040] In one possible implementation, before the Java AST performs static parsing of the Maven package, the user can select a parsing mode according to their needs. The parsing modes include interface public methods, interface and build / static methods, and all public methods, etc., which are determined according to the actual situation.
[0041] In one possible implementation, as described above Figure 2 After generating code snippets, you can also standardize the code snippets to generate the final code snippets.
[0042] In one possible implementation, in response to the SDK's package type being an NPM package or a PyPI package, the step of parsing the SDK using the corresponding parsing method to determine the corresponding code snippet specifically includes: parsing the SDK using the large language model parsing method to determine the corresponding code snippet. Specifically, the large language model parsing method is used to parse the SDK to determine the source code content, API interfaces, and dependencies; the source code content, API interfaces, and dependencies are then subjected to deep parsing using the large language model to generate the code snippet corresponding to the SDK.
[0043] For example, such as Figure 3 As shown, the NPM or PyPI package is parsed using a large language model. First, the NPM or PyPI package is input into the LLM for primary parsing, which extracts and determines the source code content, API interfaces, and dependencies. Then, the source code content, API interfaces, and dependencies are input into the LLM for deep parsing, generating code snippets.
[0044] In one possible implementation, after generating the code snippet, the code snippet quality can be verified and optimized, and the optimized code snippet can be standardized to generate the final code snippet.
[0045] Step S105: Bind the code snippet to the SDK to generate SDK version information.
[0046] In one possible implementation, the code snippet includes API-related code snippets and class definition-related code snippets; after obtaining the SDK's unique encoded ID, the ID is bound to the corresponding code snippet to generate SDK version information, that is, the SDK version information includes API-related code snippets and class definition-related code snippets.
[0047] Step S106: Save the SDK version information to the search engine.
[0048] Specifically, the search engine can be the tisplus3 search engine. Assuming that the tisplus3 search engine includes an SDK table, a code snippet table, and a class definition table, the SDK name, API-related code snippets, and class definition-related code snippets in the SDK version information are stored in the corresponding tables, and the specified IDs are stored simultaneously during the storage process.
[0049] In this embodiment of the invention, after binding the code snippet to the SDK and generating SDK version information, the method further includes other steps, specifically as follows: Figure 4 As shown: Step S107: Vectorize the SDK version information to generate vectorized SDK version information.
[0050] Step S108: Save the vectorized SDK version information to the search engine.
[0051] For example, specifically as follows: Figure 5 As shown, when the code snippets in the SDK version information are vectorized, they can be vectorized into text, code structure, and semantics respectively. The resulting vectors are then fused into multi-dimensional vectors, normalized, and indexed, and finally stored in the tisplus3 search engine.
[0052] In one possible implementation, similarity calculation optimization and retrieval performance optimization are performed after saving to the tisplus3 search engine.
[0053] In this embodiment of the invention, the tisplus3 search engine, which is pre-built using the above scheme, stores SDK version information in the tisplus3 search engine for subsequent processing.
[0054] In one possible implementation, a user query flowchart is proposed, as follows: Figure 6 As shown, it includes the following: Step S601: Obtain user query information.
[0055] Specifically, the user query information is information input by the user according to their own needs. This user query information can be input into the hybrid retrieval engine, and then the subsequent step S602 can be executed. Alternatively, the user query information can be input into the agent, and the Model Context Protocol (MCP) in the agent can sequentially call the hybrid retrieval engine according to the MCP toolchain to perform the retrieval. The MCP provides a standardized tool call interface for the agent's artificial intelligence model (or large semantic model), supporting functions such as package search, code snippet search, and class definition query. The MCP toolchain extends from resolve-library-id to get-library-docs and then to get-class-content. resolve-library-id is used to search for matching library information based on the library name, returning the library ID, name, description, etc., where the library ID is the ID of the SDK. get-library-docs is used to obtain documentation and code examples based on the precise library ID, where the code examples are code snippets. get-class-content is used to query class definitions based on the classpath, supporting dependency analysis.
[0056] Step S602: Extract keywords or perform semantic understanding on the user query information to generate keywords or semantics.
[0057] Specifically, a large language model is used to extract keywords or understand semantics from the user query information to generate keywords or semantics.
[0058] Step S603: Search the search engine based on the keywords or semantics to determine the SDK version information.
[0059] In one possible implementation, the SDK version information is determined based on the keywords or semantic search engine tisplus3.
[0060] Step S604: Retrieve the corresponding code snippet based on the SDK version information.
[0061] Specifically, the SDK version information is used to calculate similarity, sort candidate structures, fuse search results, and reorder relevance to determine the corresponding code snippets.
[0062] In one possible implementation, a schematic diagram of the retrieval via the MCP is shown below. Figure 7 As shown, after receiving the user's query information, the agent calls the MCP. The MCP executes resolve-library-id, which searches for and matches library names and information, returning the library ID and description. Then, it uses get-library-docs to perform a precise library ID query, retrieve documents and code examples, and return code snippets. Next, it uses get-class-content to perform a class path query, retrieve class definitions, and return class structure information. Finally, it uses one or more of the library ID and description, code snippets, and class structure information to enter the hybrid search engine, and uses the tisplus3 search engine to retrieve the code snippets.
[0063] In this embodiment of the invention, the recalled code snippets can be used for AI programming assistance, which includes SDK parsing triggering, intelligent search interface, and code snippet copying. The SDK parsing triggering supports package information input, parsing mode selection, and parsing status monitoring. The intelligent search interface supports natural language search, class path search, and API fuzzy search. The code snippet copying supports code snippet selection, format standardization, and copying to the clipboard. This is merely an illustrative example; the specific uses of other recalled code snippets will be determined based on actual circumstances.
[0064] In one possible implementation, the processing flowchart of the intelligent agent's product interaction interface is as follows: Figure 8As shown, the product interaction interface can realize SDK parsing triggering, intelligent search interface, and code snippet copying respectively; wherein, the specific processing flow of SDK parsing triggering includes package information input, triggering parsing task, parsing status monitoring, and parsing result display; the specific triggering flow of intelligent search interface includes natural language search, class path search, and API fuzzy search, and outputs search results display; the processing flow of code snippet copying includes code snippet selection, format standardization, and copying to clipboard.
[0065] In this embodiment of the invention, a complete example is used to describe the overall process of parsing a software development kit (SDK), specifically as follows: Figure 9 As shown, the received multilingual SDK package undergoes package type identification to determine if it is a Maven package, NPM package, or PyPI package. If the SDK package is a Maven package, Java AST project parsing is performed, followed by API signature extraction, dependency analysis, class definition layered parsing, and LLM semantic enhancement to generate corresponding code snippets for the SDK. If the SDK package is an NPM or PyPI package, LLM-led parsing, source code content extraction, LLM deep parsing, code snippet generation, and quality inspection and optimization are performed to generate corresponding code snippets for the SDK. The code snippets corresponding to the SDK are standardized and bound to the SDK to generate SDK version information. This SDK version information is then vectorized and stored in the tisplus3 search engine. User queries are directly input into the hybrid search engine for keyword and / or semantic retrieval, followed by retrieval using the tisplus3 search engine. The search results are then merged and ranked by quality. Finally, AI programming assistance, code snippet copying, API documentation generation, and dependency analysis are performed at the product interaction layer.
[0066] In this embodiment of the invention, the method for parsing software development kits can be used in various scenarios, such as complex Maven package API integration scenarios, API parsing scenarios without documentation, and enterprise-level third-party package coding assistance scenarios. Specifically, in the complex Maven package API integration scenario, the input Maven package is, for example, named com.aoao.Trade, which includes 1707 APIs and 42 core dependencies. The Maven package is then processed using JavaAST to extract API signatures, perform dependency analysis, employ a layered parsing strategy, and enhance LLM semantics, outputting accurate API call code. This API call code includes correct import statements and method signatures. In the API parsing scenario without documentation, a single SDK can be parsed into multiple APIs based on source code analysis, eliminating reliance on documentation quality. In the enterprise-level third-party package coding assistance scenario, accurate information can be obtained through the MCP tool, achieving precise integration and automatic code generation (99% of the code is generated automatically), resolving the illusion problem in AI programming and improving coding accuracy and efficiency.
[0067] Through the above embodiments, differentiated parsing strategies are adopted for SDKs of different sizes, optimizing processing efficiency while ensuring parsing quality. The source code of the SDK package is directly parsed without relying on high-quality documentation. API information is extracted directly through Java AST static analysis, significantly improving API parsing capabilities in undocumented scenarios. Binding using SDK IDs ensures API call consistency, achieving precise version matching with a parsing accuracy exceeding 95%, meeting enterprise-level precision requirements. Deep analysis of SDK dependencies supports dependency parsing in complex enterprise-level scenarios, providing complete class definitions and inheritance relationship information. Source code generation ensures code reliability and usability, reducing illusions through version binding mechanisms and enabling automatic code generation.
[0068] In this embodiment of the invention, an apparatus for parsing software development kits is provided, such as... Figure 10 As shown, it specifically includes: an acquisition unit 1001, a determination unit 1002, a parsing unit 1003, a binding unit 1004, and a storage unit 1005; The acquisition unit 1001 is used to acquire a software development kit (SDK); the determination unit 1002 is used to determine the package type of the SDK; the determination unit 1002 is also used to determine the corresponding parsing method according to the package type of the SDK, wherein the parsing method includes abstract syntax tree parsing and large language model parsing; the parsing unit 1003 is used to parse the SDK using the parsing method corresponding to the SDK to determine the code segment corresponding to the SDK; the binding unit 1004 is used to bind the code segment to the SDK to generate SDK version information; and the saving unit 1005 is used to save the SDK version information to the search engine.
[0069] Furthermore, in response to the SDK's package type being a Maven package, the parsing unit is specifically used to: parse the SDK using the abstract syntax tree parsing method to determine the code segment corresponding to the SDK.
[0070] Furthermore, the parsing unit is specifically used to: parse the SDK using the abstract syntax tree parsing method to determine the application programming interface (API) information and class definition information; and to perform semantic enhancement on the API information and class definition information using a large language model to generate code snippets corresponding to the SDK.
[0071] Furthermore, in response to the SDK's package type being an NPM package or a PyPI package, the parsing unit is specifically used to: parse the SDK using the large language model parsing method to determine the code segment corresponding to the SDK.
[0072] Furthermore, the parsing unit is specifically used to: parse the SDK using the large language model parsing method to determine the source code content, API interfaces, and dependencies; and perform deep parsing of the source code content, API interfaces, and dependencies using the large language model to generate code snippets corresponding to the SDK.
[0073] Furthermore, the device further includes: a processing unit, configured to vectorize the SDK version information to generate vectorized SDK version information; the storage unit is also configured to: save the vectorized SDK version information to the search engine.
[0074] Furthermore, the acquisition unit is also used to: acquire user query information; the device further includes: a generation unit, used to extract keywords or understand semantics from the user query information to generate keywords or semantics; a retrieval unit, used to retrieve the search engine based on the keywords or semantics to determine the SDK version information; and a recall unit, used to recall the corresponding code segment based on the SDK version information.
[0075] Figure 11 This is a schematic diagram of the structure of the electronic device described in an embodiment of the present invention. Figure 11 As shown, it includes a general computer hardware architecture, which includes at least a processor 1101 and a memory 1102. The processor 1101 and the memory 1102 are connected via a bus 1103. The memory 1102 is adapted to store instructions or programs executable by the processor 1101. The processor 1101 can be a standalone microprocessor or a collection of one or more microprocessors. Thus, the processor 1101 executes the instructions stored in the memory 1102 to perform the method flow of the embodiments of the present invention as described above, thereby realizing data processing and control of other devices. The bus 1103 connects the above-mentioned components together, and also connects the above-mentioned components to the display controller 1104, the display device, and the input / output (I / O) device 1105. The input / output (I / O) device 1105 can be a mouse, keyboard, modem, network interface, touch input device, motion-sensing input device, printer, and other devices known in the art. Typically, the input / output device 1105 is connected to the system via an input / output (I / O) controller 1106.
[0076] The instructions stored in memory 1102 are executed by at least one processor 1101 to achieve the following: obtaining a software development kit (SDK); determining the package type of the SDK; determining the corresponding parsing method based on the package type of the SDK; parsing the SDK using the parsing method corresponding to the SDK to determine the code segment corresponding to the SDK; binding the code segment to the SDK to generate SDK version information; and saving the SDK version information to a search engine.
[0077] Specifically, the electronic device includes: one or more processors 1101 and a memory 1102. Figure 11 Take processor 1101 as an example. Processor 1101 and memory 1102 can be connected via a bus or other means. Figure 11 Taking a bus connection as an example, memory 1102, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Processor 1101 executes various functional applications and data processing of the device by running the non-volatile software programs, instructions, and modules stored in memory 1102, thereby implementing the aforementioned method for determining and parsing the software development kit.
[0078] Memory 1102 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; the data storage area may store an option list, etc. Furthermore, memory 1102 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 1102 may optionally include memory remotely located relative to processor 1101, and these remote memories may be connected to external devices via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0079] One or more modules are stored in memory 1102, and when executed by one or more processors 1101, they execute the method for parsing the software development kit in any of the above method embodiments.
[0080] As those skilled in the art will recognize, various aspects of the embodiments of the present invention can be implemented as a system, method, or computer program product. Therefore, various aspects of the embodiments of the present invention can take the form of a completely hardware implementation, a completely software implementation (including firmware, resident software, microcode, etc.), or an implementation combining software and hardware aspects, which may generally be referred to herein as a "circuit," "module," or "system." Furthermore, various aspects of the embodiments of the present invention can take the form of a computer program product implemented in one or more computer-readable media having computer-readable program code implemented thereon.
[0081] Any combination of one or more computer-readable media can be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, (but not limited to) an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination thereof. More specific examples (not an exhaustive list) of computer-readable storage media will include: an electrical connection having one or more wires, a portable computer floppy disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable optical disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the context of embodiments of the present invention, a computer-readable storage medium can be any tangible medium capable of containing or storing a program used by or in conjunction with an instruction execution system, device, or apparatus.
[0082] Computer-readable signal media may include propagated digital signals having computer-readable program code implemented therein, such as in baseband or as part of a carrier wave. Such propagated signals may take any of a variety of forms, including, but not limited to, electromagnetic, optical, or any suitable combination thereof. A computer-readable signal medium may be any computer-readable medium that is not a computer-readable storage medium and can communicate, propagate, or transmit a program used by or in conjunction with an instruction execution system, device, or apparatus.
[0083] Program code implemented on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, fiber optic cable, RF, or any suitable combination thereof.
[0084] Computer program code for performing operations relating to various aspects of embodiments of the present invention can be written in any combination of one or more programming languages, including: object-oriented programming languages such as Java, Smalltalk, C++, etc.; and conventional procedural programming languages such as the "C" programming language or similar programming languages. The program code can be executed as a standalone software package entirely on the user's computer, partially on the user's computer, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet provided by an Internet service provider).
[0085] The flowchart illustrations and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention describe various aspects of the embodiments of the present invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus to produce a machine such that the instructions (executed via the processor of the computer or other programmable data processing apparatus) create means for implementing the functions / actions specified in the flowchart and / or block diagram blocks or blocks.
[0086] These computer program instructions may also be stored in a computer-readable medium that can direct a computer, other programmable data processing apparatus or other means to operate in a particular manner, such that the instructions stored in the computer-readable medium produce an article of writing that includes instructions that implement the functions / actions specified in flowchart and / or block diagram blocks or blocks.
[0087] Computer program instructions may also be loaded onto a computer, other programmable data processing apparatus or other device to cause a series of operable steps to be performed on the computer, other programmable apparatus or other device to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable apparatus, provide for implementing the functions / actions specified in flowchart and / or block diagram blocks or blocks.
[0088] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
[0089] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, and displayed data) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use, and processing of such data must comply with the relevant laws, regulations, and standards of the relevant countries and regions, and corresponding access points are provided for users to choose to authorize or refuse processing. A user's refusal to process personal information beyond what is necessary for basic functions will not affect the user's use of basic functions.
Claims
1. A method for parsing a software development kit, characterized in that, The method includes: Obtain the Software Development Kit (SDK); Determine the package type of the SDK; The corresponding parsing method is determined based on the package type of the SDK, wherein the parsing method includes abstract syntax tree parsing and large language model parsing; The SDK is parsed using the parsing method corresponding to the SDK to determine the code segment corresponding to the SDK; Bind the code snippet to the SDK to generate SDK version information; Save the SDK version information to the search engine.
2. The method according to claim 1, characterized in that, In response to the fact that the SDK package type is a Maven package, the step of parsing the SDK using the corresponding SDK parsing method to determine the code segment corresponding to the SDK specifically includes: The SDK is parsed using the abstract syntax tree parsing method to determine the code segment corresponding to the SDK.
3. The method according to claim 2, characterized in that, The step of parsing the SDK using the abstract syntax tree parsing method to determine the code segment corresponding to the SDK specifically includes: The SDK is parsed using the abstract syntax tree parsing method to determine the application programming interface (API) information and class definition information; The API information and class definition information are semantically enhanced using a large language model to generate code snippets corresponding to the SDK.
4. The method according to claim 1, characterized in that, In response to the SDK being an NPM or PyPI package, the SDK is parsed using the corresponding parsing method to determine the corresponding code segment, specifically including: The SDK is parsed using the large language model parsing method to determine the code segment corresponding to the SDK.
5. The method according to claim 4, characterized in that, The process of parsing the SDK using the large language model to determine the corresponding code snippets specifically includes: The SDK is parsed using the large language model parsing method to determine the source code content, API interfaces, and dependencies; The source code content, API interfaces, and dependencies are analyzed using a large language model to generate code snippets corresponding to the SDK.
6. The method according to claim 1, characterized in that, After binding the code snippet to the SDK and generating SDK version information, the method further includes: The SDK version information is vectorized to generate vectorized SDK version information. The vectorized SDK version information is saved to the search engine.
7. The method according to claim 1, characterized in that, The method further includes: Obtain user query information; The user query information is subjected to keyword extraction or semantic understanding to generate keywords or semantics; The SDK version information is determined by searching the search engine based on the keywords or semantics. Retrieve the corresponding code snippet based on the SDK version information.
8. An apparatus for parsing software development kits, characterized in that, The device includes: The acquisition unit is used to acquire the Software Development Kit (SDK). A determining unit is used to determine the package type of the SDK; The determining unit is further configured to determine the corresponding parsing method according to the package type of the SDK, wherein the parsing method includes abstract syntax tree parsing and large language model parsing; The parsing unit is used to parse the SDK using the parsing method corresponding to the SDK, and determine the code segment corresponding to the SDK; A binding unit is used to bind the code snippet to the SDK and generate SDK version information; A storage unit is used to save the SDK version information to the search engine.
9. An electronic device comprising a memory and a processor, characterized in that, The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1-7.