Isolated collection and structured aggregation method and system of multi-source generated text stream

CN122886591APending Publication Date: 2026-10-09HANGZHOU GALLIC ARTIFICIAL INTELLIGENCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611328113.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0008]发明目的:本发明目的在于解决多源生成式文本重复采样过程中上下文相互影响,以及不同形式的生成式响应难以进行统一、可追溯结构化处理的问题,提供一种多源生成式文本流的隔离采集与结构化聚合方法及系统

Benefits of technology

[0025]本发明通过为各采集子任务建立不携带前序消息的独立逻辑采样上下文,从源头阻断了历史会话与上下文状态的跨轮次污染,确保了多源采集数据的高度独立性与可比性;配合响应片段重构状态机,实现了对流式传输过程中的网络重传去重、乱序重排与异常截断识别,保障了重构原始响应的完整性,并为后续解析提供了客观的质量判定依据。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122886591A_ABST
    Figure CN122886591A_ABST
Patent Text Reader

Abstract

The application discloses a kind of multi-source generated text stream isolation collection and structured aggregation method and system.The method establishes independent logic sampling context for each collection subtask;Response fragment returned by reconstruction service endpoint is obtained original response and original response quality state;Original response is normalized and character position offset mapping relationship is established, and normalized text is parsed as hierarchical structure node graph;Extract and normalize entity candidate, determine the entity confidence and semantic role of target entity mention;According to the sequence index of the target entity mention of the positive correlation role, the original response quality state, the entity confidence and the positive correlation role probability are combined to generate a relationship mask;Only the entity feature records of the valid mask are written into the sparse data structure and aggregated across the sampling.The present application can reduce the interference of the previous conversation and invalid data storage, improve the reliability of response reconstruction, entity aggregation and original character interval backtracking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer data processing technology, specifically relating to a method and system for isolating, acquiring, and structuring the aggregation of multi-source generative text streams. Background Technology

[0002] Traditional web data acquisition and content analysis systems typically process static web pages, fixed application programming interface responses, or search results pages with a stable document object model hierarchy. For such data sources, parsing programs can usually obtain the title, result items, content fields, and their order based on preset Cascading Style Sheets selectors, Extensible Path language paths, field names, or fixed array subscripts.

[0003] The data returned by generative AI server endpoints differs significantly from the aforementioned fixed data sources. Different generative AI server endpoints can return responses via Hypertext Transfer Protocol (HTTP) response bodies, server-sent events, WebSocket messages, or dynamically rendered pages by browsers. The same response may also be split into multiple incremental response fragments, containing various text structures such as titles, numbered lists, unnumbered lists, tables, quotations, code blocks, and ordinary natural language paragraphs. The content of generative responses may also be influenced by factors such as historical sessions, model versions, network status, and sampling parameters, thus exhibiting characteristics such as heterogeneous sources, inconsistent return formats, variable structures, and differences between multiple responses.

[0004] Existing web content collection methods are typically designed for static web pages or API responses with relatively fixed field structures, extracting data based on page elements, API fields, or fixed levels. Generative AI services, however, respond differently. They may be returned as regular HTTP responses, or output as streaming messages or dynamic pages, and the text content and organization may change depending on the sampling process for the same question.

[0005] When repeatedly sampling the same issue, if different sampling requests use the session information or page state of the previous request, the preceding response may enter the context of subsequent requests, causing the multiple sampling results to lose their independence. On the other hand, for streaming responses, network retransmissions, response interruptions, and different endpoints using different incremental output methods can also affect the complete reconstruction of the original text.

[0006] Subsequent analysis of the collected text also requires addressing issues such as differences in text format, differences in heading and list hierarchy, and inconsistencies in entity names. Particularly after character deletion, replacement, or merging, the positions of the processed characters may differ from the original response, making it difficult to trace the identified structural nodes or entities back to the original text.

[0007] Furthermore, the presence of an entity in a generative response does not necessarily mean that the entity belongs to the valid result required by the current problem. For example, the entity might appear in comparisons, negations, or descriptive text. Directly aggregating data based on entity presence would generate many data items with no real connection. Therefore, a unified approach is needed for handling the data collection context, response reconstruction, text structure, and valid entity relationships. Summary of the Invention

[0008] Purpose of the invention: The purpose of this invention is to solve the problems of contextual interference during repeated sampling of multi-source generative text and the difficulty in uniformly and traceably structuring different forms of generative responses, and to provide a method and system for isolated acquisition and structured aggregation of multi-source generative text streams.

[0009] Technical Solution: To achieve the above objectives, the first aspect of this invention provides a method for isolated acquisition and structured aggregation of multi-source generative text streams, comprising:

[0010] Based on the generative artificial intelligence server endpoint set, probe text set and sampling configuration parameters, multiple collection sub-tasks are generated. Sampling identification information is configured for each collection sub-task and an independent logical sampling context is established. Probe text is sent to the corresponding server endpoint.

[0011] Receive the response fragment returned by the server endpoint and reconstruct it to obtain the original response, and determine the quality status of the original response;

[0012] The original response is normalized, and the normalized character range, the corresponding original character range, and the conversion type identifier are recorded to form an offset mapping relationship. The normalized text is parsed into a hierarchical structure node graph. The structure nodes in the hierarchical structure node graph record the corresponding normalized character range and are associated with the original character range through the offset mapping relationship.

