Heterogeneous Data Processing Method, Apparatus, Device, and Storage Medium
The use of a target parsing template with predefined methods automates heterogeneous data parsing, reducing complexity and improving efficiency by eliminating the need for custom code development.
Patent Information
- Application Number
- CN202111528328.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-14
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2041-12-14
AI Technical Summary
When processing heterogeneous data, the prior art requires the development of special processing programs based on the data format, which makes the processing work difficult and inefficient.
The target analysis template is adopted, which includes sub-parsement methods, and the heterogeneous data is automatically parsed through the template without writing parse code. It uses the multi-forktree principle to generate parse templates and gradually parse multi-layer data.
It reduces the difficulty of heterogeneous data analysis, improves analysis efficiency and success rate, simplifies the requirements of analysts, and adapts to multi-layer data changes.
Smart Images

Figure CN114185945B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data analysis, and in particular to a method, apparatus, device, and storage medium for processing heterogeneous data. Background Art
[0002] With the popularization of the application of big data, a huge amount of heterogeneous data has increased sharply. Heterogeneous data is data composed of non-uniform formats. For example, in HTML web pages, although the outermost structure of each page is unified, the parts carrying specific information are various and cannot be called. Therefore, when calling this heterogeneous data, it is necessary to convert its format one by one to output standardized and formatted data.
[0003] In the related art, when processing heterogeneous data, it is usually necessary to develop a corresponding processing program according to the data format of the heterogeneous data to perform data format conversion. However, when processing heterogeneous data in this way, there is a problem that the processing work is difficult. Summary of the Invention
[0004] This application provides a method, apparatus, device, and storage medium for processing heterogeneous data to solve the problem of difficult heterogeneous data processing.
[0005] On the one hand, this application provides a method for processing heterogeneous data, including: obtaining a target parsing template corresponding to the heterogeneous data to be processed, where the target parsing template includes at least one sub-parsing method; parsing the heterogeneous data to be processed based on the sub-parsing method in the target parsing template to obtain a target parsing result corresponding to the heterogeneous data to be processed.
[0006] In some embodiments, parsing the heterogeneous data to be processed based on the sub-parsing method in the target parsing template to obtain a target parsing result corresponding to the heterogeneous data to be processed includes: for the Nth heterogeneous data in the heterogeneous data to be processed, obtaining the Nth sub-parsing method corresponding to the Nth heterogeneous data from the target parsing template, where N is an integer greater than or equal to 1; parsing the Nth heterogeneous data based on the Nth sub-parsing method to obtain an Nth output result; obtaining the target parsing result of the heterogeneous data to be processed according to the Nth output result.
[0007] In some embodiments, the Nth output result includes the Nth parsing result. Obtaining the target parsing result of the heterogeneous data to be processed according to the Nth output result includes: determining whether the Nth output result includes the (N + 1)th heterogeneous data; in response to the Nth output result not including the (N + 1)th heterogeneous data, determining the parsing results corresponding to the 1st sub-parsing method to the Nth sub-parsing method as the target parsing result of the heterogeneous data to be processed.
[0008] In some embodiments, the heterogeneous data processing method further includes: in response to the Nth output result including the (N + 1)th heterogeneous data, obtaining the (N + 1)th sub-parsing method corresponding to the (N + 1)th heterogeneous data from the target parsing template; parsing the (N + 1)th heterogeneous data based on the (N + 1)th sub-parsing method to obtain the (N + 1)th output result.
[0009] In some embodiments, the heterogeneous data processing method further includes: determining whether the Nth output result contains first data that does not meet the preset requirements; in response to the Nth output result containing the first data, discarding the first data.
[0010] In some embodiments, the heterogeneous data processing method further includes: obtaining the preset output format corresponding to the target parsing result; converting the target parsing result into the preset output format to obtain the final parsing result corresponding to the heterogeneous data to be processed; outputting the final parsing result corresponding to the heterogeneous data to be processed.
[0011] In some embodiments, the heterogeneous data processing method further includes: obtaining the original heterogeneous data, where the original heterogeneous data includes the heterogeneous data to be processed; determining the sub-parsing method corresponding to the original heterogeneous data according to the preset parsing result; based on the multi-way tree principle, generating the parsing template corresponding to the original heterogeneous data according to the sub-parsing method, where the parsing template includes multiple sub-parsing methods, the parsing template includes a parent node and leaf nodes, the parent node is the heterogeneous data, and the leaf nodes of the parsing template are the output results of the heterogeneous data obtained based on the sub-parsing method.
[0012] In some embodiments, determining the sub-parsing method corresponding to the original heterogeneous data according to the preset parsing result includes: for the jth heterogeneous data corresponding to the original heterogeneous data, determining the set of original parsing methods corresponding to the jth heterogeneous data, where j is an integer greater than 1; parsing the jth heterogeneous data based on the Mth original parsing method in the set of original parsing methods to obtain the Mth parsing result corresponding to the Mth original parsing method, where M is an integer greater than or equal to 1; determining the jth sub-parsing method of the jth heterogeneous data according to the Mth parsing result and the preset parsing result; determining the parsing method corresponding to the original heterogeneous data according to the jth sub-parsing method of the jth heterogeneous data.
[0013] In some embodiments, determining the jth sub-parsing method of the jth heterogeneous data according to the Mth parsing result and the preset parsing result includes: determining whether the Mth parsing result matches the preset parsing result; in response to the Mth parsing result not matching the preset parsing result, parsing the heterogeneous data based on the (M + 1)th original parsing method in the set of original parsing methods to obtain the (M + 1)th parsing result corresponding to the (M + 1)th original parsing method, and determining the jth sub-parsing method of the jth heterogeneous data according to the (M + 1)th parsing result; or, in response to the Mth parsing result matching the preset parsing result, determining the jth sub-parsing method of the jth heterogeneous data according to the Mth parsing result.
[0014] In some embodiments, according to the j-th sub-parsing method of the j-th heterogeneous data, determining the sub-parsing method corresponding to the original heterogeneous data includes: parsing the j-th heterogeneous data based on the j-th sub-parsing method to obtain a j-th output result; determining whether the j-th output result contains heterogeneous data; in response to the j-th output result not containing heterogeneous data, determining the sub-parsing methods corresponding to the 1st to j-th heterogeneous data as the sub-parsing method of the original heterogeneous data; or, in response to the j-th output result containing heterogeneous data, determining the heterogeneous data as the (j + 1)-th heterogeneous data, and determining the sub-parsing method corresponding to the original heterogeneous data according to the (j + 1)-th heterogeneous data.
[0015] In a second aspect, the present application provides a heterogeneous data processing device, including: an acquisition module, configured to acquire a target parsing template corresponding to the heterogeneous data to be processed, where the target parsing template includes at least one sub-parsing method; a parsing module, configured to parse the heterogeneous data to be processed based on the sub-parsing method in the target parsing template to obtain a target parsing result corresponding to the heterogeneous data to be processed.
[0016] In some embodiments, the parsing module is specifically configured to: for the N-th heterogeneous data in the heterogeneous data to be processed, acquire the N-th sub-parsing method corresponding to the N-th heterogeneous data from the target parsing template, where N is an integer greater than or equal to 1; parse the N-th heterogeneous data based on the N-th sub-parsing method to obtain an N-th output result; and obtain the target parsing result of the heterogeneous data to be processed according to the N-th output result.
[0017] In some embodiments, the parsing module is specifically configured to: determine whether the N-th output result contains the (N + 1)-th heterogeneous data; in response to the N-th output result not including the (N + 1)-th heterogeneous data, determine the parsing results corresponding to the 1st to N-th sub-parsing methods as the target parsing result corresponding to the heterogeneous data to be processed.
[0018] In some embodiments, the parsing module is further configured to: in response to the N-th output result including the (N + 1)-th heterogeneous data, acquire the (N + 1)-th sub-parsing method corresponding to the (N + 1)-th heterogeneous data from the target parsing template; and parse the (N + 1)-th heterogeneous data based on the (N + 1)-th sub-parsing method to obtain an (N + 1)-th output result.
[0019] In some embodiments, the heterogeneous data processing device further includes: a processing module, configured to determine whether the N-th output result contains first data that does not meet a preset requirement; and in response to the N-th output result containing the first data, discard the first data.
[0020] In some embodiments, the obtaining module is further configured to: obtain a preset output format corresponding to the target parsing result; the heterogeneous data processing device further includes: an output module, configured to convert the target parsing result into the preset output format to obtain a final parsing result corresponding to the heterogeneous data to be processed; and output the final parsing result corresponding to the heterogeneous data to be processed.
[0021] In some embodiments, the obtaining module is further configured to: obtain original heterogeneous data, where the original heterogeneous data includes the heterogeneous data to be processed; the processing module is further configured to: determine a sub-parsing method corresponding to the original heterogeneous data according to a preset parsing result; based on the multi-way tree principle, generate a parsing template corresponding to the original heterogeneous data according to the sub-parsing method, where the parsing template includes multiple sub-parsing methods, the parsing template includes a parent node and leaf nodes, the parent node is the heterogeneous data, and the leaf nodes of the parsing template are output results of the heterogeneous data obtained based on the sub-parsing method.
[0022] In some embodiments, the processing module is specifically configured to: for the j-th heterogeneous data corresponding to the original heterogeneous data, determine an original parsing method set corresponding to the j-th heterogeneous data, where j is an integer greater than 1; parse the j-th heterogeneous data based on the M-th original parsing method in the original parsing method set to obtain an M-th parsing result corresponding to the M-th original parsing method, where M is an integer greater than or equal to 1; determine a j-th sub-parsing method of the j-th heterogeneous data according to the M-th parsing result and the preset parsing result; and determine a parsing method corresponding to the original heterogeneous data according to the j-th sub-parsing method of the j-th heterogeneous data.
[0023] In some embodiments, the processing module is specifically configured to: determine whether the M-th parsing result matches the preset parsing result; in response to the M-th parsing result not matching the preset parsing result, parse the heterogeneous data based on the (M + 1)-th original parsing method in the original parsing method set to obtain an (M + 1)-th parsing result corresponding to the (M + 1)-th original parsing method, and determine a j-th sub-parsing method of the j-th heterogeneous data according to the (M + 1)-th parsing result; or, in response to the M-th parsing result matching the preset parsing result, determine a j-th sub-parsing method of the j-th heterogeneous data according to the M-th parsing result.
[0024] In some embodiments, the processing module is specifically configured to: parse the j-th heterogeneous data based on the j-th sub-parsing method to obtain a j-th output result; determine whether the j-th output result contains heterogeneous data; in response to the j-th output result not containing heterogeneous data, determine that the sub-parsing methods corresponding to the 1st to j-th heterogeneous data are the sub-parsing methods of the original heterogeneous data; or, in response to the j-th output result containing heterogeneous data, determine that the heterogeneous data is the (j + 1)-th heterogeneous data, and determine a sub-parsing method corresponding to the original heterogeneous data according to the (j + 1)-th heterogeneous data.
[0025] In a third aspect, the present application provides an electronic device, including: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the heterogeneous data processing method as in the first aspect.
[0026] In a fourth aspect, the present application provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the heterogeneous data processing method as in the first aspect when executed by a processor.
[0027] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the heterogeneous data processing method as in the first aspect when executed by a processor.
[0028] The heterogeneous data processing method, device, equipment and storage medium provided by the present application determine the parsing method for parsing the heterogeneous data to be processed through the parsing template of the heterogeneous data, and then parse the heterogeneous data to be processed based on the parsing method. In this solution, it is possible to implement the parsing of the heterogeneous data to be processed without writing parsing code, which can reduce the parsing difficulty of the heterogeneous data and improve the parsing efficiency of the heterogeneous data. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0030] Figure 1 It is a schematic diagram of an application scenario example provided by an embodiment of the present application;
[0031] Figure 2 It is a schematic flow chart of the heterogeneous data processing method provided by an embodiment of the present application Figure 1 ;
[0032] Figure 3 It is a schematic flow chart of the heterogeneous data processing method provided by an embodiment of the present application Figure 2 ;
[0033] Figure 4 It is a schematic diagram of the principle of the heterogeneous data processing method provided by an embodiment of the present application;
[0034] Figure 5 It is a schematic flow chart of the heterogeneous data processing method provided by an embodiment of the present application Figure 3 ;
[0035] Figure 6 It is a schematic flow chart of the heterogeneous data processing method provided by an embodiment of the present application Figure 4 ;
[0036] Figure 7Structural schematic diagram of the heterogeneous data processing device provided by the embodiment of the present application;
[0037] Figure 8 Structural schematic diagram of the electronic device provided by the embodiment of the present application.
[0038] Through the above-mentioned drawings, specific embodiments of the present application have been shown, and more detailed descriptions will be provided hereinafter. These drawings and text descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed implementation manners
[0039] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0040] First, the terms related to the present application will be explained:
[0041] Heterogeneous data: Data composed of non-uniform fixed formats;
[0042] JavaScript Object Notation: (JSON), a lightweight data interchange format that uses a text format completely independent of programming languages to store and represent data;
[0043] eXtensible Markup Language: (XML), a simple data storage language that uses a series of simple tags to describe data;
[0044] Key-value storage: (KV);
[0045] Message-Digest Algorithm 5: (MD5), a widely used cryptographic hash function that can generate a 128-bit (16-byte) hash value;
[0046] Uniform Resource Location decoding: (URL decoding) A tool for encoding or decoding Chinese in URLs using encodeURI or decodeURI;
[0047] Base64 decoding: A method for representing binary data based on 64 printable characters. A tool that can perform base64 decoding / encoding on strings, implemented using JavaScript;
[0048] Hyper Text Markup Language (Html): It includes a series of tags. Through these tags, the formats of documents on the network can be unified, connecting scattered Internet resources into a logical whole;
[0049] UTF-8 (8-bit Unicode Transformation Format), a variable-length character encoding for Unicode;
[0050] Single-layer data: Data composed of a single form, such as data in the form of key-value pairs, delimiters, etc.;
[0051] Multi-layer data: Data composed of multiple forms, such as data in the form of JSON, XML, HTML, etc.
[0052] In related technologies, data parsing methods such as script code or regular capture expressions are usually used to parse heterogeneous data. That is, for each type of heterogeneous data, at least one script code file or regular capture expression needs to be written. This parsing method has relatively high requirements for parsers and requires continuous code updates and maintenance to adapt to more complex heterogeneous data.
[0053] In addition, for regular capture expressions, their ability to handle multi-layer heterogeneous data is poor. For example, for multi-layer JSON data, the presence or absence of fields and the field order in heterogeneous data can make regular expressions ineffective, and they have poor compatibility with data changes. Taking the regular expression used to extract data (a = b, c = d) as an example, for data (e = b, c = d) or (a = b, e = f, c = d), normal extraction cannot be performed.
[0054] In view of this, the embodiments of the present application provide a method, device, equipment, and storage medium for processing heterogeneous data. For each type of heterogeneous data, a data parsing template is set, and the data parsing template contains a parsing method for parsing the heterogeneous data. When parsing heterogeneous data, only the parsing method provided in the data parsing template needs to be used to parse the heterogeneous data. Through this solution, it is possible to achieve the parsing of heterogeneous data to be processed without writing parsing code or regular expressions, with relatively low requirements for parsers, and it can reduce the parsing difficulty of heterogeneous data and improve the parsing efficiency of heterogeneous data.
[0055] Figure 1This is an example diagram of the application scenario provided by the embodiments of this application. As Figure 1 shown, the devices involved in this scenario include: terminal device 101.
[0056] Among them, the terminal device 101 can be a personal digital assistant (PDA) device, a handheld device with wireless communication function (such as a smart phone, a tablet computer), a computing device (such as a personal computer (PC)), a vehicle-mounted device, a wearable device (such as a smart watch, a smart bracelet), a smart home device (such as a smart display device), etc., Figure 1 which is illustrated by taking a desktop computer as an example, but is not limited thereto.
[0057] In practical applications, a data parsing and visualization tool runs on the terminal device 101. The data parsing and visualization tool can be in various forms such as an application program, a plug-in, etc. The data parsing and visualization tool is used for data parsing personnel to perform data parsing operations.
[0058] Specifically, the parsing personnel can input the heterogeneous data to be parsed into the data parsing and visualization tool, and the terminal device 101 can use the tool to parse the heterogeneous data by using a preset parsing method and output the parsing result.
[0059] In some embodiments, the application scenario further includes a server 102. Among them, the terminal device 101 and the server 102 are connected through a network. The server 102 can be a single server, or a server cluster, can be a distributed server, or a centralized server, and can also be a cloud server, etc. The embodiments of this application do not make specific limitations.
[0060] In this embodiment, the server 102 can also perform the parsing operation of the heterogeneous data. Specifically, the parsing personnel input the heterogeneous data to be parsed into the data parsing and visualization tool, and the terminal device 101 then sends the heterogeneous data to the server 102. The server 102 uses a preset parsing method to parse the heterogeneous data and sends the parsing result to the terminal device 101 side through the network for display through the visualization tool of the terminal device 101.
[0061] Through this solution, it is possible to implement the parsing of the heterogeneous data to be processed without writing parsing code or regular expressions. It has relatively low requirements for parsing personnel, and can reduce the parsing difficulty of heterogeneous data and improve the parsing efficiency of heterogeneous data. In addition, by using the data parsing and visualization tool to perform the parsing operation on the heterogeneous data, its processing method is more flexible and can further improve the parsing efficiency of heterogeneous data.
[0062] The following uses specific embodiments to elaborate in detail on the technical solution of this application and how the technical solution of this application solves the above technical problems. These several specific embodiments below can be combined with each other, and for the same or similar concepts or processes, they may not be repeated in some embodiments. The embodiments of this application will be described below in conjunction with the accompanying drawings.
[0063] Figure 2 Flow schematic of the heterogeneous data processing method provided by the embodiments of this application Figure 1 It should be understood that the execution subject of the embodiments of this application can be the above terminal device or server. As Figure 2 shown, the heterogeneous data processing method of the embodiments of this application includes the following steps:
[0064] S201. Obtain the target parsing template corresponding to the heterogeneous data to be processed.
[0065] In the embodiments of this application, each heterogeneous data corresponds to at least one parsing template. After obtaining the heterogeneous data to be processed, the target parsing template corresponding to it can be determined according to the data structure or identification information of the heterogeneous data to be processed. The configuration method of the parsing template for heterogeneous data will be shown in subsequent embodiments.
[0066] Among them, the target parsing template includes at least one sub-parsing method. It should be understood that the sub-parsing methods corresponding to heterogeneous data with different data structures are different. The common sub-parsing methods are shown in Table 1 below. It should be noted that the sub-parsing methods provided in this table can be configured according to requirements, and the embodiments of this application do not make limitations.
[0067]
[0068] S202. Parse the heterogeneous data to be processed based on the sub-parsing methods in the target parsing template to obtain the target parsing result corresponding to the heterogeneous data to be processed.
[0069] Generally, heterogeneous data is multi-layer data and needs to be parsed multiple times to obtain the final parsing result. In the embodiments of this application, the sub-parsing methods used in each parsing step can be configured through the parsing template. Before obtaining the final parsing result, for each parsing step, a parsed heterogeneous data will be obtained. In the next parsing step, the corresponding sub-parsing method is used to parse the heterogeneous data obtained in this step until the final parsing result is obtained.
[0070] In this step, after obtaining the target parsing template corresponding to the heterogeneous data to be processed, the sub-parsing methods corresponding to each parsing step are known. According to this target parsing template, in each parsing step, the heterogeneous data corresponding to this step is parsed using the sub-parsing method corresponding to this step, and the parsing results corresponding to each step can be obtained.
[0071] Among them, the target parsing result corresponding to the heterogeneous data to be processed includes the parsing results obtained in each step.
[0072] In the embodiment of the present application, through the parsing template of heterogeneous data, the parsing method for parsing the heterogeneous data to be processed is determined, and then the heterogeneous data to be processed is parsed based on the parsing method. In this solution, since the parsing of the heterogeneous data to be processed can be realized without writing parsing code, the parsing difficulty of the heterogeneous data can be reduced and the parsing efficiency of the heterogeneous data can be improved.
[0073] In an alternative implementation manner, when using a data parsing visualization tool to parse the heterogeneous data to be processed, multiple candidate sub-parsing methods are displayed on the interface of the visualization tool. After inputting the heterogeneous data to be processed into the visualization tool, the target parsing template corresponding to the heterogeneous data to be processed is displayed on this interface, so that the parsing personnel can select the sub-parsing method corresponding to this parsing step in each parsing step according to the target parsing template, thereby parsing the heterogeneous data to be processed. After the parsing is completed, the target parsing result corresponding to the heterogeneous data is displayed through the visualization tool. Among them, the embodiment of the present application does not make specific limitations on the display manner of the target parsing template. For example, it can be displayed on the interface in a graphic and text manner.
[0074] In this embodiment, by visually displaying the target parsing template, the parsing personnel can intuitively obtain the steps for parsing the heterogeneous data to be processed and the sub-parsing methods corresponding to each step, thereby reducing the parsing difficulty of the heterogeneous data and improving the parsing efficiency of the heterogeneous data.
[0075] In another alternative implementation manner, after inputting the heterogeneous data to be processed into the visualization tool, the terminal device will obtain the corresponding target parsing template according to the heterogeneous data to be processed. At the same time, the sub-parsing methods corresponding to each parsing step are obtained according to the target parsing template, and the heterogeneous data to be processed is parsed according to each sub-parsing method. After each parsing step is completed, the target parsing result corresponding to the heterogeneous data is displayed through the visualization tool.
[0076] In this embodiment, only by inputting it into the visualization tool can the final target parsing result be obtained. Its automation degree is higher, the requirements for parsing personnel are lower, and the parsing efficiency of heterogeneous data can be improved to the greatest extent.
[0077] Figure 3 Flow schematic of the heterogeneous data processing method provided by the embodiments of the present application Figure 2 . Based on Figure 2 , the heterogeneous data processing method is further described in detail through the embodiments of the present application. As Figure 3 shown, the heterogeneous data processing method of the embodiments of the present application includes the following steps:
[0078] S301. Obtain the target parsing template corresponding to the heterogeneous data to be processed.
[0079] S302. For the Nth heterogeneous data in the heterogeneous data to be processed, obtain the Nth sub-parsing method corresponding to the Nth heterogeneous data from the target parsing template.
[0080] Where N is an integer greater than or equal to 1.
[0081] It should be understood that when N is 1, the 1st heterogeneous data is the heterogeneous data to be processed. When N is greater than 1, the Nth heterogeneous data is the heterogeneous data obtained after parsing the heterogeneous data to be processed at least once.
[0082] S303. Parse the Nth heterogeneous data based on the Nth sub-parsing method to obtain the Nth output result.
[0083] In this step, the target parsing template is used to indicate the sub-parsing method corresponding to the heterogeneous data in each parsing step. After obtaining the heterogeneous data in the current parsing step, the heterogeneous data is parsed based on the corresponding sub-parsing method to obtain the output result corresponding to each parsing step.
[0084] S304. Determine whether the Nth output result contains the (N + 1)th heterogeneous data.
[0085] S305. If the Nth output result contains the (N + 1)th heterogeneous data, obtain the (N + 1)th output result corresponding to the (N + 1)th heterogeneous data in the manner of steps S302 to S303.
[0086] S306. If the Nth output result does not contain the (N + 1)th heterogeneous data, determine that the parsing results corresponding to the 1st sub-parsing method to the Nth sub-parsing method are the target parsing results corresponding to the heterogeneous data to be processed.
[0087] It should be noted that in addition to the parsing results obtained in this step, in some embodiments, there may also be heterogeneous data in the output results. Therefore, it is necessary to judge the output results. When the output results do not contain heterogeneous data, it means that the heterogeneous data to be processed has been parsed. When the output results contain heterogeneous data, the heterogeneous data needs to be further parsed until the output results no longer contain heterogeneous data.
[0088] For ease of understanding, please refer to Figure 4 , Figure 4 , which is a schematic diagram of the principle of the heterogeneous data processing method provided by the embodiment of the present application. As Figure 4 shown, for the first heterogeneous data (i.e., the heterogeneous data to be processed), the first parsing method is used to parse it, and the first output result obtained includes: the first parsed data, heterogeneous data 2, and heterogeneous data 3. That is to say, the N+1 heterogeneous data includes heterogeneous data 2 and heterogeneous data 3.
[0089] Correspondingly, according to the target parsing template, it can be obtained that the sub-parsing method corresponding to heterogeneous data 2 is the second parsing method, and the sub-parsing method corresponding to heterogeneous data 3 is the third parsing method. The corresponding sub-parsing method is continued to parse the obtained heterogeneous data, so as to obtain the output results corresponding to heterogeneous data 2 and heterogeneous data 3.
[0090] As Figure 4 shown, the second output result includes: the second parsing result, the third parsing result, and the second data. If the second data is heterogeneous data, it means that the heterogeneous data to be processed has not been parsed completely, and it is necessary to continue to obtain the third output result in the manner of steps S302 to S303 until the output result does not include heterogeneous data, then the heterogeneous data to be processed is parsed completely. If the second data is not heterogeneous data, it means that the heterogeneous data to be processed has been parsed currently, and then the first parsing result, the second parsing result, and the third parsing result are determined as the target parsing results.
[0091] Through the method of the embodiment of the present application, it is possible to realize the parsing of the heterogeneous data to be processed without writing parsing code, which can reduce the parsing difficulty of the heterogeneous data and improve the parsing efficiency of the heterogeneous data.
[0092] In addition, its capture ability for multi-layer heterogeneous data is stronger than the existing methods. For example, for multi-layer JSON data, the presence or absence of fields and the field order in the heterogeneous data will make the regular expression invalid. Taking the extraction of the data (a=b, c=d) as an example, for the data (e=b, c=d) or (a=b, e=f, c=d), the regular expression cannot extract it normally. However, through the method of the embodiment of the present application, by parsing with multiple sub-parsing methods, the target data can be accurately extracted, thereby improving the parsing success rate of the heterogeneous data.
[0093] In an optional implementation manner, after obtaining the target parsing result, the target parsing result can be directly displayed in the visualization interface.
[0094] In another optional implementation manner, after obtaining the target parsing result, it can be converted into a preset output format to obtain structured and standardized data. Next, this solution will be described in detail in combination with steps S307 to S309.
[0095] S307. Obtain the preset output format corresponding to the target parsing result.
[0096] S308. Convert the target parsing result into the preset output format to obtain the final parsing result corresponding to the heterogeneous data to be processed.
[0097] S309. Output the final parsing result corresponding to the heterogeneous data to be processed.
[0098] Among them, the preset output format is, for example, in the format of (Key, Value) Map, etc., and the embodiments of the present application do not make specific limitations.
[0099] On the one hand, the target parsing result contains multiple parsing results, and each parsing result is processed into the preset output format.
[0100] On the other hand, different output formats can be customized for different parsing results, thereby improving the flexibility of heterogeneous data parsing and meeting personalized needs.
[0101] In some real-time modes, the output result may also contain first data that does not meet the preset requirements. Among them, the non-conforming first data is other data except for the heterogeneous data and the parsing result. For example Figure 4 as shown, in the first output result, if there is first data, then this first data needs to be discarded.
[0102] Figure 5 is the flow schematic of the heterogeneous data processing method provided by the embodiments of the present application Figure 3 . In the embodiments of the present application, the method for obtaining the parsing template of the heterogeneous data is described in detail. For example Figure 5 as shown, the heterogeneous data processing method of the embodiments of the present application includes the following steps:
[0103] S501. Obtain the original heterogeneous data.
[0104] Among them, the original heterogeneous data includes the heterogeneous data to be processed shown in the above embodiments. That is to say, before parsing the heterogeneous data to be processed, the parsing template corresponding to the heterogeneous data to be processed can be obtained through the method provided by the embodiments of the present application.
[0105] S502. Determine the parsing method corresponding to the original heterogeneous data according to the preset parsing result.
[0106] Among them, the preset parsing result is the parsing result to be obtained. Each original heterogeneous data includes multiple parsing steps, and each parsing step corresponds to a different parsing result. In the embodiments of the present application, the preset parsing result of each parsing step can be determined according to requirements, and then different parsing methods are used to parse the heterogeneous data corresponding to this step, and the parsing method that can obtain this preset parsing result is determined as the expected parsing method for this step.
[0107] Correspondingly, in the same way, the parsing methods corresponding to other steps are determined, and these parsing methods are the parsing methods corresponding to the original heterogeneous data.
[0108] S503. Based on the multi-way tree principle, generate a parsing template corresponding to the original heterogeneous data according to the parsing method.
[0109] Specifically, after determining the parsing method for each step, based on the multi-way tree principle, a parsing template corresponding to the original heterogeneous data is generated. Among them, the parsing template includes a parent node and leaf nodes. Each parent node is the heterogeneous data corresponding to this node, and the leaf nodes in the parsing template are the output results obtained when parsing the heterogeneous data based on the parsing method of this node.
[0110] Please continue to refer to Figure 4 , Figure 4 which is the multi-way tree schematic diagram of the parsing template. As Figure 4 shown, the heterogeneous data to be processed is the parent node in the first step, and both heterogeneous data 2 and heterogeneous data 3 are the parent nodes in the second step;
[0111] Correspondingly, "the first parsing result, heterogeneous data 2, the first data, and heterogeneous data 3" in the first output result are the leaf nodes in the first step; "the second parsing result, the second data, and the third parsing result" in the second output result are the leaf nodes in the second step.
[0112] In the embodiments of the present application, by generating the parsing template in the form of a multi-way tree, the parsing template can be visually displayed, enabling the parsing personnel to intuitively obtain the steps for parsing the heterogeneous data to be processed and the corresponding sub-parsing methods for each step, thereby reducing the parsing difficulty of heterogeneous data and improving the parsing efficiency of heterogeneous data.
[0113] Figure 6 is the process schematic of the heterogeneous data processing method provided by the embodiments of the present application Figure 4 . As Figure 6 shown, the heterogeneous data processing method of the embodiments of the present application includes the following steps:
[0114] S601. Obtain the original heterogeneous data.
[0115] S602. For the j-th heterogeneous data corresponding to the original heterogeneous data, determine the set of original parsing methods corresponding to the j-th heterogeneous data.
[0116] Where j is an integer greater than or equal to 1.
[0117] It should be understood that when j is 1, the first heterogeneous data is the original heterogeneous data; when j is greater than 1, the j-th heterogeneous data is the heterogeneous data obtained after parsing the original heterogeneous data at least once.
[0118] The set of original parsing methods corresponding to the j-th heterogeneous data includes multiple original parsing methods. In some embodiments, the original parsing methods in the set of original parsing methods may be some or all of the sub-parsing methods in Table 1.
[0119] S603. Parse the j-th heterogeneous data based on the M-th original parsing method in the set of original parsing methods to obtain the M-th parsing result corresponding to the M-th original parsing method.
[0120] Specifically, multiple original parsing methods in the set of original parsing methods can be sorted, and the j-th heterogeneous data is parsed one by one according to the sorted original parsing methods in the set of original parsing methods to obtain the parsing results corresponding to the respective original parsing methods.
[0121] It should be noted that for the sorting method, the embodiments of the present application do not make specific limitations. For example, the original parsing methods in the set of original parsing methods can be randomly sorted.
[0122] S604. Determine whether the M-th parsing result matches the preset parsing result.
[0123] S605. If the M-th parsing result does not match the preset parsing result, obtain the (M + 1)-th original parsing method from the set of original parsing methods, and obtain the (M + 1)-th parsing result corresponding to the (M + 1)-th original parsing method according to the method in step S603.
[0124] S606. If the M-th parsing result matches the preset parsing result, determine that the M-th original parsing method is the j-th sub-parsing method of the j-th heterogeneous data.
[0125] Exemplarily, taking M = 1 as an example, take the first original parsing method in the set of original parsing methods to parse the j-th heterogeneous data to obtain the first parsing result. If the first parsing result matches the preset parsing result, determine that the first original parsing method is the j-th sub-parsing method of the j-th heterogeneous data.
[0126] Correspondingly, if the first parsing result does not match the preset parsing result, obtain the second original parsing method in the original parsing method set, and process it in the manner of steps S603 to S606 until the obtained parsing result matches the preset parsing result, then determine the original parsing method corresponding to the matching time as the j-th sub-parsing method of the j-th heterogeneous data.
[0127] S607. Determine whether the j-th output result contains heterogeneous data.
[0128] S608. If it is determined that the j-th output result contains heterogeneous data, determine the heterogeneous data as the (j + 1)-th heterogeneous data, and determine the (j + 1)-th sub-parsing method corresponding to the (j + 1)-th heterogeneous data according to the method of S602 to S606.
[0129] S609. If it is determined that the j-th output result does not contain heterogeneous data, determine the sub-parsing methods corresponding to the first heterogeneous data to the j-th heterogeneous data as the sub-parsing methods of the original heterogeneous data.
[0130] It should be understood that when the original parsing method is used to parse the j-th heterogeneous data, an output result will be obtained, and the j-th output result is the output result corresponding to the j-th sub-parsing method. In the embodiments of the present application, if it is determined that the j-th output result still contains heterogeneous data, it means that the original heterogeneous data has not been completely parsed, and its parsing template has not been fully obtained, and the heterogeneous data needs to be further parsed.
[0131] Specifically, determine the heterogeneous data contained in the j-th output result as the (j + 1)-th heterogeneous data, and determine the (j + 1)-th sub-parsing method corresponding to the (j + 1)-th heterogeneous data according to the method of S602 to S606 until the obtained output result does not contain heterogeneous data, indicating that the original heterogeneous data has been completely parsed, and the sub-parsing methods corresponding to each heterogeneous data during the parsing process are the sub-parsing methods of the original heterogeneous data.
[0132] S610. Based on the multi-way tree principle, generate a parsing template corresponding to the original heterogeneous data according to the sub-parsing method.
[0133] It should be noted that step S610 is similar to step S503 in the Figure 5 shown embodiment, and will not be described in detail here.
[0134] Corresponding to the heterogeneous data processing method shown in the above embodiments, Figure 7 is a schematic diagram of heterogeneous data processing provided by the embodiments of the present application. For the sake of convenience of description, only the parts related to the embodiments of the present application are shown, as Figure 7 shown, the heterogeneous data processing device 700 includes:
[0135] An acquisition module 701 is configured to acquire a target parsing template corresponding to heterogeneous data to be processed, where the target parsing template includes at least one sub-parsing method; a parsing module 702 is configured to parse the heterogeneous data to be processed based on the sub-parsing methods in the target parsing template to obtain a target parsing result corresponding to the heterogeneous data to be processed.
[0136] In some embodiments, the parsing module 702 is specifically configured to: for the Nth heterogeneous data in the heterogeneous data to be processed, acquire the Nth sub-parsing method corresponding to the Nth heterogeneous data from the target parsing template, where N is an integer greater than or equal to 1; parse the Nth heterogeneous data based on the Nth sub-parsing method to obtain an Nth output result; and obtain the target parsing result of the heterogeneous data to be processed according to the Nth output result.
[0137] In some embodiments, the parsing module 702 is specifically configured to: determine whether the Nth output result includes the (N + 1)th heterogeneous data; in response to the Nth output result not including the (N + 1)th heterogeneous data, determine that the parsing results corresponding to the 1st sub-parsing method to the Nth sub-parsing method are the target parsing results corresponding to the heterogeneous data to be processed.
[0138] In some embodiments, the parsing module 702 is further configured to: in response to the Nth output result including the (N + 1)th heterogeneous data, acquire the (N + 1)th sub-parsing method corresponding to the (N + 1)th heterogeneous data from the target parsing template; and parse the (N + 1)th heterogeneous data based on the (N + 1)th sub-parsing method to obtain an (N + 1)th output result.
[0139] In some embodiments, the heterogeneous data processing device further includes: a processing module 703, where the determining module is further configured to: determine whether the Nth output result includes first data that does not meet a preset requirement; in response to the Nth output result including the first data, discard the first data.
[0140] In some embodiments, the acquisition module is further configured to: acquire a preset output format corresponding to the target parsing result; the heterogeneous data processing device further includes: an output module 704, configured to convert the target parsing result into the preset output format to obtain a final parsing result corresponding to the heterogeneous data to be processed; and output the final parsing result corresponding to the heterogeneous data to be processed.
[0141] In some embodiments, the acquisition module 701 is further configured to: acquire original heterogeneous data, where the original heterogeneous data includes the heterogeneous data to be processed; the processing module 703 is further configured to: determine a sub-parsing method corresponding to the original heterogeneous data according to a preset parsing result; based on the principle of a multi-way tree, generate a parsing template corresponding to the original heterogeneous data according to the sub-parsing method, where the parsing template includes multiple sub-parsing methods, the parsing template includes a parent node and leaf nodes, the parent node is the heterogeneous data, and the leaf nodes of the parsing template are the output results of the heterogeneous data obtained based on the sub-parsing methods.
[0142] In some embodiments, the processing module 703 is specifically configured to: for the j-th heterogeneous data corresponding to the original heterogeneous data, determine the set of original parsing methods corresponding to the j-th heterogeneous data, where j is an integer greater than 1; parse the j-th heterogeneous data based on the M-th original parsing method in the set of original parsing methods to obtain the M-th parsing result corresponding to the M-th original parsing method, where M is an integer greater than or equal to 1; determine the j-th sub-parsing method of the j-th heterogeneous data according to the M-th parsing result and the preset parsing result; and determine the parsing method corresponding to the original heterogeneous data according to the j-th sub-parsing method of the j-th heterogeneous data.
[0143] In some embodiments, the processing module 703 is specifically configured to: determine whether the M-th parsing result matches the preset parsing result; in response to the M-th parsing result not matching the preset parsing result, parse the heterogeneous data based on the (M + 1)-th original parsing method in the set of original parsing methods to obtain the (M + 1)-th parsing result corresponding to the (M + 1)-th original parsing method, and determine the j-th sub-parsing method of the j-th heterogeneous data according to the (M + 1)-th parsing result; or, in response to the M-th parsing result matching the preset parsing result, determine the j-th sub-parsing method of the j-th heterogeneous data according to the M-th parsing result.
[0144] In some embodiments, the processing module 703 is specifically configured to: parse the j-th heterogeneous data based on the j-th sub-parsing method to obtain the j-th output result; determine whether the j-th output result contains heterogeneous data; in response to the j-th output result not containing heterogeneous data, determine the sub-parsing methods corresponding to the 1st to j-th heterogeneous data as the sub-parsing methods of the original heterogeneous data; or, in response to the j-th output result containing heterogeneous data, determine the heterogeneous data as the (j + 1)-th heterogeneous data, and determine the sub-parsing method corresponding to the original heterogeneous data according to the (j + 1)-th heterogeneous data.
[0145] The above-mentioned heterogeneous data parsing device provided by the embodiments of the present application can be used to execute the technical solutions of the above-mentioned heterogeneous data parsing method, and its implementation principle and technical effects are similar, which will not be elaborated here.
[0146] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Among them, the electronic device can be a mobile terminal, a computer, a message transceiver device, a tablet device, a personal digital assistant, etc.
[0147] The electronic device 800 may include one or more of the following components: a processor 801 and a memory 802. In some embodiments, the electronic device 800 further includes: a power supply component 803, a multimedia component 804, an audio component 805, an input / output (I / O) interface 806, a sensor component 807, and a communication component 808, etc.
[0148] Among them, the processor 801 generally controls the overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processor 801 may include one or more processors to execute instructions to complete all or part of the steps of the above methods. In addition, the processor 801 may include one or more modules to facilitate the interaction between the processor 801 and other components. For example, the processor 801 may include a multimedia module to facilitate the interaction between the multimedia component 804 and the processor 801.
[0149] The memory 802 is configured to store various types of data to support the operation of the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disks, or optical disks.
[0150] The power supply component 803 provides power to various components of the electronic device 800. The power supply component 803 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
[0151] The multimedia component 804 includes a screen that provides an output interface between the electronic device 800 and the user; the audio component 805 is configured to output and / or input audio signals; the I / O interface 806 provides an interface between the processor 801 and peripheral interface modules, and the above peripheral interface modules may be a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: home button, volume buttons, power-on button, and lock button; the sensor component 807 includes one or more sensors for providing status assessments in various aspects of the electronic device 800.
[0152] The communication component 808 is configured to facilitate communication between the electronic device 800 and other devices in a wired or wireless manner. The electronic device 800 may access a communication standard-based wireless network, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 808 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 808 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0153] In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above method.
[0154] The embodiment of the present application also provides a non-transitory computer-readable storage medium. When the instructions in the storage medium are executed by the processor of the terminal device, the terminal device can execute the above heterogeneous data processing method.
[0155] It should be noted that the computer-readable medium in the present application may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a Random Access Memory (RAM), a Read Only Memory (ROM), an Erasable Programmable Read Only Memory (EPROM) or Flash Memory, an optical fiber, a portable Compact Disk Read Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0156] The above computer-readable storage medium may be included in the above electronic device; or it may exist separately without being assembled into the electronic device.
[0157] The above computer-readable storage medium stores one or more programs, which, when executed by the electronic device, cause the electronic device to perform the video processing method shown in the above embodiments.
[0158] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in a different order than that noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0159] The units described in the embodiments of the present application can be implemented in software or in hardware. In some cases, the name of the unit does not constitute a limitation on the unit itself. For example, the first acquisition unit can also be described as "the unit for acquiring at least two Internet protocol addresses".
[0160] The above description is only a preferred embodiment of the present application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with other technical features having similar functions (but not limited to) disclosed in the present application.
[0161] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although a number of specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present application. Certain features described in the context of separate embodiments may also be implemented combinatorially in a single embodiment. Conversely, the various features described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.
[0162] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. On the contrary, the specific features and acts described above are merely example forms for implementing the claims.
[0163] In particular, according to an embodiment of the present application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present application includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program code for performing the methods shown in the flowcharts. In such an embodiment, when the computer program is executed, the above-described functions defined in the heterogeneous data processing method of the embodiment of the present application are performed.
[0164] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include known common general knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and examples are only to be considered as exemplary, and the true scope and spirit of the present application are pointed out by the following claims.
[0165] It should be understood that the present application is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.
Claims
1. A heterogeneous data processing method, characterized in that, including: obtaining a target parsing template corresponding to the heterogeneous data to be processed, where the target parsing template includes at least one sub-parsing method; parsing the heterogeneous data to be processed based on the sub-parsing methods in the target parsing template to obtain a target parsing result corresponding to the heterogeneous data to be processed; the method further includes: obtaining original heterogeneous data, where the original heterogeneous data includes the heterogeneous data to be processed; for the j-th heterogeneous data corresponding to the original heterogeneous data, determining an original parsing method set corresponding to the j-th heterogeneous data, where j is an integer greater than 1; parsing the j-th heterogeneous data based on the M-th original parsing method in the original parsing method set to obtain an M-th parsing result corresponding to the M-th original parsing method, where M is an integer greater than or equal to 1; determining a j-th sub-parsing method of the j-th heterogeneous data according to the M-th parsing result and a preset parsing result; determining a sub-parsing method corresponding to the original heterogeneous data according to the j-th sub-parsing method of the j-th heterogeneous data; based on the principle of a multi-way tree, generating a parsing template corresponding to the original heterogeneous data according to the sub-parsing method, where the parsing template includes multiple sub-parsing methods, the parsing template includes a parent node and leaf nodes, the parent node is heterogeneous data, and the leaf nodes of the parsing template are output results of the heterogeneous data obtained based on the sub-parsing method.
2. The data processing method according to claim 1, wherein The parsing the heterogeneous data to be processed based on the sub-parsing methods in the target parsing template to obtain a target parsing result corresponding to the heterogeneous data to be processed includes: for the N-th heterogeneous data in the heterogeneous data to be processed, obtaining an N-th sub-parsing method corresponding to the N-th heterogeneous data from the target parsing template, where N is an integer greater than or equal to 1; parsing the N-th heterogeneous data based on the N-th sub-parsing method to obtain an N-th output result; obtaining a target parsing result of the heterogeneous data to be processed according to the N-th output result.
3. The heterogeneous data processing method according to claim 2, wherein The N-th output result includes an N-th parsing result, and the obtaining a target parsing result of the heterogeneous data to be processed according to the N-th output result includes: determining whether the N-th output result includes an (N + 1)-th heterogeneous data; in response to the N-th output result not including the (N + 1)-th heterogeneous data, determining the parsing results corresponding to the first sub-parsing method to the N-th sub-parsing method as the target parsing result of the heterogeneous data to be processed.
4. The heterogeneous data processing method according to claim 3, wherein It also includes: in response to the N-th output result including the (N + 1)-th heterogeneous data, obtaining an (N + 1)-th sub-parsing method corresponding to the (N + 1)-th heterogeneous data from the target parsing template; parsing the (N + 1)-th heterogeneous data based on the (N + 1)-th sub-parsing method to obtain an (N + 1)-th output result.
5. The heterogeneous data processing method according to claim 2, wherein It also includes: determining whether the N-th output result includes first data that does not meet preset requirements; in response to the N-th output result including the first data, discarding the first data.
6. The heterogeneous data processing method according to claim 1, wherein It also includes: obtaining a preset output format corresponding to the target parsing result; Convert the target parsing result into the preset output format to obtain the final parsing result corresponding to the heterogeneous data to be processed; Output the final parsing result corresponding to the heterogeneous data to be processed.
7. The heterogeneous data processing method according to claim 1, wherein The determining the j-th sub-parsing method of the j-th heterogeneous data according to the M-th parsing result and the preset parsing result includes: Determine whether the M-th parsing result matches the preset parsing result; In response to the M-th parsing result not matching the preset parsing result, parse the heterogeneous data based on the (M + 1)-th original parsing method in the original parsing method set to obtain the (M + 1)-th parsing result corresponding to the (M + 1)-th original parsing method, and determine the j-th sub-parsing method of the j-th heterogeneous data according to the (M + 1)-th parsing result; or, In response to the M-th parsing result matching the preset parsing result, determine the M-th original parsing method as the j-th sub-parsing method of the j-th heterogeneous data.
8. The heterogeneous data processing method according to claim 7, wherein The determining the sub-parsing method corresponding to the original heterogeneous data according to the j-th sub-parsing method of the j-th heterogeneous data includes: Determine whether the j-th output result contains heterogeneous data, where the j-th output result is obtained by parsing the j-th heterogeneous data based on the j-th sub-parsing method; In response to the j-th output result not containing heterogeneous data, determine the sub-parsing methods corresponding to the 1st to j-th heterogeneous data as the sub-parsing method of the original heterogeneous data; or, In response to the j-th output result containing heterogeneous data, determine the heterogeneous data as the (j + 1)-th heterogeneous data, and determine the sub-parsing method corresponding to the original heterogeneous data according to the (j + 1)-th heterogeneous data.
9. An heterogeneous data processing device, characterized in that Includes: An acquisition module, configured to acquire a target parsing template corresponding to the heterogeneous data to be processed, where the target parsing template includes at least one sub-parsing method; A parsing module, configured to parse the heterogeneous data to be processed based on the sub-parsing method in the target parsing template to obtain a target parsing result corresponding to the heterogeneous data to be processed; The acquisition module is further configured to acquire original heterogeneous data, where the original heterogeneous data includes the heterogeneous data to be processed; The apparatus further includes: a processing module; the processing module is configured to determine an original parsing method set corresponding to the j-th heterogeneous data corresponding to the original heterogeneous data, where j is an integer greater than 1; parse the j-th heterogeneous data based on the M-th original parsing method in the original parsing method set to obtain an M-th parsing result corresponding to the M-th original parsing method, where M is an integer greater than or equal to 1; determine a j-th sub-parsing method of the j-th heterogeneous data according to the M-th parsing result and a preset parsing result; determine a sub-parsing method corresponding to the original heterogeneous data according to the j-th sub-parsing method of the j-th heterogeneous data; generate a parsing template corresponding to the original heterogeneous data based on the multi-way tree principle according to the sub-parsing method, the parsing template includes multiple sub-parsing methods, the parsing template includes a parent node and leaf nodes, the parent node is heterogeneous data, and the leaf nodes of the parsing template are output results of the heterogeneous data obtained based on the sub-parsing method.
10. An electronic device, characterized in that, Comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the heterogeneous data processing method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, Computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, they are used to implement the heterogeneous data processing method according to any one of claims 1 to 8.
12. A computer program product, characterized in that, Comprising a computer program, which when executed by a processor implements the heterogeneous data processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Json data parsing method and device
CN107220096A
Data analysis method and device, storage medium and electronic device
CN110765195A