Data conversion method and device, electronic equipment, storage medium and program product
By building a command database and using preset algorithms, the system automatically identifies and matches command data in the original configuration file with standardized commands, thus solving the problem of syntax differences in configuration commands between devices from multiple manufacturers and improving data conversion efficiency.
Patent Information
- Application Number
- CN202510999432.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-18
- Publication Date
- 2025-11-07
AI Technical Summary
Existing technologies struggle to effectively unify the differences in configuration command syntax among multiple vendors, device types, and software versions, resulting in low data conversion efficiency.
By acquiring the original configuration file and the standardized commands of the target object, a command database is built, and a preset algorithm is used to determine the target command from multiple standardized commands to generate the target configuration file.
It enables automatic identification and matching of configuration commands for devices from different manufacturers, reducing manual intervention, avoiding errors, and improving data conversion efficiency.
Smart Images

Figure CN120909595A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data processing, and in particular to a data conversion method and device, electronic equipment, storage medium and program product. BACKGROUND
[0002] With the rapid development of networks, there are usually devices of multiple manufacturers in large networks. The devices of different manufacturers differ significantly in model, software version and configuration method, resulting in low interoperability between devices.
[0003] Existing configuration management usually relies on manual operation or customized tools to handle configuration differences between devices of different manufacturers. For example, configuration data of devices is collected by using standard protocols. However, in actual applications, these standard protocols have limited effect in handling specific configuration command syntax differences between multiple manufacturers, multiple device types and multiple software versions. The structure of existing systems is often difficult to flexibly adapt to the command line syntax specific to different devices, especially when analyzing and processing private and non-standard configuration items of manufacturers, and its flexibility and adaptability are severely insufficient.
[0004] In the above process, the configuration command syntax differences existing between multiple manufacturers, multiple device types and multiple software versions cannot be effectively and uniformly handled, resulting in low data conversion efficiency. SUMMARY
[0005] Embodiments of the present application provide a data conversion method and device, electronic equipment, storage medium and program product to improve data conversion efficiency.
[0006] In a first aspect, embodiments of the present application provide a data conversion method, comprising:
[0007] obtaining a plurality of standardized commands corresponding to at least one original configuration file and a target object, the original configuration file including a source object identifier, a plurality of configuration commands and a syntax structure corresponding to each configuration command;
[0008] constructing a command database according to the at least one original configuration file, the command database including command data corresponding to the plurality of configuration commands respectively;
[0009] determining a target command corresponding to any one command data in the plurality of standardized commands by a preset algorithm;
[0010] generating a target configuration file corresponding to the target object according to the target commands corresponding to the plurality of command data respectively.
[0011] In a possible implementation, determining a target command corresponding to the command data in the plurality of standardized commands by a preset algorithm comprises:
[0012] performing a first matching process on the command data according to the plurality of standardized commands to obtain a first matching result;
[0013] if the first matching result is a matching success, determining the standardized command matched with the command data as a target command;
[0014] if the first matching result is a matching failure, performing a second matching process on the command data according to the plurality of standardized commands by a preset algorithm to determine a target command corresponding to the command data.
[0015] In a possible implementation, the performing of the second matching process on the command data according to the plurality of standardized commands by the preset algorithm to determine a target command corresponding to the command data includes:
[0016] determining a plurality of similarities between the command data and the plurality of standardized commands according to the preset algorithm;
[0017] in the plurality of similarities, determining a target similarity as a greatest similarity;
[0018] determining whether the target similarity is greater than a first threshold value;
[0019] if yes, determining the standardized command corresponding to the target similarity as the target command.
[0020] In a possible implementation, the command data includes a command name and at least one command parameter, and the standardized command includes a standardized name and at least one standardized parameter, and for any one standardized command, the determining of the similarity between the command data and the standardized command according to the preset algorithm includes:
[0021] determining a first similarity between the command name and the standardized name;
[0022] determining a second similarity between the at least one command parameter and the at least one standardized parameter;
[0023] determining a first type corresponding to the command data and a second type corresponding to the standardized command;
[0024] determining whether the first type and the second type are same;
[0025] if yes, determining the similarity between the command data and the standardized command according to the first similarity and the second similarity;
[0026] If not, a penalty factor is determined, and a similarity between the command data and the standardized command is determined according to the first similarity, the second similarity and the penalty factor.
[0027] In a possible implementation, determining the first similarity between the command name and the standard name comprises:
[0028] Determining matching character information and a matching prefix length between the command name and the standard name, the matching character information comprising a number of matching characters and a number of transposition characters;
[0029] Determining a first similarity factor according to the number of matching characters and the number of transposition characters;
[0030] Determining a weight factor according to the matching prefix length and a preset weight factor;
[0031] Determining the first similarity according to the first similarity factor and the weight factor.
[0032] In a possible implementation, determining the second similarity between the at least one command parameter and the at least one standard parameter comprises:
[0033] For any one command parameter, determining a second similarity factor between the command parameter and a standard parameter corresponding to the command parameter;
[0034] Adding the second similarity factors of the at least one command parameter respectively to determine a sum value;
[0035] Determining a parameter quantity of the at least one command parameter;
[0036] Determining a ratio between the sum value and the parameter quantity as the second similarity.
[0037] In a possible implementation, performing first matching processing on the command data according to the plurality of standardized commands to obtain a first matching result comprises:
[0038] Obtaining a preset mapping relationship, the mapping relationship comprising a plurality of preset data and a standardized command corresponding to each preset data;
[0039] Determining whether the command data is included in the plurality of preset data;
[0040] If yes, determining that the first matching result is matching success;
[0041] If not, determining whether there is a standardized command same as the command data in the plurality of standardized commands, if yes, determining that the first matching result is matching success, and if not, determining that the first matching result is matching failure.
[0042] In a second aspect, the embodiments of the present application provide a data conversion device, comprising:
[0043] an acquisition module configured to acquire a plurality of standardized commands corresponding to a target object and at least one original configuration file, wherein the original configuration file comprises a source object identifier, a plurality of configuration commands, and a syntax structure corresponding to each configuration command;
[0044] a construction module configured to construct a command database according to the at least one original configuration file, wherein the command database comprises command data corresponding to the plurality of configuration commands respectively;
[0045] a matching module configured to determine a target command corresponding to any one command data in the plurality of standardized commands by a preset algorithm;
[0046] a generation module configured to generate a target configuration file corresponding to the target object according to the target command corresponding to each command data in the plurality of command data.
[0047] In a possible implementation, the matching module is specifically configured to:
[0048] perform a first matching process on the command data according to the plurality of standardized commands to obtain a first matching result;
[0049] if the first matching result is a matching success, determine the standardized command matched with the command data as the target command;
[0050] if the first matching result is a matching failure, perform a second matching process on the command data according to the plurality of standardized commands by the preset algorithm to determine the target command corresponding to the command data.
[0051] In a possible implementation, the matching module is specifically configured to:
[0052] determine a plurality of similarities between the command data and the plurality of standardized commands according to the preset algorithm;
[0053] determine a target similarity as a greatest similarity in the plurality of similarities;
[0054] determine whether the target similarity is greater than a first threshold value;
[0055] if yes, determine the standardized command corresponding to the target similarity as the target command.
[0056] In a possible implementation, the command data comprises a command name and at least one command parameter, the standardized command comprises a standard name and at least one standard parameter, and for any one standardized command, the matching module is specifically configured to:
[0057] determine a first similarity between the command name and the standard name;
[0058] determine a second similarity between the at least one command parameter and the at least one standard parameter;
[0059] determine a first type corresponding to the command data and a second type corresponding to the standardized command;
[0060] determine whether the first type and the second type are the same;
[0061] if yes, determine a similarity between the command data and the standardized command according to the first similarity and the second similarity;
[0062] if no, determine a penalty factor, and determine the similarity between the command data and the standardized command according to the first similarity, the second similarity and the penalty factor.
[0063] In a possible implementation, the matching module is specifically configured to:
[0064] determine matching character information and a matching prefix length between the command name and the standard name, the matching character information comprising a matching character number and a transposition character number;
[0065] determine a first similarity factor according to the matching character number and the transposition character number;
[0066] determine a weight factor according to the matching prefix length and a preset weight factor;
[0067] determine the first similarity according to the first similarity factor and the weight factor.
[0068] In a possible implementation, the matching module is specifically configured to:
[0069] for any one command parameter, determine a second similarity factor between the command parameter and a standard parameter corresponding to the command parameter;
[0070] add the second similarity factors of the at least one command parameter respectively to determine a sum value;
[0071] determine a parameter number of the at least one command parameter;
[0072] determine a ratio between the sum value and the parameter number as the second similarity.
[0073] In a possible implementation, the matching module is specifically configured to:
[0074] obtain a preset mapping relationship, the mapping relationship comprising a plurality of preset data and a standardized command corresponding to each preset data;
[0075] determine whether the command data is included in the plurality of preset data;
[0076] if yes, determine that the first matching result is a matching success;
[0077] if no, determine whether there is a standardized command same as the command data in the plurality of standardized commands, if yes, determine that the first matching result is a matching success, and if no, determine that the first matching result is a matching failure.
[0078] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor.
[0079] The memory stores computer execution instructions.
[0080] The processor executes the computer execution instructions stored in the memory, so that the processor executes the first aspect and / or various possible implementation manners of the first aspect.
[0081] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, wherein the computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by a processor to implement the first aspect and / or various possible implementation manners of the first aspect.
[0082] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program, and the computer program is executed by a processor to implement the first aspect and / or various possible implementation manners of the first aspect.
[0083] This application provides a data conversion method, apparatus, electronic device, storage medium, and program product. It involves acquiring at least one original configuration file and multiple standardized commands corresponding to a target object. The original configuration file includes a source object identifier, multiple configuration commands, and the syntax structure corresponding to each configuration command. Based on the at least one original configuration file, a command database is constructed, including command data corresponding to each of the multiple configuration commands. For any given command data, a preset algorithm is used to determine the target command corresponding to the command data from among the multiple standardized commands. Based on the target commands corresponding to the multiple command data, a target configuration file corresponding to the target object is generated. Thus, by constructing a command database and using a preset algorithm, the command data in the original configuration file can be automatically identified and matched with the standardized commands, reducing manual intervention, avoiding errors caused by human operation, unifying configuration commands for devices from different manufacturers, and improving data conversion efficiency. Attached Figure Description
[0084] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0085] Figure 1 This is a schematic diagram of the architecture of a data conversion system provided in an embodiment of this application;
[0086] Figure 2 A flowchart illustrating a data conversion method provided in an embodiment of this application;
[0087] Figure 3 A flowchart illustrating another data conversion method provided in an embodiment of this application;
[0088] Figure 4 A flowchart illustrating yet another data conversion method provided in an embodiment of this application;
[0089] Figure 5 This is a schematic diagram of the structure of a data conversion device provided in an embodiment of this application;
[0090] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0091] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0092] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The following description is made with reference to the accompanying drawings in which like reference numerals refer to like elements, unless the context of use indicates otherwise. The following description of exemplary embodiments is not representative of all embodiments consistent with the present application. Rather, it is merely an example of apparatus and methods consistent with some aspects of the present application as detailed in the appended claims.
[0093] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards of countries and regions, necessary security measures are taken, public order and good customs are not violated, and appropriate operation portals are provided for users to choose authorization or refusal.
[0094] With the rapid development of networks, there are usually devices of multiple manufacturers in large networks. The devices of different manufacturers differ significantly in model, software version, and configuration method, resulting in low interoperability between devices.
[0095] Existing configuration management usually relies on manual operation or customized tools to handle configuration differences between devices of different manufacturers. For example, configuration data of devices is collected by using standard protocols. However, in actual applications, these standard protocols have limited effect in handling specific configuration command syntax differences between multiple manufacturers, multiple device types, and multiple software versions. The structure of existing systems is often difficult to flexibly adapt to the command line syntax specific to different devices, especially when analyzing and processing private, non-standard configuration items of manufacturers, and its flexibility and adaptability are severely insufficient.
[0096] In the above process, the configuration command syntax differences existing between multiple manufacturers, multiple device types, and multiple software versions cannot be effectively and uniformly handled, resulting in low data conversion efficiency.
[0097] To solve the above technical problems, the embodiment of the present application provides a data conversion method, by acquiring at least one original configuration file corresponding to a source object and a standardized command corresponding to a target object, constructing a command database according to the at least one original configuration file, for any one command data in the command database, determining a target command corresponding to the command data in the plurality of standardized commands through a preset algorithm, and generating a target configuration file corresponding to the target object according to the target commands corresponding to the plurality of command data. In this way, by constructing the command database and using the preset algorithm, the command data in the original configuration file and the standardized command can be automatically identified and matched, manual intervention is reduced, errors caused by human operation are avoided, configuration commands of different manufacturer devices are unified, and data conversion efficiency is improved.
[0098] Next, the technical scheme of the present application will be described in detail in combination with specific embodiments. Figure 1 The architecture of the data conversion system is exemplified.
[0099] Figure 1 The architecture of the data conversion system provided by the embodiment of the present application is shown in the figure. Please refer to Figure 1 , Figure 1 The data conversion system can include an input interface layer, a data processing layer and an output generation layer.
[0100] The input interface layer, the data processing layer and the output generation layer can be communicatively connected.
[0101] The input interface layer can communicate with network devices from different manufacturers and different models, receive and store original configuration files from network devices from different manufacturers and different models.
[0102] The input interface layer can also be used to receive or store a plurality of standardized commands corresponding to a target object.
[0103] The data processing layer can be used to parse the original configuration file, and convert a plurality of command data in the original configuration file into target commands through a preset algorithm according to the plurality of standardized commands.
[0104] The output generation layer can organize the plurality of target commands according to the correct order, hierarchy and syntax according to the configuration structure requirement of the target object, and generate a target configuration file.
[0105] The technical scheme of the present application and how the technical scheme of the present application solves the above technical problems will be described in detail in the following specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in detail in some embodiments. The embodiments of the present application will be described in combination with the drawings.
[0106] Figure 2A flowchart of a data conversion method provided by an embodiment of the present application. The execution subject of the embodiment of the present application can be a processor. The processor can be implemented by software, or by a combination of software and hardware. Please refer to Figure 2 The method comprises the following steps:
[0107] S201, obtaining at least one original configuration file and a plurality of standardized commands corresponding to a target object.
[0108] The original configuration file comprises a source object identifier, a plurality of configuration commands, and a syntax structure corresponding to each configuration command.
[0109] The original configuration file can be a file obtained from a resource corresponding to a device manufacturer.
[0110] The source object identifier can be used to identify a device or a device type to which the configuration file belongs.
[0111] For example, the source object identifier can be a device model, a manufacturer name, etc.
[0112] The plurality of configuration commands can comprise an interface configuration command, a network routing setting command, a security configuration command, etc.
[0113] The syntax structure can comprise a command name, a command parameter, an option, a parameter type, etc.
[0114] The standardized command can be a configuration command adapted to the target object and pre-stored, or a configuration instruction of a uniform standard pre-set.
[0115] The target object can be a target device or a target device type.
[0116] The standardized command can comprise a standard name, a standard parameter, an option, a parameter type, a value range, etc.
[0117] For example, the data structure of the standardized command can be: {"command":"ip address","parameters":[{"name":"ip-address","type":"IP","required":True},{"name":"subnet-mask","type":"IP","required":True}]}.
[0118] At least one resource file corresponding to each source object identifier can be obtained, text extraction processing is performed on at least one resource file, at least one original configuration file is determined, and a plurality of standardized commands corresponding to a target object are obtained.
[0119] Different formats of resource files correspond to different text extraction processing.
[0120] For example, for a resource file in eXtensible Markup Language (XML) format, an XML parser is used to perform text extraction processing on the resource file.
[0121] For example, for a resource file in JavaScript Object Notation (JSON) format, text extraction processing is directly performed on the resource file.
[0122] S202. Construct a command database according to at least one original configuration file.
[0123] The command database includes command data corresponding to a plurality of configuration commands.
[0124] The command data can be an entity object with a unified standard.
[0125] The command data type can include interface type, routing type, security type, and management type, etc.
[0126] The command database can have a custom tag mechanism, and add corresponding tags for each command data type.
[0127] For example, the tags can include Internet Protocol version 4 (IPv4), Virtual Local Area Network (VLAN), etc., which are used to quickly locate and search for commands.
[0128] For example, assume that the ip address command must include the ip parameter and the subnet mask. The ip parameter in the ip address command is a required item, and the subnet mask should also be marked as a required item and establish a dependency relationship with the ip parameter.
[0129] The command database can have a dependency relationship between commands and corresponding at least one parameter, and a mapping relationship between heterogeneous commands with the same function.
[0130] In this way, different manufacturers can have different command syntaxes to perform the same function, and in the database, the mapping relationship between heterogeneous commands is established to facilitate command translation and syntax conversion.
[0131] Different original configuration files correspond to different command syntax structures.
[0132] The preset command format and the preset database can be acquired, at least one original configuration file is parsed, a plurality of command data corresponding to the command format is determined, the plurality of command data is entered into the preset data, and a command database is generated.
[0133] In the entering of the command data, a primary key or a unique index can be set to ensure the uniqueness of each command in the database.
[0134] For example, the primary key can be set as (manufacturer name + command name + command level + version number) to avoid the generation of duplicate data for the same command in different versions.
[0135] The command data can be represented by the following code:
[0136]
[0137] "vendor":"VendorA" can represent the equipment manufacturer to which the command belongs, and "VendorA" is used to represent a manufacturer.
[0138] "model":"X1000" can represent the equipment model to which the command is applicable, that is, the "X1000" model equipment supports the command.
[0139] "category":"interface" can define the type to which the command belongs, and "interface" can represent that the command is of the interface type.
[0140] "level":"interface-mode" can represent the execution level of the command, and "interface-mode" indicates that the command needs to be executed in the "interface mode".
[0141] "command":"ip address" can represent the name of the command, that is, the command string actually executed on the equipment, and "ip address" can be used to configure the IP address of the interface.
[0142] "parameters" can represent the parameters required when the command is executed.
[0143] Each parameter can include a parameter name, a type, and a mandatory object.
[0144] S203, for any one command data, a target command corresponding to the command data is determined from a plurality of standardized commands through a preset algorithm.
[0145] The preset algorithm can include a first matching process and a second matching process.
[0146] The first matching processing can be determining whether all parameters of the command data can be completely matched with any one of the standardized commands, or whether the command data is included in the mapping relationship.
[0147] The second matching processing can be determining whether all parameters of the command data can be fuzzy matched with any one of the standardized commands.
[0148] The target command can be a standardized command corresponding to the command data.
[0149] For any one command data, the target command corresponding to the command data can be determined in the plurality of standardized commands by matching the command data through a preset algorithm according to the plurality of standardized commands, wherein the matching processing can include any one or more of the first matching processing and the second matching processing.
[0150] Optionally, the target command corresponding to the command data can be determined in the plurality of standardized commands by the preset algorithm in the following manner: the first matching processing is performed on the command data according to the plurality of standardized commands to obtain a first matching result; if the first matching result is matching success, the standardized command matched with the command data is determined as the target command; if the first matching result is matching failure, the second matching processing is performed on the command data according to the plurality of standardized commands through the preset algorithm to determine the target command corresponding to the command data.
[0151] S204, generating a target configuration file corresponding to the target object according to the target commands corresponding to the plurality of command data respectively.
[0152] The target configuration file can be a configuration file conforming to the standardized command specification.
[0153] A generation rule corresponding to the target configuration file can be obtained, and the target configuration file corresponding to the target object can be generated through the generation rule according to the target commands corresponding to the plurality of command data respectively.
[0154] The generation rule can be determined by the target object.
[0155] In the process of generating the target configuration file, each target command can be adjusted according to the generation rule of the target object, so as to ensure that the order and dependency relationship of the plurality of target commands are correct.
[0156] The data conversion method provided in the embodiment comprises the following steps: obtaining a plurality of standardized commands corresponding to at least one original configuration file and a target object, wherein the original configuration file comprises a source object identifier, a plurality of configuration commands, and a syntax structure corresponding to each configuration command; constructing a command database according to the at least one original configuration file, wherein the command database comprises command data corresponding to the plurality of configuration commands respectively; determining a target command corresponding to each command data in the plurality of standardized commands by using a preset algorithm; and generating a target configuration file corresponding to the target object according to the target commands corresponding to the plurality of command data respectively. In this way, the command data in the original configuration file and the standardized commands can be automatically identified and matched by constructing the command database and using the preset algorithm, manual intervention is reduced, errors caused by human operation are avoided, the configuration commands of different manufacturers' devices are unified, and the data conversion efficiency is improved.
[0157] In the following, the process of determining a target command corresponding to each command data in the plurality of standardized commands by using a preset algorithm (S203) will be explained in combination with Figure 3
[0158] Figure 3 The flowchart of another data conversion method provided in the embodiment is shown in the following. Based on the above-mentioned embodiment, the method can be seen from Figure 3 The method comprises the following steps:
[0159] S301, performing first matching processing on the command data according to the plurality of standardized commands to obtain a first matching result.
[0160] The command data can comprise a command name and at least one command parameter, and the standardized command can comprise a standard name and at least one standard parameter.
[0161] The mapping relationship can be obtained. If the mapping relationship does not comprise the command data, the command name and the at least one command parameter are determined according to the command data, and it is verified whether there is a standardized command with the same command name in the plurality of standardized commands. If there is, it is verified whether the standardized command comprises the at least one command parameter. If yes, it is determined that the first matching result is matching success. If no, it is determined that the first matching result is matching failure. If there is no standardized command with the same command name, it is determined that the first matching result is matching failure. If the mapping relationship comprises the command data, it is determined that the first matching result is matching success.
[0162] Optionally, the first matching processing of the command data according to the plurality of standardized commands can be performed to obtain a first matching result by the following manner: obtaining a preset mapping relationship, the mapping relationship comprising a plurality of preset data and a standardized command corresponding to each preset data; determining whether the command data is included in the plurality of preset data; if yes, determining that the first matching result is matching success; if no, determining whether there is a standardized command same as the command data in the plurality of standardized commands, if yes, determining that the first matching result is matching success, if no, determining that the first matching result is matching failure.
[0163] S302, determining whether the first matching result is matching success.
[0164] If yes, performing S303;
[0165] If no, performing S304.
[0166] S303, determining the standardized command matched with the command data as a target command.
[0167] In this way, the completely matched command data can be quickly determined, and the data conversion efficiency is improved.
[0168] S304, determining a plurality of similarities between the command data and the plurality of standardized commands according to a preset algorithm.
[0169] The preset algorithm can be used to calculate the minimum number of character operations required to convert the input command into the standardized command, and the smaller the number of operations, the higher the similarity.
[0170] The preset algorithm can compare whether the number, type and position of the parameters of the commands are consistent, and calculate the matching parameter proportion.
[0171] The preset algorithm can combine the name similarity and the parameter similarity to calculate the final score through weight.
[0172] The similarity between the command data and the standardized command can be calculated through the preset algorithm for any one standardized command.
[0173] S305, determining the similarity with the largest similarity in the plurality of similarities as a target similarity.
[0174] The largest similarity in the plurality of similarities is determined as the target similarity.
[0175] S306, in the case that the target similarity is greater than a first threshold value, determining the standardized command corresponding to the target similarity as a target command.
[0176] The first threshold value can be a preset value.
[0177] If yes, the standardized command corresponding to the target similarity is determined as the target command.
[0178] Optionally, if the target similarity is not greater than the first threshold, it is determined whether the target similarity is greater than a second threshold. If the target similarity is greater than the second threshold, a verification request is sent to the target terminal. If a verification response corresponding to the verification request is verified, the standardized command corresponding to the target similarity is determined as the target command.
[0179] The second threshold is less than the first threshold.
[0180] The verification request can be used to request the target terminal whether the standardized command corresponding to the target similarity is the target command of the command data.
[0181] The implementation content of each step in the embodiments of the present application can refer to the description of the corresponding steps or operations of the above method embodiments, and the repeated content will not be described again.
[0182] The data conversion method provided in the embodiment includes the following steps: first matching processing is performed on the command data according to a plurality of standardized commands to obtain a first matching result; if the first matching result is matching success, the standardized command matched with the command data is determined as a target command; if the first matching result is matching failure, a plurality of similarities between the command data and the plurality of standardized commands are determined according to a preset algorithm; in the plurality of similarities, a target similarity with the greatest similarity is determined; it is determined whether the target similarity is greater than a first threshold; if yes, the standardized command corresponding to the target similarity is determined as the target command. In this way, by constructing a command database and using a preset algorithm, the command data in the original configuration file and the standardized command can be automatically identified and matched, manual intervention is reduced, errors caused by human operation are avoided, configuration commands of different manufacturers' devices are unified, and data conversion efficiency is improved.
[0183] Next, in combination with Figure 4 , the process (S304) of determining the similarity between the command data and the standardized command according to the preset algorithm for any one standardized command is explained and described.
[0184] Figure 4 The flowchart of another data conversion method provided in the embodiments of the present application is shown. On the basis of the above embodiments, the method can refer to Figure 4 , and the method includes the following steps.
[0185] S401, determining a first similarity between a command name and a standard name.
[0186] The first similarity can be used to describe the similarity between the command name and the standard name.
[0187] The first similarity between the command name and the standard name can be calculated by a preset algorithm.
[0188] Optionally, the first similarity between the command name and the standard name can be determined by determining matching character information and a matching prefix length between the command name and the standard name, determining a first similarity factor according to the matching character number and the transposition character number, determining a weight factor according to the matching prefix length and a preset weight factor, and determining the first similarity according to the first similarity factor and the weight factor.
[0189] The matching character information includes a matching character number and a transposition character number.
[0190] The matching character number can be a character that is the same in the command name and the standard name and has a position difference within a preset value.
[0191] The preset value is max(|s|, |t|) / 2-1, |s| can be a character length of the command name, |t| can be a character length of the standard name, and max(|s|, |t|) can determine a maximum value between the character length of the command name and the character length of the standard name.
[0192] The transposition character number can be a character that is the same in the command name and the standard name, has a position difference within a preset value, and is greater than 0.
[0193] Optionally, the first similarity factor Jaro(s, t) can be determined according to the matching character number and the transposition character number by the following formula:
[0194]
[0195] Wherein, m can represent the matching character number, τ can represent the transposition character number, |s| can represent the character length of the command name, and |t| can represent the character length of the standard name.
[0196] Optionally, the weight factor Δ can be determined according to the matching prefix length and a preset weight factor by the following formula:
[0197] Δ = 1 + β × L p
[0198] L p The L can represent a length of a common prefix in the command name and the standard name, and β can represent a preset weight value.
[0199] Optionally, the first similarity sim1 can be determined according to the first similarity factor and the weight factor by the following formula:
[0200] sim1 = Δ × Jaro(s, t)
[0201] Wherein, Δ can represent a weight factor, Jaro(s, t) can represent a first similarity factor, S can represent command data, and T can represent standardized commands.
[0202] S402, determine a second similarity between the at least one command parameter and the at least one standard parameter.
[0203] The second similarity can be used to represent the similarity between the at least one command parameter and the at least one standard parameter.
[0204] The second similarity between the at least one command parameter and the at least one standard parameter can be determined by a preset algorithm.
[0205] Optionally, the second similarity between the at least one command parameter and the at least one standard parameter can be determined by: determining, for any one command parameter, a second similarity factor between the command parameter and the standard parameter corresponding to the command parameter; adding the second similarity factors of the at least one command parameter respectively to determine a sum value; determining the number of parameters of the at least one command parameter; and determining the ratio between the sum value and the number of parameters as the second similarity.
[0206] Optionally, the second similarity between the at least one command parameter and the at least one standard parameter can be determined by the following formula:
[0207]
[0208] Wherein, The second similarity factor between the i-th command parameter and the standard parameter corresponding to the i-th command parameter can be used to represent, and N can represent the number of parameters of the at least one command parameter.
[0209] S403, determine a first type corresponding to the command data and a second type corresponding to the standardized commands.
[0210] The first type can be the type corresponding to the command data.
[0211] The second type can be the type corresponding to the standardized commands.
[0212] The first type corresponding to the command data and the second type corresponding to the standardized commands can be determined according to the labels corresponding to the command data and the standardized commands respectively.
[0213] S404, determine whether the first type and the second type are the same.
[0214] If yes, execute S405;
[0215] If no, execute S406.
[0216] S405, determining the similarity between the command data and the standardized command according to the first similarity and the second similarity.
[0217] The weight values corresponding to the first similarity and the second similarity respectively can be acquired, and the similarity between the command data and the standardized command is determined according to the weight values corresponding to the first similarity and the second similarity respectively, the first similarity and the second similarity.
[0218] Optionally, the similarity sim between the command data and the standardized command can be determined by the following formula total :
[0219] sim total =α·sim1+(1-α)·sim2
[0220] Wherein, α can represent the weight value, sim1 can represent the first similarity, and sim2 can represent the second similarity.
[0221] S406, determining a penalty factor, and determining the similarity between the command data and the standardized command according to the first similarity, the second similarity and the penalty factor.
[0222] The weight values corresponding to the first similarity and the second similarity respectively can be acquired, and the intermediate value is determined according to the weight values corresponding to the first similarity and the second similarity respectively, the first similarity and the second similarity, and the similarity between the command data and the standardized command is determined according to the intermediate value and the penalty factor.
[0223] Optionally, the similarity sim between the command data and the standardized command can be determined by the following formula total :
[0224] sim total =α·sim1+(1-α)·sim2-γ·C penalty Wherein, α can represent the weight value, sim1 can represent the first similarity, and sim2 can represent the second similarity, C penalty may represent the penalty factor, and γ can represent the penalty weight.
[0225] The implementation content of each step in the embodiments of the application can refer to the description of the corresponding steps or operations of the above method embodiments, and the repeated content will not be described here.
[0226] The data conversion method provided by the embodiment determines a first similarity between a command name and a standard name, determines a second similarity between at least one command parameter and at least one standard parameter, determines a first type corresponding to the command data and a second type corresponding to the standardized command, determines whether the first type and the second type are the same, determines a similarity between the command data and the standardized command according to the first similarity and the second similarity if the first type and the second type are the same, and determines a penalty factor, and determines the similarity between the command data and the standardized command according to the first similarity, the second similarity and the penalty factor if the first type and the second type are not the same. In this way, the command data in the original configuration file and the standardized command can be automatically identified and matched by using a preset algorithm, manual intervention is reduced, errors caused by manual operation are avoided, configuration commands of different manufacturer devices are unified, and data conversion efficiency is improved.
[0227] Figure 5 A structural schematic diagram of a data conversion device provided by the embodiment of the application is provided. Referring to Figure 5 The data conversion device 500 includes an acquisition module 501, a construction module 502, a matching module 503 and a generation module 504, wherein
[0228] The acquisition module 501 is configured to acquire at least one original configuration file and a plurality of standardized commands corresponding to a target object, wherein the original configuration file includes a source object identifier, a plurality of configuration commands and a syntax structure corresponding to each configuration command.
[0229] The construction module 502 is configured to construct a command database according to the at least one original configuration file, wherein the command database includes command data corresponding to the plurality of configuration commands respectively.
[0230] The matching module 503 is configured to determine a target command corresponding to any one command data in the plurality of standardized commands by using a preset algorithm.
[0231] The generation module 504 is configured to generate a target configuration file corresponding to the target object according to the target command corresponding to each command data.
[0232] In a possible implementation, the matching module 503 is specifically configured to:
[0233] perform first matching processing on the command data according to the plurality of standardized commands to obtain a first matching result;
[0234] if the first matching result is matching success, the standardized command matched with the command data is determined as the target command;
[0235] If the first matching result is a matching failure, a second matching processing is performed on the command data according to the plurality of standardized commands by a preset algorithm, and a target command corresponding to the command data is determined.
[0236] In a possible implementation, the matching module 503 is specifically configured to:
[0237] determine a plurality of similarities between the command data and the plurality of standardized commands according to the preset algorithm;
[0238] determine a target similarity as a maximum similarity in the plurality of similarities;
[0239] determine whether the target similarity is greater than a first threshold value;
[0240] if yes, determine a standardized command corresponding to the target similarity as the target command.
[0241] In a possible implementation, the command data includes a command name and at least one command parameter, and the standardized command includes a standard name and at least one standard parameter. For any one standardized command, the matching module 503 is specifically configured to:
[0242] determine a first similarity between the command name and the standard name;
[0243] determine a second similarity between the at least one command parameter and the at least one standard parameter;
[0244] determine a first type corresponding to the command data and a second type corresponding to the standardized command;
[0245] determine whether the first type and the second type are the same;
[0246] if yes, determine a similarity between the command data and the standardized command according to the first similarity and the second similarity;
[0247] if no, determine a penalty factor, and determine a similarity between the command data and the standardized command according to the first similarity, the second similarity and the penalty factor.
[0248] In a possible implementation, the matching module 503 is specifically configured to:
[0249] determine matching character information and a matching prefix length between the command name and the standard name, the matching character information including a matching character number and a transposition character number;
[0250] determine a first similarity factor according to the matching character number and the transposition character number;
[0251] determine a weight factor according to the matched prefix length and a preset weight factor;
[0252] determine the first similarity degree according to the first similarity factor and the weight factor.
[0253] In a possible implementation, the matching module 503 is specifically configured to:
[0254] determine a second similarity factor between the command parameter and a standard parameter corresponding to the command parameter for any one command parameter;
[0255] add the second similarity factors of the at least one command parameter respectively to determine a sum value;
[0256] determine a parameter quantity of the at least one command parameter;
[0257] determine a ratio between the sum value and the parameter quantity as the second similarity degree.
[0258] In a possible implementation, the matching module 503 is specifically configured to:
[0259] obtain a preset mapping relationship, the mapping relationship including a plurality of preset data and a standardized command corresponding to each preset data;
[0260] determine whether the command data is included in the plurality of preset data;
[0261] if yes, determine that the first matching result is a matching success;
[0262] if no, determine whether there is a standardized command same as the command data in the plurality of standardized commands, if yes, determine that the first matching result is a matching success, and if no, determine that the first matching result is a matching failure.
[0263] Figure 6 A structural schematic diagram of an electronic device provided by an embodiment of the present application is provided. Referring to FIG. 6, Figure 6 The electronic device 600 can include a memory 601, a processor 602, and a transceiver 603.
[0264] The memory 601 is configured to store program instructions.
[0265] The processor 602 is configured to execute the program instructions stored in the memory, so that the electronic device 600 performs the above method.
[0266] The transceiver 603 can include a transmitter and / or a receiver. The transmitter can also be referred to as a sender, a transmitter, a transmission port or a transmission interface, and the like. The receiver can also be referred to as a receiver, a receiving port or a receiving interface, and the like. Exemplarily, the memory 601, the processor 602, the transceiver 603 are connected with each other through the bus 604.
[0267] The embodiment of the present application further provides a computer program product, which can be executed by a processor, and when the computer program product is executed, the above method can be implemented.
[0268] The data conversion device, the electronic device, the computer readable storage medium and the computer program product provided in the embodiments of the present application can execute the technical solutions shown in the above method embodiments, and have similar implementation principles and beneficial effects. Therefore, the detailed description will not be repeated here.
[0269] It should be noted that, for each of the above method embodiments, in order to simply describe, each is described as a combination of a series of actions, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0270] It should be further noted that, although each step in the flowchart is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise stated in this article, the execution of these steps has no strict order limitation, and these steps can be executed in other order. Moreover, at least part of the steps in the flowchart can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or alternately with at least part of other steps or sub-steps or stages of other steps.
[0271] It should be understood that the above-mentioned device embodiments are only schematic, and the device of the present application can also be realized by other ways. For example, the division of units / modules in the above embodiments is only a logical function division, and actual implementation can have another division way. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0272] In addition, each functional unit / module in the embodiments of the present application can be integrated in one unit / module, or each unit / module can exist physically, or two or more units / modules can be integrated together. The integrated unit / module can be implemented in the form of hardware or in the form of a software program module.
[0273] If the integrated unit / module is implemented in the form of hardware, the hardware can be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor can be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit can be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.
[0274] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0275] In the above embodiments, the description of each of the embodiments focuses on different aspects of the embodiments. The parts not described in detail in a certain embodiment can be seen in the relevant description of the other embodiments. The technical features of the above embodiments can be combined in any manner. In order to make the description simple, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not exist contradictory, they should be considered as the scope of the disclosure.
[0276] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.
[0277] It should be understood that the application is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application is indicated only by the appended claims.
Claims
1. A data conversion method characterized by, The method comprises the following steps: obtaining a plurality of standardized commands corresponding to at least one original configuration file and a target object, the original configuration file comprising a source object identifier, a plurality of configuration commands, and a syntax structure corresponding to each configuration command; constructing a command database according to the at least one original configuration file, the command database comprising command data corresponding to the plurality of configuration commands respectively; determining a target command corresponding to the command data in the plurality of standardized commands through a preset algorithm for any one command data; generating a target configuration file corresponding to the target object according to the target commands corresponding to the plurality of command data respectively.
2. The method of claim 1, wherein, The method comprises the following steps: performing first matching processing on the command data according to the plurality of standardized commands to obtain a first matching result; if the first matching result is a matching success, determining the standardized command matched with the command data as the target command; if the first matching result is a matching failure, performing second matching processing on the command data through a preset algorithm according to the plurality of standardized commands to determine the target command corresponding to the command data.
3. The method of claim 2, wherein, The method comprises the following steps: determining a plurality of similarities between the command data and the plurality of standardized commands according to the preset algorithm; determining the greatest similarity as a target similarity in the plurality of similarities; judging whether the target similarity is greater than a first threshold value; if yes, determining the standardized command corresponding to the target similarity as the target command.
4. The method of claim 3, wherein, The command data comprises a command name and at least one command parameter, and the standardized command comprises a standard name and at least one standard parameter. The method comprises the following steps: determining a first similarity between the command name and the standard name; determining a second similarity between the at least one command parameter and the at least one standard parameter; determining a first type corresponding to the command data and a second type corresponding to the standardized command; judging whether the first type and the second type are the same; if yes, determining the similarity between the command data and the standardized command according to the first similarity and the second similarity; 5. The method of claim 4, wherein, if no, determining a penalty factor, and determining the similarity between the command data and the standardized command according to the first similarity, the second similarity, and the penalty factor. The method comprises the following steps: determining matching character information and a matching prefix length between the command name and the standard name, the matching character information comprising a matching character number and a transposition character number; determining a first similarity factor according to the matching character number and the transposition character number; determining a weight factor according to the matching prefix length and a preset weight factor; According to the first similarity factor and the weight factor, the first similarity degree is determined.
6. The method according to claim 4 or 5, characterized in that, The second similarity degree between the at least one command parameter and the at least one standard parameter is determined, including: For any one command parameter, a second similarity factor between the command parameter and the standard parameter corresponding to the command parameter is determined; The second similarity factors of the at least one command parameter are added respectively to determine a sum value; The parameter quantity of the at least one command parameter is determined; The ratio between the sum value and the parameter quantity is determined as the second similarity degree.
7. The method according to any one of claims 2-6, characterized in that, According to the plurality of standardized commands, the command data is subjected to first matching processing to obtain a first matching result, including: A preset mapping relationship is obtained, the mapping relationship including a plurality of preset data and a standardized command corresponding to each preset data; It is judged whether the command data is included in the plurality of preset data; If yes, it is determined that the first matching result is matching success; If not, it is judged whether there is a standardized command same as the command data in the plurality of standardized commands, if there is, it is determined that the first matching result is matching success, if not, it is determined that the first matching result is matching failure.
8. A data conversion apparatus characterized by comprising: The device includes: An acquisition module is configured to acquire a plurality of standardized commands corresponding to at least one original configuration file and a target object, the original configuration file including a source object identifier, a plurality of configuration commands, and a syntax structure corresponding to each configuration command; A construction module is configured to construct a command database according to the at least one original configuration file, the command database including command data corresponding to the plurality of configuration commands respectively; A matching module is configured to determine a target command corresponding to any one command data in the plurality of standardized commands through a preset algorithm; A generation module is configured to generate a target configuration file corresponding to the target object according to the target command corresponding to each command data.
9. An electronic device, comprising: It includes: A processor and a memory connected with the processor in communication; The memory stores computer execution instructions; The processor executes the computer execution instructions stored in the memory to realize the method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to realize the method of any one of claims 1 to 7.
11. A computer program product, characterised in that, It includes a computer program, which is executed by the processor to realize the method of any one of claims 1 to 7.