[0013] The structural nodes in the hierarchical node graph that can express ordered relationships between similar objects are arranged in the order of their corresponding original character ranges in the original response to form a structural node sequence. Entity candidates are extracted from the hierarchical node graph and mapped to unique entity identifiers in combination with target entity configurations to form target entity mentions. The entity confidence and semantic role of the target entity mentions are determined, and the ordinal index of the corresponding target entity is determined based on the position of the structural node in the structural node sequence where the target entity mention with a positive semantic role is located.

[0014] For target entity mentions whose original response quality status meets preset quality conditions, whose entity confidence meets preset entity confidence conditions, and whose semantic role is a positively related role, entity feature records are generated based on the ordinal index and written into a sparse data structure.

[0015] Based on the sampling identification information, a first-level aggregation is performed on multiple independent sampling results using a combination of at least two sampling attributes as the first grouping condition, and a second-level aggregation is performed on multiple first-level aggregation results using some of the sampling attributes in the first grouping condition as the second grouping condition, to obtain a structured aggregation result.

[0016] The second aspect of this invention provides an isolated acquisition and structured aggregation system for multi-source generative text streams, including a task configuration and session isolation module, a response reconstruction module, a normalization and offset mapping module, a hierarchical structure parsing module, an entity normalization and semantic role discrimination module, an order index and write determination module, and a sparse aggregation module.

[0017] The task configuration and session isolation module is used to generate collection sub-tasks based on the generative artificial intelligence service endpoint set, probe text set, sampling configuration parameters and target entity configuration, configure sampling identification information and establish an independent logical sampling context.

[0018] The response reconstruction module is used to receive and reconstruct response fragments to obtain the original response and the original response quality status.

[0019] The normalization and offset mapping module is used to normalize the original response and record the normalized character range, the corresponding original character range, and the conversion type identifier to form an offset mapping relationship.

[0020] The hierarchical structure parsing module is used to parse the normalized text into a hierarchical structure node graph with node hierarchy and node order, and to record the corresponding normalized character range in the structure node, and associate it with the original character range through the offset mapping relationship;

[0021] The entity normalization and semantic role discrimination module is used to extract entity candidates from the hierarchical structure node graph, form target entity mentions according to the target entity configuration, and determine the entity confidence and semantic role.

[0022] The sequence index and write determination module is used to arrange the structural nodes in the hierarchical structure node graph that can express the ordered relationship of similar objects according to the order of the corresponding original character range in the original response to form a structural node sequence. The sequence index is determined according to the position of the structural node in the structural node sequence of the target entity mention with a positive semantic role. The entity feature record to be written is determined according to the quality status of the original response, the entity confidence and the semantic role.

[0023] The sparse aggregation module is used to write the entity feature records into a sparse data structure, and to perform hierarchical aggregation of multiple independent sampling results according to the sampling identifier information to obtain a structured aggregation result.

[0024] Beneficial effects: Compared with the prior art, the advantages of the present invention are as follows:

[0025] This invention establishes independent logical sampling contexts for each acquisition subtask without carrying preceding messages, thereby blocking cross-round contamination of historical sessions and context states from the source and ensuring the high independence and comparability of multi-source acquisition data. In conjunction with the response fragment reconstruction state machine, it realizes network retransmission deduplication, out-of-order reordering, and abnormal truncation identification during streaming transmission, ensuring the integrity of the reconstructed original response and providing an objective quality judgment basis for subsequent parsing.

[0026] By establishing an offset mapping relationship between the normalized character position and the original character position, the bidirectional accurate positioning capability from hierarchical structure nodes and entity mentions to the original text character range is preserved, avoiding character position distortion caused by text cleaning. At the same time, based on the effective node sequence expressing the ordered relationship of similar objects and the positive semantic role determination ordinal index, the interference of ordinary explanatory nodes or earlier entity mentions in negative contexts on the true order relationship is eliminated, significantly improving the parsing accuracy of unstructured generated text.

[0027] By combining entity confidence, structural node features, and local contextual semantic role discrimination, noise interference from non-target entities with the same name and non-positive contexts such as comparison and negation is effectively eliminated. Furthermore, by using the original response quality score, confidence, and role probability to generate a relation mask, invalid entity relations are blocked before data is written, enabling direct writing of entity feature records into sparse data structures. This avoids memory waste and useless computation caused by building and traversing dense matrices, and significantly improves the processing efficiency of cross-sampling aggregation. Attached Figure Description

[0028] Figure 1 This is a schematic diagram of the module structure and data flow of the multi-source generative text stream isolation acquisition and structured aggregation system of the present invention.

[0029] Figure 2 This is a schematic diagram of the overall process of the method for isolating and structurally aggregating multi-source generative text streams according to the present invention.

[0030] Figure 3 This is a schematic diagram of the response fragment reconstruction state machine and the original response quality state generation process of the present invention.

[0031] Figure 4 This is a schematic diagram illustrating the data association between the original response, normalized text, offset mapping relationship, hierarchical structure node diagram, entity candidates, unique entity identifier, and target entity mentions of this invention.

[0032] Figure 5This is a schematic diagram illustrating the processing relationships between the effective node sequence, ordinal index, target entity-original response relationship mask, entity feature record, sparse data structure, and cross-sampling aggregation of the present invention.

