Function calling method, device, equipment and storage medium based on development platform
By splitting and deduplication of the development platform's function code, personalized function encoding and call requests are generated, which solves the problem that the development platform cannot realize personalized function calls and improves the satisfaction of user needs.
Patent Information
- Application Number
- CN202111446598.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2041-11-30
AI Technical Summary
Existing development platforms cannot realize personalized function calls to users, and fixed docking standards cannot meet users' differentiated needs.
By obtaining the source code of the development platform, split it into the function code of each callable function, further split it into the minimum function code, deduplication and encoding, generate target encoding according to user needs, and generate call requests to realize function calls.
It realizes personalized function calls to users, avoids the limitations of fixed functions, and improves the compliance of development efficiency and user needs.
Smart Images

Figure CN114138243B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a function calling method, device, electronic device and computer-readable storage medium based on a development platform. Background Art
[0002] With the diversification of user needs and the complexity of the logic of realizing the needs in software, the workload of the software function development process has become increasingly huge. Therefore, in order to improve the development efficiency for user needs, more and more developers have encapsulated the various functions that users want to obtain into easy-to-use API interfaces through IT technology, and provided users with diversified service functions through interface calls. This kind of API interface is called an open API, and the platform that provides such an open API interface is itself called a development platform.
[0003] The existing method of using a development platform to call functions is mostly based on preset docking standards, that is, calling the existing functions that the development platform can provide according to the docking standards pre-set in the development platform to provide services to users. However, due to the large differences in the needs of different users, the fixed docking standards in this method cannot meet the personalized needs of users. Summary of the invention
[0004] The present invention provides a function calling method, device and computer-readable storage medium based on a development platform, the main purpose of which is to solve the problem that the development platform cannot realize personalized function calling for users.
[0005] To achieve the above object, the present invention provides a function calling method based on a development platform, comprising:
[0006] Obtaining source code of a preset development platform, and splitting the source code into function codes corresponding to each callable function in the development platform;
[0007] Obtaining the implementation logic of each of the callable functions, and splitting the function code into minimum function codes according to the implementation logic;
[0008] De-duplication processing is performed on the minimum function code, and non-repetitive encoding is performed on the minimum function code after de-duplication, so as to obtain a function code corresponding to each minimum function code;
[0009] Obtaining user needs, determining the target function to be called according to the user needs, and obtaining the target code corresponding to the target function from the function code;
[0010] A calling request is generated according to the target code and a preset user identifier, and the function of the development platform is called using the calling request.
[0011] Optionally, splitting the function code into minimum function codes according to the implementation logic includes:
[0012] Execute the code in the target area to obtain an execution result;
[0013] Determining whether the code in the target area can realize the function of the implementation logic according to the execution result;
[0014] If the target area cannot realize the function of the realization logic, the target area is expanded, and the code in the target area is executed back to obtain the execution result;
[0015] If the code in the target area can realize the function of the implementation logic, it is determined that the code contained in the target area is the minimum functional code.
[0016] Optionally, the performing deduplication processing on the minimum function code includes:
[0017] Selecting one of the minimum function codes as the target function code one by one from the minimum function codes;
[0018] Calculating the degree of overlap between the target function code and the minimum function code that has not been selected;
[0019] The minimum function codes whose overlap is greater than a preset threshold value among the minimum function codes that have not been selected are deleted.
[0020] Optionally, the non-repetitive encoding of the minimum function code after deduplication to obtain the function code corresponding to each minimum function code includes:
[0021] Randomly arranging the minimum function codes after deduplication to obtain a code queue;
[0022] The deduplicated minimum function codes are numbered incrementally according to the sequence of each minimum function code in the code queue, and the number of each minimum function code is used as the function code.
[0023] Optionally, determining the target function to be called according to the user demand includes:
[0024] Performing word segmentation processing on the user demand to obtain demand word segmentation;
[0025] Convert the demand word segmentation into word vectors, and concatenate the word vectors into a vector matrix;
[0026] Obtaining the function label corresponding to each of the minimum function codes, and calculating the distance value between the vector matrix and each of the function labels one by one;
[0027] Determine that the function implemented by the minimum function code corresponding to the function tag whose distance value is less than the preset distance threshold is the target function.
[0028] Optionally, performing word segmentation processing on the user demand to obtain demand word segmentation includes:
[0029] Deleting meaningless words from the user requirements to obtain standard corpus;
[0030] The standard corpus is searched in a preset dictionary according to different data lengths, and the words retrieved from the dictionary that are the same as those in the standard corpus are collected as corpus segmentation required by the user.
[0031] Optionally, generating a call request according to the target code and a preset user identifier includes:
[0032] Converting the target code and the user identifier into a data field;
[0033] Filling the data field into a preset parameter-free data request to obtain a parameter-containing request;
[0034] The parameter-containing request is compiled to obtain the calling request.
[0035] In order to solve the above problems, the present invention also provides a function calling device based on a development platform, the device comprising:
[0036] A source code splitting module, used to obtain the source code of a preset development platform, and split the source code into function codes corresponding to each callable function in the development platform;
[0037] A function splitting module, used for obtaining the implementation logic of each of the callable functions, and splitting the function code into minimum function codes according to the implementation logic;
[0038] A code deduplication module is used to perform deduplication processing on the minimum function code, and perform non-repetitive encoding on the deduplicated minimum function code to obtain a function code corresponding to each minimum function code;
[0039] A demand analysis module is used to obtain user demand, determine the target function to be called according to the user demand, and query the target code corresponding to the target function from the function code;
[0040] The function calling module is used to generate a calling request according to the target code and a preset user identifier, and use the calling request to call the function of the development platform.
[0041] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0042] at least one processor; and,
[0043] a memory communicatively connected to the at least one processor; wherein,
[0044] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the above-mentioned function calling method based on the development platform.
[0045] In order to solve the above problem, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned function calling method based on the development platform.
[0046] The embodiment of the present invention can disassemble the codes of various functions in a development platform that aggregates multiple functions, so as to split a single fixed function into multiple sub-functions that cannot be split any further, and then after analyzing the user's needs, it can make targeted function calls according to the user's needs, avoiding providing only fixed functions in the platform to the user, and realizing personalized function calls for the user. Therefore, the function call method, device, electronic device and computer-readable storage medium based on the development platform proposed by the present invention can solve the problem that the development platform cannot realize personalized function calls for users. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A schematic diagram of a flow chart of a function calling method based on a development platform provided in one embodiment of the present invention;
[0048] Figure 2 A schematic diagram of a process for splitting a function code into minimum function codes provided by an embodiment of the present invention;
[0049] Figure 3 A schematic diagram of a process for performing deduplication processing on a minimum function code according to an embodiment of the present invention;
[0050] Figure 4 A functional module diagram of a function calling device based on a development platform provided by an embodiment of the present invention;
[0051] Figure 5 A schematic diagram of the structure of an electronic device for implementing the function calling method based on the development platform provided in one embodiment of the present invention.
[0052] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0054] The embodiment of the present application provides a function calling method based on a development platform. The execution subject of the function calling method based on the development platform includes but is not limited to at least one of the electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the function calling method based on the development platform can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0055] Reference Figure 1 FIG. 1 is a flow chart of a method for calling a function based on a development platform according to an embodiment of the present invention. In this embodiment, the method for calling a function based on a development platform includes:
[0056] S1. Obtain source code of a preset development platform, and split the source code into function codes corresponding to each callable function in the development platform.
[0057] In the embodiment of the present invention, the development platform includes a functional platform that is authorized to provide services to the outside world, for example, a DevCloud platform, a CODING platform, etc.
[0058] In detail, the source code is the underlying code corresponding to different functions that can be provided to the outside world in the development platform, for example, the underlying code of the transaction function, the underlying code of the login function, etc.
[0059] In an embodiment of the present invention, a computer statement with a data capture function (such as a Java statement, a Python statement, etc.) can be used to capture the source code from a preset storage area corresponding to the development platform, wherein the preset storage area includes but is not limited to a database, a blockchain node or a machine storage storing the source code.
[0060] In one of the practical application scenarios of the present invention, since the source code includes codes corresponding to all callable functions in the development platform, in order to implement analysis of each individual function, the source code can be split into function codes corresponding to each callable function.
[0061] In the embodiment of the present invention, since the codes of different callable functions in the development platform are often stored in different source code files, the source code can be directly split into the function code of each callable function according to the source code file where each callable function is located.
[0062] S2. Obtain the implementation logic of each of the callable functions, and split the function code into minimum function codes according to the implementation logic.
[0063] In one of the practical application scenarios of the present invention, since each separate callable function in the development platform is often a set of functions required to complete certain business needs, but different users often have different execution processes for the same business, the function code can be further split into minimum function codes, wherein the minimum function code is the smallest function unit that cannot be further divided in implementing a certain function.
[0064] In detail, the callable function refers to a function provided by the development platform that can be called by an external user.
[0065] For example, the callable function existing in the development platform may specifically be a transaction function. The function code of the transaction function may include a function code for querying the inventory of transaction items, a function code for querying the account balance, a function code for reconciliation and settlement of transaction amounts, a function code for order generation, and other minimum and indivisible function codes for realizing a complete transaction function.
[0066] In the embodiment of the present invention, the implementation logic is the logic that needs to be executed to implement any complete callable function. For example, when the callable function is a transaction function, in order to implement the transaction function, it is necessary to perform multiple operations such as transaction subject query, account balance query, order generation, transaction amount reconciliation and settlement. The above operations are the implementation logic of the transaction function.
[0067] In detail, the implementation logic can be pre-defined by the personnel who develop the development platform, and the implementation logic of each callable function can be obtained by querying from a pre-acquired data table that records the implementation logic, and then the function code corresponding to each callable function can be split into the minimum function code according to the implementation logic.
[0068] In the embodiment of the present invention, Figure 2 As shown, the function code is split into minimum function codes according to the implementation logic, including:
[0069] S21, dividing the function code into multiple sub-code areas according to the implementation logic, and selecting one of the areas as the target area one by one;
[0070] S22, executing the code in the target area to obtain an execution result;
[0071] S23, judging whether the code in the target area can realize the function of the implementation logic according to the execution result;
[0072] If the target area cannot realize the function of the realization logic, then execute S24, expand the target area, and return to S22;
[0073] If the code in the target area can realize the function of the implementation logic, S25 is executed to determine whether the code contained in the target area is a minimum functional code.
[0074] In detail, the function code can be divided into multiple sub-code areas with reference to the implementation logic and the pre-existing annotations in the function code. For example, there is an order generation process in the implementation logic, and there are annotations on the code area for implementing the order generation process in the function code. Therefore, the function code can be divided according to the annotations; or, the function code can be divided into multiple sub-code areas according to the implementation logic by manual division.
[0075] Specifically, since the divided sub-code areas are not necessarily accurate, there may be a situation where the code is missing and the corresponding function of the sub-code area cannot be implemented. Therefore, after preliminarily dividing the functional code into multiple sub-code areas according to the implementation logic, it is necessary to execute the sub-code areas one by one to determine whether the divided sub-code areas are complete.
[0076] In an embodiment of the present invention, one of the areas can be selected as the target area one by one, and the code in the target area can be compiled using a preset compiler, and then the compiled code can be executed, and the execution result can be compared with the pre-acquired function corresponding to the target area. When the execution result meets the function corresponding to the target area, it is determined that the code in the target area can realize the function of the implementation logic, and then it is determined that the code contained in the target area is the minimum functional code.
[0077] When the execution result does not conform to the function corresponding to the target area, the target area is expanded, for example, part of the code of the adjacent area of the target area is divided into the target area, and the code in the target area is returned to execute to obtain the execution result.
[0078] In detail, the expansion range N can be set in advance, where N is a positive integer; for example, when the expansion range N=2, then when expansion is performed, each of the upper and lower adjacent lines of code of the target area can be divided into the target area, or, the two adjacent lines of code above the target area can be divided into the target area, or, the two adjacent lines of code below the target area can be divided into the target area.
[0079] In an embodiment of the present invention, the function code is split into minimum function codes by implementing logic, which is beneficial for subsequent users to call the minimum function when calling the function in the development platform, rather than calling the function according to the business process preset by the development platform, thereby improving the degree of compliance with user personalized needs.
[0080] S3. De-duplication processing is performed on the minimum function code, and non-repetitive encoding is performed on the minimum function code after de-duplication, so as to obtain a function code corresponding to each minimum function code.
[0081] In one of the practical application scenarios of the present invention, since the development platform includes many callable functions, but different callable functions may have partial functional overlaps, resulting in partial overlaps in the divided minimum functional codes of different callable functions.
[0082] For example, the development platform includes two callable functions, namely, the transaction function and the login function. However, both of the two callable functions have processes for authenticating the user. Therefore, in the minimum function codes corresponding to the two callable functions, the parts regarding user identity authentication overlap with each other.
[0083] In an embodiment of the present invention, in order to improve the efficiency of users calling functions in the development platform, repeated codes in the minimum function code can be deduplicated so that subsequent users can uniquely and accurately call the required functions when calling.
[0084] In the embodiment of the present invention, Figure 3 As shown, the deduplication processing of the minimum function code includes:
[0085] S31, selecting one of the minimum function codes from the minimum function codes one by one as the target function code;
[0086] S32, calculating the overlap between the target function code and the minimum function code that has not been selected;
[0087] S33, deleting the minimum function codes whose overlap degree is greater than a preset threshold among the minimum function codes that have not been selected.
[0088] In detail, the degree of overlap can be calculated by comparing the number of identical code lines between the target function code and the minimum function code that has not been selected, that is, dividing the number of identical code lines between the target function code and the minimum function code that has not been selected by the total number of code lines in the target function code, and taking the calculation result as the degree of overlap, and then selecting the code in the minimum function code that has not been selected whose degree of overlap is greater than a preset threshold.
[0089] For example, the minimum function code contains code A, code B, and code C. When code A is selected as the target function code, the degree of overlap between code A and code B and code C can be calculated respectively. When there is a code in code B or code C whose degree of overlap with code A is greater than a preset threshold, the code in code B or code C whose degree of overlap with code A is greater than the preset threshold is deleted.
[0090] Furthermore, in order to realize the rapid calling of each minimum function module, the minimum function code after deduplication may be encoded without duplication to obtain the function code corresponding to each minimum function code.
[0091] In the embodiment of the present invention, the non-repetitive encoding of the minimum function code after deduplication to obtain the function code corresponding to each minimum function code includes:
[0092] Randomly arranging the minimum function codes after deduplication to obtain a code queue;
[0093] The deduplicated minimum function codes are numbered incrementally according to the sequence of each minimum function code in the code queue, and the number of each minimum function code is used as the function code.
[0094] In detail, by means of incremental numbering, all the minimum function codes after duplication can be quickly encoded, and the non-repetitiveness of the encoding can be ensured, thereby improving the efficiency of generating function codes.
[0095] S4. Obtain user requirements, determine the target function to be called according to the user requirements, and obtain the target code corresponding to the target function from the function code.
[0096] In the embodiment of the present invention, the user demand includes a demand text generated by the user for calling one or more functions in the development platform, and then the user demand is analyzed to determine the one or more functions called by the user demand.
[0097] In the embodiment of the present invention, determining the target function to be called according to the user demand includes:
[0098] Performing word segmentation processing on the user demand to obtain demand word segmentation;
[0099] Convert the demand word segmentation into word vectors, and concatenate the word vectors into a vector matrix;
[0100] Obtaining the function label corresponding to each of the minimum function codes, and calculating the distance value between the vector matrix and each of the function labels one by one;
[0101] Determine that the function implemented by the minimum function code corresponding to the function tag whose distance value is less than the preset distance threshold is the target function.
[0102] In detail, in detail, a pre-trained artificial intelligence model with a word segmentation function can be used to perform word segmentation on the user needs to obtain the demand segmentation, wherein the artificial intelligence model includes but is not limited to an NLP (Natural Language Processing) model and an HMM (Hidden Markov Model).
[0103] In another embodiment of the present invention, since the user needs may contain a large number of sentences and each sentence may be relatively long, directly analyzing the user needs will occupy a large amount of computing resources. Therefore, the user needs may be segmented and divided into corpus segmentations to improve the efficiency of subsequent analysis of the user needs.
[0104] In detail, the segmentation of the user demand to obtain the demand segmentation includes:
[0105] Deleting meaningless words from the user requirements to obtain standard corpus;
[0106] The standard corpus is searched in a preset dictionary according to different data lengths, and the words retrieved from the dictionary that are the same as those in the standard corpus are collected as corpus segmentation required by the user.
[0107] In detail, the non-meaning words refer to words that have no actual linguistic meaning, for example, modal particles, onomatopoeia, structural auxiliary words, etc. When the user generates the user demand, the user demand may contain some non-meaning words, and the non-meaning words do not contain the actual meaning that the user wants to express. Therefore, the non-meaning words in the user demand can be deleted to reduce the amount of user demand data, thereby improving the efficiency and accuracy of subsequent analysis of the user demand.
[0108] Specifically, the dictionary is a pre-constructed dictionary containing multiple standard word segmentations. The user needs after deleting meaningless words can be searched in the dictionary according to different data lengths. When the same words as those in the user needs are retrieved, it is confirmed that the retrieved words are the corpus word segmentations of the user needs.
[0109] Specifically, in order to improve the processing efficiency of the demand word segmentation, a pre-trained word vector model can be used to convert the demand word segmentation into a word vector in numerical form, and then each word vector is spliced into a vector matrix as a row vector, wherein the word vector model includes but is not limited to a word2vec model and a bert model.
[0110] Furthermore, the function label is a data label pre-defined according to the functions that can be realized by each minimum function code, and can be used to mark the functions of different minimum function codes.
[0111] In the embodiment of the present invention, the step of calculating the distance value between the vector matrix and each of the function labels one by one includes:
[0112] The distance value between the vector matrix and each of the function labels is calculated one by one using the following distance value algorithm:
[0113]
[0114] Where D is the distance value, a is the vector matrix, b i is the function label of the i-th minimum function code.
[0115] In the embodiment of the present invention, the CREATE INDEX function in SQL can be used to create an index of the function code corresponding to each minimum function code, and then the template code corresponding to each target function can be queried from the function code corresponding to each minimum function code according to the index.
[0116] S5. Generate a call request according to the target code and a preset user identifier, and use the call request to call the function of the development platform.
[0117] In an embodiment of the present invention, there are a large number of minimum function codes that can realize different functions in the development platform. In order to quickly call the functions required by the user, the target code and the pre-acquired user identifier can be used to generate a call request for the minimum function code corresponding to the target function, and then the call request can be used to call the function in the development platform.
[0118] In detail, the user identification includes but is not limited to data that can identify the user identity, such as user ID and user IP address.
[0119] In the embodiment of the present invention, the step of generating a call request according to the target code and a preset user identifier includes:
[0120] Converting the target code and the user identifier into a data field;
[0121] Filling the data field into a preset parameter-free data request to obtain a parameter-containing request;
[0122] The parameter-containing request is compiled to obtain the calling request.
[0123] In detail, since the data format of the user identifier and the target code may be different from the data format of the data call request of the development platform, in order to generate the call request using the target code and the user identifier, a preset data conversion tool can be used to convert the target code and the user identifier into a data field that conforms to the data request, wherein the data conversion tool includes but is not limited to a json plug-in and an ArcGIS plug-in.
[0124] Specifically, the parameter-free data request is a pre-acquired request that does not contain any parameters and only contains the necessary format fields for the data request to the development platform. The template code converted into the data field and the user identifier can be filled into the parameter-free data request as parameters to obtain the parameter-containing request, and the parameter-containing request is compiled using a preset compiler to obtain the call request, wherein the compiler includes but is not limited to the VisualStudio compiler and the Dev C++ compiler.
[0125] In the embodiment of the present invention, the calling request can be executed, and then the function that meets the user's needs can be called out from the development platform.
[0126] The embodiment of the present invention can disassemble the codes of various functions in the development platform that aggregates multiple functions, so as to split a single fixed function into multiple sub-functions that cannot be split any further, and then after analyzing the user's needs, it can make targeted function calls according to the user's needs, avoiding providing only fixed functions in the platform to the user, and realizing personalized function calls for the user. Therefore, the function calling method based on the development platform proposed by the present invention can solve the problem that the development platform cannot realize personalized function calls for users.
[0127] like Figure 4 , which is a functional module diagram of a function calling device based on a development platform provided in one embodiment of the present invention.
[0128] The function calling device 100 based on the development platform of the present invention can be installed in an electronic device. According to the functions to be implemented, the function calling device 100 based on the development platform can include a source code splitting module 101, a function splitting module 102, a code deduplication module 103, a demand analysis module 104 and a function calling module 105. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0129] In this embodiment, the functions of each module / unit are as follows:
[0130] The source code splitting module 101 is used to obtain the source code of a preset development platform and split the source code into function codes corresponding to each callable function in the development platform;
[0131] The function splitting module 102 is used to obtain the implementation logic of each of the callable functions, and split the function code into minimum function codes according to the implementation logic;
[0132] The code deduplication module 103 is used to perform deduplication processing on the minimum function code, and perform non-repetitive encoding on the deduplicated minimum function code to obtain a function code corresponding to each minimum function code;
[0133] The demand analysis module 104 is used to obtain user demand, determine the target function to be called according to the user demand, and query the target code corresponding to the target function from the function code;
[0134] The function calling module 105 is used to generate a calling request according to the target code and a preset user identifier, and use the calling request to call the function of the development platform.
[0135] In detail, each module described in the function calling device 100 based on the development platform in the embodiment of the present invention is used in the same manner as described above. Figures 1 to 3 The technical means are the same as the function calling method based on the development platform described in, and can produce the same technical effects, so they will not be repeated here.
[0136] like Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing a function calling method based on a development platform provided by an embodiment of the present invention.
[0137] The electronic device 1 may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a function calling program based on a development platform.
[0138] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing a function call program based on a development platform, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0139] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of a function call program based on a development platform, but may also be used to temporarily store data that has been output or is to be output.
[0140] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0141] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0142] Figure 5 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 5 The structure shown does not constitute a limitation on the electronic device 1, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0143] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0144] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0145] The function calling program based on the development platform stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0146] Obtaining source code of a preset development platform, and splitting the source code into function codes corresponding to each callable function in the development platform;
[0147] Obtaining the implementation logic of each of the callable functions, and splitting the function code into minimum function codes according to the implementation logic;
[0148] De-duplication processing is performed on the minimum function code, and non-repetitive encoding is performed on the minimum function code after de-duplication, so as to obtain a function code corresponding to each minimum function code;
[0149] Obtaining user needs, determining the target function to be called according to the user needs, and obtaining the target code corresponding to the target function from the function code;
[0150] A calling request is generated according to the target code and a preset user identifier, and the function of the development platform is called using the calling request.
[0151] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to the description of the relevant steps in the corresponding embodiment of the accompanying drawings, which will not be repeated here.
[0152] Furthermore, if the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0153] The present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program can implement:
[0154] Obtaining source code of a preset development platform, and splitting the source code into function codes corresponding to each callable function in the development platform;
[0155] Obtaining the implementation logic of each of the callable functions, and splitting the function code into minimum function codes according to the implementation logic;
[0156] De-duplication processing is performed on the minimum function code, and non-repetitive encoding is performed on the minimum function code after de-duplication, so as to obtain a function code corresponding to each minimum function code;
[0157] Obtaining user needs, determining the target function to be called according to the user needs, and obtaining the target code corresponding to the target function from the function code;
[0158] A calling request is generated according to the target code and a preset user identifier, and the function of the development platform is called using the calling request.
[0159] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0160] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0161] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0162] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0163] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0164] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0165] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0166] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0167] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A function calling method based on a development platform, characterized in that: The method comprises: Obtaining source code of a preset development platform, and splitting the source code into function codes corresponding to each callable function in the development platform; Obtaining the implementation logic of each of the callable functions, and splitting the function code into minimum function codes according to the implementation logic; De-duplication processing is performed on the minimum function code, and non-repetitive encoding is performed on the minimum function code after de-duplication, so as to obtain a function code corresponding to each minimum function code; Obtaining user needs, determining the target function to be called according to the user needs, and obtaining the target code corresponding to the target function from the function code; Generate a call request according to the target code and a preset user identifier, and use the call request to call the function of the development platform; Wherein, the step of splitting the function code into minimum function codes according to the implementation logic includes: dividing the function code into multiple sub-code areas according to the implementation logic, and selecting one of the areas as the target area one by one; executing the code in the target area to obtain an execution result; judging whether the code in the target area can realize the function of the implementation logic according to the execution result; if the target area cannot realize the function of the implementation logic, expanding the target area and returning to the step of executing the code in the target area to obtain the execution result; if the code in the target area can realize the function of the implementation logic, determining that the code contained in the target area is the minimum function code; The deduplication processing of the minimum function code includes: selecting one of the minimum function codes as the target function code one by one from the minimum function codes; calculating the overlap between the target function code and the minimum function code not selected; deleting the minimum function code whose overlap is greater than a preset threshold among the minimum function codes not selected; Determining the target function to be called according to the user demand includes: performing word segmentation processing on the user demand to obtain demand segmentation; converting the demand segmentation into word vectors, and splicing the word vectors into a vector matrix; obtaining the function label corresponding to each of the minimum function codes, and calculating the distance value between the vector matrix and each of the function labels one by one; determining that the function implemented by the minimum function code corresponding to the function label whose distance value is less than a preset distance threshold is the target function.
2. The function calling method based on the development platform according to claim 1, characterized in that: The non-repetitive encoding of the minimum function code after deduplication is performed to obtain the function code corresponding to each minimum function code, including: Randomly arranging the minimum function codes after deduplication to obtain a code queue; The deduplicated minimum function codes are numbered incrementally according to the sequence of each minimum function code in the code queue, and the number of each minimum function code is used as the function code.
3. The function calling method based on the development platform according to claim 1, characterized in that: The performing word segmentation processing on the user demand to obtain the demand word segmentation includes: Deleting meaningless words from the user requirements to obtain standard corpus; The standard corpus is searched in a preset dictionary according to different data lengths, and the words retrieved from the dictionary that are the same as those in the standard corpus are collected as corpus segmentation required by the user.
4. The function calling method based on the development platform according to any one of claims 1 to 3, characterized in that: The generating a call request according to the target code and a preset user identifier includes: Converting the target code and the user identifier into a data field; Filling the data field into a preset parameter-free data request to obtain a parameter-containing request; The parameter-containing request is compiled to obtain the calling request.
5. A function calling device based on a development platform, used to implement the function calling method based on a development platform as claimed in any one of claims 1 to 4, characterized in that: The device comprises: A source code splitting module, used to obtain the source code of a preset development platform, and split the source code into function codes corresponding to each callable function in the development platform; A function splitting module, used for obtaining the implementation logic of each of the callable functions, and splitting the function code into minimum function codes according to the implementation logic; A code deduplication module is used to perform deduplication processing on the minimum function code, and perform non-repetitive encoding on the deduplicated minimum function code to obtain a function code corresponding to each minimum function code; A demand analysis module is used to obtain user demand, determine the target function to be called according to the user demand, and query the target code corresponding to the target function from the function code; The function calling module is used to generate a calling request according to the target code and a preset user identifier, and use the calling request to call the function of the development platform.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the function calling method based on the development platform as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the function calling method based on the development platform as claimed in any one of claims 1 to 4 is implemented.
