Conversational information retrieval method, apparatus, device, storage medium and program product
By using a dual-array trie for conversational information retrieval, the problem of low retrieval efficiency in existing technologies is solved, achieving efficient and accurate information retrieval, adapting to multi-character language scenarios, and improving resource utilization and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA UNITED NETWORK COMM GRP CO LTD
- Filing Date
- 2026-02-13
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, conversational information retrieval relies on keywords for searching, but it cannot accurately match needs when faced with vague or complex questions, resulting in low retrieval efficiency and a poor user experience.
A double-array trie tree is used for character traversal and node location. By working together with the base array and the parity array, the node position is calculated using the transition radix and boundary checks are performed, avoiding memory waste caused by fixed array length and improving retrieval efficiency.
It significantly improves the efficiency and accuracy of conversational information retrieval, reduces memory waste, adapts to multi-character language scenarios, and enhances resource utilization and retrieval speed.
Smart Images

Figure CN122153129A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a conversational information retrieval method, apparatus, device, storage medium, and program product. Background Technology
[0002] With the rapid development of internet technology and the diversification of information acquisition methods, conversational information retrieval, as an important research direction in the field of natural language processing, provides users with intelligent retrieval services by integrating multimodal interaction and pre-trained model technology.
[0003] In existing technologies, conversational information retrieval relies on keywords for searching. However, traditional keyword retrieval cannot accurately match needs when faced with fuzzy or complex questions, and it is difficult to quickly output effective results. It suffers from problems such as low retrieval efficiency and delayed response, and cannot meet users' intuitive and efficient retrieval needs, resulting in a poor user experience.
[0004] Therefore, existing technologies suffer from low efficiency in conversational information retrieval. Summary of the Invention
[0005] This application provides a conversational information retrieval method, apparatus, device, storage medium, and program product to achieve conversational information retrieval effects.
[0006] In a first aspect, embodiments of this application provide a conversational information retrieval method, including:
[0007] Obtain the target keywords corresponding to the information to be retrieved;
[0008] Based on a pre-defined double-array trie, character traversal and node positioning are performed on the target keyword to obtain the node position information of the target keyword. The pre-defined double-array trie includes a base array and a check array. The base array stores the transition cardinality of each node, which is used to calculate the node position of the corresponding character in the target keyword. The check array stores the check identifier, which is used to verify the legality of the node transition.
[0009] Based on the node location information, query the preset database;
[0010] Based on the query results, determine the target information corresponding to the target keywords.
[0011] In one possible implementation, based on a preset double-array trie, character traversal and node positioning processing are performed on the target keyword to obtain the node position information of the target keyword, including:
[0012] Use the root node of the double-array trie as the current node;
[0013] For each character in the target keyword, iterate through the double-array trie for processing;
[0014] Iterate through each character in the target keyword, performing the following steps:
[0015] Get the transition cardinality of the current node in the base array, and the encoding value of the current character in the preset character encoding table;
[0016] Calculate the target node position corresponding to the current character based on the transition cardinality and the encoding value;
[0017] Obtain the verification identifier corresponding to the target node position from the verification array; where the verification identifier is the transition cardinality of the target node's parent node;
[0018] Determine whether the verification identifier is consistent with the transition base of the current node;
[0019] If they match, update the target node to the current node and continue traversing the next character;
[0020] If they do not match, then the target keyword is not in the double-array trie;
[0021] After all characters have been traversed, the final current node position is output as the node position information of the target keyword.
[0022] In one possible implementation, if there are multiple target keywords, then for each target keyword, character traversal processing and node positioning processing are performed according to a preset double-array trie to obtain the node position information of the target keyword.
[0023] In one possible implementation, after calculating the target node position corresponding to the current character, the process includes:
[0024] Obtain the valid index range of the preset double-array trie; where the valid index range is the array length of the base array and the parity array, and the array lengths of the base array and the parity array are the same;
[0025] Based on the valid index range, perform boundary checks on the target node location to obtain the boundary check results;
[0026] If the boundary check result indicates that the target node position is within the valid index range, then proceed to obtain the check identifier corresponding to the target node position in the check array;
[0027] If the boundary check result indicates that the target node location is not within the valid index range, the traversal will terminate and a retrieval failure feedback message will be generated.
[0028] In one possible implementation, the preset double-array trie includes constant identifiers; wherein the constant identifiers are the word ending nodes of the preset double-array trie.
[0029] In one possible implementation, after obtaining the target keywords corresponding to the information to be retrieved, the method further includes:
[0030] Using time series natural language processing techniques, the target keywords are analyzed to extract their temporal features;
[0031] Based on time characteristics and node location information, a pre-set database is queried to obtain target information corresponding to the target keywords.
[0032] In one possible implementation, obtaining the target keywords corresponding to the information to be retrieved includes:
[0033] Retrieve the information to be searched;
[0034] Perform semantic analysis on the information to be retrieved to obtain the keywords corresponding to the information to be retrieved;
[0035] Generate a dialogue strategy based on keywords;
[0036] Based on the dialogue strategy, interact with the user to obtain the target keywords corresponding to the information to be retrieved.
[0037] Secondly, embodiments of this application provide a conversational information retrieval device, comprising:
[0038] The acquisition module is used to obtain the target keywords corresponding to the information to be retrieved.
[0039] The module is used to perform character traversal and node positioning processing on the target keyword according to the preset double-array trie to obtain the node position information of the target keyword. The preset double-array trie includes a base array and a check array. The base array stores the transition cardinality of each node. The transition cardinality is used to calculate the node position of the corresponding character in the target keyword. The check array stores the check identifier. The check identifier is used to check the legality of the node transition.
[0040] Optionally, the preset double-array trie includes constant identifiers; wherein, the constant identifiers are the word ending nodes of the preset double-array trie.
[0041] The query module is used to query a preset database based on node location information.
[0042] The determination module is used to determine the target information corresponding to the target keywords based on the query results.
[0043] In one possible implementation, the module can also be used for:
[0044] Use the root node of the double-array trie as the current node;
[0045] For each character in the target keyword, iterate through the double-array trie for processing;
[0046] Iterate through each character in the target keyword, performing the following steps:
[0047] Get the transition cardinality of the current node in the base array, and the encoding value of the current character in the preset character encoding table;
[0048] Calculate the target node position corresponding to the current character based on the transition cardinality and the encoding value;
[0049] Obtain the verification identifier corresponding to the target node position from the verification array; where the verification identifier is the transition cardinality of the target node's parent node;
[0050] Determine whether the verification identifier is consistent with the transition base of the current node;
[0051] If they match, update the target node to the current node and continue traversing the next character;
[0052] If they do not match, then the target keyword is not in the double-array trie;
[0053] After all characters have been traversed, the final current node position is output as the node position information of the target keyword.
[0054] In one possible implementation, the module can also be used for:
[0055] If there are multiple target keywords, then for each target keyword, character traversal and node positioning are performed according to the preset double-array trie to obtain the node position information of the target keyword.
[0056] In one possible implementation, after calculating the target node position corresponding to the current character, the module can also be used for:
[0057] Obtain the valid index range of the preset double-array trie; where the valid index range is the array length of the base array and the parity array, and the array lengths of the base array and the parity array are the same;
[0058] Based on the valid index range, perform boundary checks on the target node location to obtain the boundary check results;
[0059] If the boundary check result indicates that the target node position is within the valid index range, then proceed to obtain the check identifier corresponding to the target node position in the check array;
[0060] If the boundary check result indicates that the target node location is not within the valid index range, the traversal will terminate and a retrieval failure feedback message will be generated.
[0061] In one possible implementation, after obtaining the target keywords corresponding to the information to be retrieved, the query module can also be used for:
[0062] Using time series natural language processing techniques, the target keywords are analyzed to extract their temporal features;
[0063] Based on time characteristics and node location information, a pre-set database is queried to obtain target information corresponding to the target keywords.
[0064] In one possible implementation, the acquisition module can also be used for:
[0065] Retrieve the information to be searched;
[0066] Perform semantic analysis on the information to be retrieved to obtain the keywords corresponding to the information to be retrieved;
[0067] Generate a dialogue strategy based on keywords;
[0068] Based on the dialogue strategy, interact with the user to obtain the target keywords corresponding to the information to be retrieved.
[0069] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0070] The memory stores the instructions that the computer executes;
[0071] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0072] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0073] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0074] The conversational information retrieval method, apparatus, device, storage medium, and program product provided in this application obtain target keywords corresponding to the information to be retrieved; based on a preset double-array trie, character traversal and node positioning processing are performed on the target keywords to obtain the node position information of the target keywords; wherein, the preset double-array trie includes a base array and a check array, the base array stores the transition cardinality of each node, the transition cardinality is used to calculate the node position of the corresponding character in the target keyword, and the check array stores check identifiers, the check identifiers are used to check the legality of node transitions; based on the node position information, a preset database is queried; based on the query results, the target information corresponding to the target keyword is determined. Compared with traditional keyword retrieval, this application uses a double-array trie for retrieval in conversational mode retrieval scenarios, which effectively improves retrieval efficiency. Attached Figure Description
[0075] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0076] Figure 1 This is a schematic diagram of the structure of an array trie in the prior art;
[0077] Figure 2 Flowchart of the conversational information retrieval method provided in this application Figure 1 ;
[0078] Figure 3 Flowchart of the conversational information retrieval method provided in this application Figure 2 ;
[0079] Figure 4 Flowchart of the conversational information retrieval method provided in this application Figure 3 ;
[0080] Figure 5 A schematic diagram of the conversational information retrieval device provided in this application;
[0081] Figure 6 A schematic diagram of the structure of the electronic device provided in this application.
[0082] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0083] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0084] It should be noted that all data involved in this application are information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0085] With the rapid development of artificial intelligence and natural language processing technologies, users' demand for information retrieval has shifted from traditional keyword search to a more natural dialogue interaction mode.
[0086] For example, in scenarios such as smart cities, government service platforms, and enterprise customer service systems, users may ask vague or complex questions to the system via voice or text. These questions typically include multi-dimensional information such as geographical location, time range, and data type, and the user's needs may be implicit in natural language, making them difficult to extract directly through traditional keyword matching.
[0087] In existing technologies, keyword-based search systems cannot effectively handle such complex queries, while multimodal dialogue systems, although capable of integrating text, voice and other information, have limited ability to parse structured information such as time and geographical location, resulting in insufficient accuracy and efficiency of search results.
[0088] In addition, users may dynamically adjust their query intent during the interaction process, requiring the system to have the ability to understand and adjust strategies in real time.
[0089] Furthermore, in existing conversational information retrieval technologies, trie trees are widely used as a common technique for storing and retrieving massive amounts of strings. They are applied to scenarios such as autocomplete and spell checking, and can efficiently realize string generation, deletion, search and prefix matching operations. Array trie trees are the mainstream implementation of trie trees.
[0090] The array trie stores all child nodes by configuring a fixed-length pointer array for each node. It uses the correspondence between the position and value of array elements to achieve unified addressing, storage and retrieval, so that the time complexity of array word retrieval reaches O(1), which greatly improves the efficiency of string operation and retrieval.
[0091] Optionally, Figure 1This is a schematic diagram of the structure of an array trie in the prior art, such as... Figure 1 As shown, this trie is constructed from four English strings: abc, d, da, and dda. It is used to visually demonstrate the node organization, character mapping, terminal symbol marking rules, and pointer vacancy status of a fixed-length pointer array trie.
[0092] The trie uses a hierarchical multi-branch tree structure, with the root node as the starting node. A path from the root node to any red-marked terminal node corresponds to a unique and complete input string (e.g., abc, d, da, dda). Each level of the tree corresponds to a character position in the string, and the nodes are connected by pointers to form character links.
[0093] Each node is stored internally using a fixed-length 27-bit pointer array. 26 positions in the array are mapped to the English letters a~z in sequence, and the remaining position is used as a string termination marker. If a valid pointer is stored in one position in the array, it means that the node has a child node with the corresponding character. If there is no subsequent character, the pointer points to NULL (null pointer).
[0094] Characters and array indices are in one-to-one correspondence. For example, character b corresponds to the second position of the array and character c corresponds to the third position of the array. The character pointer is located directly through the array index, realizing addressing, storage and retrieval operations with O(1) complexity.
[0095] Figure 1 The red node in the middle represents the end position of the string, that is, the position of the array terminator corresponding to the node is activated, indicating that the path from the root node to the current node constitutes a complete and valid string; the pointer at the end of the branch without subsequent characters all points to NULL.
[0096] However, array-based trie systems mandate that each layer of the link must be configured with a pointer array, and all pointer arrays corresponding to all nodes must have identical specifications and fixed lengths. The actual array length must cover all character types of the target language, rather than the actual number of child nodes required by the node. This directly leads to the vast majority of pointers in the array remaining in a long-term empty state, resulting in a large amount of invalid memory usage. In actual dictionary retrieval applications, the number of common prefixes between strings is extremely low relative to the total number of nodes, making the actual number of child nodes under most nodes far less than the fixed length of the pointer array. This further exacerbates the proportion of empty pointers, making the space waste problem even more prominent and severely disconnected from the space requirements of actual applications. In multi-character language scenarios, this space waste problem will be amplified exponentially. For languages like Chinese with a large number of single characters, if the above-mentioned fixed-length pointer array implementation method is adopted, the array length must match the total number of Chinese characters, resulting in a massive number of empty pointers.
[0097] Therefore, existing array-based trie implementations suffer from poor scenario adaptability and low retrieval efficiency due to their low space utilization.
[0098] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0099] Figure 2 Flowchart of the conversational information retrieval method provided in this application Figure 1 ,like Figure 2 As shown, the method includes:
[0100] S201. Obtain the target keywords corresponding to the information to be retrieved.
[0101] In this embodiment, the information to be retrieved refers to the original input content of the corresponding related information obtained in response to a user's retrieval request.
[0102] Target keywords refer to the character combinations extracted from the information to be retrieved and used to locate target information.
[0103] Accordingly, the information to be retrieved is preprocessed to extract target keywords; the preprocessing includes word segmentation and stop word removal.
[0104] S202. Based on the preset double-array trie, perform character traversal and node positioning processing on the target keyword to obtain the node position information of the target keyword; wherein, the preset double-array trie includes a base array and a check array. The base array stores the transition cardinality of each node. The transition cardinality is used to calculate the node position of the corresponding character in the target keyword. The check array stores the check identifier. The check identifier is used to check the legality of the node transition.
[0105] In this embodiment, the preset double-array trie (also known as a double-array trie tree) refers to the data structure used for target keyword character traversal and node positioning, which is constructed based on a preset corpus; for example, a double-array trie is constructed based on a geographic corpus.
[0106] The array positions in the base array are used to record the node of each character in the target keyword, and the values stored in the base array are the transition bases.
[0107] The transition radix is an integer stored in the base array of the double-array trie, used to calculate the target node position of the current character in the base array in combination with the encoding value of the current character.
[0108] The length of the check array is the same as the length of the base array. The array position in the check array stores the check identifier, which is the transition cardinality of the parent node of the corresponding node. It is used to check the legality of the node transition to ensure that the node positioning of the current character conforms to the link rules of the double array trie and avoids node positioning errors.
[0109] Node position information refers to the specific position of the node corresponding to each character in the base array after the target keyword has undergone character traversal and node positioning processing in the double-array trie, as well as the final current node position after the target keyword traversal is completed.
[0110] S203. Query the preset database based on the node location information.
[0111] In this embodiment, the preset database refers to a database that stores and manages various types of data associated with the target keyword. The stored content includes geographic information, backend signaling aggregation information, and time-related data. It is used to receive retrieval requests corresponding to node location information, return associated data matching the target keyword, and obtain the corresponding query results.
[0112] Based on the final current node position, query the preset database.
[0113] S204. Based on the query results, determine the target information corresponding to the target keywords.
[0114] In this embodiment, the search results obtained are visualized to enable users to obtain target information corresponding to the target keywords and complete the information retrieval.
[0115] The conversational information retrieval method provided in this application splits the existing radix-based trie structure into a base array and a check array using a dual-array trie. It dynamically calculates node positions using the transition radix, avoiding memory waste caused by fixed array lengths in existing technologies. Nodes are directly located using the transition radix of the base array, eliminating the need to traverse the entire array and significantly reducing the number of null pointers. This solves the inherent space-for-time tradeoff of existing array tries, improving storage efficiency for single-character Chinese languages while maintaining O(1) query complexity. In high-concurrency scenarios such as smart cities, it can support large-scale keyword indexing with lower memory overhead, thereby significantly improving resource utilization and retrieval efficiency.
[0116] Figure 3 Flowchart of the conversational information retrieval method provided in this application Figure 2 ,like Figure 3 As shown, in this embodiment... Figure 2Based on the embodiments, the method of performing character traversal and node positioning processing on the target keyword according to the preset double-array trie to obtain the node position information of the target keyword is described in detail. The method includes:
[0117] S301. Take the root node of the double-array trie as the current node.
[0118] In this embodiment, the root node is positioned at the default starting position in the base array.
[0119] For example, a predefined double-array trie is shown below:
[0120] The node positions of the base array are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
[0121] The corresponding transition bases are: 1, null, 3, 2, 2, 3, 6, 2, 3, 2, 6;
[0122] Verify the node positions of the array: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
[0123] The corresponding checksums are: null, null, 1, 3, 3, 3, 2, 6, 2, 6, 2;
[0124] At this point, in the base array, the root node position is 0, and the transition base corresponding to the root node is 1; the current node position is 0, and the transition base of the current node is 1.
[0125] S302. For each character in the target keyword, perform traversal processing based on the double-array trie.
[0126] In this embodiment, for example, if the target keyword is Tsinghua, then the traversal order is Tsinghua, then Tsinghua.
[0127] Iterate through each character in the target keyword, performing the following steps:
[0128] S3021. Obtain the transition radix of the current node in the radix array, and the encoding value of the current character in the preset character encoding table.
[0129] In this embodiment, the preset character encoding table refers to the preset mapping relationship table between characters and encoding values, which is used to assign a unique integer code to each character in the target keyword; to provide a numerical basis for calculating the target node position of the transfer cardinality, and to ensure that each character can determine the node position of the character in the cardinality array through the combination of the encoding value and the transfer cardinality.
[0130] For example, the preset character encoding table is shown in the table below:
[0131] The correspondence between characters and encoding values is as follows: Qing - 1, Hua - 2, Da - 3, Xue - 4, Xin - 5, Zhong - 6, Ren - 7.
[0132] When the traversed character is Qing, the transfer base of the current node is read from the base array as 1, and the encoding value of the current character is read from the preset character encoding table as 1.
[0133] When the traversed character is Hua, the transfer base of the current node is read from the base array as 3, and the encoding value of the current character is read from the preset character encoding table as 2.
[0134] S3022. Calculate the position of the target node corresponding to the current character according to the transfer base and the encoding value.
[0135] In this embodiment, the calculation formula for the position of the target node is as follows:
[0136] Position of target node = transfer base of current node + encoding value of current character
[0137] For example, when the traversed character is Qing, the position of the target node is 2. When the traversed character is Hua, the position of the target node is 5.
[0138] In some embodiments, after calculating the position of the target node corresponding to the current character, it includes:
[0139] Obtain the effective index range of the preset double - array trie; wherein, the effective index range is the array lengths of the base array and the check array, and the array lengths of the base array and the check array are the same.
[0140] Perform a boundary check on the position of the target node according to the effective index range to obtain a boundary check result.
[0141] If the boundary check result indicates that the position of the target node is within the effective index range, then perform the step of obtaining the check flag corresponding to the position of the target node in the check array.
[0142] If the boundary check result indicates that the position of the target node is not within the effective index range, then terminate the traversal and generate a feedback message indicating a retrieval failure.
[0143] In this embodiment, for example, if the lengths of the base array and the check array are 11, then the effective index range includes node positions greater than or equal to 0 and less than or equal to 10.
[0144] When the traversed character is Qing, the position of the target node is 2. At this time, since the position of the target node is within the effective index range, it indicates that the boundary check is passed.
[0145] When the traversed character is Hua, the position of the target node is 5. At this time, since the position of the target node is within the effective index range, it indicates that the boundary check is passed.
[0146] S3023. Obtain the check identifier corresponding to the position of the target node from the check array; wherein, the check identifier is the transfer radix of the parent node of the target node.
[0147] In this embodiment, for example, when the traversed character is 'qing', obtain the check identifier 1 corresponding to the position 2 of the target node from the check array. When the traversed character is 'hua', obtain the check identifier 3 corresponding to the position 5 of the target node from the check array.
[0148] S3024. Determine whether the check identifier is consistent with the transfer radix of the current node.
[0149] In this embodiment, for example, when the traversed character is 'qing', the transfer radix of the current node is 1, and the check identifier corresponding to the position of the target node is 1, then the check identifier is consistent with the transfer radix of the current node, indicating that the node transfer is legal.
[0150] When the traversed character is 'hua', the transfer radix of the current node is 3, and the check identifier corresponding to the position of the target node is 3, then the check identifier is consistent with the transfer radix of the current node, indicating that the node transfer is legal.
[0151] S3025. If they are consistent, update the target node to the current node and continue to traverse the next character.
[0152] In this embodiment, for example, when the traversed character is 'qing', update the target node to the new current node. At this time, the position of the current node is 2, and the transfer radix corresponding to the current node is 3. Continue to traverse the next character 'hua'.
[0153] When the traversed character is 'hua', at this time, the position of the current node is 5, and the transfer radix corresponding to the current node is 3. There is no subsequent character to traverse, and execute step S303.
[0154] S3026. If they are inconsistent, determine that the target keyword is not in the double-array trie.
[0155] In this embodiment, if the target keyword is 'qingda', when the traversed character is 'qing', the steps are the same as those from S3021 to S3025. When the traversed character is 'da', at this time, the position of the target node is 6, the check identifier is 2, which is inconsistent with the transfer radix 3 corresponding to the current node. Then determine that the target keyword 'qingda' is not in the double-array trie, terminate the traversal, and feedback the information of retrieval failure.
[0156] S303. When all characters are traversed, output the final position of the current node as the node position information of the target keyword.
[0157] In this embodiment, if the target keyword is "Tsinghua", the output of the final current node position as the node position information of the target keyword is 5.
[0158] In some embodiments, if there are multiple target keywords, for each target keyword, according to the preset double-array trie, character traversal processing and node positioning processing are respectively performed to obtain the node position information of the target keyword.
[0159] In this embodiment, for example, if there are multiple target keywords, including: "Tsinghua", "Tsinghua University", "fresh", "China", "Chinese", for each target keyword, starting from the root node, steps S3021 to S3026 are respectively executed to independently complete node positioning, and the traversal processes between multiple target keywords do not interfere with each other.
[0160] Further, when constructing a double-array trie without leaf nodes according to the preset corpus, for the same vocabulary group in the preset corpus, when constructing the double-array trie in different orders using the preset character encoding table, the base arrays in the obtained double-array trie are also different.
[0161] For example, the vocabulary group includes: "Tsinghua", "Tsinghua University", "fresh", "China", "Chinese"; and the transfer base of the root node is defined as 1.
[0162] In a possible embodiment, each character of each vocabulary in the vocabulary group is processed in sequence until all characters of all vocabularies are processed. At this time, the obtained base array is as follows:
[0163] Node positions of the base array: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18;
[0164] Corresponding transfer bases: 8, null, null, null, null, null, null, null, null, 10, 10, null, 10, 12, 15, 10, 12, 15, 10.
[0165] In a possible embodiment, the first characters of each vocabulary in the vocabulary group are processed in sequence, and then the second characters of each vocabulary are processed in sequence until all characters of the vocabulary group are completed.
[0166] For example, the first characters of each vocabulary in the vocabulary group are processed in sequence: "qing", "zhong", "hua"; by the transfer base and the encoded value of the character, the writing position is determined. At this time, the obtained base array is as follows:
[0167] Node positions of the base array: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
[0168] Corresponding transfer base: 1, null, 1, 1, null, null, null, 1, null, null, null.
[0169] Then, process the second character of each word in turn. When processing the character '华' in the word '清华', start from the root node, and through the transfer base and the encoding value of the character '清', find that the node position corresponding to the character '清' is 2, so as to calculate that the node position corresponding to the character '华' is 3.
[0170] During the character processing, if there is an effective node at the calculated target write position, it is determined that a state conflict occurs; perform a post-move processing on the conflict node, write the conflict node to the first empty array position after the target write position; and reconstruct the transfer base of the parent node corresponding to the conflict node; the calculation formula of the new transfer base is as follows:
[0171] New transfer base = empty position after the conflict node is post-moved - encoding value of the conflict character
[0172] Synchronously rewrite the transfer base of the parent node, and update the transfer base of the conflict node after post-movement to the new transfer base reconstructed by the parent node, ensuring that the positions calculated by all child nodes of the parent node through the new transfer base and the encoding value of the character are empty positions; until all character nodes are written and conflict processing is completed, the final base array is obtained.
[0173] For example, if there is already a transfer base in node position 3, then move the node position corresponding to the character '华' one position backward. At this time, the node position corresponding to the character '华' is 4.
[0174] Since the node corresponding to the character '华' cannot be written to the position predicted by the predecessor node corresponding to the character '清' at this time, in order to ensure that the node corresponding to the character '华' can be found through the predecessor node corresponding to the character '清', it is necessary to recalculate the transfer base of the node corresponding to the character '清' and rewrite the transfer base of the node corresponding to the character '清'. The calculation formula is as follows:
[0175] Transfer base of the node corresponding to the character '清' = node position corresponding to the character '华' - encoding value of the character '清'
[0176] Keep the transfer base of the node corresponding to the character '华' consistent with the transfer base of the node corresponding to the character '清'. At this time, the transfer base of the node corresponding to the character '华' is 2. <>
[0177] Until all characters in the word group are processed, the obtained base array is as follows:
[0178] Node positions of the base array: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
[0179] The corresponding transition bases are: 1, null, 3, 2, 2, 3, 6, 2, 3, 2, 6.
[0180] In a double-array trie, words can share a prefix, but conflicts can easily occur when the suffix has the same word or the suffix and prefix have the same word, requiring the reconstruction of new nodes.
[0181] When a conflict occurs, the transfer base of the parent node needs to be modified to ensure that the parent node can accommodate all child nodes. This will cause the already constructed child nodes to be reconstructed, increasing the construction time of the double array trie.
[0182] If a new word whose first character is not included in the dictionary causes a conflict, the root node's transfer cardinality needs to be rewritten, leading to a full reconstruction of the double-array trie. Therefore, the order in which nodes are constructed affects the construction speed and space utilization of the base array. In practical applications, the first character of all words is constructed first, and then child nodes are constructed layer by layer, limiting conflicts to a single parent node or between child nodes and avoiding large-scale reconstructions.
[0183] In some embodiments, the transition cardinality of the word ending node of the preset double-array trie can be marked with a negative number to avoid additional storage structures and further compress storage space.
[0184] In some embodiments, the preset double-array trie includes a constant identifier; wherein the constant identifier is the word ending node of the preset double-array trie.
[0185] In this embodiment, the constant identifier refers to the word tail node identifier of the double array trie; it is used to mark that the character traversal of the target keyword has been completed, that is, the current node is the word tail node corresponding to the target keyword. It can replace the method of taking a negative transfer cardinality to optimize the recognition efficiency of the word tail node and improve code readability and robustness.
[0186] In some embodiments, the sizes of the base array and the parity array can be dynamically adjusted to adapt to different data sizes, thereby optimizing memory allocation.
[0187] The conversational information retrieval method provided in this application achieves efficient traversal and accurate node positioning of target keywords through a dual-array trie where the radix and check array work together. By calculating node positions using the transfer radix and character encoding values, coupled with boundary checks and consistency judgment of check identifiers, it effectively avoids node positioning errors, ensures retrieval legitimacy, and significantly improves the accuracy and reliability of conversational information retrieval. To address node conflict issues, a mechanism of node shifting and parent node radix reconstruction is adopted to effectively resolve conflicts caused by prefixes and suffixes, as well as suffixes with the same character, reducing the probability of full tree reconstruction, improving the speed and space utilization of radix array construction, and reducing construction time. End-word nodes are marked using either a negative transfer radix or a constant identifier, balancing storage space compression and recognition efficiency, improving code readability and robustness. It supports independent positioning of multiple target keywords without interference, adapting to multi-keyword retrieval needs, and overall improving the efficiency, stability, and practicality of conversational information retrieval.
[0188] Figure 4 Flowchart of the conversational information retrieval method provided in this application Figure 3 ,like Figure 4 As shown, in this embodiment... Figure 2 Based on the examples, the conversational information retrieval method is described in detail, which includes:
[0189] S401. Obtain the information to be retrieved.
[0190] In this embodiment, the system receives user-initiated search requests through interactive methods such as a conversational search interface, speech-to-text conversion, and text input boxes to obtain the information to be searched.
[0191] The information to be retrieved includes text-based, time-based, and geographic information.
[0192] For example, the information to be retrieved could be: how active was the production in the First Industrial Park from January to March 2023, or what was the urbanization rate of Suzhou in May 2023.
[0193] S402. Perform semantic analysis on the information to be retrieved to obtain the keywords corresponding to the information to be retrieved.
[0194] In this embodiment, natural language processing technology is used to preprocess the information to be retrieved to obtain the keywords corresponding to the information to be retrieved; wherein, the preprocessing includes word segmentation, stop word removal, and keyword extraction.
[0195] The target keywords include words related to geography, time, and attributes.
[0196] For example, target keywords include:
[0197] Geography: First Industrial Park, Suzhou City;
[0198] Time period: January to March 2023, May 2023;
[0199] Attributes: Production activity, urbanization.
[0200] S403. Generate a dialogue strategy based on keywords.
[0201] In this embodiment, the extracted keywords undergo validity verification to determine if there are issues such as keyword ambiguity, missing information, or semantic ambiguity. Based on the verification results, a corresponding dialogue strategy is generated to ensure that the subsequently acquired target keywords are accurate and unambiguous. The dialogue strategies include confirmatory, supplementary, and clarifying strategies. For example, if the validity verification of the extracted keywords reveals that "First Industrial Park" has a vague targeting issue, a location-confirming dialogue strategy is generated as follows: "Which city's First Industrial Park are you referring to? For example, Suzhou, Chengdu, Beijing, etc."
[0202] S404. Based on the dialogue strategy, interact with the user to obtain the target keywords corresponding to the information to be retrieved.
[0203] In this embodiment, the generated dialogue strategy is fed back to the user in natural language, the user's interactive response is received, and the keywords are corrected, completed, and confirmed based on the user's interactive response to obtain target keywords with unique search points.
[0204] S405. Analyze the target keywords using time series natural language processing techniques and extract their temporal features.
[0205] In this embodiment, time series natural language processing technology is used to analyze time-related words in the target keywords, identify basic time concepts such as morning, evening, noon, and dusk, and analyze the future development trend of time, thereby obtaining the time characteristics of the target keywords.
[0206] Among them, time series natural language processing technology is trained based on semantic regular expressions, and performs semantic matching through regular expressions to improve the flexibility of text content matching. The implementation algorithms of semantic regular expressions include rule-based matching, statistical matching, and deep learning-based matching.
[0207] S406. Based on time characteristics and node location information, query the preset database to obtain the target information corresponding to the target keywords.
[0208] In some embodiments, when querying a preset database based on time characteristics and node location information to obtain target information corresponding to target keywords, for geographic target information, the backend first calculates signaling aggregation information based on the geographic name and precise geographic boundary coordinates in the target information, and then filters out signaling aggregation data that falls within the precise geographic boundary coordinate range through spatial matching. Finally, the corresponding signaling aggregation results are displayed according to the geographic target information dimension, realizing the association between signaling data and specific geographic space, and ensuring that the data display fits the geographic needs specified by the user.
[0209] The conversational information retrieval method provided in this application acquires various types of information to be retrieved through multiple interactive methods. It combines natural language processing preprocessing to extract keywords and uses dialogue strategies to clarify and complete ambiguous or missing keywords, ensuring the accuracy and unambiguity of target keywords and improving user interaction convenience. Employing time-series natural language processing technology based on semantic regularization, it can accurately extract time features, taking into account both basic time concepts and future trend analysis, ensuring the accuracy of time-dimensional retrieval. When querying the database, it achieves precise association between signaling data and geospatial data through geographic boundary coordinates and signaling aggregation data spatial matching, ensuring that the displayed data matches the user's geographic needs. This method achieves end-to-end optimization of retrieval interaction, keyword extraction, time analysis, and data query, significantly improving the accuracy, convenience, and targeting of conversational retrieval, and efficiently meeting users' natural language retrieval needs.
[0210] Figure 5 A schematic diagram of the conversational information retrieval device provided in this application is shown below. Figure 5 As shown, the conversational information retrieval device provided in this embodiment includes:
[0211] The acquisition module 501 is used to acquire the target keywords corresponding to the information to be retrieved.
[0212] The module 502 is used to perform character traversal and node positioning processing on the target keyword according to the preset double-array trie to obtain the node position information of the target keyword. The preset double-array trie includes a base array and a check array. The base array stores the transition cardinality of each node. The transition cardinality is used to calculate the node position of the corresponding character in the target keyword. The check array stores the check identifier. The check identifier is used to check the legality of the node transition.
[0213] Optionally, the preset double-array trie includes constant identifiers; wherein, the constant identifiers are the word ending nodes of the preset double-array trie.
[0214] The query module 503 is used to query a preset database based on node location information.
[0215] The 504 determination module is used to determine the target information corresponding to the target keywords based on the query results.
[0216] In one possible implementation, module 502 can also be used for:
[0217] Use the root node of the double-array trie as the current node;
[0218] For each character in the target keyword, iterate through the double-array trie for processing;
[0219] Iterate through each character in the target keyword, performing the following steps:
[0220] Get the transition cardinality of the current node in the base array, and the encoding value of the current character in the preset character encoding table;
[0221] Calculate the target node position corresponding to the current character based on the transition cardinality and the encoding value;
[0222] Obtain the verification identifier corresponding to the target node position from the verification array; where the verification identifier is the transition cardinality of the target node's parent node;
[0223] Determine whether the verification identifier is consistent with the transition base of the current node;
[0224] If they match, update the target node to the current node and continue traversing the next character;
[0225] If they do not match, then the target keyword is not in the double-array trie;
[0226] After all characters have been traversed, the final current node position is output as the node position information of the target keyword.
[0227] In one possible implementation, module 502 can also be used for:
[0228] If there are multiple target keywords, then for each target keyword, character traversal and node positioning are performed according to the preset double-array trie to obtain the node position information of the target keyword.
[0229] In one possible implementation, after calculating the target node position corresponding to the current character, module 502 can also be used for:
[0230] Obtain the valid index range of the preset double-array trie; where the valid index range is the array length of the base array and the parity array, and the array lengths of the base array and the parity array are the same;
[0231] Based on the valid index range, perform boundary checks on the target node location to obtain the boundary check results;
[0232] If the boundary check result indicates that the target node position is within the valid index range, then proceed to obtain the check identifier corresponding to the target node position in the check array;
[0233] If the boundary check result indicates that the target node location is not within the valid index range, the traversal will terminate and a retrieval failure feedback message will be generated.
[0234] In one possible implementation, after obtaining the target keywords corresponding to the information to be retrieved, the query module 503 can also be used for:
[0235] Using time series natural language processing techniques, the target keywords are analyzed to extract their temporal features;
[0236] Based on time characteristics and node location information, a pre-set database is queried to obtain target information corresponding to the target keywords.
[0237] In one possible implementation, the acquisition module 501 can also be used for:
[0238] Retrieve the information to be searched;
[0239] Perform semantic analysis on the information to be retrieved to obtain the keywords corresponding to the information to be retrieved;
[0240] Generate a dialogue strategy based on keywords;
[0241] Based on the dialogue strategy, interact with the user to obtain the target keywords corresponding to the information to be retrieved.
[0242] The conversational information retrieval device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0243] Figure 6 A schematic diagram of the structure of the electronic device provided in this application. Figure 6 As shown, the electronic device provided in this embodiment includes at least one processor 601 and a memory 602. Optionally, the electronic device further includes a communication component 603. The processor 601, memory 602, and communication component 603 are connected via a bus 604.
[0244] In a specific implementation, at least one processor 601 executes computer execution instructions stored in memory 602, causing at least one processor 601 to perform the above-described method.
[0245] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0246] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0247] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0248] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0249] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0250] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0251] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0252] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0253] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0254] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0255] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0256] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0257] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0258] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A conversational information retrieval method, characterized in that, include: Obtain the target keywords corresponding to the information to be retrieved; Based on a preset double-array trie, character traversal and node positioning are performed on the target keyword to obtain the node position information of the target keyword; wherein, the preset double-array trie includes a base array and a check array, the base array stores the transition cardinality of each node, the transition cardinality is used to calculate the node position of the corresponding character in the target keyword, and the check array stores a check identifier, the check identifier is used to check the legality of node transition; Based on the node location information, query the preset database; Based on the query results, determine the target information corresponding to the target keywords.
2. The method according to claim 1, characterized in that, The step of performing character traversal and node positioning processing on the target keyword based on a preset double-array trie to obtain the node position information of the target keyword includes: The root node of the double-array trie is taken as the current node; For each character in the target keyword, traverse the double-array trie. Iterate through each character in the target keyword and perform the following steps: Obtain the transition cardinality of the current node in the base array, and the encoding value of the current character in the preset character encoding table; Calculate the target node position corresponding to the current character based on the transition cardinality and the encoding value; Obtain the verification identifier corresponding to the target node position from the verification array; wherein, the verification identifier is the transition cardinality of the target node's parent node; Determine whether the verification identifier is consistent with the transition base of the current node; If they match, update the target node to the current node and continue traversing the next character; If there is a discrepancy, then the target keyword is determined not to be in the double-array trie; After all the characters have been traversed, the final current node position is output as the node position information of the target keyword.
3. The method according to claim 2, characterized in that, If there are multiple target keywords, then for each target keyword, character traversal processing and node positioning processing are performed according to the preset double-array trie to obtain the node position information of the target keyword.
4. The method according to claim 2, characterized in that, After calculating the target node position corresponding to the current character based on the transition cardinality and the encoding value, the process includes: Obtain the effective index range of the preset double-array trie; wherein, the effective index range is the array length of the base array and the check array, and the array lengths of the base array and the check array are the same; Based on the valid index range, a boundary check is performed on the target node position to obtain the boundary check result; If the boundary check result indicates that the target node position is within the valid index range, then the step of obtaining the verification identifier corresponding to the target node position in the verification array is executed; If the boundary check result indicates that the target node position is not within the valid index range, the traversal is terminated and a retrieval failure feedback message is generated.
5. The method according to claim 2, characterized in that, The preset double-array trie includes constant identifiers; wherein, the constant identifiers are the word ending nodes of the preset double-array trie.
6. The method according to claim 1, characterized in that, After obtaining the target keywords corresponding to the information to be retrieved, the method further includes: The target keywords are analyzed using time series natural language processing techniques to extract their temporal features. Based on the time characteristics and the node location information, a preset database is queried to obtain the target information corresponding to the target keyword.
7. The method according to claim 1, characterized in that, The step of obtaining the target keywords corresponding to the information to be retrieved includes: Retrieve the information to be searched; Semantic analysis is performed on the information to be retrieved to obtain the keywords corresponding to the information to be retrieved; Generate a dialogue strategy based on the keywords; According to the dialogue strategy, interact with the user to obtain the target keywords corresponding to the information to be retrieved.
8. A conversational information retrieval device, characterized in that, include: The acquisition module is used to acquire the target keywords corresponding to the information to be retrieved; The module is used to perform character traversal and node positioning processing on the target keyword according to a preset double-array trie to obtain the node position information of the target keyword; wherein, the preset double-array trie includes a base array and a check array, the base array stores the transition cardinality of each node, the transition cardinality is used to calculate the node position of the corresponding character in the target keyword, and the check array stores a check identifier, the check identifier is used to check the legality of node transitions; The query module is used to query a preset database based on the node location information; The determination module is used to determine the target information corresponding to the target keywords based on the query results.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.
11. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-7.