Structured data analysis method, electronic equipment and storage medium
Through a multi-level intelligent parsing strategy, the structured data output by the large language model is automatically parsed into a standard hierarchical structure and target attribute features, which solves the problem of unstable JSON structure, achieves efficient and accurate data parsing, and supports seamless compatibility with enterprise-level applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-18
- Publication Date
- 2026-04-10
AI Technical Summary
The JSON structured data generated by the large language model has problems such as syntax errors, key-value pair mismatches, and chaotic nesting levels, which makes it impossible for downstream systems to parse directly. It requires manual intervention to clean the data, which affects the efficiency and reliability of automated processes.
This paper provides a structured data parsing method that uses a multi-level intelligent parsing strategy, including path expression segmentation, depth-first search, contextual semantic parsing, and field association graph generation, to automatically parse the structured data output by a large language model into a standard hierarchical structure and target attribute features that meet user requirements.
It enables automatic parsing of large language model output data, ensuring the stability, accuracy, and efficiency of parsing results, reducing manual intervention, supporting seamless compatibility with downstream systems, and improving the reliability of enterprise-level applications.
Smart Images

Figure CN121835650A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data parsing technology, and in particular to a structured data parsing method, electronic device, and storage medium. Background Technology
[0002] With breakthroughs in artificial intelligence technology, Large Language Models (LLMs) have demonstrated powerful text generation capabilities in the field of natural language processing, finding widespread application in scenarios such as intelligent customer service, content creation, and data analysis. At the industrial application level, structured data output has become a crucial technical branch of LLMs. Among these, JSON (JavaScript Object Notation) format, due to its lightweight and easy-to-parse characteristics, is widely used as the standard interface for interaction between model output and downstream systems. By utilizing the JSON generation capabilities of LLMs, enterprises can automatically convert natural language instructions into structured data, thereby supporting core business functions such as intelligent decision-making, data visualization, and business process automation.
[0003] However, when large language models process complex instructions, the generated JSON structures often have problems such as syntax errors, key-value pair mismatches, and chaotic nesting levels. These technical defects prevent downstream systems from directly parsing the model output, requiring manual intervention for data cleaning and format correction, which seriously affects the efficiency and reliability of automated processes.
[0004] Therefore, finding a structured data parsing method that can automatically parse the structured data output by large language models has become a current research hotspot. Summary of the Invention
[0005] This invention provides a structured data parsing method, electronic device, and storage medium, which realizes automatic parsing of structured data output by a large language model, thereby obtaining parsing results of structured data that meet user requirements.
[0006] This invention provides a method for parsing structured data. The method includes: acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsing data with target attribute features; parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure.
[0007] According to a structured data parsing method provided by the present invention, obtaining target parsing data with target attribute features based on the structured data having a standard hierarchical structure specifically includes: determining the target level where the parsing data with target attribute features is located based on the structured data having a standard hierarchical structure; and obtaining the target parsing data with target attribute features based on the parsing data under the target level.
[0008] According to a structured data parsing method provided by the present invention, the parsed data at the target level includes multiple fields. When the field expression of the fields is different from the target field of the target parsed data, the step of obtaining target parsed data with target attribute features based on the parsed data at the target level specifically includes: normalizing the multiple fields of the parsed data to obtain multiple normalized fields; calculating the similarity between each of the multiple normalized fields and the target field to obtain each similarity value between each normalized field and the target field; using the normalized fields whose similarity values exceed a similarity threshold as target normalized fields; and obtaining target parsed data with target attribute features based on the target normalized fields.
[0009] According to a structured data parsing method provided by the present invention, after calculating the similarity between the target field and each of the normalized fields to obtain the similarity values between the normalized fields and the target field, the method further includes: if it is detected that no similarity value exceeds a similarity threshold, performing contextual semantic parsing on the parsed data to obtain a field association graph representing the contextual semantics of the parsed data; based on the field association graph, inferring the missing key fields in the parsed data; and based on the key fields, obtaining target parsed data with target attribute features.
[0010] According to a structured data parsing method provided by the present invention, the step of parsing the structured data to obtain structured data with a standard hierarchical structure specifically includes: determining the path expression of the structured data based on the structured data; segmenting the path expression to obtain multiple segmented sub-path expressions; parsing each of the segmented sub-path expressions to obtain parsed sub-path expressions; and obtaining structured data with a standard hierarchical structure based on the parsed sub-path expressions.
[0011] According to a structured data parsing method provided by the present invention, parsing each of the segmented sub-path expressions to obtain parsed sub-path expressions specifically includes: performing a depth-first search to search and parse each of the segmented sub-path expressions to obtain parsed sub-path expressions.
[0012] According to a structured data parsing method provided by the present invention, the structured data output by a generative large language model includes multiple streaming structured data segments. The step of parsing the structured data to obtain structured data with a standard hierarchical structure specifically includes: sequentially parsing the streaming structured data segments to obtain parsed streaming structured data segments; if the obtained parsed streaming structured data segments can form structured data with a standard hierarchical structure, stopping the parsing of subsequent streaming structured data segments, and obtaining structured data with a standard hierarchical structure based on the obtained parsed streaming structured data segments.
[0013] The present invention also provides a structured data parsing apparatus, the apparatus comprising: an acquisition module for acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsing data with target attribute features; a parsing module for parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and a processing module for obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure.
[0014] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the structured data parsing method as described above.
[0015] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the structured data parsing method as described above.
[0016] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the structured data parsing method as described above.
[0017] This invention provides a structured data parsing method, electronic device, and storage medium. The method includes: acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsed data with target attribute features; parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and obtaining target parsed data with target attribute features based on the structured data with the standard hierarchical structure. This achieves automatic parsing of structured data output by a large language model, thereby obtaining parsing results of structured data that meet user requirements. It effectively solves the stability, accuracy, and efficiency problems of parsing JSON output of structured data from generative large language models, providing reliable assurance for enterprise-level applications. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0019] Figure 1 This is one of the flowcharts illustrating the structured data parsing method provided by this invention.
[0020] Figure 2 This is a schematic diagram of the process of obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure provided by the present invention.
[0021] Figure 3 This is a schematic diagram of the process of obtaining target parsing data with target attribute features based on the parsing data under the target level provided by the present invention.
[0022] Figure 4 This is the second flowchart of the structured data parsing method provided by the present invention.
[0023] Figure 5 This is a schematic diagram of the process provided by the present invention for parsing the structured data to obtain structured data with a standard hierarchical structure.
[0024] Figure 6 This is a schematic diagram of the structure of the structured data parsing device provided by the present invention.
[0025] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0027] The structured data parsing method provided by this invention solves the technical problems of unstable and non-standard JSON output of large models through a multi-level intelligent parsing strategy.
[0028] Figure 1 This is one of the flowcharts illustrating the structured data parsing method provided by this invention.
[0029] The following will combine Figure 1 The process of the structured data parsing method provided by this invention will be described.
[0030] In an exemplary embodiment of the present invention, combined with Figure 1 As can be seen, the structured data parsing method may include steps 110 to 130, and each step will be described below.
[0031] In step 110, the structured data output by the generative large language model is obtained. The structured data is obtained based on the input prompt text input to the generative large language model. The input prompt text is a prompt text describing the target parsing data with target attribute features that the generative large language model needs to output.
[0032] In one embodiment, structured data output from a generative large language model can be received. This data can be generated from input prompt text, which must explicitly describe the attribute characteristics of the target data to be parsed, such as: "Output JSON data containing name, ID number, and date of birth."
[0033] In step 120, the structured data is parsed to obtain structured data with a standard hierarchical structure, which matches the input prompt text.
[0034] In step 130, target parsing data with target attribute features is obtained based on structured data with a standard hierarchical structure.
[0035] In one embodiment, because the structured data output by the generative large language model, i.e., JSON data, has issues of being non-standard and irregular, the acquired structured data, i.e., JSON data, can be parsed to obtain a standard hierarchical structure that perfectly matches the input prompt text requirements, i.e., structured data with a standard hierarchical structure. For example, if the input prompt requirement is { "Personal Information": [ "Name", "ID Number" ]}, then the output hierarchy (the structured data corresponding to the standard hierarchical structure) must conform to this key-value pair nesting format.
[0036] Furthermore, based on the obtained standard hierarchical structured data, data with target attribute features defined by the input prompt text can be extracted and output, for example, the final output could be { "Personal Information": { "Name": "Zhang San", "ID Number": "110XXXXXXXX34"}}). In one embodiment, the aforementioned structured data parsing method can also be directly interfaced with downstream systems (such as database APIs) to achieve seamless compatibility between generative model output and industrial systems.
[0037] In the aforementioned embodiments, the structured data output by the generative large language model is parsed into a standard hierarchical structure that matches the input prompt text—that is, structured data with a standard hierarchical structure—eliminating the randomness in format caused by the model's free output, such as mixed XML / JSON usage or key name variations. This ensures that the final target parsed data strictly adheres to the target attribute characteristics (such as field names, data types, and nesting levels) defined in the input prompt text, avoiding secondary manual cleaning.
[0038] This invention provides a structured data parsing method, comprising: acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsed data with target attribute features; parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and obtaining target parsed data with target attribute features based on the structured data with the standard hierarchical structure. This method automatically parses the structured data output by the large language model, thereby obtaining parsing results of structured data that meet user requirements. It effectively solves the stability, accuracy, and efficiency problems of parsing JSON output of structured data from generative large language models, providing reliable assurance for enterprise-level applications.
[0039] Figure 2 This is a schematic diagram of the process of obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure provided by the present invention.
[0040] The following will combine Figure 2 The process of obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure provided by the present invention will be described.
[0041] In an exemplary embodiment of the present invention, combined with Figure 2 As can be seen, obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure may include steps 210 and 220, which will be described in detail below.
[0042] In step 210, based on the structured data with a standard hierarchical structure, the target level of the parsed data with target attribute features is determined; In step 220, target parsing data with target attribute features is obtained based on the parsing data at the target level.
[0043] In one embodiment, the data level corresponding to the target attribute feature required by the input prompt text can be located based on the generated structured data with a standard hierarchical structure, such as { "Result": { "Contact Information": { "Mobile Phone": "13800138XXX"}, "Address": "Beijing"}}, that is, the target level of the parsed data with the target attribute feature can be determined. Continuing with the previous embodiment as an example, if the target attribute is the "Mobile Phone" field under "Contact Information", then the target level is ["Result"]["Contact Information"].
[0044] In another embodiment, parsed data at the target level, i.e., target parsed data with target attribute characteristics, such as "phone": "13800138XXX", can be extracted as the final output, ignoring redundant data from non-target levels, such as the "address" field. In this embodiment, through a hierarchical positioning mechanism, data directly related to the target attribute characteristics is accurately filtered from a multi-level structure. For example, in nested JSON, only values under the corresponding path are extracted, avoiding interference from non-target data.
[0045] Figure 3 This is a schematic diagram of the process of obtaining target parsing data with target attribute features based on the parsing data under the target level provided by the present invention.
[0046] The following will combine Figure 3 The process of obtaining target parsing data with target attribute characteristics based on the parsing data under the target level is explained.
[0047] In an exemplary embodiment of the present invention, combined with Figure 3As can be seen, the parsed data under the target level may include multiple fields. When the field expression method is different from the target field of the target parsed data, obtaining target parsed data with target attribute characteristics based on the parsed data under the target level may include steps 310 to 340. Each step will be described below.
[0048] In step 310, multiple fields of the parsed data are normalized to obtain multiple normalized fields.
[0049] In one embodiment, if the parsed data at the target level contains multiple fields, such as { "Mobile Number": "13800138XXX", "Telephone": "010-12345678"}, and the field expression, such as "Mobile Number", is inconsistent with the target field required by the target parsed data, such as "Mobile Phone", the original fields, i.e., the multiple fields of the parsed data, can be normalized, for example, by uniformly converting them to lowercase / removing symbols and other basic formats, to generate normalized fields.
[0050] It should be noted that normalization methods can also include converting camelCase to underscore form (snake_case): userName → user_name; removing special characters and spaces: user-name → username; and handling singular and plural forms: users → user, addresses → address. In this embodiment, no specific limitations are imposed on the normalization method.
[0051] In step 320, the similarity between the normalized fields and the target field is calculated to obtain the similarity values between each normalized field and the target field.
[0052] In step 330, the normalized field corresponding to the similarity value exceeding the similarity threshold is used as the target normalized field.
[0053] In step 340, target parsing data with target attribute features is obtained based on the target normalized fields.
[0054] In one embodiment, the character similarity value between each normalized field and a target field, such as "mobile phone," can be calculated. Further, normalized fields with similarity values exceeding a preset threshold (e.g., threshold = 0.5) are selected as target normalized fields, such as "phone number." The similarity calculation may include Levenshtein's edit distance (calculating the minimum number of operations required to convert between two strings) and Jaccard similarity (a set similarity based on character or word levels). In this embodiment, the specific method of similarity calculation is not limited.
[0055] Furthermore, based on the values of the matching fields, such as "phone number": "13800138XXX", the final output is generated, for example, { "mobile phone": "13800138XXX"}, which yields target parsed data with target attribute features. In this embodiment, normalization processing and similarity matching mechanisms are used to solve the extraction failure problem caused by inconsistencies between the output field names of the large language model and the target field names (such as "phone" / "Mobile"). Semantic understanding enhancement enables the system to handle changes and differences in field naming, greatly improving the success rate of field extraction and making the parsing process more robust to changes in the output of the large model.
[0056] Figure 4 This is the second flowchart of the structured data parsing method provided by the present invention.
[0057] The following will combine Figure 4 The process of another structured data parsing method provided by the present invention will be described.
[0058] In an exemplary embodiment of the present invention, combined with Figure 4 As can be seen, after calculating the similarity between the normalized fields and the target field to obtain the similarity values between each normalized field and the target field, the structured data parsing method may also include the following steps 410 to 430, which will be described below.
[0059] In step 410, if no similarity value exceeds the similarity threshold, the parsed data is subjected to contextual semantic parsing to obtain a field association graph that represents the contextual semantics of the parsed data.
[0060] In step 420, based on the field association graph, the missing key fields in the parsed data are inferred.
[0061] In step 430, target parsing data with target attribute features is obtained based on the key fields.
[0062] In one embodiment, if all similarity values do not exceed a threshold, meaning there is no situation where the similarity value between the normalized field and the target field exceeds the similarity threshold, it indicates that a field is missing. In this scenario, the semantic relationships between adjacent fields in the target-level data can be parsed to generate a field association graph representing the logical connections between fields. Further, based on the field association graph, missing fields that semantically match the target attribute features are identified. Then, based on the key fields, target parsed data with target attribute features is obtained. In this embodiment, even if the original field name and the target field name have no direct similarity, missing key fields can still be completed based on semantic relationships, ensuring that the final output strictly meets the target attribute requirements of the input prompt.
[0063] In the aforementioned embodiments, context-aware inference enables the inference of missing or abnormal data based on existing information, greatly enhancing the system's ability to process incomplete data and improving data integrity and availability.
[0064] Figure 5 This is a schematic diagram of the process provided by the present invention for parsing the structured data to obtain structured data with a standard hierarchical structure.
[0065] The following will combine Figure 5 The process of parsing the structured data to obtain structured data with a standard hierarchical structure is described.
[0066] In an exemplary embodiment of the present invention, combined with Figure 5 As can be seen, parsing the structured data to obtain structured data with a standard hierarchical structure may include steps 510 to 540, and each step will be described below.
[0067] In step 510, the path expression of the structured data is determined based on the structured data.
[0068] In step 520, the path expression is segmented to obtain multiple segmented sub-path expressions.
[0069] In one embodiment, based on structured data output by a generative large language model, such as JSON data { "result": { "contact": "13800138000"}}, its path expression is extracted, for example, / result / contact. Further, the path expression can be segmented to obtain multiple sub-path expressions, for example, / result / contact can be segmented into sub-paths ["result", "contact"].
[0070] In step 530, each segmented sub-path expression is parsed to obtain the parsed sub-path expression.
[0071] In step 540, structured data with a standard hierarchical structure is obtained based on the parsed sub-path expression.
[0072] In another embodiment, each sub-path can be parsed separately, for example, verifying whether "result" is the root node and "contact" is a child node, and then combining the parsed sub-paths into a standard hierarchical structure that matches the input prompt text, for example, constructing a standard structure: { "result": { "contact information": "13800138000"}}.
[0073] In this embodiment, by splitting paths and parsing sub-paths independently, the final generated standard hierarchical structure is ensured to strictly align with the nesting requirements of the input prompt text (such as forcibly converting A / B / C paths into three-level nested JSON), solving the problem of chaotic output hierarchy in large language models, supporting complex nested path expressions, eliminating the need for developers to write a large amount of nested condition judgment code, greatly simplifying the development workload, and improving code maintainability.
[0074] In yet another exemplary embodiment of the present invention, the previously described embodiments will continue to be used as examples for explanation. The parsing of each segmented sub-path expression to obtain the parsed sub-path expression can be achieved in the following manner: Based on depth-first search, the segmented sub-path expressions are searched and parsed to obtain the parsed sub-path expressions.
[0075] In one embodiment, the segmented sub-path expressions (such as ["result", "contact", "mobile"]) can be parsed layer by layer in a depth-first order. For example, the deepest path can be parsed first (e.g., first check if "mobile" is a leaf node); then the parent path can be parsed back (e.g., check if "contact" contains "mobile"); and finally the root path can be parsed (e.g., verify if "result" contains "contact").
[0076] Furthermore, the sub-path expression parsed using depth-first search is output. For example, after confirming "mobile" as a valid terminal node, its path is marked as / result / contact / mobile, thus obtaining the parsed sub-path expression. In this embodiment, the depth-first search mechanism prioritizes parsing the lowest-level sub-path (such as C in A / B / C), ensuring that the hierarchical relationship of deeply nested fields strictly matches the input prompt text requirements. By recursively searching to find the target data, the system's adaptability to structural changes is significantly improved, reducing parsing failures caused by structural changes.
[0077] In another exemplary embodiment of the present invention, the previously described embodiments will be used as examples for further explanation. The structured data output by the generative large language model includes multiple streaming structured data fragments. The parsing of the structured data to obtain structured data with a standard hierarchical structure can be achieved in the following manner: The streaming structured data segments are parsed sequentially to obtain parsed streaming structured data segments; If the obtained parsed streaming structured data fragments can form structured data with a standard hierarchical structure, then stop parsing the subsequent streaming structured data fragments, and obtain structured data with a standard hierarchical structure based on the obtained parsed streaming structured data fragments.
[0078] In one embodiment, when the generative large language model outputs multiple streaming structured data fragments, such as first outputting {"Name": "Zhang San", followed by "Phone": "13800138000"}, the first fragment can be parsed sequentially, for example, parsing {"Name": "Zhang San" → generating a partial structure {"Name": "Zhang San"}, and then continuing to parse the next fragment, for example, parsing "Phone": "13800138000" → merging it into {"Name": "Zhang San", "Phone": "13800138000"}.
[0079] If the currently parsed fragments can be combined to form a complete standard hierarchical structure, such as the input prompt requiring {"Name", "Phone Number"}, then the merged structure meets the requirements, and the parsing of subsequent fragments immediately stops, for example, ignoring the unreached "Address" field. Furthermore, a standard hierarchical structure can be directly output based on the parsed fragments, resulting in structured data with a standard hierarchical structure, such as outputting {"Name": "Zhang San", "Phone Number": "13800138000"}. In this embodiment, the instant parsing and early termination mechanism of streaming fragments avoids meaningless parsing of subsequent redundant data. It can perform parsing while receiving the output stream of a large model, without waiting for the complete output, significantly reducing response latency and improving user experience, making it particularly suitable for streaming interaction scenarios.
[0080] As described above, the structured data parsing method provided by this invention includes: acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsing data with target attribute features; parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure. This method automatically parses the structured data output by the large language model, thereby obtaining parsing results of structured data that meet user requirements. It effectively solves the stability, accuracy, and efficiency problems of parsing JSON output of structured data from generative large language models, providing reliable assurance for enterprise-level applications.
[0081] The structured data parsing apparatus provided by the present invention will be described below. The structured data parsing apparatus described below can be referred to in correspondence with the structured data parsing method described above.
[0082] Figure 6 This is a schematic diagram of the structure of the structured data parsing device provided by the present invention.
[0083] The following will combine Figure 6 The structure of the structured data parsing device provided by the present invention will be described.
[0084] In an exemplary embodiment of the present invention, combined with Figure 6 As can be seen, the structured data parsing device may include an acquisition module 610, a parsing module 620, and a processing module 630. Each module will be described in detail below.
[0085] The acquisition module 610 can be configured to acquire structured data output by the generative large language model, wherein the structured data is obtained based on the input prompt text input to the generative large language model, and the input prompt text is a prompt text describing that the generative large language model needs to output target parsing data with target attribute features; The parsing module 620 can be configured to parse the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; The processing module 630 can be configured to obtain target parsing data with target attribute features based on the structured data having a standard hierarchical structure.
[0086] In an exemplary embodiment of the present invention, the parsing module 620 can obtain target parsing data with target attribute features based on the structured data having a standard hierarchical structure in the following manner: Based on the structured data with the standard hierarchical structure, determine the target level where the parsed data with target attribute features is located; Based on the parsed data at the target level, target parsed data with target attribute characteristics is obtained.
[0087] In an exemplary embodiment of the present invention, the parsed data at the target level includes multiple fields. When the field expression method of the fields is different from the target fields of the target parsed data, the parsing module 620 can obtain target parsed data with target attribute features based on the parsed data at the target level in the following manner: The parsed data is normalized through multiple fields to obtain multiple normalized fields. The similarity between each of the normalized fields and the target field is calculated to obtain the similarity values between each normalized field and the target field. The normalized field whose similarity value exceeds the similarity threshold is used as the target normalized field. Based on the target normalized fields, target parsing data with target attribute features is obtained.
[0088] In an exemplary embodiment of the present invention, the parsing module 620 may further be configured to: If no similarity value exceeds the similarity threshold, the parsed data is subjected to contextual semantic parsing to obtain a field association graph that represents the contextual semantics of the parsed data. Based on the field association diagram, the missing key fields in the parsed data are inferred. Based on the key fields, target parsing data with target attribute characteristics is obtained.
[0089] In an exemplary embodiment of the present invention, the parsing module 620 can perform parsing based on the structured data to obtain structured data with a standard hierarchical structure in the following manner: Based on the structured data, determine the path expression of the structured data; The path expression is segmented to obtain multiple segmented sub-path expressions; Each of the segmented sub-path expressions is parsed to obtain the parsed sub-path expressions; Based on the parsed sub-path expression, structured data with a standard hierarchical structure is obtained.
[0090] In an exemplary embodiment of the present invention, the parsing module 620 may parse each of the segmented sub-path expressions in the following manner to obtain the parsed sub-path expressions: Based on depth-first search, the segmented sub-path expressions are searched and parsed to obtain the parsed sub-path expressions.
[0091] In an exemplary embodiment of the present invention, the structured data output by the generative large language model includes multiple streaming structured data fragments; the parsing module 620 can perform parsing based on the structured data in the following manner to obtain structured data with a standard hierarchical structure: The streaming structured data segments are parsed sequentially to obtain parsed streaming structured data segments; If the obtained parsed streaming structured data fragments can form structured data with a standard hierarchical structure, then stop parsing the subsequent streaming structured data fragments, and obtain structured data with a standard hierarchical structure based on the obtained parsed streaming structured data fragments.
[0092] Figure 7 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 7As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, communications interface 720, and memory 730 communicate with each other via the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute a structured data parsing method. This method includes: acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsing data with target attribute features; parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure.
[0093] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0094] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the structured data parsing method provided by the above methods. The method includes: acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsing data with target attribute features; parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure.
[0095] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the structured data parsing method provided by the above methods. The method includes: acquiring structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, the input prompt text being a prompt text describing the need for the generative large language model to output target parsing data with target attribute features; parsing the structured data to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; and obtaining target parsing data with target attribute features based on the structured data with the standard hierarchical structure.
[0096] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0097] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A structured data parsing method, characterized in that, The method includes: Obtain structured data output by a generative large language model, wherein the structured data is obtained based on input prompt text input to the generative large language model, and the input prompt text is a prompt text describing the need for the generative large language model to output target parsing data with target attribute features; The structured data is parsed to obtain structured data with a standard hierarchical structure, wherein the standard hierarchical structure matches the input prompt text; Based on the structured data with the standard hierarchical structure, target parsing data with target attribute features is obtained.
2. The structured data parsing method according to claim 1, characterized in that, The process of obtaining target parsing data with target attribute features based on the structured data having a standard hierarchical structure specifically includes: Based on the structured data with the standard hierarchical structure, determine the target level where the parsed data with target attribute features is located; Based on the parsed data at the target level, target parsed data with target attribute characteristics is obtained.
3. The structured data parsing method according to claim 2, characterized in that, The parsed data at the target level includes multiple fields. When the field representation of these fields differs from the target fields in the target parsed data, obtaining target parsed data with target attribute features based on the parsed data at the target level specifically includes: The parsed data is normalized through multiple fields to obtain multiple normalized fields. The similarity between each of the normalized fields and the target field is calculated to obtain the similarity values between each normalized field and the target field. The normalized field whose similarity value exceeds the similarity threshold is used as the target normalized field. Based on the target normalized fields, target parsing data with target attribute features is obtained.
4. The structured data parsing method according to claim 3, characterized in that, After calculating the similarity between the multiple normalized fields and the target field to obtain the similarity values between each normalized field and the target field, the method further includes: If no similarity value exceeds the similarity threshold, the parsed data is subjected to contextual semantic parsing to obtain a field association graph that represents the contextual semantics of the parsed data. Based on the field association diagram, the missing key fields in the parsed data are inferred. Based on the key fields, target parsing data with target attribute characteristics is obtained.
5. The structured data parsing method according to any one of claims 1 to 4, characterized in that, The process of parsing the structured data to obtain structured data with a standard hierarchical structure specifically includes: Based on the structured data, determine the path expression of the structured data; The path expression is segmented to obtain multiple segmented sub-path expressions; Each of the segmented sub-path expressions is parsed to obtain the parsed sub-path expressions; Based on the parsed sub-path expression, structured data with a standard hierarchical structure is obtained.
6. The structured data parsing method according to claim 5, characterized in that, The segmented sub-path expressions are parsed to obtain the parsed sub-path expressions, specifically including: Based on depth-first search, the segmented sub-path expressions are searched and parsed to obtain the parsed sub-path expressions.
7. The structured data parsing method according to claim 1, characterized in that, The structured data output by the generative large language model includes multiple streaming structured data fragments; the parsing based on the structured data to obtain structured data with a standard hierarchical structure specifically includes: The streaming structured data segments are parsed sequentially to obtain parsed streaming structured data segments; If the obtained parsed streaming structured data fragments can form structured data with a standard hierarchical structure, then stop parsing the subsequent streaming structured data fragments, and obtain structured data with a standard hierarchical structure based on the obtained parsed streaming structured data fragments.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the structured data parsing method as described in any one of claims 1 to 7.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the structured data parsing method as described in any one of claims 1 to 7.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the structured data parsing method as described in any one of claims 1 to 7.