[0033] Figure 6 This is a schematic diagram illustrating the evidence storage and offline recalculation process based on dictionaries, normalization rules, structural parsing rules, and model version updates for this invention. Detailed Implementation

[0034] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings, but the scope of protection of the present invention is not limited to the embodiments described.

[0035] Example 1: System Overall Architecture

[0036] like Figure 1 As shown, this embodiment provides an isolated acquisition and structured aggregation system for multi-source generative text streams, including a task configuration and session isolation module 10, a response reconstruction module 20, a normalization and offset mapping module 30, a hierarchical structure parsing module 40, an entity normalization and semantic role discrimination module 50, an ordinal index and write determination module 60, a sparse aggregation module 70, and an evidence storage and offline recalculation module 80.

[0037] The task configuration and session isolation module 10 receives task configuration data, which includes the generative artificial intelligence service endpoint, probe text, number of repeated sampling rounds, and target entity configuration. It can also set corresponding request control parameters based on the endpoint access method. The task configuration and session isolation module 10 generates corresponding collection subtasks according to the combination of the generative artificial intelligence service endpoint, probe text, and repeated sampling rounds. Each collection subtask records its endpoint, probe text, and sampling round identification information. The sampling identification information is used to characterize the correspondence between probe text, service endpoint, and sampling rounds.

[0038] In one implementation, the probe text set can be pre-generated based on the descriptive information of the target entity. Specifically, the standard name of the target entity and at least one of the following: descriptive text, network address, or product / service information corresponding to the target entity, are obtained. Based on the information, one or more semantic topics related to the target entity are determined, and probe texts corresponding to the respective semantic topics are generated. For collection tasks that require comparison of similar objects, comparison entities belonging to the same object category as the target entity can also be identified simultaneously, and these comparison entities are added to the target entity configuration. Thus, a probe text set corresponding to the target object and its business semantics can be formed before generating the collection subtask, and subsequent generative AI service endpoints perform repeated sampling on the same probe text.

[0039] The task configuration and session isolation module 10 establishes an independent logical sampling context for each collection subtask without carrying previous sampling messages, and sends the current probe text to the corresponding generative artificial intelligence server endpoint.

[0040] The response reconstruction module 20 receives response fragments returned by the generative artificial intelligence server endpoint, reconstructs the response fragments based on their sequence information, repetition status, and termination status, and generates the original response and its original response quality status. The original response and its original response quality status are sent to the subsequent processing module and saved to the evidence storage unit 81.

[0041] The normalization and offset mapping module 30 normalizes the original response to obtain normalized text, and simultaneously establishes an offset mapping relationship between the normalized character positions and the original character positions. The offset mapping relationship is saved to the evidence storage unit 81.

[0042] The hierarchical structure parsing module 40 converts the normalized text into a hierarchical structure node graph based on the structural markers in the normalized text. The hierarchical structure node graph at least represents the parent-child relationship, sibling relationship, and sequence relationship between each structural node, and associates each structural node with the original character range in the original response.

[0043] The entity normalization and semantic role discrimination module 50 extracts entity candidates from the structural nodes of the hierarchical structure node graph, maps entity candidates that meet the entity confidence conditions to unique entity identifiers to form target entity mentions, and determines entity confidence and semantic role probability based on the structural features and local context features of the structural node where the target entity mention is located.

[0044] The sequence index and write determination module 60 selects structural nodes that can express the ordered relationship between similar objects from the hierarchical structure node graph and establishes a valid node sequence; determines the sequence index based on the position of the structural node containing the target entity mention of the positive association role in the valid node sequence; and generates a target entity-original response relationship mask based on the original response quality status, entity confidence, and positive association role probability.

[0045] The sparse aggregation module 70 only generates entity feature records based on the corresponding ordinal index for target entities whose original response relationship mask is valid, and writes them into the sparse data structure; then it aggregates multiple independent sampling results corresponding to the same generative artificial intelligence service endpoint and the same probe text to obtain structured aggregation results.

[0046] The evidence storage and offline recalculation module 80 includes an evidence storage unit 81 and an offline recalculation control unit 82. The system also stores dictionary, normalization rules, structural parsing rules, and model version information 401. The evidence storage unit 81 stores the original response, original response quality status, offset mapping relationship, hierarchical structure node graph, target entity mentions, entity feature records, original character ranges, and corresponding dictionary, rule, and model versions. When the target entity configuration, normalization rules, structural parsing rules, entity recognition model, or semantic role discrimination model is updated, the offline recalculation control unit 82 determines the starting point for re-execution based on the updated object and uses the data stored in the evidence storage unit 81 to perform subsequent processing.

[0047] Example 2: Isolated Acquisition and Structured Aggregation Method

[0048] like Figure 2 As shown, this embodiment provides a method for isolated acquisition and structured aggregation of multi-source generative text streams, including steps S101 to S109.

[0049] Step S101: Generate a data acquisition subtask and establish an independent logical sampling context.

[0050] The system acquires the generative AI server endpoint set, probe text set, resampling count, and target entity configuration. Based on the combination of the generative AI server endpoint, probe text, and resampling count, it generates multiple data collection subtasks. For each subtask, it establishes an independent logical sampling context without carrying preceding sampling messages and sends the current probe text to the corresponding generative AI server endpoint.

