Character conversion file storage method, device, equipment and medium
By orderly splitting the characters of the file extension and constructing a trie, outer and inner branch code is generated, which solves the problems of long development cycle and stability in the existing technology of file extension recognition and processing, and realizes fast, compatible and efficient file type recognition and conversion.
Patent Information
- Application Number
- CN202511245670.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-02
- Publication Date
- 2026-11-10
- Estimated Expiration
- 2045-09-02
AI Technical Summary
Existing technologies require modification of source code and recompilation when identifying file extensions, resulting in long development cycles, difficulty in quickly responding to agile development needs, and inconsistent path string encoding leading to interruptions in file processing and system crashes.
By generating a linked list of character nodes by orderly splitting the characters in the file extension, a character trie is constructed, and outer and inner branch code is generated to achieve automated file extension processing and standardized character conversion.
It enables rapid compatibility with new file types and multilingual characters, reducing development time and improving the stability and efficiency of file processing.
Smart Images

Figure CN121118839B_ABST
Abstract
Description
Technical Field
[0001] The embodiments disclosed herein relate to the field of computer technology, and more specifically to methods, apparatus, devices, and media for storing character conversion files. Background Technology
[0002] Currently, when extracting character information from logs or network traffic files, file uploads require verification and processing. This involves identifying the file type by its extension and assigning it to the appropriate source code processing module based on a predefined mapping (e.g., ".py" corresponds to the Python interpreter, ".js" to the JavaScript engine) for subsequent deployment, compilation, or execution. The common method for identifying file extensions is to extract the extension segment from the full path to determine the file type and match it to the corresponding processing module.
[0003] However, when using the above method to identify file extensions, the following technical problems often arise:
[0004] First, whenever support for a new file type is needed (e.g., adding ".jsonl" or ".markdown"), developers must directly modify the mapping table definition or processing logic code in the source code, then recompile and deploy the entire service. This significantly extends the development cycle, increases the system's operational complexity and release risks, and makes it difficult to meet the agile development needs that require rapid response and frequent addition of new file format support.
[0005] Second, the encoding of the path string (e.g., UTF-8, GBK) may be inconsistent with the default character encoding settings of the system parsing environment, resulting in incorrect positioning of the split point, incorrect parsing of extension characters (garbled characters), or even complete inability to recognize valid suffix segments, which in turn causes the file processing flow to be interrupted, leading to system crashes.
[0006] The information disclosed in this background section is only intended to enhance the understanding of the background of the inventive concept, and therefore may contain information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0007] The summary portion of this disclosure is intended to provide a brief overview of the concepts, which will be described in detail in the detailed description portion. This summary portion is not intended to identify key or essential features of the claimed technical solutions, nor is it intended to limit the scope of the claimed technical solutions.
[0008] Some embodiments of this disclosure provide character conversion file storage methods, apparatuses, devices, and media to address one or more of the technical problems mentioned in the background section above.
[0009] In a first aspect, some embodiments of this disclosure provide a character conversion file storage method, comprising: performing character-order splitting on the string corresponding to each file suffix in a file suffix set to generate a character node linked list, thereby obtaining a character node linked list set; assigning unique identifier information to each character in each character node linked list in the character node linked list set, thereby obtaining an assigned character node linked list set; encapsulating each character node linked list in the assigned character node linked list set to obtain a character dictionary tree; for each non-leaf node in the character dictionary tree, performing the following generation steps: generating outer branch code corresponding to the non-leaf node based on the identifier information corresponding to the non-leaf node; determining at least one child node connected to the non-leaf node; generating inner branch code corresponding to the non-leaf node based on the character value corresponding to the at least one child node; integrating the obtained outer branch code set and inner branch code set to obtain a character conversion file, which is then stored on the system disk.
[0010] Secondly, some embodiments of this disclosure provide a character conversion file storage device, comprising: a character splitting unit configured to perform character-order splitting on the string corresponding to each file suffix in a file suffix set to generate a character node linked list, thereby obtaining a character node linked list set; an information allocation unit configured to allocate unique identifier information to each character in each character node linked list in the character node linked list set, thereby obtaining an allocated character node linked list set; a character encapsulation unit configured to encapsulate each character node linked list in the allocated character node linked list set, thereby obtaining a character dictionary tree; a code generation unit configured to perform the following generation steps for each non-leaf node in the character dictionary tree: generating outer branch code corresponding to the non-leaf node based on the identifier information corresponding to the non-leaf node; determining at least one child node connected to the non-leaf node; generating inner branch code corresponding to the non-leaf node based on the character value corresponding to the at least one child node; and a file storage unit configured to integrate the obtained outer branch code set and inner branch code set to obtain a character conversion file for storage in a system disk.
[0011] Thirdly, some embodiments of this disclosure provide an electronic device, including: one or more processors; and a storage device having one or more programs stored thereon, such that when the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any implementation of the first aspect.
[0012] Fourthly, some embodiments of this disclosure provide a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method as described in any implementation of the first aspect.
[0013] The above-described embodiments of this disclosure have the following beneficial effects: Character conversion files obtained through the character conversion file storage method of some embodiments of this disclosure, when used at the start of the target project, can achieve file suffix recognition and standardized conversion, quickly supporting new file types and multilingual characters, reducing the development time of character adaptation code, and improving the stability of the file processing flow. Specifically, the reason for the long development time of character adaptation code is that each file type required by the system needs to have its suffix name and corresponding processing logic pre-registered in a hard-coded mapping table. This prevents developers from directly modifying the mapping table definition in the source code, and then recompiling and deploying the entire service of the target project. Based on this, the character conversion file storage method of some embodiments of this disclosure first performs character-order splitting on the string corresponding to each file suffix in the file suffix set to generate a character node linked list, thus obtaining a character node linked list set. This provides a refined character-level decomposition of the file suffixes, laying the foundation for subsequent character dictionary construction and improving processing efficiency. Second, each character in each character node linked list in the above-described character node linked list set is assigned unique identification information, resulting in an assigned character node linked list set. Therefore, each character is given a unique identifier, facilitating character identification during subsequent code generation. Next, the character node linked lists in the allocated character node set are encapsulated to obtain a character trie. This forms a tree-like storage structure, supporting fast character matching and traversal, and optimizing character query performance. Then, for each non-leaf node in the character trie, the following generation steps are performed: Based on the identifier information corresponding to the non-leaf node, the outer branch code corresponding to the non-leaf node is generated. Thus, the node's state information defines the outer framework of the branch logic, facilitating modular processing. At least one child node connected to the non-leaf node is determined; thus, the node's direct descendant nodes are determined, providing necessary input for the generation of inner code and ensuring the integrity of the branch logic. Based on the character value corresponding to the at least one child node, the inner branch code corresponding to the non-leaf node is generated. Thus, specific conditional code is generated based on the character value, precisely controlling the branch to improve execution efficiency. Finally, the obtained outer and inner branch code sets are integrated to obtain a character conversion file, which is stored on the system disk. This generates an executable conversion file for the system to load and use, automating file extension processing and storing it for repeated access. Thus, through ordered character splitting, state allocation, trie construction, and code generation techniques, efficient file extension recognition and standardized character conversion are achieved. This allows for rapid compatibility with new file types and multilingual characters, reducing the time spent developing adaptation code for different file extensions and improving the stability of the file processing workflow. Attached Figure Description
[0014] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and elements are not necessarily drawn to scale.
[0015] Figure 1 This is a flowchart of some embodiments of the character conversion file storage method according to the present disclosure;
[0016] Figure 2 This is a schematic diagram of the structure of some embodiments of the character conversion file storage device according to the present disclosure;
[0017] Figure 3 This is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. Detailed Implementation
[0018] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0019] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.
[0020] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0021] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0022] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0023] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0024] refer to Figure 1The diagram illustrates a flow 100 of some embodiments of a character conversion file storage method according to the present disclosure. This character conversion file storage method includes the following steps:
[0025] Step 101: Perform character-order splitting on the string corresponding to each file suffix in the file suffix set to generate a character node linked list, thus obtaining a character node linked list set.
[0026] In some embodiments, the execution entity (e.g., an electronic device) of the above-described character conversion file storage method can be a computer device (e.g., a server, personal computer, and embedded device), which can be composed of a processor, memory, compiler, debugger, storage device, and software modules. The above-described file suffix set can be a preset set of file suffixes to be processed. The above-described string can be a string composed of characters corresponding to the file suffixes. The above-described character node linked list can be a singly linked list with the characters of the file suffixes as nodes. For example, in an application scenario, a string (e.g., ".txt") can be converted into a character node linked list including four nodes (e.g., ["."->"t"->"x"->"t"]).
[0027] As an example, the string corresponding to a file extension can be split into individual characters. For instance, the string corresponding to a file extension could be ".txt". It can be split into ["."", "t", "x", "t"]. The list of character nodes could be ["."->"t"->"x"->"t"], where each character includes a character value and a pointer.
[0028] In some optional implementations of certain embodiments, the aforementioned execution entity may perform character-order splitting on the string corresponding to each file suffix in the file suffix set to generate a character node linked list, which may include the following steps:
[0029] The first step is to split the string corresponding to the file extension based on the character order, obtaining a character list. The character order can be the sequential arrangement of characters within the string (e.g., from left to right). The character list can be a list of the split characters from the string. For example, if the string is ".txt", then the character list could be ["."", "t", "x", "t"].
[0030] The second step involves generating case-conversion characters for the characters in the character list, since the characters are in alphabetic form. This results in a case-conversion character list. These case-conversion characters can be the converted versions of English characters. The case-conversion character list can be a list storing these converted characters.
[0031] The third step involves linking the characters in the character list and the case conversion character list according to their respective character order, resulting in a character node linked list. This linked list connection can be achieved by using characters from both the character list and the case conversion character list as nodes in the linked list and connecting them according to the character order of the string.
[0032] Step 102: Assign unique identifier information to each character in each character node linked list in the character node linked list set to obtain the assigned character node linked list set.
[0033] In some embodiments, the execution entity can assign unique identifier information to each character in each character node linked list in the character node linked list set, resulting in an assigned set of character node linked lists. The unique identifier information can be a unique identifier assigned to a character node (e.g., an identifier or a number). This unique identifier can also identify the unique position of a character node within the linked list. For example, during the code generation phase, this unique identifier can be used to determine the character node corresponding to the currently generated code. During the code execution phase, this unique identifier can be used to trace the character node corresponding to the code at the current position.
[0034] As an example, the position information of each character in each character node linked list in the character node set can be used as unique identification information. For example, in an application scenario, the above unique identification information can be a number (e.g., 1, 2, 3).
[0035] Step 103: Encapsulate each character node linked list in the allocated character node linked list set to obtain a character trie.
[0036] In some embodiments, the execution entity can encapsulate each character node linked list in the allocated character node linked list set to obtain a character trie. The character trie can be a tree-like data structure for storing characters.
[0037] As an example, first, a root node (empty node) can be created for the trie. Second, each character node in the character node linked list is processed, extracting the character node and its associated identifier. Then, the path is dynamically expanded within the trie, copying the character nodes and their associated identifiers to the trie nodes. Finally, when the character node linked list is traversed, a termination marker is set at the final node in the trie to indicate that the string has been completely stored, resulting in the character trie.
[0038] In some optional implementations of certain embodiments, the execution entity may encapsulate each character node linked list in the allocated character node linked list set to obtain a character trie, which may include the following steps:
[0039] The first step is to perform the following determination steps for each character node linked list:
[0040] The first sub-step involves traversing the character nodes in the aforementioned character node linked list to obtain the original letter node chain. This original letter node chain can be a sequence of original character nodes obtained by traversing the character node linked list.
[0041] The second sub-step involves converting the characters corresponding to the character nodes in the aforementioned character node linked list to their capitalization, resulting in a case-converted letter node chain. This case conversion can be a step of changing a character letter to another form of capitalization (e.g., converting the letter "a" to the letter "A"). The case-converted letter node chain can be a sequence of nodes formed by converting the capitalization of the letters corresponding to the characters in the character node linked list.
[0042] As an example, firstly, we can determine the original character corresponding to the character node. Secondly, if the original character is a lowercase letter, it is converted to an uppercase letter. If the original letter is an uppercase letter, it is converted to a lowercase letter. Finally, we use the converted letters to generate new nodes and create a linked list of nodes.
[0043] The third sub-step involves identifying the original letter nodes in the aforementioned original letter node chain as tree nodes, thus obtaining the original letter tree. These tree nodes can be nodes of a trie. Each node can include character, identifier, and child node pointer attributes. The original letter tree can be a trie constructed using the original character nodes as tree nodes.
[0044] As an example, first, a new trie can be created. Second, the original letter node chain is traversed to obtain the current original letter node. Then, each current original letter node is added to the nodes of the trie. Finally, after the traversal is complete, the corresponding constructed trie can be obtained.
[0045] The fourth sub-step involves identifying the case-conversion nodes in the aforementioned chain of case-conversion nodes as tree nodes, thus obtaining a case-conversion tree. This case-conversion tree can be a trie constructed using the case-conversion nodes as tree nodes.
[0046] The second step is to integrate the corresponding nodes of the letters in the original letter trees and the case conversion letter trees to obtain a character trie. The corresponding nodes can be nodes with the same character position but different case forms.
[0047] As an example, first, create the root node of the new trie. Second, traverse the original alphabet and the case conversion alphabet, merging the corresponding nodes. Finally, obtain the character trie. For example, the original alphabet could be [“.”->“t”->“x”->“t”]. The case conversion alphabet could be [“.”->“T”->“x”->“T”, “.”->“t”->“x”->“t”, “.”->“T”->“X”->“T”]. Then the new trie could be [“.”->“t” (“T”)->“x” (“X”)->“t” (“T”) with only one path.
[0048] Step 104: For each non-leaf node in the character trie, perform the following generation steps:
[0049] Step 1041: Generate the outer branch code corresponding to the non-leaf node based on the identifier information corresponding to the non-leaf node.
[0050] In some embodiments, the execution entity can generate outer branch code corresponding to non-leaf nodes based on the identification information of the non-leaf nodes. The non-leaf nodes can be nodes that are at least one child node in a trie. The outer branch code can be code that fills the identification information of the non-leaf nodes into preset positions in the conditional logic statement framework. For example, in Python, the conditional logic statement can be an "if" statement. The outer branch code can be "if identification information:...else:...".
[0051] As an example, first, the syntax requirements of logical statements (e.g., if condition: ...else: ...) can be determined. Then, for each non-leaf node, code including identification information is generated. Finally, the code including the identification information is filled into the corresponding filling positions of the logical statements (e.g., condition) to obtain the outer branch code.
[0052] In the process of adopting technical solutions to address the aforementioned technical problems, the following issues often arise: difficulties in locating and tracing the precise mapping between runtime state and static code during character conversion (e.g., character trie traversal), and the inefficiency of traditional logging or breakpoint debugging methods in checking boundary conditions of parsing rules.
[0053] Conventional solutions to these problems typically involve relying on code comments and adding log output. However, the inventors considered these methods to be inefficient and increase maintenance burden. They also struggled to capture the instantaneous state during character conversions and lacked structured runtime observation methods for checking rule boundaries and character matching completeness. Therefore, we decided to adopt the following solution:
[0054] In some optional implementations of certain embodiments, the execution entity can generate the outer branch code corresponding to the non-leaf node based on the identification information corresponding to the non-leaf node, which may include the following steps:
[0055] The first step is to determine the code block generation location within the target outer code template, thus obtaining the target code block location. The target outer code template is the template for the outer branch code to be generated. The code block generation location can be a predefined location for filler code within the target outer code template. For example, in Python, the code block generation location could be the location of the "condition" in an "if condition:" statement. The target outer code template can be a code block for an "if" statement (e.g., "if condition: ... else: ...").
[0056] The second step is to assign node debug identifiers to the aforementioned non-leaf nodes. These node debug identifiers can serve as unique identifiers for debugging (e.g., in string form). For example, in Python, these node debug identifiers can be unique identifiers provided by a custom symbol allocator (e.g., a custom function "DebugSymbolManager()"). The node debug identifier for "Node 1" could be "dbg_a1b2c3d4". During debugging, the node's position in the original file (e.g., "file1.py, line 10, column 25") can be determined by querying the node's identifier (e.g., "dbg_a1b2c3d4").
[0057] The third step involves semantically binding the aforementioned node debug identifiers and the locations of the target code blocks to generate dynamic debug anchors. This semantic binding can be the process of establishing an association between debug identifiers and code locations. For example, in a debugger, a mapping relationship is established between node debug identifiers and the locations of target code blocks. The dynamic debug anchor can be a breakpoint instruction written by the debugger to the memory address corresponding to this mapping. For instance, in a character conversion scenario, the dynamic debug anchor can be inserted, enabled, disabled, and removed at any time after the character conversion program starts and runs, without modifying the code in the character conversion file or restarting the program corresponding to the character conversion file.
[0058] As an example, firstly, the debugger can be invoked to use node debug identifiers (e.g., dbg_a1b2c3d4) to parse the memory address (e.g., 0x7ffeefbfa0cc) of the machine instruction corresponding to the conditional logic of the if statement (the location of the target code block). Then, a record is created in the debugger's internal mapping table to record the mapping relationship between the node debug identifier and the location of the target code block, thus obtaining a dynamic debug anchor.
[0059] Fourth, based on the location of the target code statement block mentioned above, perform the following outer code generation steps:
[0060] The first sub-step involves replacing the predefined identifier placeholders in the target code block with the aforementioned identifier information, resulting in code with the replaced identifier information. The identifier placeholders can be symbols used to mark the insertion point of the identifier information at the code statement filling location. The code with the replaced identifier information can be a code snippet after replacing the placeholders. For example, in Python, the identifier information could be "0". The node could be "S". The identifier placeholder could be "#node1dbg_a1b2c3d4 if char==node(node placeholder):return condition_expression(identifier placeholder)", then the code with the replaced identifier information could be "#node1dbg_a1b2c3d4 ifchar==S:return 0".
[0061] The second sub-step involves inserting a boundary check interface into the target code block location, resulting in the code for the inserted boundary check interface. This boundary check interface is a custom function interface that verifies the legality of input stream access operations at runtime. The input stream can be a sequence corresponding to the suffix of a character conversion file being processed. In practice, the checking strategy can be obtained by querying a debug configuration file. This debug configuration file can be a file declaring the checking rules during the debugging phase (e.g., in JSON format). It can include metadata of length, such as rule identifiers and input data. As an example, firstly, the compiler can be invoked to obtain the starting address of the code at the target code block location. Then, the function call instruction corresponding to the boundary check interface is added before the starting address of the code to obtain the code for the inserted boundary check interface.
[0062] The third sub-step involves obtaining the current input stream's state information and the aforementioned node debugging identifier in response to the boundary check interface trigger call, and generating a structured first debugging information event. The current input stream's state information can be a snapshot of the input stream's access context at the dynamic debugging anchor point. The structured first debugging information event can be a structured representation of boundary check debugging event information. For example, in a character conversion scenario, the snapshot information could include: a pointer to the next character node to be read, the number of character nodes in the input sequence, the sequence from the starting position to the current pointer, and the number of character nodes from the current pointer to the end of the sequence. The debugging event information can be metadata of the debugging event (e.g., timestamp and event type) and specific data of the debugging event (e.g., input stream state information and rule identifier).
[0063] The fourth sub-step, in response to the fact that the child nodes of the aforementioned non-leaf nodes are leaf nodes, inserts a character remainder check interface into the aforementioned target code block location, resulting in the code for inserting the character remainder check interface. This character remainder check interface can be an interface for checking whether there are any remaining characters in the input stream. The code for inserting the character remainder check interface is the code after adding the character remainder check interface.
[0064] The fifth sub-step involves, in response to the aforementioned character remaining check interface being invoked, obtaining the difference information between the remaining character nodes in the character linked list corresponding to the non-leaf nodes and the preset node pattern, and generating a structured second debugging information event. This second debugging information event can be debugging event information for the character remaining check (e.g., in JSON format).
[0065] For example, in Python, the structured second debug information event described above could be {"event_type":"character_remaining_check","debug_symbol":"dbg_date_1234","node_type":"DateNode","expected_pattern":"-[0-9]{2}","remaining_characters":"-01","is_match":true,"message":"Remaining characters match the expected pattern for the date suffix.","input_stream_position":45}.
[0066] The sixth sub-step involves structurally integrating the aforementioned dynamic debugging anchors, the first debugging information event, and the second debugging information event to obtain debugging event stream information, which is then stored on the system disk. This debugging event stream information is structured data generated by the outer branch code and triggered during execution, forming a mirror image of static declarations and dynamic execution. The debugging event stream information can be a structured sequence of records arranged chronologically. This sequence can record events occurring during program execution (e.g., event type, timestamp, function name, source file, line number). The static declarations can be partial code structures generated by the outer branch code. These partial code structures can be debugging anchors and event triggering code pre-inserted into the source code using tools (e.g., a compiler) during the compilation or code generation phase. The dynamic execution can be the actual behavior and data state of the program at runtime. The actual behavior can be the execution path, function call stack, variable values, and memory allocation. The data state can be the actual branches (if statements) traversed by the program, the number of loops, the order and hierarchy of function calls, the specific values of variables, and the creation and destruction of objects on the heap. The aforementioned mirroring relationship can be a one-to-one correspondence between two entities, where one entity is an exact or highly corresponding copy or mapping of another. For example, a mirror of a static declaration could be that each record in the event stream directly corresponds to a statically declared debug anchor in the source code. Records in the debug anchor, such as "function name," "source file," and "line number," allow locating the specific location in the source code. A mirror of dynamic execution could be the order and content of records in the event stream, reproducing the history of the program's dynamic execution. By examining the event records chronologically, one can understand the sequence of program actions and the functions and branches executed.
[0067] Optionally, the aforementioned debug event flow information can be structured debug data generated during code execution. This debug event flow information can completely record structured debug data information throughout the entire lifecycle from static code to dynamic code execution. The structured debug data information can include: event type (e.g., boundary checks and character remainder checks), associated node debug identifiers, input stream status (e.g., position, length, and current character), timestamp, and corresponding static code position. This debug event flow information can be used for event flow analysis. Event flow analysis can include: problem diagnosis, performance optimization, and behavior verification. Problem diagnosis can be the diagnosis of abnormal patterns and the causes of error events. Performance optimization can be achieved by analyzing event timing and resource consumption to identify optimizable points in the system and perform targeted optimizations. Behavioral verification can be achieved by comparing the expected and actual event flows to verify whether the system operates as designed.
[0068] The seventh sub-step involves integrating the code after replacing the aforementioned identifier information, the code for the inserted boundary check interface, and the code for the inserted character remainder check interface to obtain the outer branch code. For example, in Python, this outer branch code could be the generated complete code.
[0069]
[0070]
[0071] The above-described steps, as an inventive point of this disclosure, solve the second technical problem mentioned in the background: "The encoding of the path string (e.g., UTF-8, GBK) may be inconsistent with the default character encoding settings of the system parsing environment, leading to incorrect segmentation point positioning." In practice, traditional log output or interactive debuggers may fail to efficiently diagnose errors in parsing rules under complex input streams due to fragmented information, lack of contextual association, or difficulty in triggering specific boundary conditions. This disclosure designs a scheme for an event stream capture debugging framework based on debug anchor semantic binding. By adding dynamic debug anchors during the code generation stage and structurally capturing boundary checks and character remainder checks event streams, the event states of the character conversion file during static creation and dynamic execution are obtained. This realizes the event information from static declaration to dynamic execution of state transition logic. Therefore, developers can perform efficient problem diagnosis based on the structured debug event stream and analyze and optimize computer performance. This improves the maintainability of character conversion files and the execution performance of the computer.
[0072] Step 1042: Determine at least one child node that is connected to the non-leaf node.
[0073] In some embodiments, the execution entity described above can determine at least one child node connected to a non-leaf node. For example, firstly, the set of child nodes of the current non-leaf node can be extracted. Finally, it is determined whether the set of child nodes is empty; if it is empty, each node object in the set of child nodes is returned as a child node.
[0074] In some optional implementations of certain embodiments, the execution entity may determine at least one child node connected to the non-leaf node, which may include the following steps:
[0075] The first step is to obtain the set of child node pointers for the non-leaf nodes using the tree data structure of the character trie described above. This set of child node pointers can be a set of pointers to the direct child nodes of the non-leaf nodes.
[0076] The second step is to perform the following node determination steps for each child node pointer in the above set of child node pointers:
[0077] The first sub-step involves parsing the attribute information of the child node data structure corresponding to the aforementioned child node pointers to obtain the node attribute information. This node attribute information can include key node attributes (e.g., character attributes and identifier information).
[0078] The second sub-step involves generating attribute key-value pairs between the non-leaf nodes and their child nodes using the aforementioned node attribute information. These attribute key-value pairs can be structured data with parent node information as the key and child node attribute information as the value.
[0079] The third sub-step involves asynchronously writing the aforementioned attribute key-value pairs to a distributed in-memory index pool. This distributed in-memory index pool is a database structure with hierarchical sharding that supports concurrent queries. The writing to the distributed in-memory index pool can be done using a non-blocking method. The hierarchical sharding storage can be distributed by hierarchy (parent node state) and shards (child node character range). The database structure can be an in-memory database (e.g., a Redis cluster).
[0080] Third, based on the aforementioned distributed memory index pool, perform the following node mapping table construction steps:
[0081] The first sub-step is to obtain the attribute key-value pairs from the distributed memory index pool mentioned above, thus obtaining the attribute key-value pair set.
[0082] The second sub-step involves determining the topological weight value of each node corresponding to each attribute key-value pair in the aforementioned attribute key-value pair set, based on a preset topological feature rule library, thus obtaining a topological weight value set. The preset topological feature rule library can be a rule library for determining the topological weight of nodes (e.g., the number of nodes and depth). The aforementioned topological weight values can be numerical values that quantify the importance of a node in the tree.
[0083] The third sub-step involves sorting the topology weight values in the aforementioned topology weight value set in descending order to obtain a topology weight value sequence. This topology weight value sequence can be a sequence obtained by arranging the weight values in the topology sequence in descending order.
[0084] The fourth sub-step involves constructing a node mapping table representing the connection relationships between non-leaf nodes using the aforementioned topological weight value sequence. This node mapping table can be a data structure (e.g., an adjacency list) describing the connection relationships between non-leaf nodes and their child nodes.
[0085] The fourth step involves determining the aggregation characteristics of the nodes in the node mapping table to obtain the child nodes of the non-leaf nodes. These aggregation characteristics can be statistical features of the child nodes (e.g., the node with the highest weight and the average weight). For example, child nodes with weights higher than the average weight can be filtered out and used as child nodes of the non-leaf nodes.
[0086] Step 1043: Generate inner branch code corresponding to non-leaf nodes based on the character value corresponding to at least one child node.
[0087] In some embodiments, the execution entity can generate inner branch code corresponding to non-leaf nodes based on the character value corresponding to at least one child node.
[0088] As an example, firstly, corresponding branch code (e.g., a case statement) can be generated based on the character value corresponding to the child node. Secondly, in each branch, the state of the current branch is set to the identifier of the child node. Finally, the code is supplemented to obtain the inner branch code.
[0089] In some optional implementations of certain embodiments, the execution entity can generate inner branch code corresponding to the non-leaf node based on the character value corresponding to at least one child node, which may include the following steps:
[0090] The first step is to extract the character values corresponding to at least one of the child nodes to obtain a character value set. This character value set can be a collection of strings stored in each child node.
[0091] The second step involves querying the identifier information for each character value in the aforementioned character value set to obtain the identifier information set corresponding to the character value. This identifier information set can be a mapping (e.g., Map) or a dictionary (e.g., Dictionary), where characters serve as keys (e.g., Key) and their corresponding identifiers as values (e.g., Value).
[0092] The third step is to construct a character state mapping table based on the aforementioned character value set and identifier information set. This character state mapping table can be a key-value pair table containing character values and identifier information.
[0093] The fourth step is to initialize the code framework of the inner branch code based on the preset branch structure. The preset branch structure can be a framework structure of code statements (e.g., a switch statement template). The code framework can be a code framework template to be added. For example, in the Java language, the code framework could be "
[0094] switch(current_char){
[0095] / / [Placeholder] This will be filled with specific case branches in the future.
[0096] }".
[0097] Fifth, based on the above code framework, perform the following inner code generation steps:
[0098] The first sub-step involves generating matching branch code for the character corresponding to each state mapping in the aforementioned state mapping table, resulting in a matching branch code module. This matching branch code can be a conditional branch that processes different character values (e.g., case "character value": ...). The matching branch code module can be a module composed of these matching branch codes arranged in a specific order. For example, in Java, this matching branch code module could be...
[0099] case's': return 1; / / This is a matching branch code
[0100] case'q': return 2; / / This is the code for the second matching branch.
[0101] case'l': return 3; / / This is the third matching branch code.
[0102] The second sub-step, in response to the fact that the child node corresponding to the matching branch code in the above matching branch code module is a leaf node, appends a termination code module to the above matching branch code, resulting in an appended matching branch code module. Here, the leaf node can be a terminal node with no child nodes. The termination code module can be code that ends a branch (e.g., a break statement). The appended matching branch code module can be the complete matching branch code module after adding the termination code. For example, in the Java language, the appended matching branch code module could be "
[0103] case's:
[0104] return 1;
[0105] break; / / This terminates the code module.
[0106] Step 6: Fill the code framework with the matching branch code module to obtain the inner branch code. This inner branch code can be character matching logic code. For example, in Java, the character matching logic code could be "
[0107]
[0108] As an example, the matching branch code module can be filled into the corresponding placeholder in the above code framework to obtain the complete inner branch code.
[0109] Step 105: Integrate the obtained outer branch code set and inner branch code set to obtain a character conversion file, which is then stored on the system disk.
[0110] In some embodiments, the execution entity can integrate the obtained outer branch code set and inner branch code set to obtain a character conversion file, which can then be stored on the system disk. This character conversion file can be an executable file that includes complete character conversion logic.
[0111] As an example, firstly, the outer branch code in the outer branch code set and the inner branch code in the inner branch code set can be combined according to node correspondence to obtain the complete code. Finally, the complete code is merged into a code file and written to a disk file.
[0112] Optionally, in some optional implementations of some embodiments, the above-mentioned execution entity may further include the following steps:
[0113] The first step, in response to the target project starting, is to perform the following character conversion steps:
[0114] The first sub-step involves retrieving the aforementioned character conversion file from the system disk. This system disk can be a persistent storage device on the computer.
[0115] The second sub-step involves using the character mapping function corresponding to the code in the aforementioned character conversion file to iterate through the suffix characters of the project files in the target project to perform compatibility character conversion and obtain a standard file copy. Here, the character mapping function can be the code function corresponding to the character conversion in the character conversion file. The target project can be the software project that needs to be started and executed. The compatibility character conversion can be a copy of the project file after the character conversion has been performed.
[0116] The second step is to replace the corresponding project file in the target project with the copy of the standard file mentioned above in order to start the target project.
[0117] As an example, you can overwrite the original project files with a standard file copy and then start the target project.
[0118] In the process of adopting technical solutions to solve the above-mentioned technical problems, the following problems often arise: when processing files at high frequency, for frequently occurring file extensions, it is still necessary to call character file conversion files from the disk for processing, which increases the character conversion time.
[0119] To address these issues, a conventional solution is to define new suffix mappings for frequently occurring file extensions using a configuration file, resulting in a new character conversion file for processing. However, the inventors considered that the core of character conversion lies in decoupling the file extension recognition logic from the character conversion file and implementing the loading of character conversion functions for character conversion. Therefore, we decided to adopt the following solution.
[0120] In some optional implementations of certain embodiments, the above-mentioned execution entity may further include the following steps:
[0121] First, in response to the completion of the character conversion file storage, the following cache optimization steps are performed:
[0122] The first sub-step involves acquiring historical conversion frequency data to determine the target suffix set whose conversion frequency is higher than the target frequency. The historical conversion frequency data can be statistical information recording the number of file suffix conversions (e.g., the ".log" suffix was converted 1000 times). The target frequency can be the minimum number of conversions required to trigger optimization (e.g., 1000 times). The target suffix set can be the set of file suffixes that need optimization.
[0123] The second sub-step involves performing the following processing for each target suffix in the aforementioned target suffix set:
[0124] Sub-step one: Obtain the node path corresponding to the target suffix in the aforementioned character trie. This node path includes the paths to all non-leaf nodes from the root node to the leaf nodes. Specifically, the node path can be a sequence of path nodes from the root node to the leaf node of the suffix. For example, the node path can be obtained by traversing the character trie from the root node.
[0125] Sub-step two: Based on the aforementioned character conversion file, extract the outer branch code and inner branch code corresponding to each non-leaf node in the aforementioned node path. The outer branch code can be character state transition framework code. The inner branch code can be character matching logic code. For example, in the Java language, the character matching logic code could be "
[0126]
[0127] Sub-step three involves deduplicating and optimizing the outer and inner branch code to generate optimized code. Deduplication can involve removing duplicate code snippets. Optimization can involve combining related code into efficient code units. The optimized code can be a processed code block. For example, in C language, this code block could be "
[0128]
[0129] Sub-step four involves compiling the optimized code into machine code functions for storage in a memory cache. These machine code functions can be compiled native machine instructions. The memory cache can be a high-speed memory storage area (e.g., Redis). In practice, a compiler can be used to compile the optimized code. For example, the machine code functions can be code functions assembled using x86 assembly language.
[0130] The second step, in response to the file conversion of the target project, is to perform the following character conversion steps:
[0131] The first sub-step, in response to the fact that the file extension of the target project is the target extension, calls the corresponding machine code function in the memory cache to perform character conversion. For example, in the application scenario, the file is "app.log", and the extension ".log" is in the target extension set. The system directly finds the pre-compiled machine code function from the memory cache and calls it to perform character conversion.
[0132] The second sub-step, in response to the fact that the filename extension of the target project is not the target extension, invokes the aforementioned character conversion file to perform character conversion. For example, in an application scenario, the file is "config.xml", and the extension ".xml" is not in the target extension set. The system then falls back to the interpreted character conversion file (e.g., "char_converter.py") for character conversion.
[0133] The above-described steps, as an inventive point of this disclosure, solve the first technical problem mentioned in the background: "Whenever a new file type needs to be supported (e.g., adding '.jsonl' or '.markdown'), developers must directly modify the mapping table definition or processing logic code in the source code, and then recompile and deploy the entire service." In practice, at project startup, character conversion files are scanned and converted using character conversion files. For high-frequency file extensions (e.g., ".txt"), frequent file reading from the system disk may increase conversion time and computer performance overhead. This disclosure designs a scheme that integrates a pre-compiled character conversion cache based on historical conversion frequency data. Based on historical conversion frequency statistics, the character node paths corresponding to high-frequency file extensions are identified. The state transition and matching logic code corresponding to the character node paths are compiled into directly executable machine code functions and stored in a memory cache. During character conversion operations, the pre-compiled machine code functions can be directly called. Therefore, in file character conversion scenarios, for high-frequency file extensions, the character conversion efficiency can be significantly improved, the character conversion time delay reduced, and the computer performance overhead lowered.
[0134] The above-described embodiments of this disclosure have the following beneficial effects: Character conversion files obtained through the character conversion file storage method of some embodiments of this disclosure, when used at the start of the target project, can achieve file suffix recognition and standardized conversion, quickly supporting new file types and multilingual characters, reducing the development time of character adaptation code, and improving the stability of the file processing flow. Specifically, the reason for the long development time of character adaptation is that each file type required by the system needs to have its suffix name and corresponding processing logic pre-registered in a hard-coded mapping table. This prevents developers from directly modifying the mapping table definition in the source code, and then recompiling and deploying the entire service of the target project. Based on this, the character conversion file storage method of some embodiments of this disclosure first performs character-order splitting on the string corresponding to each file suffix in the file suffix set to generate a character node linked list, thus obtaining a character node linked list set. This provides a refined character-level decomposition of the file suffixes, laying the foundation for subsequent character dictionary construction and improving processing efficiency. Second, each character in each character node linked list in the above-described character node linked list set is assigned unique identification information, resulting in an assigned character node linked list set. Therefore, each character is given a unique identifier, facilitating character identification during subsequent code generation. Next, the character node linked lists in the allocated character node set are encapsulated to obtain a character trie. This forms a tree-like storage structure, supporting fast character matching and traversal, and optimizing character query performance. Then, for each non-leaf node in the character trie, the following generation steps are performed: Based on the identifier information corresponding to the non-leaf node, the outer branch code corresponding to the non-leaf node is generated. Thus, the node's state information defines the outer framework of the branch logic, facilitating modular processing. At least one child node connected to the non-leaf node is determined; thus, the node's direct descendant nodes are determined, providing necessary input for the generation of inner code and ensuring the integrity of the branch logic. Based on the character value corresponding to the at least one child node, the inner branch code corresponding to the non-leaf node is generated. Thus, specific conditional code is generated based on the character value, precisely controlling the branch to improve execution efficiency. Finally, the obtained outer and inner branch code sets are integrated to obtain a character conversion file, which is stored on the system disk. This generates an executable conversion file for the system to load and use, automating file extension processing and storing it for repeated access. Thus, through ordered character splitting, state allocation, trie construction, and code generation techniques, efficient file extension recognition and standardized character conversion are achieved. This allows for rapid compatibility with new file types and multilingual characters, reducing the time spent developing adaptation code for different file extensions and improving the stability of the file processing workflow.
[0135] Further reference Figure 2 As an implementation of the methods shown in the above figures, this disclosure provides some embodiments of a character conversion file storage device, which are similar to... Figure 1 Corresponding to the method embodiments shown, this character conversion file storage device can be specifically applied to various electronic devices.
[0136] like Figure 2 As shown, a character conversion file storage device 200 includes: a character splitting unit 201, an information allocation unit 202, a character encapsulation unit 203, a code generation unit 204, and a file storage unit 205. The character splitting unit 201 is configured to: perform ordered character splitting on the string corresponding to each file suffix in the file suffix set to generate a character node linked list, resulting in a character node linked list set. The information allocation unit 202 is configured to: assign unique identifier information to each character in each character node linked list in the character node linked list set, resulting in an allocated character node linked list set. The character encapsulation unit 203 is configured to: encapsulate each character node linked list in the allocated character node linked list set, resulting in a character trie. The code generation unit 204 is configured to: for each non-leaf node in the character trie, perform the following generation steps: generate outer branch code corresponding to the non-leaf node based on the identifier information; determine at least one child node connected to the non-leaf node; and generate inner branch code corresponding to the non-leaf node based on the character value corresponding to the at least one child node. File storage unit 205 is configured to integrate the obtained outer branch code set and inner branch code set to obtain a character conversion file for storage on the system disk.
[0137] It is understandable that the units described in the character conversion file storage device 200 are related to the reference. Figure 1 The steps in the described method correspond to each other. Therefore, the operations, features, and beneficial effects described above for the method also apply to the character conversion file storage device 200 and the units contained therein, and will not be repeated here.
[0138] The following is for reference. Figure 3 It shows a schematic diagram of the structure of an electronic device (e.g., an electronic device) 300 suitable for implementing some embodiments of the present disclosure. Figure 3 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.
[0139] like Figure 3As shown, the electronic device 300 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from a storage device 308 into a random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the electronic device 300. The processing unit 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0140] Typically, the following devices can be connected to I / O interface 305: input devices 306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 309. Communication device 309 allows electronic device 300 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 An electronic device 300 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 3 Each box shown can represent a device or multiple devices as needed.
[0141] In particular, according to some embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 309, or installed from storage device 308, or installed from ROM 302. When the computer program is executed by processing device 301, it performs the functions defined in the methods of some embodiments of this disclosure.
[0142] It should be noted that, in some embodiments of this disclosure, the computer-readable medium described above may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, 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 device, magnetic storage device, or any suitable combination thereof. In some embodiments of this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-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 computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0143] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0144] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently without being assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to: perform character-order splitting on the string corresponding to each file extension in the file extension set to generate a character node linked list, obtaining a character node linked list set; assign unique identifier information to each character in each character node linked list in the character node linked list set, obtaining an assigned character node linked list set; encapsulate each character node linked list in the assigned character node linked list set to obtain a character trie; for each non-leaf node in the character trie, perform the following generation steps: generate outer branch code corresponding to the non-leaf node based on the identifier information corresponding to the non-leaf node; determine at least one child node connected to the non-leaf node; generate inner branch code corresponding to the non-leaf node based on the character value corresponding to the at least one child node; integrate the obtained outer branch code set and inner branch code set to obtain a character conversion file, which is then stored in the system disk.
[0145] Computer program code for performing operations of some embodiments of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0146] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0147] The units described in some embodiments of this disclosure can be implemented in software or hardware. The described units can also be located in a processor; for example, a processor may be described as including a character splitting unit, an information allocation unit, a character encapsulation unit, a code generation unit, and a file storage unit. The names of these units do not necessarily limit the unit itself; for example, a character splitting unit may also be described as "a unit that performs ordered character splitting on the string corresponding to each file suffix in a file suffix set to generate a character node linked list, thus obtaining a set of character node linked lists."
[0148] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0149] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.
Claims
1. A method for storing character conversion files, comprising: The strings corresponding to each file extension in the file extension set are split into characters in an ordered manner to generate a character node linked list, thus obtaining a set of character node linked lists; Assign unique identifier information to each character in each character node linked list in the character node linked list set to obtain the assigned character node linked list set; The character node linked lists in the allocated character node linked list set are encapsulated to obtain a character trie; For each non-leaf node in the character trie, perform the following generation steps: Based on the identifier information corresponding to the non-leaf nodes, generate the outer branch code corresponding to the non-leaf nodes, including: Determine the location where the code statement block is generated in the outer code template of the target, and obtain the location of the target code statement block; Assign a node debugging identifier to the non-leaf node, wherein the node debugging identifier is a unique identifier for debugging; Semantically bind the node debug identifier and the target code block location to generate dynamic debug anchor points; Based on the location of the target code statement block, the following outer code generation steps are performed: Replace the predefined identifier placeholder in the target code block location with the identifier information to obtain the code after the identifier information is replaced; Insert a boundary check interface at the location of the target code statement block to obtain the code of the inserted boundary check interface; In response to the boundary check interface being triggered, the current input stream status information and the node debug identifier are obtained, and a structured first debug information event is generated; In response to the fact that the child node of the non-leaf node is a leaf node, a character remaining check interface is inserted into the target code statement block position to obtain the code for inserting the character remaining check interface; When the character remaining check interface is triggered and called, the difference information between the remaining character nodes in the character linked list corresponding to the non-leaf node and the preset node pattern is obtained, and a structured second debugging information event is generated. The dynamic debugging anchor point, the first debugging information event, and the second debugging information event are structurally integrated to obtain debugging event stream information, which is then stored on the system disk. The outer branch code is obtained by integrating the code after the identification information is replaced, the code of the inserted boundary check interface, and the code of the inserted character remaining check interface; Determine at least one child node connected to the non-leaf node; Based on the character value corresponding to the at least one child node, generate the inner branch code corresponding to the non-leaf node, including: Extract the character values corresponding to the at least one child node to obtain a character value set; For each character value in the character value set, perform an identification information query to obtain the identification information set corresponding to the character value; Construct a character state mapping table based on the character value set and the identification information set; Based on the preset branch structure, initialize the code framework of the inner branch code; Based on the aforementioned code framework, the following inner code generation steps are performed: For each character corresponding to a state mapping in the state mapping table, a matching branch code is generated to obtain the matching branch code module; In response to the fact that the child node corresponding to the matching branch code in the matching branch code module is a leaf node, a termination code module is appended to the matching branch code to obtain the appended matching branch code module. The matching branch code module is populated into the code framework to obtain the inner branch code; The obtained outer branch code set and inner branch code set are integrated to obtain a character conversion file, which is then stored on the system disk.
2. The method according to claim 1, wherein, The method further includes: In response to the target project starting, the following character conversion steps are performed: Obtain the character conversion file from the system disk; Using the character mapping function corresponding to the code in the character conversion file, the suffix characters corresponding to the project files in the target project are traversed to perform compatibility character conversion and obtain a standard file copy; Replace the corresponding project file in the target project with the copy of the standard file to start the target project.
3. The method according to claim 1, wherein, The step of splitting the string corresponding to each file extension in the file extension set into character-ordered segments to generate a linked list of character nodes includes: Based on the character order of the strings, the string corresponding to the file suffix is split to obtain a character list; In response to the fact that the characters in the character list are in alphabetic form, a case conversion character for the characters is generated to obtain a case conversion character list; Based on the character order of the string, the characters in the character list and the case conversion character list are linked together to obtain a character node linked list.
4. The method according to claim 1, wherein, The step of encapsulating each character node linked list in the allocated character node linked list set to obtain a character trie includes: For each character node linked list, perform the following determination steps: Traverse the character nodes in the character node linked list to obtain the original letter node chain; Perform case conversion on the characters corresponding to the character nodes in the character node linked list to obtain a case-converted letter node chain; The original letter nodes in the original letter node chain are identified as tree nodes to obtain the original letter tree; The case conversion letter nodes in the chain of case conversion letter nodes are identified as tree nodes to obtain the case conversion letter tree; By integrating the nodes corresponding to the letters in the original alphabet trees and the case conversion alphabet trees, a character dictionary tree is obtained.
5. The method according to claim 1, wherein, Determining at least one child node connected to the non-leaf node includes: The set of child node pointers of the non-leaf nodes is obtained through the tree data structure of the character dictionary; For each child node pointer in the set of child node pointers, perform the following node determination steps: Parse the attribute information of the child node data structure corresponding to the child node pointer to obtain the node attribute information; Based on the node attribute information, attribute key-value pairs between the non-leaf nodes and their child nodes are generated; The attribute key-value pairs are asynchronously written to a distributed memory index pool, wherein the distributed memory index pool is a database structure with hierarchical sharding storage that supports concurrent queries. Based on the distributed memory index pool, the following node mapping table construction steps are performed: Obtain the attribute key-value pairs from the distributed memory index pool to obtain the attribute key-value pair set; Based on the preset topology feature rule library, the topology weight value of each attribute key-value pair corresponding to the node in the attribute key-value pair set is determined to obtain the topology weight value set; The topology weight values in the set of topology weight values are sorted in descending order to obtain a sequence of topology weight values; A node mapping table for the connection relationships of non-leaf nodes is constructed using the sequence of topological weight values. The child nodes of the non-leaf nodes are obtained by determining the aggregation characteristics of the nodes in the node mapping table.
6. A character conversion file storage device, comprising: The character splitting unit is configured to split the string corresponding to each file suffix in the file suffix set into character order to generate a character node linked list, thus obtaining a character node linked list set; The information allocation unit is configured to assign unique identification information to each character in each character node linked list in the character node linked list set, thereby obtaining the allocated character node linked list set. The character encapsulation unit is configured to encapsulate each character node linked list in the allocated character node linked list set to obtain a character trie; The code generation unit is configured to perform the following generation steps for each non-leaf node in the character trie: Based on the identifier information corresponding to the non-leaf node, generate the outer branch code corresponding to the non-leaf node, including: determining the code statement block generation position in the target outer code template to obtain the target code statement block position; assigning a node debugging identifier to the non-leaf node, wherein the node debugging identifier is a unique identifier for debugging; semantically binding the node debugging identifier and the target code statement block position to generate a dynamic debugging anchor point; based on the target code statement block position, perform the following outer code generation steps: replacing the identifier information with a predefined identifier placeholder in the target code statement block position to obtain the code after the identifier information is replaced; inserting a boundary check interface in the target code statement block position to obtain the code of the inserted boundary check interface; and in response to the boundary check interface being triggered, obtaining... The current input stream state information and the node debugging identifier are used to generate a structured first debugging information event; in response to the non-leaf node's child node being a leaf node, a character remaining check interface is inserted into the target code statement block position to obtain the code for inserting the character remaining check interface; in response to the character remaining check interface being triggered, the difference information between the remaining character nodes in the character chain corresponding to the non-leaf node and the preset node pattern is obtained to generate a structured second debugging information event; the dynamic debugging anchor point, the first debugging information event, and the second debugging information event are structurally integrated to obtain debugging event stream information, which is stored on the system disk; the code after the identifier information is replaced, the code of the inserted boundary check interface, and the code of the inserted character remaining check interface are integrated to obtain the outer branch code; Determine at least one child node connected to the non-leaf node; Generating inner branch code corresponding to the non-leaf node based on the character value corresponding to the at least one child node includes: extracting the character value corresponding to the at least one child node to obtain a character value set; querying the identifier information for each character value in the character value set to obtain an identifier information set corresponding to the character value; constructing a character state mapping table based on the character value set and the identifier information set; initializing the code framework of the inner branch code based on a preset branch structure; and performing the following inner code generation steps based on the code framework: generating matching branch code for each character corresponding to each state mapping in the state mapping table to obtain a matching branch code module; in response to the child node corresponding to the matching branch code in the matching branch code module being a leaf node, appending a termination code module to the matching branch code to obtain an appended matching branch code module; and filling the matching branch code module into the code framework to obtain the inner branch code. The file storage unit is configured to integrate the obtained outer branch code set and inner branch code set to obtain a character conversion file, which is then stored on the system disk.
7. An electronic device, comprising: One or more processors; Storage device, on which one or more programs are stored, When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in any one of claims 1-5.
8. A computer-readable medium having a computer program stored thereon, wherein, When the program is executed by the processor, it implements the method as described in any one of claims 1-5.
Citation Information
Patent Citations
Code data processing method and device and electronic equipment
CN113961192A
Data processing method and device, electronic equipment and storage medium
CN114416035A
