Context processing method, apparatus, device, and storage medium
Patent Information
- Application Number
- CN202610557673.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-24
- Publication Date
- 2026-08-07
AI Technical Summary
当前相关模型虽然在上下文长度不断提升,但处理远超过其有效窗口的超长文本,如长期连续对话日志、完整项目代码库时,当输入长度远超窗口,模型对文本前部信息的记忆与关联能力呈断崖式下跌,导致最终的回答可能遗漏关键信息或前后矛盾
[0015]本公开的一种上下文处理方法,通过构建隔离执行环境,以存储任意长度的上下文,将物理上的超长文本从模型的单次输入限制中解耦。采用根模型和递归模型相配合,根模型和递归模型通过隔离执行环境按需分块地访问和处理上下文,确保查询内容在全过程中的可访问性与一致性。根模型决策与递归模型执行的分层处理方式,有效避免将较大计算强加于单一模型,降低整体结算开销和响应延迟度。即根模型基于对用户查询和上下文结构的综合分析动态确定处理策略,以使不同类型的查询任务均可以确定出适配的处理流程,将超长文本拆分为适配递归模型处理能力的数据子集后,每个子集的信息可被充分识别与挖掘,同时根模型全程统筹处理策略制定与结果合并,始终锚定用户初始查询需求,避免了模型对早期信息的记忆衰退与需求偏离。
Smart Images