[0051] Independent logical sampling contexts can be established using at least one of the following methods: For generative AI service endpoints that support stateless requests, the request body contains only the current probe text and preset system instructions, without attaching preceding sampling messages; for generative AI service endpoints that maintain context through session identifiers, a new session identifier is generated for each repeated sampling; for generative AI service endpoints accessed automatically through a browser, a new isolated browser context is established for each repeated sampling, and historical messages, page caches, cookies, local storage data, and session storage data in this isolated browser context are cleared. Through these methods, each collection subtask does not share preceding sampling messages and session state on the client side.

[0052] For each data collection subtask, sampling identification information is established. This sampling identification information includes at least a data collection task identifier, a probe text identifier, a generative AI server endpoint identifier, and a sampling round identifier. The raw responses returned by each data collection subtask and their subsequent structured results inherit the corresponding sampling identification information. In one specific implementation, the data collection task identifier is used as the primary association key for the same batch of collected data, and the probe text identifier and the generative AI server endpoint identifier are used as secondary association information. The sampling round identifier is used to distinguish multiple responses obtained for the same probe text and the same server endpoint. Therefore, the subsequent aggregation process can select the corresponding sampling results within different statistical ranges, such as a single probe text, a single server endpoint, and across server endpoints.

[0053] Step S102: Receive response fragments, reconstruct the original response, and determine the quality status of the original response.

[0054] Receive response fragments returned by the generative artificial intelligence server endpoint. Each response fragment includes at least the fragment payload and reception time, and may also include a fragment identifier, fragment sequence number, retransmission identifier, content hash, and termination flag. Sort, deduplicate, and concatenate the response fragments according to their order information, duplication status, and termination status to obtain the original response. Determine the original response quality status based on response fragment continuity, termination status, timeout status, and endpoint anomaly status. The original response quality status at least characterizes whether the original response is complete, and may also include completion status, truncation status, failure status, termination reason, and response latency.

[0055] In one implementation, the original response quality score is determined based on integrity, segment continuity, normal termination state, and response delay. ,in, Indicates the first The original response quality score of each original response, and: When the original response is complete and the fragments are continuous, the original response quality score is high; when fragments are missing, timeout occurs, or abnormal termination occurs, the original response quality score decreases; when the endpoint request fails and no processable original response is generated, the original response will not enter the subsequent aggregation process.

[0056] Step S103: Normalize the original response and establish an offset mapping relationship.

[0057] The original response undergoes at least one normalization operation: character encoding unification, newline character unification, invisible character removal, Hypertext Markup Language entity decoding, text format control character recognition, and continuous whitespace compression, resulting in normalized text. During character deletion, replacement, or merging operations, the normalized character range, the corresponding original character range, and the conversion type identifier are recorded, forming an offset mapping relationship between the normalized character positions and the original character positions.

[0058] Step S104: Parse the normalized text into a hierarchical node graph.

[0059] Extract at least one structural marker from the normalized text, including heading markers, numbering patterns, bullets, table separators, quotation marks, code fences, line break density, and sentence-ending punctuation. Based on the hierarchical relationship between structural markers, use a parsing stack to perform push, sibling node creation, or pop operations to parse the normalized text into a hierarchical node graph. Each structural node records at least the node identifier, parent node identifier, node type, hierarchy depth, sibling sequence number, and normalized character range, and determines the corresponding original character range based on the offset mapping relationship.

[0060] Step S105: Extract entity candidates, map them to unique entity identifiers, and determine entity confidence and semantic role probability.

[0061] Entity candidates are extracted from the structural nodes of the hierarchical node graph. Entity candidates that meet the entity confidence criteria are mapped to unique entity identifiers, forming target entity mentions. Based on the structural features and local context features of the structural node where the target entity mention resides, the corresponding entity confidence and semantic role probability are determined. Semantic roles include at least positive association, comparison, neutral description, and negative association. Target entity mentions that cannot be reliably classified into the above semantic roles or whose semantic role probability is below a preset threshold can be marked as uncertain roles.

[0062] Step S106: Establish a valid node sequence and determine the ordinal index.

[0063] From the hierarchical node graph, select structural nodes that can express ordered relationships between similar objects, and establish a valid node sequence according to the order of the original character ranges corresponding to the structural nodes in the original response. For target entity mentions with a positive semantic role, determine the ordinal index of the corresponding target entity based on the position of its structural node in the valid node sequence.

[0064] Step S107: Generate the target entity-original response relationship mask

[0065] A target entity-original response relationship mask is generated based on the original response quality status, entity confidence, and positive correlation role probability. The target entity-original response relationship mask is valid when the original response quality status, entity confidence, and positive correlation role probability each meet their respective threshold conditions; otherwise, the target entity-original response relationship mask is invalid.

[0066] Step S108: Generate entity feature records and write them into a sparse data structure

[0067] For target entities whose original response relationship mask is valid only, the order weight is determined based on their order index, entity feature records are generated, and the entity feature records are written into a sparse data structure.

[0068] For original responses with invalid relation masks or no valid target entity mentions, no corresponding entity feature entries are created in the sparse data structure, but the sampling completion status and target entity mention status of the original response are retained. During cross-sampling aggregation, the total number of valid samples is determined based on the number of original responses that meet preset response quality conditions, and the number of target entity mentions is determined based on the number of original responses with valid target entity mentions. The mention rate of the target entity is determined by the ratio between the number of target entity mentions and the total number of valid samples.

