Web session data retrieval methods, devices, electronic equipment, and storage media
By injecting multi-level contextual hints into the query text and performing multi-level semantic reasoning, a structured query expression is generated, which solves the problems of cumbersome web session data retrieval operations and insufficient understanding of query intent in existing technologies, and achieves efficient and accurate data retrieval and analysis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN FENGCHI TECHNOLOGY CO LTD
- Filing Date
- 2026-03-24
- Publication Date
- 2026-06-30
AI Technical Summary
In existing technologies, web session data retrieval is cumbersome, requiring users to have a deep understanding of complex data models and filtering logic, resulting in high learning costs and difficulty in accurately understanding users' natural language query intent. This is especially true in scenarios involving multi-dimensional combinations, time ranges, numerical comparisons, and technical terms, leading to low query efficiency and failing to meet diverse and intelligent needs.
By injecting multi-layered contextual hints into the user's input query text and performing multi-layered semantic reasoning, structured query expressions are generated, reducing operational difficulty and improving retrieval accuracy.
Users can efficiently and accurately obtain the data they need without understanding the underlying data model, which reduces the operational threshold and learning cost, improves the flexibility and accuracy of queries, and meets diverse and intelligent query needs.
Smart Images

Figure CN122309829A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data search technology, and in particular to a method, apparatus, electronic device and storage medium for retrieving web session data. Background Technology
[0002] In related technologies, web session data retrieval primarily employs form-based filters, predefined reports, or SQL / DSL queries written directly by technical personnel. Users need in-depth knowledge of complex data models and filtering logic, and setting multiple composite conditions is cumbersome and time-consuming. Furthermore, these systems struggle to accurately understand the semantics of user queries expressed in natural language, especially in complex scenarios involving multi-dimensional combinations, time ranges, numerical comparisons, and specialized web session monitoring terminology (such as LCP and JS anomalies). These issues collectively result in low efficiency and a high barrier to entry for users when retrieving and analyzing massive amounts of web session data, failing to meet diverse, intelligent, and domain-specific query needs. Summary of the Invention
[0003] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for retrieving Web session data, which can improve retrieval accuracy while reducing the operational difficulty of Web session data retrieval.
[0004] This application provides a method for retrieving web session data, including: Get the query text entered by the user; Multi-level contextual hints are injected into the query text to obtain contextual hint data; Based on the contextual hints data, multi-level semantic reasoning is performed on the query text to obtain a structured query expression that matches the query text. The structured query expression is transformed into a structured form, and the resulting array of structured filters is displayed in the interactive interface. Based on the structured filter array, the corresponding target session data is retrieved.
[0005] In some embodiments, injecting multi-level contextual hints into the query text includes: Retrieve target document fragments that are semantically related to the query text from a preset knowledge base; The target document fragment, the query text, and the preset prompt template are fused together to obtain the context prompt data; the prompt template is used to inject multi-level context information.
[0006] In some embodiments, the prompt template is used to inject first context information, second context information, third context information, and fourth context information. The first context information is information describing the data structure characteristics of the target session data, the second context information is information describing the mapping relationship between the query text and the target document fragment, the third context information is information describing the conversion pattern characteristics from natural language to structured query, and the fourth context information is information describing the format constraint characteristics of semantic reasoning output.
[0007] In some embodiments, performing multi-level semantic reasoning on the query text based on the contextual hint data includes: Identify the contextual cue information and target perception fields in the contextual cue data; Based on the contextual prompts, the target perception field is subjected to chain-like hierarchical perception. The perception process of subsequent layers inherits and integrates the perception features of the previous layers to obtain multi-layer perception features. Based on the multi-level perceptual features, semantic reasoning is performed on the query text to obtain a structured query expression that matches the query text.
[0008] In some embodiments, the step of performing chain-based hierarchical perception of the target perception field based on the contextual prompt information includes: Based on the contextual prompts, the data structure features of the target session data are perceived to obtain the first intermediate perception features; Based on the contextual hints, the mapping relationship between the query text and the target document fragment is perceived, and the first intermediate perception feature is fused to obtain the second intermediate perception feature; Based on the contextual prompts, the conversion pattern features from natural language to structured query are perceived, and the second intermediate perception feature is fused to obtain the third intermediate perception feature; Based on the contextual prompts, the format constraint features of the semantic reasoning output are perceived, and the third intermediate perception features are fused to obtain the multi-level perception features.
[0009] In some embodiments, retrieving the corresponding target session data based on the structured filter array includes: In response to the interactive operation on the structured filter array, data retrieval is performed based on the structured filter array after interactive confirmation, and the retrieved target session data is displayed in the interactive interface.
[0010] In some embodiments, the structured query expression includes user intent information characterizing the user's query intent, and displaying the retrieved target session data in the interactive interface includes: Based on the user intent information, the target session data is converted into a target format and then displayed in the interactive interface; the target format includes chart format, table format and / or text format.
[0011] This application also provides a web session data retrieval device, including: The first module is used to obtain the query text input by the user; The second module is used to inject multi-level contextual hint information into the query text to obtain contextual hint data; The third module is used to perform multi-level semantic reasoning on the query text based on the contextual hint data to obtain a structured query expression that matches the query text. The fourth module is used to perform a structured transformation on the structured query expression and display the structured filter array obtained from the structured transformation process in the interactive interface; The fifth module is used to retrieve the corresponding target session data based on the structured filter array.
[0012] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described Web session data retrieval method.
[0013] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described Web session data retrieval method.
[0014] The beneficial effects of this application are as follows: By injecting multi-level contextual hints into the user's input query text and performing multi-level semantic reasoning, the structured query expression generated by the multi-level semantic reasoning is then converted into a structured filter array, thereby retrieving the corresponding target session data. This allows users to directly express their query intent in natural language, greatly reducing the operational threshold and learning cost. By injecting multi-level contextual hints into the query text and performing multi-level semantic reasoning, the system can accurately understand the user's natural language query intent, avoiding inaccurate or unexecuted queries due to insufficient semantic understanding. This reduces the operational difficulty of Web session data retrieval while improving retrieval accuracy. Attached Figure Description
[0015] Figure 1 This is a diagram illustrating the application environment of the Web session data retrieval method provided in the embodiments of this application.
[0016] Figure 2This is a flowchart of the Web session data retrieval method provided in the embodiments of this application.
[0017] Figure 3 This is a flowchart of a method for injecting multi-level contextual hints into query text, as provided in an embodiment of this application.
[0018] Figure 4 This is a flowchart of a method for performing multi-level semantic reasoning on query text provided in an embodiment of this application.
[0019] Figure 5 This is a schematic diagram of the structure of the Web session data retrieval device provided in the embodiments of this application.
[0020] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0022] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and drawings are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application. Furthermore, the information, data, and signals involved in the embodiments of this application are all authorized by relevant parties or have been fully authorized by all parties, and the collection, use, and processing of related data comply with the relevant laws, regulations, and standards of the relevant countries and regions.
[0024] In the field of web session data retrieval, existing technologies rely on table-based filters, predefined reports, or queries written directly by technical personnel. Users are required to master complex data models and filtering logic. When setting multiple composite conditions, the process involves multiple interactive steps, increasing the learning curve. Furthermore, the system struggles to accurately interpret the semantics of user queries expressed in natural language, particularly in scenarios involving multi-dimensional combinations, time range definitions, numerical comparisons, and web session monitoring terminology (such as LCP and JS exceptions). This leads to insufficient semantic understanding of query intent and low user interaction efficiency. For example, when monitoring the web session performance of an e-commerce platform, operations personnel might input the query "Find all sessions with an LCP exceeding 2.5 seconds and exhibiting JavaScript runtime exceptions." However, existing systems cannot map "LCP" to the maximum content rendering metric or understand the technical meaning of "JavaScript runtime exception." Therefore, users are required to select the "LCP" metric from a dropdown menu, set a numerical threshold, and separately select the "JS exception" type, completing the condition combination through multiple interactions. Consequently, the user's query intent cannot be accurately expressed in one go, the process is lengthy, and the real-time performance of data retrieval is limited.
[0025] If the above problems are not addressed, the data retrieval process will remain inefficient, users will find it difficult to quickly locate target session data, reliance on technical personnel will increase, real-time monitoring and analysis capabilities will be unable to meet diverse query needs, and the system will be hindered from adapting to the development trends of intelligence and domain specialization.
[0026] Based on this, embodiments of this application provide a Web session data retrieval method, apparatus, device, and medium. By injecting multi-level contextual hints into the query text input by the user and performing multi-level semantic reasoning, a corresponding structured query expression is generated, thereby reducing the operational difficulty of Web session data retrieval while improving retrieval accuracy.
[0027] Figure 1 This diagram illustrates the application environment of the Web session data retrieval method provided in this embodiment. (See attached diagram.) Figure 1This method is applied to a Web session data retrieval system. The system includes a terminal 110 and a server 120. The terminal 110 and server 120 are connected via a network. The terminal 110 can be at least one of a mobile phone, tablet, laptop, or in-vehicle terminal. The server 120 can be a standalone server or a server cluster consisting of several servers. The terminal 110 sends the user-input query text to the server 120. The server 120 obtains the user-input query text, injects multi-level contextual hints into the query text to obtain contextual hint data, performs multi-level semantic reasoning on the query text based on the contextual hint data, obtains a structured query expression matching the query text, performs a structured transformation on the structured query expression, displays the structured filter array obtained from the structured transformation process in the interactive interface, and retrieves the corresponding target session data based on the structured filter array.
[0028] See Figure 2 In one embodiment, a Web session data retrieval method is provided, wherein the execution subject of the method is a server, including but not limited to steps S201 to S205.
[0029] Step S201: Obtain the query text input by the user.
[0030] Query text refers to the text content entered by a user in natural language to express their search intent. This text can be simple keywords or complex sentences that describe the characteristics or conditions of the web session data the user hopes to find.
[0031] Obtaining user-inputted query text can be achieved in several ways. For example, users can directly type their query requirements into the text input box on the interactive interface, and the execution entity receives and processes this input. Alternatively, the execution entity can provide a voice input interface to convert the user's voice commands into text-based query text. In some scenarios, the query text can also be selected and loaded through preset shortcut phrases or historical query records.
[0032] Step S202: Inject multi-level contextual hints into the query text to obtain contextual hint data.
[0033] Contextual cues refer to additional information provided during semantic understanding and reasoning to accurately interpret the intent of the query text. This information can include data structure features, semantic mapping relationships, transformation pattern features, and format constraints, aiming to provide background knowledge and guidance for semantic reasoning.
[0034] Contextual cue data refers to a dataset formed by fusing the user-input query text with injected contextual cue information. This dataset contains the original query intent and background knowledge to aid understanding, providing comprehensive input for subsequent multi-level semantic reasoning.
[0035] Injecting multi-layered contextual cues into the query text aims to provide necessary background knowledge for subsequent semantic understanding. One approach is for the executing agent to pre-store a set of general rules or metadata related to Web session data. Upon receiving the query text, these general rules are directly appended as contextual cues. For example, for a query about "page load time," the executing agent can inject information about common representations or units of "page load time" in the Web session data model. Another approach is for the executing agent to look up and inject relevant synonyms or hypernyms from a simple dictionary based on keywords in the query text as contextual cues.
[0036] Step S203: Based on the contextual hints data, perform multi-level semantic reasoning on the query text to obtain a structured query expression that matches the query text.
[0037] Multi-level semantic reasoning refers to a phased, progressive semantic analysis process. In this process, the semantics of the query text are gradually and deeply understood, and inferences are made from different dimensions and granularities by combining contextual clues to accurately capture the user's complex query intent.
[0038] A structured query expression is a query statement with a clear syntax and semantic structure that is translated from a user's natural language query intent into a machine-understandable and executable query statement after semantic reasoning. This expression is typically used for query operations in databases or data storage systems, such as fragments of SQL, DSL, or other specific query languages.
[0039] Based on this contextual information, multi-level semantic reasoning is performed on the query text to transform the natural language query intent into a machine-executable structured form. One approach is for the executing agent to use a rule-based matching engine, pre-setting a series of mapping rules from natural language patterns to structured query fragments. When the query text matches a rule, a corresponding structured query expression is generated. For example, when the query text contains "display errors from the last hour," the executing agent can convert it into a structured fragment of "time_range:last_hour AND event_type:error" according to pre-set rules. Another approach is for the executing agent to utilize simple keyword extraction and mapping techniques to directly map keywords in the query text to predefined structured fields and operators, thereby constructing a structured query expression.
[0040] Step S204: Perform a structured transformation on the structured query expression and display the structured filter array obtained from the structured transformation process in the interactive interface.
[0041] Structured transformation refers to further processing the structured query expressions obtained from semantic reasoning into user-friendly elements that can be visualized and manipulated in an interactive interface. This transformation process aims to present complex query logic to users in an intuitive and easy-to-understand way.
[0042] A structured filter array is a set of actionable, visual components for filtering and selecting web session data, processed through structured transformation. Each filter represents a query condition or dimension, and users can refine search results by adjusting or confirming these filters.
[0043] The structured query expression undergoes a structured transformation, and the resulting array of structured filters is displayed in the interactive interface, aiming to present complex structured query expressions in a user-friendly manner. One implementation approach is for the executing entity to directly convert each condition or field in the structured query expression into a text label or dropdown menu in the interactive interface. For example, a structured fragment "event_type:error" can be converted into a text label displaying "Event Type: Error". Another approach is for the executing entity to pre-define a fixed visual component template for each component of the structured query expression and directly populate the expression content into the template to form a structured filter array.
[0044] Step S205: Retrieve the corresponding target session data based on the structured filter array.
[0045] Target session data refers to all relevant session records that match the user's query criteria, retrieved from the Web session data store based on the structured filter array ultimately confirmed by the user. This data represents the results the user ultimately hopes to obtain and analyze.
[0046] Based on this structured filter array, the corresponding target session data is retrieved by obtaining results from the data storage according to the query conditions confirmed by the user. One implementation approach is that the executing entity can directly convert the currently displayed structured filter array into an executable query statement for the backend database, execute the query immediately, and then return the query results directly to the user as a raw data list. For example, if the filter array displays "Event Type: Error" and "Time Range: Last Hour," the executing entity directly executes the corresponding database query and lists all raw session data entries that meet the conditions.
[0047] The following example will provide a more detailed explanation of the above technical solution: Suppose user A wants to retrieve web session data, and their query intent is "find all JS abnormal sessions with an LCP greater than 2.5 seconds within the last day". In existing technologies, user A might need to manually construct complex SQL query statements or set time ranges, LCP thresholds, and event types one by one in multiple form filters. This is not only cumbersome but also requires users to have a deep understanding of data models and technical terminology.
[0048] The method in this embodiment first obtains the query text input by user A: "All abnormal JS sessions with an LCP greater than 2.5 seconds within the last day". This natural language text is received by the execution entity.
[0049] Subsequently, the executing entity injects multi-layered contextual hints into the query text, obtaining contextual hint data. For example, the executing entity can identify that "LCP" is a web performance metric and inject its field name in the data model (such as "largest_contentful_paint"), along with its numerical type and unit information. Simultaneously, the executing entity can identify that "JS exception" is an event type and inject its corresponding event code or category. For "within the last day," the executing entity can inject the representation of the time range field and commonly used time units. This contextual information is integrated with the original query text to form contextual hint data containing rich background knowledge.
[0050] Next, based on this contextual hint data, the executing agent performs multi-level semantic reasoning on the query text to obtain a structured query expression that matches the query text. During the reasoning process, the executing agent utilizes the injected contextual information to gradually understand each component of the query text. For example, the executing agent can identify that "within the most recent day" corresponds to the "past 24 hours" range of the time field; identify that "LCP greater than 2.5 seconds" corresponds to "largest_contentful_paint>2500" (assuming the unit is milliseconds); and identify that "JS exception" corresponds to "event_type = 'js_error'". Through multi-level analysis and combination, a structured query expression is finally generated, such as: "time_range:last_24_hours AND largest_contentful_paint>2500 AND event_type:'js_error'".
[0051] Then, the structured query expression undergoes a structured transformation, and the resulting array of structured filters is displayed in the interactive interface. The executing entity parses the structured query expression into user-friendly visual components. For example, "time_range:last_24_hours" is transformed into a filter component displaying "Time range: last 24 hours"; "largest_contentful_paint>2500" is transformed into a filter component displaying "LCP>2.5 seconds"; and "event_type:'js_error'" is transformed into a filter component displaying "Event type: JS exception". These filter components are presented as an array in the interactive interface, allowing users to intuitively view and understand the current query conditions.
[0052] Finally, based on this structured filter array, the execution entity retrieves the corresponding target session data. After the user confirms these structured filter components in the interactive interface, the execution entity sends the query conditions represented by these filters to the backend data storage system. The backend system, based on these precise structured conditions, filters all session records from massive amounts of web session data that meet the criteria of "LCP greater than 2.5 seconds within the most recent day and a JS exception," and returns this target session data to the user in the interactive interface. Through this process, user A can efficiently and accurately obtain the required data without understanding the underlying data model or writing complex query statements.
[0053] Based on the above examples, the technical solution of this embodiment demonstrates a significant technical contribution in solving the problems of the prior art.
[0054] In existing technologies, if user A wants to complete a search for "all JavaScript exception sessions with an LCP greater than 2.5 seconds within the last day," they typically need a deep understanding of the underlying data model of web session data, such as the field names corresponding to LCP, the event codes of JavaScript exceptions, and the precise syntax of the time range. Furthermore, users need to manually set conditions one by one in multiple form filters or directly write complex SQL / DSL query statements. This approach is not only cumbersome and costly to learn, but also prone to retrieval failures or inaccurate results due to syntax errors or misunderstandings of the data model.
[0055] In contrast, this embodiment utilizes user-inputted query text, allowing users to directly express their query intent in natural language, significantly reducing the operational threshold and learning cost. Users do not need to memorize complex field names or query syntax; they can simply input their requirements as in everyday communication.
[0056] Furthermore, by injecting multi-level contextual hints into the query text and performing multi-level semantic reasoning based on the contextual hints, this embodiment effectively solves the problem of accurately understanding the user's natural language query intent in existing technologies. In the above example, it can intelligently identify professional terms in fields such as "LCP" and "JS exception," and accurately convert them into machine-executable structured query expressions by combining complex conditions such as time range and numerical comparison. This avoids the problem of inaccurate or unexecutable queries due to insufficient semantic understanding in existing technologies, especially in complex scenarios involving multi-dimensional combinations and professional terms, where the advantages of this solution are even more prominent.
[0057] Furthermore, the process of transforming the structured query expression and displaying the resulting structured filter array in the interactive interface presents the complex structured query logic to the user in an intuitive and visual filter format. This not only improves the transparency of the query conditions, allowing users to clearly understand the executor's interpretation of the query intent, but also provides the possibility of interactive adjustments, further enhancing the flexibility and accuracy of the query. Users no longer need to deal with obscure query statements, but can confirm or fine-tune them through a user-friendly interface.
[0058] Ultimately, the corresponding target session data is retrieved based on this structured filter array, ensuring efficient data retrieval according to the precise conditions confirmed by the user. The entire process, from natural language input to structured query, then to visual interaction and final data retrieval, forms a closed-loop, intelligent web session data retrieval system. This system significantly improves user efficiency in retrieving and analyzing massive amounts of web session data, lowers the technical threshold, and better meets diverse, intelligent, and domain-specific query needs, thus achieving technical effects that existing technologies cannot reach.
[0059] See Figure 3 In one embodiment, the method for injecting multi-level contextual hints into query text includes, but is not limited to, steps S301 to S302.
[0060] Step S301: Retrieve target document fragments that are semantically related to the query text from a preset knowledge base.
[0061] Step S302: Contextual fusion is performed on the target document fragment, query text, and preset prompt template to obtain contextual prompt data.
[0062] Hint templates are used to inject multi-layered contextual information. In essence, a hint template provides a predefined structure or text pattern to guide the model in understanding the query intent and injecting contextual information at different levels, thereby standardizing the input and output of semantic reasoning. The hint template can be a text string containing placeholders, such as: "Given the following document fragment and query text, and considering the structural characteristics of web session data, generate a structured query expression: [Document Fragment] [Query Text] [Structured Query Format Requirements]". Alternatively, the hint template can be a structured data format, such as JSON or XML, which defines fields and expected value types for different contextual information to facilitate model parsing and utilization.
[0063] Retrieving target document fragments semantically related to the query text from a pre-defined knowledge base can be based on methods such as keyword matching and vector similarity calculation. This involves finding document fragments in the knowledge base that are semantically closest to or most relevant to the query text. For example, pre-trained language models (such as BERT and Word2Vec) can be used to generate word vectors or sentence vectors, and cosine similarity can be calculated to identify semantically related target document fragments. Alternatively, knowledge graph-based retrieval methods can be employed. The knowledge base can be constructed as a knowledge graph, and entity links or path searches can be performed within the graph using the query text to obtain relevant target document fragments.
[0064] Contextual fusion of the target document fragment, query text, and pre-defined suggestion template combines the query text, retrieved relevant document fragments, and a pre-defined suggestion template to form a holistic data set containing rich contextual information, providing comprehensive and structured input for subsequent semantic reasoning. This fusion process can be achieved through simple concatenation, such as combining the target document fragment, query text, and suggestion template into a long string in a specific order. Alternatively, more complex fusion mechanisms can be employed, such as using attention mechanisms or Transformer encoders to deeply interact with the three elements, thereby generating contextual suggestion data that includes semantic relationships among them.
[0065] This application's solution first retrieves target document fragments semantically related to the query text from a pre-defined knowledge base, ensuring the high relevance and specificity of the acquired contextual information. Subsequently, these target document fragments, the original query text, and a pre-defined hint template are fused together. The hint template is designed to inject multi-layered contextual information, thus providing not only the original intent of the query text during the fusion process but also relevant background knowledge and guiding information for subsequent processing. This fusion method results in generated contextual hint data containing rich and structured context, providing a solid foundation for subsequent multi-layered semantic reasoning of the query text and effectively solving the problem of how to efficiently and accurately acquire and organize contextual hint information.
[0066] The following is a concrete example. When a user enters the query text "Show the most visited pages in the last week", the executing entity first retrieves target document fragments semantically related to "visits", "pages", and "last week" from a pre-defined knowledge base. These document fragments may contain definitions of page view count fields (such as `page_view_count`), usage examples of timestamp fields (such as `timestamp`), and examples of how to represent time ranges from web session data. Subsequently, these retrieved target document fragments, the original query text, and a pre-defined prompt template are contextually fused. This prompt template can be a text containing instructions and placeholders, such as: "Given the following Web session data structure description, related document fragments, and user query, a structured query expression conforming to a specific query language (such as ElasticsearchQuery DSL). Example Web session data structure: `{ "timestamp": "datetime", "url": "keyword", "page_view_count": "integer", ...}`. Related document fragments: [Insert retrieved document fragment here]. User query: [Insert user query text here]. Output format requirements: JSON format, including `query` and `sort` fields." In this way, all the necessary information is integrated into a contextual prompt, providing a comprehensive and guided input for subsequent semantic reasoning.
[0067] Through the above technical solution, this application can effectively obtain background information highly relevant to the query text from a pre-set knowledge base, and deeply integrate this information with the query text through the guidance of prompt templates, thereby generating prompt data containing multi-level, structured context. This significantly improves the accuracy and robustness of subsequent multi-level semantic reasoning, enables a more precise understanding of user intent, and generates high-quality structured query expressions, thereby improving the efficiency and accuracy of Web session data retrieval.
[0068] In some embodiments, the prompt template is used to inject first context information, second context information, third context information and fourth context information. The first context information is information describing the data structure characteristics of the target session data, the second context information is information describing the mapping relationship between the query text and the target document fragment, the third context information is information describing the transformation pattern characteristics from natural language to structured query, and the fourth context information is information describing the format constraint characteristics of the semantic reasoning output.
[0069] The first contextual information aims to provide the semantic reasoning model with a detailed description of how the target session data is internally organized. This includes, but is not limited to, the field names, data types (such as strings, integers, dates, booleans, etc.), hierarchical relationships between fields, ranges of enumerated values, and the logical structure of the data storage (such as JSON, XML, relational database table structures, etc.). By providing this information, the model can understand the specific correspondence and constraints of the entities or attributes mentioned in the user's query within the target data. For example, it can be provided in the form of a schema definition language (such as JSON Schema, GraphQL Schema) or in the form of structured text (such as "The session data contains the following fields: User ID (string), Access Time (datetime), Page URL (string), Behavior Type (enum: click, view, purchase)").
[0070] The second layer of contextual information is used to clarify the semantic association or correspondence between the user's input query text and the target document fragment retrieved from the knowledge base. This mapping relationship can indicate which concept in the document fragment corresponds to a keyword in the query, or how the overall intent of the query is supported or explained by the information in the document fragment. For example, when querying "which product detail pages did the user visit", the document fragment might contain "the URL pattern of the product detail page is / product / detail / ", then the mapping relationship will indicate the association between "product detail page" and " / product / detail / ". This can be achieved by explicitly annotating the correspondence between query terms and entities in the document fragment, such as using triples (query term, relation, document entity); or by providing examples demonstrating how phrases in the query are combined with information in the document fragment to understand the user's intent.
[0071] The third layer of contextual information aims to guide the semantic reasoning model on how to convert natural language queries into structured query expressions (e.g., SQL, Elasticsearch Query DSL, PromQL, etc.). This includes common transformation rules, syntactic structures, operator mappings (e.g., "greater than" corresponds to ">", "contains" corresponds to "LIKE"), usage of aggregate functions (e.g., "count" corresponds to "COUNT()"), and conditional combination logic (e.g., "and" corresponds to "AND"). By providing these patterns, the model can learn and follow specific transformation paradigms, ensuring that the generated structured queries conform to the target syntax and semantic requirements. For example, a set of natural language queries and their corresponding structured query example pairs can be provided, or the syntactic rules and semantic mapping tables for transformation can be explicitly defined.
[0072] The fourth contextual information specifies the particular format requirements that the structured query expression output by the semantic reasoning process should follow. This may include the overall structure of the output expression, naming conventions for specific fields, the order of parameters, nesting level restrictions, and whether specific metadata is required. For example, it might be required that the output structured query expression be in JSON format and contain two top-level keys, "query" and "filters," or that all field names must use camelCase. These constraints ensure that the generated structured query expression can be correctly parsed and processed by the subsequent structured transformation module. This can be achieved by providing a schema definition of the output format or by describing the structure and components of the output expression in natural language.
[0073] This application's solution enriches and structures the contextual suggestion data semantically by explicitly distinguishing and injecting first, second, third, and fourth contextual information into the suggestion template. Specifically, upon receiving the user's input query text, the executing entity first retrieves target document fragments semantically related to the query text from a pre-defined knowledge base. Subsequently, during context fusion, the pre-defined suggestion template not only integrates the target document fragments and the query text, but more importantly, it injects, according to a pre-defined structure, first contextual information describing the data structure characteristics of the target session data, second contextual information describing the mapping relationship between the query text and the target document fragments, third contextual information describing the transformation pattern characteristics from natural language to structured queries, and fourth contextual information describing the format constraints of the semantic reasoning output into the contextual suggestion data. This multi-dimensional, structured contextual information injection method provides extremely refined guidance for subsequent multi-level semantic reasoning. The first contextual information enables the semantic reasoning model to accurately understand the data fields, their types, and structures involved in the user query, avoiding misunderstandings caused by unclear data structures. The second layer of contextual information helps the model establish a precise correlation between query intent and background knowledge (target document fragments), thereby more accurately capturing the deeper meaning of the user's query. The third layer of contextual information provides the model with "syntactic and semantic rules" for transforming natural language into structured queries, enabling it to follow a predefined transformation paradigm and generate logically correct and compliant query expressions. Finally, the fourth layer of contextual information ensures that the output of semantic reasoning (structured query expressions) is formatted correctly and parsable, facilitating subsequent structured transformation processing. In this way, the executing entity can more effectively transform complex natural language queries into accurate and executable structured queries, significantly improving the accuracy and efficiency of web session data retrieval.
[0074] Through the above technical solutions, the prompt template can inject multi-layered, structured contextual information, significantly improving the accuracy and robustness of Web session data retrieval. Specifically, the first contextual information enables the semantic reasoning model to accurately understand the internal structure of the target session data, avoiding ambiguity caused by unclear data structure. The second contextual information enhances the semantic connection between the query text and background knowledge, enabling the model to more accurately capture the user's deeper intent. The third contextual information provides clear pattern guidance for the conversion from natural language to structured queries, ensuring the syntactic correctness and semantic consistency of the generated queries. The fourth contextual information ensures that the structured query expressions output by semantic reasoning conform to preset format requirements, improving the compatibility and efficiency of subsequent processing. Overall, this refined contextual information injection mechanism enables the executing entity to generate more accurate and reliable structured query expressions when processing complex and ambiguous natural language queries, thereby effectively solving the problems of inaccurate understanding of user intent and low conversion efficiency in the semantic reasoning process, greatly improving the accuracy of Web session data retrieval and user experience.
[0075] See Figure 4 In one embodiment, the method for performing multi-level semantic reasoning on query text includes, but is not limited to, steps S401 to S403.
[0076] Step S401: Identify the contextual cue information and target-aware fields in the contextual cue data.
[0077] Step S402: Based on the contextual prompts, the target perception field is subjected to chain-like hierarchical perception. The perception process of subsequent layers inherits and integrates the perception features of the previous layers to obtain multi-layer perception features.
[0078] Step S403: Based on multi-level perceptual features, perform semantic reasoning on the query text to obtain a structured query expression that matches the query text.
[0079] Chain-based hierarchical perceptualization is a progressive, layer-by-layer perceptual mechanism. When processing target perceptual fields, the executing agent does not complete all perception at once, but decomposes the complex perceptual process into multiple layers. Each layer focuses on perceiving a specific type of feature, and subsequent layers utilize and integrate the results of previous layers. This mechanism ensures a comprehensive and detailed understanding of the semantics of the query text. For example, multi-layer neural network models, such as recurrent neural networks (RNNs), long short-term memory networks (LSTMs), or Transformer models, can be used, where each layer is responsible for extracting semantic features at different granularities and passing the output to the next layer for further processing.
[0080] Multi-level perceptual features are the output of a chain-like hierarchical perceptual process. They encompass comprehensive feature representations that understand and abstract the target perceptual field from different levels and dimensions. These features can fully reflect the semantic intent of the query text and its relevance to the target session data. These features can be represented as high-dimensional vectors, and through methods such as feature vector concatenation, weighted summation, or attention mechanism fusion, the perceptual results from different levels can be integrated into a unified feature representation.
[0081] The proposed solution, when performing multi-level semantic reasoning on query text, first identifies contextual clues and target-aware fields in the contextual cue data. Contextual clues provide rich background knowledge and guidance for the reasoning process, while target-aware fields clarify the focus of the reasoning. Subsequently, based on these contextual clues, a chain-like hierarchical perception is performed on the target-aware fields. This chain-like hierarchical perception mechanism is the core of this solution. It decomposes the complex semantic understanding task into a series of interconnected and progressively deepening perception levels, allowing each level to focus on extracting specific types of semantic features. More importantly, the perception process of subsequent levels is not independent but inherits and integrates the perception features of previous levels. This means that each subsequent level of perception is built on the understanding of the preceding levels, thereby achieving a cumulative and progressive understanding of the semantics of the query text. In this way, the executing agent can capture deeper and finer-grained semantic information in the query text and integrate it into comprehensive multi-level perception features. Finally, based on these comprehensive and in-depth multi-level perception features, semantic reasoning is performed on the query text, resulting in a more accurate and robust structured query expression that matches the query text. Compared to semantic reasoning that relies on a single level or simple fusion, this chain-based hierarchical perception method, which combines multi-level perception features, significantly improves the depth and accuracy of semantic reasoning and effectively solves the problem of complex query intents being difficult to understand and structure accurately.
[0082] The following example illustrates this. Suppose a user's query is "display web pages with over 1000 visits in the past week," and the contextual hints include information about the web session data structure (such as fields like "access time," "visits," and "page URL") and common query patterns (such as time range filtering corresponding to "past week"). In the recognition phase, the executing agent can identify "past week," "over 1000 visits," and "web page" as target perception fields, while extracting contextual hints related to the data structure and query patterns. In the chain-like hierarchical perception phase, a multi-layered Transformer model can be used. The first layer might focus on perceiving the semantics of the time phrase "past week," parsing it as a time range feature; the second layer might fuse the output of the first layer and perceive the numerical values and comparisons in "over 1000 visits," extracting numerical filtering features; the third layer might further fuse the features from the first two layers, perceiving the entity type represented by "web page," and, combined with the contextual hints, understanding its corresponding fields in the data structure. Each layer processes the input through a self-attention mechanism and a feedforward network, passing its output to the next layer to ensure the inheritance and fusion of information flow. Ultimately, these multi-layered perceptual features, rich in semantic information such as time, numerical values, and entity type, obtained after processing by multiple Transformer models, are input into a Sequence-to-Sequence (Seq2Seq) model. Based on these features, the Seq2Seq model generates a structured query expression, such as `SELECT page_url FROM web_sessions WHERE access_time>= 'one week ago' AND visit_count>1000`.
[0083] Through the above technical solution, this application effectively addresses the problem of accurately understanding and structuring user query intent in complex Web session data retrieval. By identifying contextual hints and target-aware fields, and employing a chain-like hierarchical perception mechanism, the executing entity can perform deep and detailed semantic analysis of the query text, accumulating and fusing semantic features layer by layer, thereby comprehensively capturing the user's true query intent. This multi-layered perception and reasoning process enables the executing entity to generate more accurate and robust structured query expressions when faced with fuzzy, ambiguous, or complex natural language queries, significantly improving the accuracy of Web session data retrieval and user experience.
[0084] In some embodiments, the target-aware field is subjected to chain-like hierarchical perception based on contextual prompts, including: perceiving the data structure features of the target session data based on contextual prompts to obtain a first intermediate perception feature; perceiving the mapping relationship between the query text and the target document fragment based on contextual prompts, and fusing the first intermediate perception feature to obtain a second intermediate perception feature; perceiving the conversion pattern features from natural language to structured query based on contextual prompts, and fusing the second intermediate perception feature to obtain a third intermediate perception feature; and perceiving the format constraint features of the semantic reasoning output based on contextual prompts, and fusing the third intermediate perception feature to obtain multi-level perception features.
[0085] This application's scheme employs a chain-like hierarchical perception mechanism to progressively integrate multi-level contextual information into the perception features. First, based on contextual cues, the data structure features of the target session data are perceived, yielding the first intermediate perception feature, which lays the structural foundation for subsequent perceptions. Building upon this, the mapping relationship between the query text and the target document fragment is further perceived and fused with the first intermediate perception feature to obtain the second intermediate perception feature, thereby enhancing semantic accuracy based on structured understanding. Subsequently, the transformation pattern features from natural language to structured queries are perceived and fused with the second intermediate perception feature to obtain the third intermediate perception feature, making the perception results closer to the generation logic of structured queries. Finally, the format constraint features of the semantic reasoning output are perceived and fused with the third intermediate perception feature to obtain the final multi-level perception features. The entire process ensures that subsequent levels of perception inherit and integrate the perception features of preceding levels, thus forming a comprehensive and progressive perception system from structure to semantics, from pattern to format, resulting in a deeper and more accurate understanding of the query text.
[0086] The following is a concrete example to illustrate this. Suppose the user inputs the query text "Display the pages with the highest visit count in the past week, and which are from users in Beijing". The executing agent first perceives the data structure characteristics of the target session data based on contextual clues. For example, it identifies that "page" corresponds to the `page_url` field in the log, "visits" corresponds to the `visit_count` field, "past week" corresponds to the `timestamp` field, and "Beijing users" corresponds to the `user_location` field, understanding the data types and relationships of these fields to obtain the first intermediate perceived feature. Next, the executing agent perceives the mapping relationship between the query text and the target document fragments based on contextual clues. For example, through a knowledge base or historical query pattern, it identifies the condition `BETWEEN current_date - 7 AND current_date` mapping "past week" to the `timestamp` field, `highest visit count` mapping to `ORDER BY visit_count DESC LIMIT1`, and `users from Beijing` mapping to `user_location = 'Beijing'`. These mapping relationships are merged with the first intermediate perceived feature to obtain the second intermediate perceived feature. Then, based on contextual cues, the executing agent perceives the transformation pattern characteristics from natural language to structured queries. For example, it understands how to combine the identified fields and conditions into a complete SQL query statement, including the structure and order of clauses such as `SELECT`, `FROM`, `WHERE`, `GROUP BY`, and `ORDER BY`. This is then fused with the second intermediate perception feature to obtain the third intermediate perception feature. Finally, based on contextual cues, the executing agent perceives the format constraint characteristics of the semantic reasoning output. For example, it ensures that the generated SQL statement conforms to the syntax requirements of a specific database, such as field names, function calls, and quotation mark usage. This is then fused with the third intermediate perception feature to ultimately obtain multi-level perception features used to guide semantic reasoning.
[0087] Through the above technical solution, this application can ensure that contextual information from different levels is effectively and systematically integrated during the chain-like hierarchical perception process. This gradual accumulation and refinement of perception methods enables the final generated multi-level perception features to comprehensively and accurately capture the user's query intent, thereby significantly improving the accuracy and robustness of subsequent semantic reasoning. It solves the technical problem of how to effectively integrate multi-source contextual information to generate accurate structured query expressions in complex query scenarios.
[0088] In some embodiments, retrieving corresponding target session data based on a structured filter array includes: responding to an interactive operation on the structured filter array, performing data retrieval based on the structured filter array after interactive confirmation, and displaying the retrieved target session data in the interactive interface.
[0089] Responding to interactive operations on a structured filter array refers to the ability to receive and process various user actions on these filters after the structured filter array is displayed in the interactive interface. This ensures that users have control and the ability to modify the automatically generated query conditions. For example, by providing editable UI controls such as text boxes, drop-down menus, checkboxes, or radio buttons for each filter element in the interactive interface, users can modify the filter values, operators, or logical relationships. Furthermore, by providing buttons or drag-and-drop functionality for deleting, adding, or reordering filter elements, users can add, delete, modify, and query the composition of the filter array.
[0090] Data retrieval based on a structured filter array after interactive confirmation means that the data retrieval is not based on the initially generated filter array, but on the final filter array after the user interacts and confirms (e.g., clicks the "Search" button). This ensures the accuracy of the retrieval and the matching degree of the user's intent. Specifically, after the user modifies the structured filter array, the execution entity waits for the user's explicit confirmation instruction, such as clicking the "Apply," "Search," or "Submit" button, before sending the confirmed filter array as the final query conditions to the backend data retrieval module. Alternatively, it can be designed as a real-time preview mode, where the execution entity performs lightweight verification or preprocessing in the background for each filter modification by the user, but only executes the full data retrieval operation after the user completes all modifications and clicks confirmation.
[0091] The solution in this application, through the aforementioned technical means, in a Web session data retrieval method, first generates and displays a structured filter array in the interactive interface based on the user-input query text through a series of semantic reasoning and structured transformations. To address potential biases in automatically generated filters or issues related to user-specific needs, this application further proposes that after displaying the structured filter array, the execution entity responds to user interactions with the array. This means that users can review, modify, add, or delete automatically generated filters, thereby precisely adjusting query conditions to better align with their true intent. Only after the user completes these interactions and provides explicit confirmation will the execution entity perform data retrieval based on this user-confirmed structured filter array. This mechanism ensures that the retrieval operation is based on highly accurate query conditions ultimately approved by the user, thus avoiding unnecessary or inaccurate retrieval. Finally, the execution entity clearly displays the retrieved target session data in the interactive interface, allowing users to intuitively view and analyze the required information. By introducing user interaction and confirmation steps, this application effectively improves the accuracy of retrieval results and user satisfaction, making the entire retrieval process more flexible and controllable.
[0092] The following example illustrates this. When a user enters the query text "Show all failed login sessions from yesterday", the executing entity first generates a structured filter array in the interactive interface through semantic reasoning and structured transformation, for example, displayed as: `[{"field": "Event Type", "Operator": "Equal to", "Value": "Login Failed"}, {"field": "Time Range", "Operator": "At", "Value": "Yesterday"}]`. At this point, the user may find the definition of "Login Failed" too broad, or want to further limit it to a specific user. The user can modify it to "Login Failed (Incorrect Password)" by clicking the edit button next to the "Event Type" filter, or by adding a new filter, such as `[{"field": "User ID", "Operator": "Equal to", "Value": "user_A"}]`. After the user completes these modifications, for example, by clicking the "Execute Retrieval" button on the interface for confirmation, the executing entity will then send a query request to the backend database based on this structured filter array modified and confirmed by the user. The matching session data returned by the database can be presented in a table format on the interactive interface. The table columns include "session ID", "user ID", "event type", "timestamp", "source IP address", etc., and each row corresponds to a session record that meets the conditions.
[0093] Through the above technical solution, this application effectively solves the problem that automatically generated structured filter arrays may not fully and accurately reflect user intent. By introducing a mechanism that responds to user interaction, users can review, modify, and confirm the automatically generated query conditions before data retrieval, thereby ensuring that the search conditions highly match the user's actual needs. Data retrieval based on the structured filter array after interactive confirmation significantly improves the accuracy and relevance of search results, avoiding invalid searches or a large number of irrelevant results caused by inaccurate query conditions. At the same time, displaying the retrieved target session data in the interactive interface provides users with intuitive and clear feedback, greatly improving user experience and data analysis efficiency. This user participation and confirmation mechanism makes the Web session data retrieval process more flexible, intelligent, and user-centric.
[0094] In some embodiments, the structured query expression contains user intent information that characterizes the user's query intent. Displaying the retrieved target session data in the interactive interface includes: converting the target session data into a target format based on the user intent information and then displaying it in the interactive interface.
[0095] User intent information is structured or unstructured data used to characterize a user's query intent. Its purpose is to clarify the type of results or data presentation a user expects when making a query. For example, user intent information can be keywords or phrases extracted from the query text using natural language processing techniques, indicating whether the user wants to view data trends, details, distribution, or summaries. In another implementation, user intent information can also be predefined labels or codes, which are automatically identified and associated by the executing entity based on query patterns or user history when the user enters a query.
[0096] Target formats include chart formats, table formats, and / or text formats. In essence, a target format refers to the specific data presentation format after the retrieved target session data has been transformed. Its purpose is to present the data in a way that best suits the user's understanding and analysis, based on the user's intent. Target formats can include chart formats, table formats, and / or text formats. Chart formats present data graphically, such as line charts, bar charts, pie charts, scatter plots, etc., suitable for displaying data trends, distributions, comparisons, etc. Table formats organize data in rows and columns, suitable for displaying detailed lists, precise values, or multi-dimensional data. Text formats present data in plain text or structured text, such as summaries, reports, lists of key indicators, etc., suitable for providing concise summary information or specific text content. Converting target session data to a target format can be achieved in various ways. For example, a set of data transformation rules and templates can be preset, and the data can be formatted according to the user's intent. In another implementation, a data visualization engine or report generation tool can be used to dynamically generate or select appropriate rendering components and layouts based on user intent information, thereby converting the raw data into the target format desired by the user.
[0097] The solution in this application, after the executing entity completes data retrieval and obtains the target session data based on the structured filter array confirmed through interaction, introduces user intent information to further improve the user's understanding and experience of the retrieval results. This user intent information is included when generating the structured query expression, and it carries the data presentation requirements implicitly or explicitly expressed by the user during the initial query. Before displaying the retrieved target session data, the executing entity uses this user intent information as guidance to perform format conversion on the original target session data. Specifically, the executing entity dynamically converts the target session data into the corresponding target format, such as chart format, table format, or text format, according to the expected display method indicated by the user intent information (e.g., viewing data trends, detailed lists, or key summaries). This conversion ensures that the data finally presented in the interactive interface is not only accurate in content but also intuitive in form, highly matching the user's query intent, thereby enabling the user to understand and utilize the retrieval results more quickly and effectively.
[0098] The following example illustrates this. Suppose the user inputs the query text "the most visited pages and their trends in the past week". After multi-level semantic reasoning, the executing entity will obtain a structured query expression containing user intent information, which may be identified as "view trends" and "page view ranking". When the executing entity retrieves web session data from the past week based on the structured filter array, it will convert the raw session data (e.g., daily page view records for each page) into a line graph format based on the "view trends" user intent information, where each line represents the page view trend. Simultaneously, based on the "page view ranking" user intent information, the executing entity can also list the top-viewed pages in a table, displaying their specific view counts. In this way, users can directly see the trend graph and detailed ranking table of the most visited pages in the interactive interface, without manual data processing or format conversion, greatly improving the efficiency of data analysis.
[0099] Through the above technical solution, in the process of web session data retrieval, not only can the target session data be accurately retrieved, but furthermore, based on the user intent information contained in the structured query expression, the retrieved target session data can be intelligently converted into the user's desired target format (such as chart format, table format, or text format) for display. This solves the problems of traditional search result display methods being monotonous and requiring users to process data themselves to meet specific analytical needs. Users can obtain intuitive and easy-to-understand data presentations without additional operations, significantly improving the efficiency of users' understanding of search results and data analysis experience, and allowing the value of search results to be more fully realized.
[0100] See Figure 5 This application also provides a Web session data retrieval device that can implement the above-described Web session data retrieval method. The device includes: The first module 501 is used to obtain the query text input by the user; The second module 502 is used to inject multi-level contextual hint information into the query text to obtain contextual hint data; The third module 503 is used to perform multi-level semantic reasoning on the query text based on contextual hints to obtain a structured query expression that matches the query text. The fourth module, 504, is used to perform a structured transformation on the structured query expression and displays the structured filter array obtained from the structured transformation process in the interactive interface. Module 505 is used to retrieve the corresponding target session data based on the structured filter array.
[0101] The specific implementation of this Web session data retrieval device is basically the same as the specific implementation of the Web session data retrieval method described above, and will not be repeated here.
[0102] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application.
[0103] The following reference Figure 6 To describe an electronic device 600 according to such an embodiment of the present disclosure. Figure 6 The electronic device 600 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0104] like Figure 6 As shown, the electronic device 600 is presented in the form of a general-purpose computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different system components (including storage unit 620 and processing unit 610), a display unit 640, etc.
[0105] The storage unit stores program code, which can be executed by the processing unit 610, causing the processing unit 610 to perform the steps described in the Web session data retrieval method section of this specification according to various exemplary embodiments of this disclosure.
[0106] Storage unit 620 may include a readable medium in the form of a volatile storage unit, such as random access memory (RAM) 6201 and / or cache memory 6202, and may further include a read-only memory (ROM) 6203.
[0107] Storage unit 620 may also include a program / utility 6204 having a set (at least one) program module 6205, such program module 6205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0108] Bus 630 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0109] Electronic device 600 can also communicate with one or more external devices 600' (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 600, and / or with any device that enables electronic device 600 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 650. Furthermore, electronic device 600 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 660. Network adapter 660 can communicate with other modules of electronic device 600 via bus 630. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0110] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0111] The Web session data retrieval method, apparatus, electronic device, and storage medium provided in this application inject multi-level contextual hints into the query text input by the user and perform multi-level semantic reasoning. Then, the structured query expression generated by the multi-level semantic reasoning is converted into a structured filter array, thereby retrieving the corresponding target session data. Thus, users can directly express their query intent in natural language, greatly reducing the operational threshold and learning cost. By injecting multi-level contextual hints into the query text and performing multi-level semantic reasoning, the system can accurately understand the user's natural language query intent, avoiding inaccurate or unexecuted queries due to insufficient semantic understanding. This reduces the operational difficulty of Web session data retrieval while improving retrieval accuracy.
[0112] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, or network device, etc.) to execute the methods described above according to the embodiments of this disclosure.
[0113] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0114] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0115] Those skilled in the art will understand that the above modules can be distributed in the device as described in the embodiments, or they can be modified accordingly and placed in one or more devices that are unique to this embodiment. The modules in the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.
[0116] Exemplary embodiments of this disclosure have been specifically shown and described above. It should be understood that this disclosure is not limited to the detailed structures, arrangements, or implementations described herein; rather, this disclosure is intended to cover various modifications and equivalent arrangements contained within the spirit and scope of the appended claims.
Claims
1. A method for retrieving Web session data, characterized in that, include: Get the query text entered by the user; Multi-level contextual hints are injected into the query text to obtain contextual hint data; Based on the contextual hints data, multi-level semantic reasoning is performed on the query text to obtain a structured query expression that matches the query text. The structured query expression is transformed into a structured form, and the resulting array of structured filters is displayed in the interactive interface. Based on the structured filter array, the corresponding target session data is retrieved.
2. The Web session data retrieval method according to claim 1, characterized in that, The injection of multi-level contextual hints into the query text includes: Retrieve target document fragments that are semantically related to the query text from a preset knowledge base; The target document fragment, the query text, and the preset prompt template are fused together to obtain the context prompt data; the prompt template is used to inject multi-level context information.
3. The Web session data retrieval method according to claim 2, characterized in that, The prompt template is used to inject first context information, second context information, third context information, and fourth context information. The first context information is information describing the data structure characteristics of the target session data. The second context information is information describing the mapping relationship between the query text and the target document fragment. The third context information is information describing the conversion pattern characteristics from natural language to structured query. The fourth context information is information describing the format constraint characteristics of semantic reasoning output.
4. The Web session data retrieval method according to claim 1, characterized in that, The step of performing multi-level semantic reasoning on the query text based on the contextual hint data includes: Identify the contextual cue information and target-aware fields in the contextual cue data; Based on the contextual prompts, the target perception field is subjected to chain-like hierarchical perception. The perception process of subsequent layers inherits and integrates the perception features of the previous layers to obtain multi-layer perception features. Based on the multi-level perceptual features, semantic reasoning is performed on the query text to obtain a structured query expression that matches the query text.
5. The Web session data retrieval method according to claim 4, characterized in that, The step of performing chained hierarchical perception of the target perception field based on the contextual prompt information includes: Based on the contextual prompts, the data structure features of the target session data are perceived to obtain the first intermediate perception features; Based on the contextual hints, the mapping relationship between the query text and the target document fragment is perceived, and the first intermediate perception feature is fused to obtain the second intermediate perception feature; Based on the contextual prompts, the conversion pattern features from natural language to structured queries are perceived, and the second intermediate perception feature is fused to obtain the third intermediate perception feature; Based on the contextual prompts, the format constraint features of the semantic reasoning output are perceived, and the third intermediate perception features are fused to obtain the multi-level perception features.
6. The Web session data retrieval method according to claim 1, characterized in that, The step of retrieving the corresponding target session data based on the structured filter array includes: In response to the interactive operation on the structured filter array, data retrieval is performed based on the structured filter array after interactive confirmation, and the retrieved target session data is displayed in the interactive interface.
7. The Web session data retrieval method according to claim 6, characterized in that, The structured query expression contains user intent information characterizing the user's query intent, and the display of the retrieved target session data in the interactive interface includes: Based on the user intent information, the target session data is converted into a target format and then displayed in the interactive interface; the target format includes chart format, table format and / or text format.
8. A Web session data retrieval device, characterized in that, include: The first module is used to obtain the query text input by the user; The second module is used to inject multi-level contextual hint information into the query text to obtain contextual hint data; The third module is used to perform multi-level semantic reasoning on the query text based on the contextual hint data to obtain a structured query expression that matches the query text. The fourth module is used to perform a structured transformation on the structured query expression and display the structured filter array obtained from the structured transformation process in the interactive interface; The fifth module is used to retrieve the corresponding target session data based on the structured filter array.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the Web session data retrieval method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the Web session data retrieval method according to any one of claims 1 to 7.