Figure CN122528870A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a context processing method, apparatus, device, and storage medium. Background Technology
[0002] With the widespread application of large language models in long text processing tasks, their inherent context window limitation problem has become increasingly prominent. Although current related models are constantly improving in terms of context length, when processing extremely long texts that far exceed their effective window, such as long-term continuous dialogue logs or complete project code libraries, the model's ability to remember and associate information from the beginning of the text drops sharply when the input length far exceeds the window, which may lead to the final answer missing key information or being contradictory. Summary of the Invention
[0003] This disclosure provides a context processing method, apparatus, device, and storage medium to at least solve the above-mentioned technical problems existing in the prior art.
[0004] A first aspect of this disclosure provides a context processing method, the method comprising:
[0005] Obtain the user's query and target text; An isolated execution environment is constructed, which is used to store context variables and key execution information representing the target text; The root model is used to analyze the user query statement, and the corresponding processing strategy is determined in combination with the context variables; In response to the processing strategy being a context understanding strategy, a recursive model is used to process the data subset corresponding to the target text to obtain the corresponding sub-processing results; The root model is used to merge the results of each sub-processing step to obtain the corresponding target processing result.
[0006] In one possible implementation, the step of analyzing the user query statement using the root model and determining the corresponding processing strategy in conjunction with the context variables includes: The target text is used as a corresponding context variable using the root model; Randomly select any context fragment of the context variable; The format and field meaning of the target text are analyzed based on the arbitrary context fragment to obtain the text structure analysis results, which are then stored in the isolated execution environment. The corresponding processing strategy is determined based on the user query, the context variables, and the text structure analysis results.
[0007] In one possible implementation, before responding to the processing strategy being a context understanding strategy and processing the data subset corresponding to the target text using a recursive model to obtain the corresponding sub-processing result, the method further includes: The root model is used to divide the context variable into multiple data subsets based on a partitioning strategy, and each data subset represents a data block of a fixed size.
[0008] In one possible implementation, dividing the context variable into multiple data subsets based on a partitioning strategy using the root model includes: The root model is used to determine the corresponding partitioning strategy based on the keywords of the user query and the text structure analysis results of the target text; The context variables are divided into multiple data subsets based on the partitioning strategy.
[0009] In one possible implementation, the method further includes: In response to the processing strategy being a context search strategy, the root model is used to search for target context fragments in the target text based on keywords in the user query statement.
[0010] In one possible implementation, the step of using the root model to search for target context fragments in the target text based on keywords in the user's query statement includes: The target search function is determined using the root model. The target search function is used to search the context variables to determine the target context fragment that matches the user query.
[0011] In one possible implementation, the execution key information includes at least the maximum recursion depth and intermediate processing results.
[0012] A second aspect of this disclosure provides a context processing apparatus, the apparatus comprising: The data acquisition module is used to obtain user query statements and target text; A configuration module is used to construct an isolated execution environment, which stores context variables and key execution information representing the target text. The strategy generation module is used to analyze the user query statement using the root model and determine the corresponding processing strategy in combination with the context variables; The first processing module is used to process the data subset corresponding to the target text using a recursive model in response to the processing strategy being a context understanding strategy, and to obtain the corresponding sub-processing result. The second processing module is used to merge the results of each sub-processing using the root model to obtain the corresponding target processing result.
[0013] A third aspect of this disclosure provides an electronic device comprising: At least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the context processing method described herein.
[0014] A fourth aspect of this disclosure provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the context processing method described in this disclosure.
[0015] This disclosure discloses a context processing method that decouples physically long text from the single-input limitation of the model by constructing an isolated execution environment to store context of arbitrary length. It employs a root model and a recursive model in conjunction, which access and process the context in chunks as needed through the isolated execution environment, ensuring the accessibility and consistency of the query content throughout the process. The hierarchical processing approach of root model decision-making and recursive model execution effectively avoids imposing large computations on a single model, reducing overall settlement overhead and response latency. Specifically, the root model dynamically determines the processing strategy based on a comprehensive analysis of the user query and context structure, ensuring that different types of query tasks can determine suitable processing flows. After splitting the long text into data subsets suitable for the processing capabilities of the recursive model, the information in each subset can be fully identified and mined. Simultaneously, the root model coordinates the formulation of processing strategies and result merging throughout the process, always anchoring to the user's initial query needs, avoiding memory decay of early information and deviation from the desired outcome.
[0016] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0017] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation, in which: In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
[0018] Figure 1 This illustration shows an implementation flow diagram of a context processing method according to an embodiment of the present disclosure. Figure 1 ; Figure 2 This illustration shows an implementation flow diagram of a context processing method according to an embodiment of the present disclosure. Figure 2 ; Figure 3 A schematic diagram of a context processing apparatus according to an embodiment of the present disclosure is shown; Figure 4 A schematic diagram of the composition structure of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0019] To make the objectives, features, and advantages of this disclosure more apparent and understandable, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0020] This disclosure provides a context processing method, such as... Figure 1 As shown, the method includes: S101. Obtain the user's query statement and target text.
[0021] In this step, the target text is the raw text to be processed that matches the user's query, and its size exceeds the model's single-processing capacity. For example, the current user needs to perform query analysis on a certain log, and the log size is 100TB. Here, the user's query represents the user's actual query needs, and the subsequent root model can determine the user's actual query needs by analyzing the user's query.
[0022] S102. Construct an isolated execution environment, which is used to store context variables representing the target text and key execution information.
[0023] In this step, an isolated execution environment based on Python REPL is constructed, which can store contexts of arbitrary degrees. In addition, the isolated execution environment can cache intermediate processing results generated by each processing step and key execution information such as the maximum recursion depth to manage the recursive processing state.
[0024] S103. Analyze user query statements using the root model and determine the corresponding processing strategy in conjunction with context variables.
[0025] In this step, the root model is used to process the user's initial query. It should be noted that the root model in this step is a root language model, preferably a large-parameter model such as the Deepseek-R1 model. During context processing, the root model analyzes the user's query to determine the user's actual query needs and, in conjunction with the context variables corresponding to the target text, determines the appropriate processing strategy.
[0026] S104. In response to the context-understanding strategy, a recursive model is used to process the data subset corresponding to the target text to obtain the corresponding sub-processing results.
[0027] In this step, if the root model determines, through analyzing the user's query, that the user's actual query requirement is to understand fragments of content in the target text—for example, querying the aggregation behavior of user IDs to obtain statistical indicators—then the root model, based on semantic understanding of the user's query, determines that the current user's query requirement is fragment understanding. In this case, the target text needs to be divided into several blocks. Accordingly, the target text is processed by user ID, resulting in several data subsets. Each data subset represents a data block, which is stored in an isolated execution environment. Then, a recursive model is called to process each data block, obtaining the corresponding sub-processing results. The recursive model can be a lightweight model, such as Qwen-32b. In other words, if the query processing strategy determined by the root model is a context-understanding strategy, a recursive model needs to be called to process the data subsets of the target text. The extremely long target text is transformed into multiple fragments that can be processed by the recursive model. The recursive model then aggregates and calculates the corresponding data in each data subset, and the resulting sub-processing results, i.e., intermediate results, are stored in an isolated execution environment.
[0028] S105. Use the root model to merge the results of each sub-processing to obtain the corresponding target processing result.
[0029] In this step, each sub-processing result generated by the recursive model is sequentially passed to the root model. The root model then aggregates these sub-processing results to obtain the final answer relevant to the user's actual query, i.e., the target processing result. Specifically, the recursive model processes each data block, reading the relevant text content within the data block, performing corresponding statistical calculations, and obtaining the sub-processing results. These sub-processing results are stored in an intermediate result cache module within the isolated execution environment. Correspondingly, the isolated execution environment automatically updates its context, marking the corresponding data block as processed to avoid duplicate processing. Finally, the root model merges each sub-processing result and outputs the final query answer.
[0030] This disclosure discloses a context processing method that decouples physically long text from the single-input limitation of the model by constructing an isolated execution environment to store context of arbitrary length. It employs a root model and a recursive model in conjunction, which access and process the context in chunks as needed through the isolated execution environment, ensuring the accessibility and consistency of the query content throughout the process. The hierarchical processing approach of root model decision-making and recursive model execution effectively avoids imposing large computations on a single model, reducing overall settlement overhead and response latency. Specifically, the root model dynamically determines the processing strategy based on a comprehensive analysis of the user query and context structure, ensuring that different types of query tasks can determine suitable processing flows. After splitting the long text into data subsets suitable for the processing capabilities of the recursive model, the information in each subset can be fully identified and mined. Simultaneously, the root model coordinates the formulation of processing strategies and result merging throughout the process, always anchoring to the user's initial query needs, avoiding memory decay of early information and deviation from the desired outcome.
[0031] In one possible implementation, the user query statement is analyzed using a root model, and processing instructions corresponding to the target text are generated in conjunction with context variables, including: The root model is used to establish the target text as corresponding context variables; Randomly select any fragment of the context variable; The text structure analysis results are obtained by analyzing the format and field meaning of the target text based on any context fragment and then storing them in an isolated execution environment. The corresponding processing instructions are determined based on the user's query, context variables, and text structure analysis results.
[0032] In this embodiment, the target text is established as a context variable through a root model. For example, a user's log is established as a context variable, and several context fragments are randomly selected for quick viewing and content format understanding to determine the format of the target text. Specifically, the root model randomly selects several context fragments from the established context variables. By analyzing the meaning of the fields in each context fragment and whether the corresponding format is consistent, the corresponding text structure analysis result is obtained and stored in an isolated execution environment. For example, five 1000-character log fragments at different positions are randomly selected. Through these log fragments, the core information of the target text is quickly determined, such as the log containing key fields like user ID, login time, logout time, and login IP, and all log fragments have a uniform format. The random sampling operation can be repeated multiple times to enhance the accuracy of text format understanding. It should be noted that the context variable in this embodiment contains the core content of the target text and is a data carrier that can be stored by the execution environment and recognized and manipulated by the model.
[0033] Furthermore, the root model determines the appropriate query method for the current user's query based on the actual semantics of the user's query, the content of context variables, and the analyzed text structure, generating corresponding processing instructions. Different processing instructions correspond to different query methods, leading to different subsequent processing flows. If the user's query requires understanding fragments of the target text, the corresponding processing instructions include context understanding instructions. This allows the subsequent recursive model to determine the corresponding sub-processing results from each data block by executing the context understanding instructions, ultimately obtaining a query result that matches the user's query requirements.
[0034] This embodiment introduces a priori text structure analysis mechanism, which can effectively solve the inefficiency problem of the root model when processing text with unknown format. That is, before determining the core processing strategy, the root model quickly determines the basic format and field meaning of the context through random sampling, and generates key metadata such as text structure analysis results. This allows for the rapid establishment of a cognitive framework for unknown text, providing an important basis for subsequent determination of processing strategies, preventing incorrect strategy selection due to misunderstanding of text structure, and significantly improving the accuracy of subsequent processing.
[0035] In one possible implementation, in response to the processing strategy being a context understanding strategy, before processing the data subset corresponding to the target text using a recursive model to obtain the corresponding sub-processing result, the method further includes: The root model is used to divide the context variables corresponding to the target text into multiple data subsets based on a partitioning strategy. Each data subset represents a data block of a fixed size.
[0036] In this embodiment, if the root model determines that the user's query requirement is context fragment understanding based on the user's query statement, then the corresponding processing strategy is determined to be the context understanding strategy. Accordingly, a corresponding partitioning strategy is further determined to divide the context variables established for the target text into blocks, resulting in several corresponding data subsets for targeted processing by the recursive model. For example, the context variables are partitioned based on the user ID, with a step size of 8000 characters and a size of 100000 characters per block.
[0037] It should be noted that each data subset represents a fixed-size data block. That is, by splitting the complete original text into several data blocks and processing them separately, the fixed-size blocks can ensure the controllability of recursive processing. By pre-dividing the extremely long context variables into multiple moderately sized and fixed-size data subsets, each subset can adapt to the upper limit of the processing capacity of the recursive model, avoiding the problem of model overload caused by excessive input data in a single operation.
[0038] In one implementation, the root model is used to divide the context variables corresponding to the target text into multiple data subsets based on a partitioning strategy, including: The root model is used to determine the corresponding partitioning strategy based on the keywords in the user query and the text structure analysis results of the target text; The context variable is divided into multiple data subsets based on a partitioning strategy.
[0039] In this embodiment, the root model determines the corresponding partitioning strategy by analyzing the semantics of keywords in the user's query statement and the text structure analysis results of the target text, that is, the analysis results of fields and formats.
[0040] For example, a user query might be: "Query the aggregated behavior of user IDs to obtain statistical indicators." Based on this, the root model determines that the user's query requirement is to aggregate and statistically analyze user behavior. Combined with the text structure analysis results cached in the execution environment, it's determined that the current query task is a complex aggregation task requiring calculation on the entire log. Further, the context variables corresponding to the entire log are processed into several data subsets, i.e., several data blocks. A subquery is generated for each block, such as "Statistically count the number of logins and average login duration (logout time - login time) for each user ID within this block, outputting user ID, number of logins, and average duration." The recursive model processes each data subset based on the above subquery, determining the relevant fragment content from the corresponding segments of each data subset to obtain the sub-processing result, such as "User ID: 000001, Number of logins: 15, Average duration: 20 minutes." This result is stored in the intermediate result cache module of the isolated execution environment. The isolated execution environment automatically updates the context, marking the block as processed to avoid duplicate processing.
[0041] It should be noted that user queries need to be aggregated by user ID. If a data block contains multiple user IDs, a secondary recursion will be triggered, further dividing the data by user ID. That is, if the current recursive level of block division is insufficient to meet the task requirements, further block division and secondary recursion are needed, and so on, with the maximum recursion depth not exceeding the depth limited by the isolated execution environment. The processing results of all blocks are stored in the intermediate result cache module of the isolated execution environment, and the context is marked as indicating that all block processing is complete. The root model reads all block statistical results from the isolated execution environment and merges all statistical results to obtain the final query result. In other words, this embodiment processes extremely long target text by user ID, converting long texts that originally exceeded the model's processing capacity into multiple data blocks that can be efficiently processed by the recursive model. The information in each data block can be fully identified and utilized within the model, preventing the problem of early information in long contexts being easily overwritten by later text.
[0042] like Figure 2As shown, in one possible implementation, the method further includes: S106. In response to the processing strategy of context search, the root model is used to search for target context fragments in the target text based on keywords in the user query statement.
[0043] In this embodiment, if the root model determines that the current user query requires a context fragment search, i.e., without involving a deep understanding of the fragment, then the root model directly searches the target text for the target context fragment that matches the keywords in the user's query. In other words, besides displaying fragment understanding, this embodiment can also handle search-type tasks, directly finding the final target context fragment based on keywords, avoiding unnecessary computational overhead and improving response speed.
[0044] For example, a user query might be: "Extract all log records containing 'login failure' and extract the corresponding user ID and failure time." The root model, based on the query and the text structure analysis of the target text, determines that the task is a simple search task, requiring only keyword-based location. That is, using "login failure" as the keyword, it filters all log fragments containing this keyword, extracts the user ID and failure time fields, and obtains the corresponding target context fragment.
[0045] In one possible implementation, the root model is used to search for target context fragments in the target text based on keywords in the user's query command, including: Determine the target search function; The root model is used to call the target search function, which searches for target context fragments that match the keywords in the user's query statement in the context variables corresponding to the target text.
[0046] In this embodiment, if the current user's requirement is to find certain fragments in the target text, a contextual search is performed based on the execution of the target search function. The target search function is a standardized core utility function built into the isolated execution environment. After the root model determines the current user's query requirement, it sends a corresponding processing instruction to the isolated execution environment. The isolated execution environment automatically matches the content's built-in search function according to this instruction. The search function performs a contextual search, performing refined matching of the query keywords. During the execution process, the search range is marked in real time to avoid repeated traversal. The intermediate results are stored in the isolated execution environment, and finally, the root model reads the corresponding search results from the environment and returns them to the user.
[0047] In one possible implementation, the key information to be executed includes at least the maximum recursion depth and intermediate processing results.
[0048] In this embodiment, an isolated execution environment based on the Python REPL is isolated from external systems, ensuring that code execution, such as code chunking, can proceed without interference. This environment can be created using the `exec()` function. Furthermore, this isolated execution environment can store contexts of arbitrary length, cache intermediate results, and limit the maximum recursion depth during execution.
[0049] It's important to note that by establishing the target text as a context variable and storing it in the execution environment, subsequent calls to the root model can retrieve the corresponding size of data to be processed from the execution environment. This prevents the model from directly processing excessively long contexts, which could lead to critical information being overwritten by later text and causing inaccurate results. Limiting the maximum recursion depth effectively prevents infinite recursion when handling complex tasks, ensuring system stability and reliability. The caching mechanism for intermediate processing results allows for the sharing and reuse of already calculated results during recursive processing, avoiding repeated analysis of the same subset of data, reducing redundant computation, and improving overall processing efficiency.
[0050] To implement the above method, an example of this application also provides a context processing device 300, such as... Figure 3 As shown, the device includes: The acquisition module 301 is used to acquire user query statements and target text; Configuration module 302 is used to build an isolated execution environment, which is used to store context variables representing the target text and key execution information; The strategy generation module 303 is used to analyze the user query statement using the root model and determine the corresponding processing strategy in combination with context variables; The first processing module 304 is used to process the data subset corresponding to the target text using a recursive model in response to the processing strategy being a context understanding strategy, and to obtain the corresponding sub-processing results. The second processing module 305 is used to merge the results of each sub-processing using the root model to obtain the corresponding target processing result.
[0051] In one implementation, the strategy generation module 303 is used to establish the target text as a corresponding context variable using the root model; Randomly select any fragment of the context variable; The text structure analysis results are obtained by analyzing the format and field meaning of the target text based on any context fragment and then stored in the isolated execution environment. The corresponding processing strategy is determined based on the user query, context variables, and text structure analysis results.
[0052] In one embodiment, the first processing module 304 is further configured to divide the context variable into multiple data subsets based on a partitioning strategy using the root model, and each data subset represents a data block of a fixed size.
[0053] In one embodiment, the first processing module 304 is used to determine the corresponding partitioning strategy based on the keywords of the user query statement and the text structure analysis results of the target text using the root model. The context variable is divided into multiple data subsets based on a partitioning strategy.
[0054] In one embodiment, the device further includes a third processing module, which is configured to, in response to a contextual search strategy, use a root model to search for target context fragments in the target text based on keywords in the user query statement.
[0055] In one possible implementation, the third processing module is further configured to determine the target search function; The target context fragment that matches the user's query statement is determined by searching the context variables based on the target search function.
[0056] In one possible implementation, the key information to be executed includes at least the maximum recursion depth and intermediate processing results.
[0057] By way of example, this application also provides an electronic device, including: processor; Memory used to store processor-executable instructions; The processor is used to read executable instructions from memory and execute the instructions to implement the context processing method described above.
[0058] By way of example, this application also provides a computer-readable storage medium storing a computer program for performing the above-described context processing method.
[0059] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0060] like Figure 4 As shown, device 400 includes a computing unit 401, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 402 or a computer program loaded from storage unit 408 into random access memory (RAM) 403. RAM 403 may also store various programs and data required for the operation of device 400. The computing unit 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0061] Multiple components in device 1000 are connected to I / O interface 405, including: input unit 406, such as keyboard, mouse, etc.; output unit 407, such as various types of monitors, speakers, etc.; storage unit 408, such as disk, optical disk, etc.; and communication unit 409, such as network card, modem, wireless transceiver, etc. Communication unit 409 allows device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0062] The computing unit 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as a context processing method. For example, in some embodiments, a context processing method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of a context processing method described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform a context processing method by any other suitable means (e.g., by means of firmware).
[0063] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0064] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0065] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer 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 of the foregoing.
[0066] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0067] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0068] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0069] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.
[0070] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means two or more, unless otherwise explicitly specified.
[0071] The above description is merely a specific embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure. Therefore, the scope of protection of this disclosure should be determined by the scope of the claims.
Claims
1. A context processing method, characterized in that, The method includes: Obtain the user's query and target text; An isolated execution environment is constructed, which is used to store context variables and key execution information representing the target text; The root model is used to analyze the user query statement, and the corresponding processing strategy is determined in combination with the context variables; In response to the processing strategy being a context understanding strategy, a recursive model is used to process the data subset corresponding to the target text to obtain the corresponding sub-processing results; The root model is used to merge the results of each sub-processing step to obtain the corresponding target processing result.
2. The context processing method according to claim 1, characterized in that, The step of analyzing the user query statement using the root model and determining the corresponding processing strategy in conjunction with the context variables includes: The target text is used as a corresponding context variable using the root model; Randomly select any context fragment of the context variable; The format and field meaning of the target text are analyzed based on the arbitrary context fragment to obtain the text structure analysis results, which are then stored in the isolated execution environment. The corresponding processing strategy is determined based on the user query, the context variables, and the text structure analysis results.
3. The context processing method according to claim 1, characterized in that, Before the response to the processing strategy being a context understanding strategy, and before processing the data subset corresponding to the target text using a recursive model to obtain the corresponding sub-processing result, the method further includes: The root model is used to divide the context variable into multiple data subsets based on a partitioning strategy, and each data subset represents a data block of a fixed size.
4. The context processing method according to claim 3, characterized in that, The process of dividing the context variables into multiple data subsets using the root model based on a partitioning strategy includes: The root model is used to determine the corresponding partitioning strategy based on the keywords of the user query and the text structure analysis results of the target text; The context variables are divided into multiple data subsets based on the partitioning strategy.
5. The context processing method according to any one of claims 1-4, characterized in that, The method further includes: In response to the processing strategy being a context search strategy, the root model is used to search for target context fragments in the target text based on keywords in the user query statement.
6. The context processing method according to claim 5, characterized in that, The step of using the root model to search for target context fragments in the target text based on keywords in the user's query statement includes: The target search function is determined using the root model. The target search function is used to search the context variables to determine the target context fragment that matches the user query.
7. The context processing method according to claim 6, characterized in that, The key execution information includes at least the maximum recursion depth and intermediate processing results.
8. A context processing apparatus, characterized in that, The device includes: The data acquisition module is used to obtain user query statements and target text; A configuration module is used to construct an isolated execution environment, which stores context variables and key execution information representing the target text. The strategy generation module is used to analyze the user query statement using the root model and determine the corresponding processing strategy in combination with the context variables; The first processing module is used to process the data subset corresponding to the target text using a recursive model in response to the processing strategy being a context understanding strategy, and to obtain the corresponding sub-processing result. The second processing module is used to merge the results of each sub-processing using the root model to obtain the corresponding target processing result.
9. An electronic device, characterized in that, include: At least one processor; and a memory connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform claim 1. The context processing method described in any one of the 7.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the context processing method according to any one of claims 1-7.