[0069] Step S109: Aggregate the results of multiple independent samplings and establish evidence associations.

[0070] Based on a sparse data structure, multiple independent sampling results are aggregated to obtain a structured aggregation result. Each original response is associated with its generative AI server endpoint identifier, probe text identifier, and sampling round identifier. For entity feature records obtained from the original responses, an evidentiary association is established between the entity feature records and the original response identifier, structure node identifier, target entity mention identifier, ordinal information, and original character range.

[0071] Specifically, the process first performs a first-level aggregation on multiple independent sampling results corresponding to the same probe text and the same generative AI service endpoint, forming an aggregation result for the corresponding service endpoint for that probe text. Then, a second-level aggregation is performed on the first-level aggregation result based on the probe text identifier or the generative AI service endpoint identifier, forming a cross-service endpoint aggregation result for the same probe text, or a cross-probe text aggregation result for the same generative AI service endpoint. Each aggregation level records the corresponding aggregation range and the number of samples involved in the aggregation.

[0072] When the original response contains source citation information, the source citation information is associated with and saved along with the corresponding original response and the generative AI service endpoint. For source citation information with the same source identifier within the same aggregation range, they can be merged and statistically analyzed to obtain the frequency or percentage of each source citation, and then traced back to the corresponding original response through the evidence association.

[0073] Example 3: Response Fragment Reconstruction State Machine

[0074] like Figure 3 As shown, the response reconstruction module 20 establishes a response fragment reconstruction state machine. The response fragment reconstruction state machine includes at least a waiting state, a receiving state, a completion state, a truncation state, and a failure state.

[0075] After the system generates a data acquisition subtask and sends a request, the response fragment reconstruction state machine enters a waiting state.

[0076] Upon receiving the first valid response fragment while in the waiting state, the state machine enters the receiving state and writes the response fragment to the fragment queue corresponding to the current acquisition subtask. In the receiving state, subsequent response fragments are received, and the fragments are sorted, checked for duplicates, and concatenated. For response fragments with explicit fragment numbers, the fragment order is determined according to the fragment number. For response fragments without explicit fragment numbers, the fragment order is determined based on the reception time and the increment prefix relationship. The increment prefix relationship is used to determine whether the current fragment is a subsequent increment of already received content or a cumulative fragment containing preceding content. For response fragments within the same acquisition subtask, if the fragment number is the same, or if they have the same retransmission identifier and the same content hash, the later received response fragment is identified as a network retransmission fragment and removed. Responses with the same content belonging to different acquisition subtasks are saved as independent sampling results.

[0077] When a normal termination marker is received and the response segments are continuous, the state machine transitions from the receiving state to the completion state, generates a complete original response, and determines the quality state of the original response based on the segment continuity, termination state, and response delay.

[0078] When a timeout occurs, a normal termination marker is missing, a missing segment is detected, or an output interruption is detected, the state machine changes from the receiving state to the truncation state, saves the received portion of the original response and the reason for truncation, and generates the corresponding original response quality state.

[0079] When an endpoint returns an exception, the response payload is invalid, the number of retries reaches the limit, or the waiting state continues for more than the timeout threshold without receiving a valid payload, the state machine enters a failure state, recording the error code and the reason for failure. Failure acquisition subtasks that do not generate a processable original response do not proceed to the subsequent entity aggregation process.

[0080] The truncated state is not used as an independent mask input, but rather participates in the determination of the target entity-original response relationship mask through the original response quality state and its corresponding original response quality score.

[0081] Example 4: Normalization, Hierarchical Structure Resolution, and Entity Normalization

[0082] like Figure 4 As shown, the original response 201 is normalized to form normalized text 202. During the normalization process, an offset mapping relationship 203 is established simultaneously.

[0083] The normalization and offset mapping module 30 performs at least one of the following processes on the original response 201: converting the character encoding to a unified encoding; converting different forms of newline characters to a unified newline character; deleting invisible characters that do not participate in the semantic expression of the text; decoding the hypertext markup language entities; identifying and processing text format control characters; and merging consecutive whitespace characters according to preset rules.

[0084] When performing normalization operations, offset mapping 203 records at least: the normalized character range; the corresponding original character range; and the conversion type identifier. For example, when deleting a format control character, the original character range of the deleted character in the original response 201 is recorded; when multiple original characters are decoded into a normalized character, the normalized character is mapped to the corresponding start and end ranges of the original characters; when multiple whitespace characters are merged into a whitespace character, the correspondence between the merged normalized character and the original character ranges before merging is recorded.

[0085] Therefore, any structural node or entity reference in the normalized text 202 can be located to the original character range in the original response 201 through the offset mapping relationship 203.

[0086] The hierarchical structure parsing module 40 scans the normalized text 202, identifying structural boundaries based on heading markers, numbering patterns, bullets, table separators, citation markers, code fences, line break density, and sentence-ending punctuation. The hierarchical structure node graph includes a root node 204 and one or more content nodes 205 located under the root node 204. Content nodes 205 may further include sentence nodes 206. Content nodes 205 can be chapter nodes, heading nodes, numbered list item nodes, unnumbered list item nodes, table row nodes, paragraph nodes, citation nodes, or code nodes. Each structural node records at least: node identifier; parent node identifier; node type; hierarchy depth; sibling sequence number; normalized character range; and the original character range determined according to the offset mapping relationship 203. For ordinary text that cannot be reliably identified as a list, table, or heading, at least paragraph nodes and sentence nodes are established so that subsequent entity references have corresponding structural carriers.

[0087] The entity normalization and semantic role discrimination module 50 extracts entity candidates 207 from sentence nodes 206 or other content nodes 205. The target entity configuration includes at least the standard name, alias, and entity type of the target entity, and may also include a description of the target entity and context for excluding entities with the same name. The entity candidates 207 are obtained through at least one of the following two channels: a text matching channel based on the standard name and alias of the target entity; and an entity recognition channel based on a named entity recognition model.

[0088] When using two channels simultaneously, for the first... Mapped to the target entity in the original response The For each entity mentioned, the entity confidence level is determined according to the following formula:

[0089]

[0090] in: Score for dictionary matching; Assign confidence levels to named entities; The semantic similarity between the entity candidate and the target entity description; Scoring is based on entity type and context consistency; , , and The weights are non-negative and satisfy: When the semantic similarity calculation channel is not configured, let .

[0091] When an entity candidate is located in a context where it is excluded by the same name, the entity type is inconsistent with the target entity type, or the entity confidence is lower than the entity confidence threshold, the entity candidate is marked as an invalid candidate.

[0092] Entity candidates 207 that meet the entity confidence criteria are mapped to unique entity identifiers 208 to form target entity mentions 209. Target entity mentions 209 must record at least: entity mention identifier; unique entity identifier; surface text; identifier of the structural node; normalized character range; original character range; entity confidence; and matching source.

[0093] Local context features are extracted from the structural node where the target entity mentions 209 and its adjacent nodes. The local context features include the structural node type, related words near the entity mention, and semantic information that can represent negation, comparison, or conditional relationships. Based on this, the semantic role probability of the target entity mention is determined.

[0094] Example 5: Valid Node Sequence, Ordinal Index, Mask, and Sparse Aggregation

[0095] like Figure 5 As shown, the sequence index and write determination module 60 establishes a valid node sequence based on the hierarchical structure node graph and determines the sequence index; based on the original response quality score, entity confidence and positive correlation role probability, the mask generation unit generates a target entity-original response relationship mask; the sparse aggregation module 70 generates entity feature records only for target entities with valid masks and writes them into the sparse data structure.

[0096] A valid node sequence consists of structural nodes that can express ordered relationships between objects of the same type. Structural nodes include at least one of the following: numbered list item nodes, unnumbered list item nodes, table row nodes, and sentence nodes with explicit parallel relationships.

[0097] A sequence of valid nodes is formed according to their order in the original response. When multiple entity mentions satisfying the positive association condition exist for the same target entity, the position of the first valid node in the sequence of valid nodes is used as the ordinal index of that target entity.

[0098] When a valid node contains multiple target entities and their internal order cannot be determined, the multiple target entities are set as shared node-level order positions, and their parallel relationships are recorded.

[0099] Regarding the first The target entity in the original response The target entity-original response relationship mask is calculated according to the following formula:

[0100]

[0101] in: For the first Original response and target entity The relationship mask; This is an indicator function that takes the value 1 when the condition is true and 0 when the condition is false. For the first The original response quality score of each original response; This is the quality score threshold; To determine the entity confidence level mentioned by the target entity in the ordinal index; The entity confidence threshold; This is used to determine the probability of a positively associated role mentioned by the target entity in the ordinal index; This is the probability threshold for positively correlated roles.

[0102] Only when the original response quality score, entity confidence score, and probability of positively correlated roles all reach the corresponding thresholds, ;otherwise, Sparse data structures only receive and store the mask validity ( The entity feature record generated during the data writing phase can directly strip away zero-value relationships.

[0103] Let the total number of original responses be The total number of target entities is The actual number of non-zero entity relations written is Dense matrices need to be Each original response—entity combination—is allocated a storage location; the sparse data structure in this embodiment only stores... A non-zero entity relation, whose storage space and aggregate traversal size are mainly related to... Related.

[0104] Aggregate multiple independent sampling results corresponding to the same generative artificial intelligence server endpoint, the same probe text, the same model version, and the same or compatible sampling parameters.

[0105] The sparse aggregation module 70 collects the effective entity features obtained from multiple independent samplings according to the endpoints, probe texts and corresponding sampling conditions, and performs accumulation, statistics or other aggregation processing according to the actual application needs to form the corresponding structured aggregation results.

[0106] Example 6: Evidence Storage and Offline Recalculation

[0107] like Figure 6 As shown, the evidence storage and offline recalculation module 80 is used to save intermediate processing data and version information, and to perform offline recalculation from the processing stage corresponding to the updated content when the dictionary, rules or model are updated.

[0108] Evidence storage unit 81 stores the original response, intermediate processing results, and corresponding rule and model versions generated in the aforementioned processing. For entity features written into the sparse data structure, the corresponding original response, structure node, entity mention, and original character range are further recorded, so that the aggregation result can be traced back to its original data source.

[0109] The offline recalculation control unit 82 determines the starting point for re-execution based on the updated object. When the target entity configuration or entity recognition model is updated, it reads the saved hierarchical structure node graph and re-executes from the entity candidate extraction and unique entity identifier mapping process. When the semantic role discrimination model is updated, it reads the saved target entity mentions and their structural node information and re-executes from the semantic role probability determination process. When the structural parsing rules are updated, it reads the saved normalized text and offset mapping relationship and re-executes from the hierarchical structure node graph parsing process. When the normalization rules are updated, it reads the saved original response and re-executes from the normalization processing and offset mapping relationship establishment process. After re-executing the corresponding processing, it sequentially completes the generation of ordinal index and mask, the writing of entity feature records, and sparse aggregation to obtain the updated aggregation result. The offline recalculation control unit 82 determines the recalculation starting point based on the updated processing rules or model, and uses the original response or corresponding intermediate processing result already saved in the evidence storage unit 81 as input to re-execute this processing stage and its subsequent processing.

[0110] Example 7: Multi-endpoint response processing instance

[0111] This embodiment illustrates that generative AI service endpoints with different return methods can be converted into a unified response fragment object and enter the same subsequent processing flow.

[0112] In a single processing instance, the task configuration includes multiple probe texts and generative AI service endpoints with different return methods, and repeated sampling is performed on the combination of each endpoint and probe text. Different collection subtasks establish independent logical sampling contexts. For endpoints that return a complete response in one go, the complete response is converted into a single response fragment object; for endpoints that return in streaming mode, the received incremental content is converted into response fragment objects and then processed by the response reconstruction module.

[0113] Since the ordinary description node is not part of the valid node sequence, and its entity mention does not satisfy the positive association role probability condition, this entity mention is not used to determine the ordinal index. The entity mention in the third valid node of the numbered list satisfies the positive association role probability condition, therefore the ordinal index of the target entity is determined to be 3. This avoids using the first character position of the target entity in the original response as the valid ordinal index.

[0114] Example 8: Disambiguation of entities with the same name and processing of unnumbered lists

[0115] Same-name entity disambiguation: A target entity type in the target entity configuration is an organization type, but the entity candidate extraction process simultaneously identifies a location object with the same name as the target entity; the text matching channel generates two entity candidates with identical surface text, and the named entity recognition channel provides the organization type and location type respectively; the entity normalization and semantic role discrimination module 50 compares the identified type of the entity candidate with the target entity type in the target entity configuration, and determines the context consistency score by combining the category words, predicates and context features in the structural node where the entity candidate is located; the entity candidate of the location type is marked as an invalid candidate because the entity type is inconsistent with the target entity type; the entity candidate of the organization type meets the entity confidence condition and is mapped to the corresponding unique entity identifier.

[0116] Unnumbered list processing: When a generative response uses bullet points, indentation, or bold object names to represent multiple objects of the same type without using numerical numbers, the hierarchical structure parsing module creates unnumbered list item nodes based on the bullet points and indentation relationships; unnumbered list item nodes are added to the valid node sequence according to the order of their original character ranges; if the same unnumbered list item node contains multiple target entities and there are no semantic clues such as "first," "second," "former," or "later" that can indicate a reliable internal order, then the multiple target entities share the node-level order of that node and are set with a parallel flag.

[0117] As described above, although the invention has been shown and described with reference to specific preferred embodiments, it should not be construed as limiting the invention itself. Various changes in form and detail may be made without departing from the spirit and scope of the invention as defined in the appended claims.

Claims

1. A method for isolated acquisition and structured aggregation of multi-source generative text streams, characterized in that, include: Based on the generative artificial intelligence server endpoint set, probe text set and sampling configuration parameters, multiple collection sub-tasks are generated. Sampling identification information is configured for each collection sub-task and an independent logical sampling context is established. Probe text is sent to the corresponding server endpoint. Receive the response fragment returned by the server endpoint and reconstruct it to obtain the original response, and determine the quality status of the original response; The original response is normalized, and the normalized character range, the corresponding original character range, and the conversion type identifier are recorded to form an offset mapping relationship. The normalized text is parsed into a hierarchical structure node graph. The structure nodes in the hierarchical structure node graph record the corresponding normalized character range and are associated with the original character range through the offset mapping relationship. The structural nodes in the hierarchical node graph that can express ordered relationships between similar objects are arranged in the order of their corresponding original character ranges in the original response to form a structural node sequence. Entity candidates are extracted from the hierarchical node graph and mapped to unique entity identifiers in combination with target entity configurations to form target entity mentions. The entity confidence and semantic role of the target entity mentions are determined, and the ordinal index of the corresponding target entity is determined based on the position of the structural node in the structural node sequence where the target entity mention with a positive semantic role is located. For target entity mentions whose original response quality status meets preset quality conditions, whose entity confidence meets preset entity confidence conditions, and whose semantic role is a positively related role, entity feature records are generated based on the ordinal index and written into a sparse data structure. Based on the sampling identification information, a first-level aggregation is performed on multiple independent sampling results using a combination of at least two sampling attributes as the first grouping condition, and a second-level aggregation is performed on multiple first-level aggregation results using some of the sampling attributes in the first grouping condition as the second grouping condition, to obtain a structured aggregation result.

2. The method for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 1, characterized in that, The sampling configuration parameters include the number of repeated samplings, and the sampling round is determined based on the number of repeated samplings; the sampling identification information includes identification information used to characterize the correspondence between probe text, server endpoint, and sampling round; The establishment of independent logical sampling contexts includes at least one of the following methods: for service endpoints using stateless network requests, the corresponding request object carries only the current probe text and preset system instructions, and the preceding sampling messages are isolated; for service endpoints using session identifiers, independent session identifiers are established for different sampling rounds; for service endpoints accessed through a browser, isolated browser contexts are established for different sampling rounds, and the page cache and storage data of each isolated browser context are initialized to a preset initial state.

3. The method for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 1, characterized in that, The response reconstruction includes: establishing a response reconstruction state machine for each acquisition subtask, including at least a waiting state, a receiving state, a completed state, a truncated state, and a failure state; for response segments with explicit segment numbers, determining the order of response segments based on the segment numbers; for response segments without explicit segment numbers, determining the order of response segments based on the receiving time and the incremental prefix relationship; when the segment numbers are the same or the retransmission identifiers are the same and the content hashes are the same, they are determined to be duplicate response segments and deduplication is performed; and the quality status of the original response is determined based on the continuity of the response segments, the termination state, the timeout state, and the abnormal state of the server endpoint.

4. The method for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 1, characterized in that, The normalization process includes converting at least one of the following in the original response: character encoding, newline character, invisible character, format control character, and consecutive whitespace.

5. The method for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 1, characterized in that, The target entity configuration includes the target entity's standard name, alias, and entity type; the entity confidence is determined based on the target entity's name matching result, entity recognition result, and the consistency between the context of the entity candidate and the target entity configuration; the semantic role is determined based on the semantic information in the structural node where the target entity is mentioned and its adjacent structural nodes; the structural node includes at least one of numbered list item nodes, unnumbered list item nodes, table row nodes, and sentence nodes with explicit parallel relationships.

6. The method for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 1, characterized in that, For sampling results where the original response quality status meets the preset quality conditions but does not form a target entity mention that meets the preset entity confidence conditions and has a positive semantic role, the target entity does not appear status is saved in the corresponding sampling result record.

7. The method for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 1, characterized in that, The first grouping condition is jointly determined by the probe text identifier and the generative artificial intelligence server endpoint identifier, and multiple independent sampling results with the same probe text identifier and the same generative artificial intelligence server endpoint identifier but different sampling round identifiers are grouped into the same first aggregation unit; The second-layer aggregation includes at least one of the following: grouping multiple first aggregation units with the same probe text identifier into a cross-endpoint second aggregation unit, and grouping multiple first aggregation units with the same generative artificial intelligence service endpoint identifier into a cross-probe second aggregation unit.

8. The method for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 7, characterized in that, When the generative AI server endpoint returns reference source information corresponding to the original response, a reference source identifier is established for the reference source information, and the reference source identifier is associated with and saved with the corresponding original response identifier and sampling identifier information; when aggregating the sampling results, reference source information belonging to the same aggregation unit is merged according to the reference source identifier, and the occurrence frequency and associated original response identifier of each reference source identifier are recorded.

9. A system for isolated acquisition and structured aggregation of multi-source generative text streams, characterized in that, It includes a task configuration and session isolation module, a response reconstruction module, a normalization and offset mapping module, a hierarchical structure parsing module, an entity normalization and semantic role discrimination module, an ordinal index and write determination module, and a sparse aggregation module. The task configuration and session isolation module is used to generate collection sub-tasks based on the generative artificial intelligence service endpoint set, probe text set, sampling configuration parameters and target entity configuration, configure sampling identification information and establish an independent logical sampling context. The response reconstruction module is used to receive and reconstruct response fragments to obtain the original response and the original response quality status. The normalization and offset mapping module is used to normalize the original response and record the normalized character range, the corresponding original character range, and the conversion type identifier to form an offset mapping relationship. The hierarchical structure parsing module is used to parse the normalized text into a hierarchical structure node graph with node hierarchy and node order, and to record the corresponding normalized character range in the structure node, and associate it with the original character range through the offset mapping relationship; The entity normalization and semantic role discrimination module is used to extract entity candidates from the hierarchical structure node graph, form target entity mentions according to the target entity configuration, and determine the entity confidence and semantic role. The sequence index and write determination module is used to arrange the structural nodes in the hierarchical structure node graph that can express the ordered relationship of similar objects according to the order of the corresponding original character range in the original response to form a structural node sequence. The sequence index is determined according to the position of the structural node in the structural node sequence of the target entity mention with a positive semantic role. The entity feature record to be written is determined according to the quality status of the original response, the entity confidence and the semantic role. The sparse aggregation module is used to write the entity feature records into a sparse data structure, and to perform hierarchical aggregation of multiple independent sampling results according to the sampling identifier information to obtain a structured aggregation result.

10. The system for isolated acquisition and structured aggregation of multi-source generative text streams according to claim 9, characterized in that, It also includes an evidence storage and offline recalculation module, which includes an evidence storage unit and an offline recalculation control unit; The evidence storage module is configured to save the original response, quality status, offset mapping relationship, hierarchical structure node graph, target entity mention, entity feature record, sampling identification information, as well as the target entity configuration, normalization rules, structural parsing rules, and version information corresponding to the entity recognition model and semantic role discrimination model. The recalculation control module is configured to read the saved data of the corresponding stage in the evidence storage module as recalculation input when at least one of the target entity configuration, normalization rules, structural parsing rules, entity recognition model or semantic role discrimination model is updated, and to re-execute subsequent processing offline starting from the stage.