Query word completion method and device, and electronic device

By employing recursive processing in the prefix tree using both full and abbreviated pinyin modes, and combining the association between initials and finals, the problem of low accuracy in query word completion in existing technologies is solved, achieving efficient and accurate pinyin completion and retrieval.

CN123030698APending Publication Date: 2026-11-03NAVINFO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611290645.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-24
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing technologies for query word completion in Chinese input rely on hard segmentation schemes based on statistical word segmentation or streaming dictionaries, resulting in low accuracy and an inability to effectively utilize the real bifurcation context of the backend POI entity database. Furthermore, character-by-character matching leads to syllable boundary loss and computational latency explosion.

Method used

A recursive processing mode is adopted, which matches and consumes Pinyin stream data in the prefix tree through full Pinyin track mode and simplified Pinyin track mode. Combining the relationship between initials and finals, the matching strategy is dynamically selected to form a complete Pinyin path, avoiding interference from the original mixed text format, and achieving adaptive consumption at the input end.

Benefits of technology

It significantly improves the accuracy and scene coverage of pinyin completion, ensuring that any matching path corresponds to a real entity pinyin sequence, thereby improving retrieval efficiency and recall capabilities, and reducing homophone noise and computational latency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123030698A_ABST
    Figure CN123030698A_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the technical field of data processing, and provide a query word completion method and device and electronic equipment. The method comprises: obtaining to-be-queried pinyin stream data; determining a recursive processing mode of the to-be-queried pinyin stream data according to the to-be-queried pinyin stream data and prefix tree data, wherein the recursive processing mode comprises a full-pinyin track mode and a simplified-pinyin track mode, the prefix tree data comprises at least one node, each node comprises a pinyin segment composed of at least one character, and there is a hierarchical association relationship between adjacent nodes, the hierarchical association relationship is used to indicate that a complete pinyin path is formed by splicing the pinyin segment stored in a parent node and the pinyin segment stored in a child node; and determining a query word candidate result corresponding to the to-be-queried pinyin stream data in the prefix tree data according to the recursive processing mode. The technical solution can improve the completion accuracy of query words.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus and electronic device for query term completion. Background Technology

[0002] In modern map navigation systems, in-vehicle navigation devices, and local life service platforms, users often need to quickly locate points of interest (POIs) through input boxes. Due to the special nature of Chinese input, user input often presents a complex form that combines Chinese characters with polymorphic pinyin.

[0003] Currently, query word completion is mainly achieved through a pre-processing hard segmentation recall scheme based on statistical word segmentation or streaming dictionary. That is, after receiving a mixed text query, a pre-processing pinyin / Chinese segmenter is used in isolation at the input end.

[0004] However, the above scheme, which completely deviates from the actual forking context of the backend POI entity database, performs pre-hard segmentation in isolation at the input end, which greatly reduces the accuracy of query term completion. Summary of the Invention

[0005] The query term completion method, apparatus, and electronic device provided in this application are used to achieve the technical effect of improving the accuracy of query term completion.

[0006] In a first aspect, embodiments of this application provide a query term completion method, including:

[0007] Retrieve the Pinyin stream data to be queried;

[0008] Based on the queried pinyin stream data and prefix tree data, a recursive processing mode for the queried pinyin stream data is determined. The recursive processing mode includes a full pinyin path mode and a simplified pinyin path mode. The prefix tree data includes at least one node, and each node includes at least one pinyin segment composed of at least one character. There is a hierarchical relationship between nodes at adjacent levels. The hierarchical relationship is used to indicate how to splice the pinyin segments stored in the parent node with the pinyin segments stored in the child node to form a complete pinyin path. The full pinyin path mode is a mode that matches and consumes pinyin syllables as units, and the simplified pinyin path mode is a mode that uses the initial consonant character as the starting anchor point and performs multi-path matching through the predicted set of vowels.

[0009] Based on the recursive processing mode, candidate query words corresponding to the Pinyin stream data to be queried are determined from the prefix tree data.

[0010] In one or more embodiments, determining the candidate query word for the Pinyin stream data to be queried from the prefix tree data according to the recursive processing mode includes:

[0011] According to the recursive processing mode, the matching and consumption processing of the current recursive layer is performed on the Pinyin stream data to be queried, and the recursive processing mode is redefined in the next recursive layer until the Pinyin stream data to be queried is consumed.

[0012] If the query Pinyin stream data is consumed, the query terms associated with the current node and its subordinate leaf nodes will be determined as the candidate results of the query terms.

[0013] In the first recursive layer, the root node of the prefix tree data is used as the current node, and in each subsequent recursive layer, the matched child node is used as the current node. The root node is the starting node of the hierarchical association relationship.

[0014] In one or more embodiments, the recursive processing mode is the full track stitching mode;

[0015] Accordingly, the step of performing matching and consumption processing on the Pinyin stream data to be queried according to the recursive processing mode includes:

[0016] The current syllable in the queried pinyin stream data is compared with the pinyin segments stored in the child nodes of the current node;

[0017] When the current syllable is completely identical to the pinyin segment stored in the child node, the current syllable is consumed from the pinyin stream data to be queried, and the current node is updated to the matched child node.

[0018] In one or more embodiments, the recursive processing mode is the simplified track assembly mode;

[0019] Accordingly, the step of performing matching and consumption processing on the Pinyin stream data to be queried according to the recursive processing mode includes:

[0020] The first character of the current syllable in the Pinyin stream data to be queried is determined as the initial consonant to be queried;

[0021] A candidate set of finals is generated based on the initial consonant to be queried, and each candidate final in the candidate set is matched with the pinyin fragments stored in each child node of the current node.

[0022] The successfully matched child nodes are identified as candidate child nodes. The first character of the current syllable is consumed from the queried pinyin stream data, and each matched candidate child node is used as the current node of the next recursive layer.

[0023] In one or more embodiments, determining the recursive processing mode of the Pinyin stream data to be queried based on the Pinyin stream data to be queried and the prefix tree data includes:

[0024] Based on the association between the current syllable in the queried pinyin stream data and the pinyin fragments stored in the child nodes of the current node in the prefix tree data, the recursive processing mode is determined.

[0025] The association relationship is used to indicate the degree of matching and / or matching type between the current syllable and the pinyin fragment stored in the child node.

[0026] In one or more embodiments, the association includes at least one of the following:

[0027] The current syllable and the pinyin fragment stored in the child node are either completely or partially matched at the character level.

[0028] The character length of the current syllable is equal to or not equal to the character length of the pinyin segment stored in the child node;

[0029] The correspondence between the composition type of the current syllable and the composition type of the pinyin segment stored in the child node, wherein the composition type includes: independent initial consonant type and complete syllable type;

[0030] The consistency relationship between the first character of the current syllable and the first character of the pinyin segment stored in the child node.

[0031] In one or more embodiments, obtaining the Pinyin stream data to be queried includes:

[0032] Get the string data input by the user;

[0033] If the string data contains Chinese characters, the Chinese characters are converted into Pinyin characters to obtain the Pinyin stream data to be queried, and the feature data of the Chinese characters are obtained.

[0034] If the string data does not contain any Chinese characters, the string data is determined to be the Pinyin stream data to be queried.

[0035] In one or more embodiments, the method further includes:

[0036] Based on the feature data of the Chinese characters, the query term candidate results are subjected to reverse semantic verification;

[0037] Based on the verification results, the target query term that matches the string data is determined from the query term candidate results.

[0038] Secondly, embodiments of this application provide a query term completion device, comprising:

[0039] The acquisition module is used to acquire the Pinyin stream data to be queried;

[0040] The first determining module is used to determine the recursive processing mode of the queried pinyin stream data based on the queried pinyin stream data and the prefix tree data. The recursive processing mode includes a full pinyin path mode and a simplified pinyin path mode. The prefix tree data includes at least one node, and each node includes a pinyin segment consisting of at least one character. There is a hierarchical relationship between nodes at adjacent levels. The hierarchical relationship is used to indicate that the pinyin segment stored in the parent node is spliced ​​with the pinyin segment stored in the child node to form a complete pinyin path. The full pinyin path mode is a mode of matching and consuming pinyin syllables. The simplified pinyin path mode is a mode of multi-path matching based on the initial consonant character as the starting anchor point and through the prediction of the vowel set.

[0041] The second determining module is used to determine the candidate query word results corresponding to the Pinyin stream data to be queried in the prefix tree data according to the recursive processing mode.

[0042] In one or more embodiments, the second determining module, according to the recursive processing mode, determines the candidate query word results corresponding to the Pinyin stream data to be queried in the prefix tree data, specifically for:

[0043] According to the recursive processing mode, the matching and consumption processing of the current recursive layer is performed on the Pinyin stream data to be queried, and the recursive processing mode is redefined in the next recursive layer until the Pinyin stream data to be queried is consumed.

[0044] If the query Pinyin stream data is consumed, the query terms associated with the current node and its subordinate leaf nodes will be determined as the candidate results of the query terms.

[0045] In the first recursive layer, the root node of the prefix tree data is used as the current node, and in each subsequent recursive layer, the matched child node is used as the current node. The root node is the starting node of the hierarchical association relationship.

[0046] In one or more embodiments, the recursive processing mode is the full track stitching mode;

[0047] Accordingly, the second determining module, based on the recursive processing mode, performs matching and consumption processing of the current recursive layer on the Pinyin stream data to be queried, specifically for:

[0048] The current syllable in the queried pinyin stream data is compared with the pinyin segments stored in the child nodes of the current node;

[0049] When the current syllable is completely identical to the pinyin segment stored in the child node, the current syllable is consumed from the pinyin stream data to be queried, and the current node is updated to the matched child node.

[0050] In one or more embodiments, the recursive processing mode is the simplified track assembly mode;

[0051] Accordingly, the second determining module, based on the recursive processing mode, performs matching and consumption processing of the current recursive layer on the Pinyin stream data to be queried, specifically for:

[0052] The first character of the current syllable in the Pinyin stream data to be queried is determined as the initial consonant to be queried;

[0053] A candidate set of finals is generated based on the initial consonant to be queried, and each candidate final in the candidate set is matched with the pinyin fragments stored in each child node of the current node.

[0054] The successfully matched child nodes are identified as candidate child nodes. The first character of the current syllable is consumed from the queried pinyin stream data, and each matched candidate child node is used as the current node of the next recursive layer.

[0055] In one or more embodiments, the first determining module determines the recursive processing mode of the queried pinyin stream data based on the queried pinyin stream data and the prefix tree data, specifically for:

[0056] Based on the association between the current syllable in the queried pinyin stream data and the pinyin fragments stored in the child nodes of the current node in the prefix tree data, the recursive processing mode is determined.

[0057] The association relationship is used to indicate the degree of matching and / or matching type between the current syllable and the pinyin fragment stored in the child node.

[0058] In one or more embodiments, the association includes at least one of the following:

[0059] The current syllable and the pinyin fragment stored in the child node are either completely or partially matched at the character level.

[0060] The character length of the current syllable is equal to or not equal to the character length of the pinyin segment stored in the child node;

[0061] The correspondence between the composition type of the current syllable and the composition type of the pinyin segment stored in the child node, wherein the composition type includes: independent initial consonant type and complete syllable type;

[0062] The consistency relationship between the first character of the current syllable and the first character of the pinyin segment stored in the child node.

[0063] In one or more embodiments, the acquisition module acquires the Pinyin stream data to be queried, specifically for:

[0064] Get the string data input by the user;

[0065] If the string data contains Chinese characters, the Chinese characters are converted into Pinyin characters to obtain the Pinyin stream data to be queried, and the feature data of the Chinese characters are obtained.

[0066] If the string data does not contain any Chinese characters, the string data is determined to be the Pinyin stream data to be queried.

[0067] In one or more embodiments, the second determining module is further configured to:

[0068] Based on the feature data of the Chinese characters, the query term candidate results are subjected to reverse semantic verification;

[0069] Based on the verification results, the target query term that matches the string data is determined from the query term candidate results.

[0070] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0071] The memory stores computer-executed instructions;

[0072] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0073] 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.

[0074] 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.

[0075] The query word completion method, apparatus, and electronic device provided in this application embodiment acquire the query pinyin stream data; determine the recursive processing mode of the query pinyin stream data based on the query pinyin stream data and prefix tree data, the recursive processing mode includes: full pinyin track mode and simplified pinyin track mode, the prefix tree data includes at least one node, each node includes: at least one pinyin segment composed of at least one character, and there is a hierarchical relationship between adjacent level nodes, the hierarchical relationship is used to indicate the concatenation of the pinyin segment stored in the parent node with the pinyin segment stored in the child node to form a complete pinyin path; the full pinyin track mode is a mode of matching and consuming pinyin syllables, the simplified pinyin track mode is a mode of multi-way matching based on the initial consonant character as the starting anchor point and through the predicted vowel set; according to the recursive processing mode, the query word candidate result corresponding to the query pinyin stream data is determined in the prefix tree data. This technical solution avoids format interference from the original mixed text by acquiring the Pinyin stream data to be queried. It determines the recursive processing mode based on the Pinyin stream data and the prefix tree data, enabling dynamic selection of matching strategies during traversal. The prefix tree data stores Pinyin fragments and hierarchical relationships through nodes to form complete Pinyin paths, internalizing the constraints of Pinyin combinations into the data structure and ensuring that any matching path corresponds to a real-world Pinyin sequence. The full Pinyin track mode matches and consumes Pinyin syllables, enabling rapid consumption with large steps when the input is complete, improving retrieval efficiency in precise matching scenarios. The simplified Pinyin track mode uses initial consonant characters as starting anchors and performs multi-path matching through predicted vowel sets, automatically completing all possible complete syllables and traversing even when the input is only an initial consonant abbreviation, thus significantly improving recall capability under short input. Finally, based on the recursive processing mode, candidate query results are determined in the prefix tree, achieving seamless switching and collaborative retrieval between full and simplified Pinyin during the recursive process, significantly improving the accuracy and scenario coverage of Pinyin completion. Attached Figure Description

[0076] 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.

[0077] Figure 1 A schematic diagram of the architecture and signal flow of the query term completion system provided in the embodiments of this application;

[0078] Figure 2 A flowchart illustrating the query term completion method provided in this application embodiment. Figure 1 ;

[0079] Figure 3 A flowchart illustrating the query term completion method provided in this application embodiment. Figure 2 ;

[0080] Figure 4 A flowchart illustrating the query term completion method provided in this application embodiment. Figure 3 ;

[0081] Figure 5 A flowchart illustrating the query term completion method provided in this application embodiment. Figure 4 ;

[0082] Figure 6 A schematic diagram of the structure of the query term completion device provided in the embodiments of this application;

[0083] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0084] 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 concepts of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0085] 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.

[0086] In the field of Chinese geospatial entity (POI) suggestion and autocomplete, when faced with highly interwoven and varied polymorphic pinyin mixed text input by users, consisting of Chinese characters, abbreviated pinyin, and full pinyin, the closest existing technology typically adopts the following approach:

[0087] Approach 1: Pre-processing hard segmentation recall scheme based on statistical word segmentation or streaming dictionary:

[0088] Implementation Mechanism: Upon receiving a mixed text query, the system employs a pre-processed Pinyin / Chinese character segmenter (e.g., based on a Markov model or static bidirectional maximum matching) at the input end. This segmenter attempts to divide the mixed string into discrete Chinese character tokens, full Pinyin syllable tokens, and abbreviated Pinyin initials tokens. Subsequently, these segmented static tokens are used to concurrently search the inverted index or standard prefix tree. Finally, the system performs intersection and union calculations and sorting of the multi-way recall candidate sets externally before outputting the results.

[0089] Method 2: Character-by-character prefix fuzzy matching scheme for flat pure Pinyin stream:

[0090] Implementation mechanism: In the offline phase, all POIs are converted into pure pinyin character strings. During online retrieval, the mixed query is also uniformly converted into a flat pure pinyin stream in a one-size-fits-all manner (for example, "亥天dx" is converted to haitiandx), and rigid prefix matching is performed character by character on the prefix tree with a fixed step size of 1, without any awareness of the physical boundaries of Chinese initials and finals.

[0091] However, through cause-effect analysis, it is found that the above conventional approach has the following deep-seated defects when processing mixed input of Chinese characters and polymorphic pinyin:

[0092] 1) Cascading errors of segmentation ambiguity caused by pre-positive static segmentation lead to severe missed recall of target POIs:

[0093] Root cause: Chinese pinyin has no natural separators, and the syllable stream has natural overlapping ambiguity (for example, "chang" can be the full pinyin of the Chinese character "常", or a combination of four abbreviated pinyin initials c-h-a-g).

[0094] The above first existing approach performs isolated pre-positive forced segmentation at the input end, completely divorced from the real branching context of the backend POI entity library.

[0095] Technical effect: Once the pre-segmenter makes a wrong prediction (for example, the user intends to input a mixed string of abbreviated pinyin + full pinyin, but the system mistakenly segments it into a pure full pinyin sequence), the subsequent retrieval process will completely drill down along the wrong branch. This cascading effect where an error in the previous stage leads to total errors in subsequent stages will cause the target POI branch to be incorrectly pruned in the early stage of retrieval, resulting in severe missed recall (sharp drop in recall).

[0096] 2) Syllable boundary loss and exponential divergence caused by character-by-character matching lead to homophone pollution and computational latency explosion:

[0097] Root cause: The above second existing approach forcibly reduces the dimension of mixed text into a pure pinyin stream, adopts character-by-character comparison, and completely loses the natural physical boundary and constraint information of Chinese initials, finals, and Chinese characters in the mixed input.

[0098] Technical Effect: When faced with queries interwoven with long tails of Chinese characters and polymorphic pinyin, the system cannot determine whether a character is a vowel within a full pinyin syllable or the abbreviated initial consonant of the next independent entity. This causes the prefix tree to blindly probe and recall a large number of noisy POIs that superficially overlap in pinyin but are logically completely unrelated, leading to an exponential divergence in the search space. This not only severely wastes the computing power of the server's central processing unit (CPU) (causing high latency in completion), but also generates a large amount of homophone noise (leading to a sharp drop in precision).

[0099] To address the technical problems existing in the current technology, the inventors of this application propose the following: The reason why the current solution has low accuracy is that the fixed process of segmenting first and then querying forcibly breaks the originally continuous Pinyin stream at the input end, making it irreversible once a segmentation error occurs. To overcome this barrier, if the query processing can be changed from offline hard segmentation to online adaptive consumption, that is, no longer pre-setting any segmentation boundaries, but uniformly normalizing the mixed text input by the user into a pure Pinyin stream and constructing a prefix tree that can be recursively traversed; on this basis, a runtime multi-track mode is introduced, using the initial consonant as a natural boundary anchor point. During the traversal of the prefix tree nodes, based on the current character of the Pinyin stream, the full Pinyin track large step length matching or the simplified Pinyin track reverse prediction and deep search are selected in real time, so that segmentation and matching are performed synchronously, and any pseudo-paths can be pruned in real time during the traversal. Thus, without relying on the backend POI entity library, the accuracy of completion can be greatly improved by relying solely on the pre-processing at the input end.

[0100] and then, Figure 1 A schematic diagram of the architecture and signal flow of the query term completion system provided in the embodiments of this application is shown below. Figure 1 As shown, this illustrates the collaborative relationship between the online runtime Chinese character and polymorphic Pinyin state machine and the post-verifier:

[0101] Module 1), Online Input Normalization and Context Push:

[0102] User input is a mixed query: polymorphic text covering any defined combination of Chinese characters, pure Pinyin, pure full Pinyin, and abbreviated Pinyin, which is then executed.

[0103] Path 1: Extract original Chinese character boundary information → context stack (preserve original information) → send to the retrieval core;

[0104] Path 2: [Pre-processing sound conversion engine] Normalizes pure Pinyin stream → Sends it to the retrieval core;

[0105] Module 2), Runtime Streaming State Machine: Adaptive Track Switching and Syllable Prediction Depth-First Search (DFS) Recursion:

[0106] Adaptive multi-track state machine controller (MatchLouds recursive engine); initial consonant table;

[0107] Adaptive orbit estimator:

[0108] Track 1: Chinese Penetration Track (direct access via Chinese character phonetic segments);

[0109] Track 2: Full-track mode (conforms to vowel rules, large step length consumption);

[0110] Track 3: Simplified Pinyin Track Mode (Dynamic prediction of legal vowel syllables at runtime: Based on the current initial consonant-derived full-pinyin candidate stream, drive the prefix tree to perform multi-way DFS for precise drill-down).

[0111] That is:

[0112] "When determining whether the current syllable should use the full or abbreviated track mode, the adaptive track evaluator dynamically evaluates the information from multiple dimensions, including:"

[0113] (1) The structural characteristics of the remaining string after the current character, such as whether the remaining input begins with a vowel letter;

[0114] (2) Label information on the current Trie node, that is, the content and length of the pinyin fragment stored in the current node;

[0115] (3) The set of all reachable syllables under the current node, that is, the distribution of the pinyin segments stored in the child nodes;

[0116] (4) Whether there is a valid combination of vowels after the current initial consonant, that is, whether the first character of the current input has the conditions to form a complete syllable;

[0117] (5) The trend of input length change, that is, the ratio of the current consumed length to the total input length;

[0118] (6) The historical state of the current path, i.e., the processing mode records used by each previous recursive level;

[0119] (7) Whether there is a complete syllable that can be directly consumed, that is, whether the current input prefix is ​​completely consistent with the pinyin fragment stored in a certain child node.

[0120] Furthermore, the multidimensional information shown above can be weighted and synthesized to output the final orbit determination result.

[0121] Read the next input character and proceed to the next recursive iteration of the state machine;

[0122] Trigger candidate coarse screening and recall at leaf nodes;

[0123] Wherein, the core mechanisms of the second module are: multi-track adaptive switching, dynamic syllable prediction, trie DFS drill-down, and large step size consumption optimization;

[0124] Module 3), post-processing reverse semantic verifier:

[0125] Context stack (original Chinese character boundaries);

[0126] Performing reverse segmentation alignment verification on the original Chinese character boundaries in the context stack and candidate POI entities;

[0127] Eliminating homophone pollution and retaining the optimal candidate with consistent semantics;

[0128] Verification dimensions: boundary consistency verification / semantic relevance verification / homophone ambiguity elimination;

[0129] Output the accurate POI ID: 202.

[0130] It should be understood that the above is an example of a possible implementation of the method involved in the embodiments of the present application, and does not limit the specific execution implementation steps and the like of the present method.

[0131] The technical solution of the present application and how the technical solution of the present application solves the above technical problems will be described in detail below with specific embodiments. The execution subject of this technical solution is an electronic device, such as a vehicle, a server, and the like.

[0132] The following several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0133] Figure 2 is a schematic flowchart of the query term completion method provided by the embodiments of the present application Figure 1 , as Figure 2 shown, the method includes:

[0134] Step 21: Acquire pinyin stream data to be queried;

[0135] In this step, the pinyin stream data to be queried may be a data stream in a pure pinyin form obtained after pre-normalization processing.

[0136] In actual application scenarios, the query content input by the user in the input box of a map navigation application or a search engine may present various forms: complete pure pinyin input (e.g., haitiandaxue), pure simplified pinyin input (e.g., htdx), pure Chinese character input (e.g., 亥天大学), mixed Chinese character and pinyin input (e.g., 亥天dx, 亥天daxue), and the like.

[0137] To avoid introducing additional branch judgment logic due to heterogeneous data types in the subsequent trie traversal process, after obtaining the original user input, pre-normalization processing is preferably performed on it to unify all input forms into a pure pinyin stream, so as to obtain the pinyin stream data to be queried.

[0138] For example, when the user inputs "亥天dx" in the search box, the character string is acquired as the original input, then it is detected that it contains Chinese characters, which triggers the pinyin conversion normalization process (the specific conversion process is shown in step 42), and finally the pinyin stream data to be queried "haitiandx" is obtained;

[0139] For another example, when the user inputs "htdx", the character string is acquired and directly determined as the pinyin stream data to be queried "htdx". When the user inputs "haitiandaxue", it is also directly determined as the pinyin stream data to be queried "haitiandaxue".

[0140] Optionally, the POI indicated by the pinyin stream data to be queried in the present application may be a location or the like, that is, the trie data records a plurality of location-related name data.

[0141] Step 22: Determine a recursive processing mode for the pinyin stream data to be queried according to the pinyin stream data to be queried and the trie data;

[0142] The recursive processing mode includes a full pinyin track mode and a simplified pinyin track mode. The trie data includes at least one node, and each node includes a pinyin segment composed of at least one character, and there is a hierarchical association relationship between nodes of adjacent levels. The hierarchical association relationship is used to indicate that the pinyin segment stored in the parent node is spliced with the pinyin segment stored in the child node to form a complete pinyin path; the full pinyin track mode is a mode of matching and consuming in units of pinyin syllables, and the simplified pinyin track mode is a mode of taking initial consonant characters as starting anchors and performing multi-path matching by predicting a final set;

[0143] In this step, a trie data structure is pre-constructed. The trie data includes at least one node, each node stores a pinyin segment composed of at least one character, and there is a hierarchical association relationship between nodes of adjacent levels. The hierarchical association relationship is used to indicate that the pinyin segment stored in the parent node is spliced with the pinyin segment stored in the child node to form a complete pinyin path.

[0144] For example, for the target POI "Haitian University", its storage path in the prefix tree is: root node → Node_i (storing "hai") → Node_j (storing "tian") → Node_k (storing "da") → Node_l (storing "x") → Node_m (storing "ue"). By sequentially splicing the pinyin segments stored in each node along the hierarchical association relationship from the root node, the complete pinyin path "haitiandaxue" can be obtained.

[0145] Optionally, the recursive processing modes include a full pinyin track mode and a simplified pinyin track mode.

[0146] Wherein:

[0147] 1) The full pinyin track mode may be a processing mode that performs matching and consumption in units of complete pinyin syllables, that is, it is considered that the user inputs complete pinyin syllables (such as hai, tian, da, xue, etc.) in the current input stream to be matched. In this mode, segmentation is performed according to the natural boundaries of complete pinyin syllables to carry out exact matching with the pinyin segments stored in the child nodes of the prefix tree, and characters of the entire syllable length are consumed at one time after successful matching;

[0148] 2) The simplified pinyin track mode may be a processing mode that takes initial consonant characters as starting anchors and performs multi-path matching by dynamically predicting final vowel sets, that is, it is considered that the user only provides initial consonant information (such as h, t, d, x, etc.) in the current input stream and has not input complete syllables. Therefore, taking the initial consonant character as the starting anchor, all legal final vowels that can be possibly paired with the initial consonant are dynamically predicted to generate a set of candidate full pinyin syllables, and then multi-path matching is initiated in the child nodes of the prefix tree.

[0149] Optionally, step 22 may include: determining the recursive processing mode based on the association relationship between the current syllable in the pinyin stream data to be queried and the pinyin segments stored in the child nodes of the current node in the prefix tree data;

[0150] Wherein, the association relationship is used to indicate the matching degree and / or matching type between the current syllable and the pinyin segments stored in the child nodes.

[0151] In this implementation, when determining the recursive processing mode corresponding to the current syllable, it relies on the real-time evaluation of the association relationship between the current syllable in the pinyin stream data to be queried (that is, the current unconsumed syllable) and the pinyin segments stored in each child node of the current node in the prefix tree data. This association relationship can be the core basis for the runtime state machine to perform track determination, and reflects multiple matching dimensions between the current input syllable and the reachable paths in the underlying prefix tree. A runtime evaluator performs quantitative analysis and comprehensive judgment on these association relationships, so as to dynamically decide at the current recursion level whether to enter the full pinyin track mode or the simplified pinyin track mode.

[0152] Accordingly, the relationship includes at least one of the following:

[0153] The first item is whether the current syllable and the pinyin fragment stored in the child node are completely or partially matched at the character level.

[0154] In this implementation, this association is used to evaluate the overall consistency between the current syllable and the pinyin fragments of its child nodes at the character sequence level. The currently unconsumed syllable is treated as a complete string unit, and a string-level character-by-character comparison is performed between it and the pinyin fragments stored in each child node: if they are identical at every character position, it is considered a complete match; if there is a difference at any character position, or if one side's character sequence is a proper subset / superset of the other but the overall sequence is not equal, it is considered an incomplete match.

[0155] For example, for the input "haitiandaxue", the current syllable "hai" is read in the root node and compared with the "hai" stored in the child node Node_i. It is found that the two are completely identical at the character level ("h"="h", "a"="a", "i"="i"), so it is determined to be a complete match; while for the current syllable "h" in the input "htdx", it is compared with the "hai" stored in the child node Node_i. It is found that "h" is a prefix substring of "hai" rather than being completely equal, so it is determined to be a non-complete match.

[0156] Based on this relationship, it can be preliminarily determined that "hai" is suitable for full-spelling consumption, while "h" is not. Further consideration of other relationships is needed to determine whether to enter the simplified spelling track.

[0157] The second item is whether the character length of the current syllable is equal to or not equal to the character length of the pinyin segment stored in the child node;

[0158] In this implementation, this association is used to evaluate whether the character length of the current syllable is equal to or not equal to the character length of the child node's pinyin segment. The number of characters in the current syllable and the number of characters in the child node's pinyin segment are calculated separately and compared.

[0159] If the lengths are equal, it means that the current syllable has the potential to form a complete correspondence with a certain child node pinyin segment in terms of the number of characters, which can be one of the basic conditions for the full pinyin track mode; if the lengths are not equal (usually the current syllable length is less than the child node pinyin segment length, i.e. abbreviated pinyin scenario), it means that the current syllable cannot completely match the child node, and it is possible to evaluate whether to adopt the abbreviated pinyin track mode.

[0160] For example, in the input “haitiandaxue”, the length of the current syllable “hai” is 3, and the length of “hai” stored in the child node Node_i is also 3. Since the two lengths are equal, combined with other relationships, it can be determined that the input is in full-track mode. However, in the input “htdx”, the length of the current syllable “h” is 1, and the length of “hai” stored in the child node Node_i is 3. The two lengths are not equal, and the length of the current syllable is less than the length of the child node’s pinyin segment. Based on this, it can be determined that the current input is more likely to be in abbreviated-track mode.

[0161] The third item is the correspondence between the current syllable's composition type and the composition type of the pinyin segment stored in the child node. The composition types include: independent initial consonant type and complete syllable type.

[0162] In this implementation, this association is used to evaluate the type consistency between the composition type of the current syllable and the composition type of the child node pinyin fragments. The composition type is labeled for both the current syllable and the child node pinyin fragments: if a pinyin string can exist as an independent syllable in the Chinese Pinyin system (i.e., composed of both initials and finals, or composed only of finals but pronounced independently), it is labeled as a complete syllable type, such as "hai", "tian", "da", "xue", etc.; if a pinyin string consists of only one initial character (such as "b", "p", "m", "f", "d", ..., "c", "s", "y", "w", etc.), it is labeled as an "independent initial type". The composition type of the current syllable is then matched with the composition types of each child node pinyin fragment.

[0163] For example, in the input “htdx”, the current syllable “h” is marked as an independent initial consonant, and the “hai” stored in the child node Node_i is marked as a complete syllable. Based on this type correspondence, it is determined that the current syllable should use the abbreviated syllable mode. However, in the input “haitiandaxue”, the current syllable “hai” is marked as a complete syllable, and the “hai” stored in the child node Node_i is also a complete syllable. Therefore, it is determined that the full syllable mode should be used.

[0164] The fourth item is the consistency relationship between the first character of the current syllable and the first character of the pinyin segment stored in the child node.

[0165] In this implementation, this association is used to evaluate whether the first character of the current syllable matches the first character of the child node's pinyin segment. The first character of the current syllable (for a syllable of length 1, this character is itself) is extracted, along with the first character of the pinyin segment stored in each child node, and the two are compared. If they match, it means that the current syllable has an alignment basis with the child node's pinyin segment in terms of the starting character, regardless of whether it's a full pinyin track (complete match) or a simplified pinyin track (initial consonant alignment); if they don't match, the child node is directly excluded at the current recursive level and no longer participates in subsequent matching.

[0166] For example, in the input "htdaxue", the first character of the current syllable "h" is "h", and the first character of "hai" stored in the child node Node_i is also "h". Since they are consistent, the child node is retained to participate in the comprehensive evaluation of subsequent association relationships. However, for the current syllable "h", its first character "h" is compared with the first character "h" of "hai" stored in the child node Node_i. If they are inconsistent, Node_i is directly excluded at this level, and "d" will not be matched with "hai" in any subsequent way, thus achieving efficient path pruning.

[0167] Optionally, if and only if the first correlation indicator is a complete match and the second indicator has the same character length, it is directly determined to be the full-track mode; otherwise, if the first character of the fourth indicator is the same and the third indicator indicates that the current syllable is an independent initial consonant type, it is determined to be the abbreviated track mode; if neither mode condition is met, it is determined to be a mismatch and pruned.

[0168] Optionally, in some implementations, the recursive processing mode also includes a Chinese character pass-through mode. This mode is used to handle Chinese characters in the input stream that may not have undergone phonetic conversion.

[0169] When a Chinese character is detected in the current input stream (usually in scenarios where the preceding phonetic transcription is not fully covered, or when the user directly mixes Chinese characters into the Pinyin stream), the Chinese character penetration track is triggered: the current Chinese character is mapped and compared with the Pinyin fragments stored in each child node under the current node, that is, the Pinyin fragments of the child nodes are first reverse-translated into candidate Chinese characters, and then directly matched with the input Chinese character at the character level.

[0170] Step 23: Based on the recursive processing mode, determine the candidate query words corresponding to the Pinyin stream data to be queried in the prefix tree data.

[0171] In this step, the process of determining the candidate query results can be completed by a recursive matching engine, which is started with the recursive function MatchLouds(Node_Index, Rem_Query) as the entry point. Here, Node_Index represents the node in the current prefix tree data that has been traversed, and Rem_Query represents the remaining input string that has not yet been consumed.

[0172] Based on the recursive processing mode determined at the current recursive level, the matching engine is driven to perform path exploration in the prefix tree data. Finally, after all the Pinyin stream data to be queried has been consumed, the query words associated with the matched path are determined as candidate query results.

[0173] Optionally, the recursive matching engine continues to perform matching operations until all the Pinyin stream data to be queried has been consumed and there are no more reachable paths, or all search paths have been pruned and terminated.

[0174] The query word completion method provided in this application embodiment obtains the query pinyin stream data; based on the query pinyin stream data and prefix tree data, it determines the recursive processing mode of the query pinyin stream data. The recursive processing mode includes a full pinyin path mode and a simplified pinyin path mode. The prefix tree data includes at least one node, and each node includes at least one pinyin segment composed of at least one character. There is a hierarchical relationship between nodes at adjacent levels. The hierarchical relationship is used to indicate the connection between the pinyin segments stored in the parent node and the pinyin segments stored in the child node to form a complete pinyin path. The full pinyin path mode is a mode of matching and consuming pinyin syllables, and the simplified pinyin path mode is a mode of multi-path matching based on the initial consonant character as the starting anchor point and through the predicted vowel set. Based on the recursive processing mode, the candidate query word results corresponding to the query pinyin stream data are determined in the prefix tree data. This technical solution avoids format interference from the original mixed text by acquiring the Pinyin stream data to be queried. It determines the recursive processing mode based on the Pinyin stream data and the prefix tree data, enabling dynamic selection of matching strategies during traversal. The prefix tree data stores Pinyin fragments and hierarchical relationships through nodes to form complete Pinyin paths, internalizing the constraints of Pinyin combinations into the data structure and ensuring that any matching path corresponds to a real-world Pinyin sequence. The full Pinyin track mode matches and consumes Pinyin syllables, enabling rapid consumption with large steps when the input is complete, improving retrieval efficiency in precise matching scenarios. The simplified Pinyin track mode uses initial consonant characters as starting anchors and performs multi-path matching through predicted vowel sets, automatically completing all possible complete syllables and traversing even when the input is only an initial consonant abbreviation, thus significantly improving recall capability under short input. Finally, based on the recursive processing mode, candidate query results are determined in the prefix tree, achieving seamless switching and collaborative retrieval between full and simplified Pinyin during the recursive process, significantly improving the accuracy and scenario coverage of Pinyin completion.

[0175] Based on the above embodiments, Figure 3 A flowchart illustrating the query term completion method provided in this application embodiment. Figure 2 ,like Figure 3 As shown, step 23 may include:

[0176] Step 31: According to the recursive processing mode, perform matching and consumption processing of the current recursive layer on the Pinyin stream data to be queried, and enter the next recursive layer to redetermine the recursive processing mode until the Pinyin stream data to be queried is consumed.

[0177] In the first recursive layer, the root node of the prefix tree data is used as the current node, and in each subsequent recursive layer, the matched child node is used as the current node, and the root node is the starting node of the hierarchical relationship.

[0178] In this step, specific matching and consumption operations are performed at each recursive level according to the processing mode determined in step 22, and then the state machine is driven to enter the next recursive level until all the Pinyin stream data to be queried has been consumed. The starting node of each recursion is different: the first recursive level uses the root node of the prefix tree data as the current node, and each subsequent recursive level uses the child node that was successfully matched in the previous level as the new current node.

[0179] During the processing of each recursive level, all child nodes under the current node are first used as candidate matching pools. Then, based on the characteristics of the currently unconsumed input syllables, one of the full-track mode and the simplified-track mode is selected for execution.

[0180] Optionally, when the recursive processing mode is the full-track mode, one implementation of step 31, which involves performing matching and consumption processing of the current recursive layer on the pinyin stream data to be queried according to the recursive processing mode, could be:

[0181] Step 1: Compare the current syllable in the Pinyin stream data to be queried with the Pinyin segments stored in the child nodes of the current node;

[0182] In this implementation, when the current recursive level uses the full-track pinyin mode, the currently unconsumed syllables (a complete pinyin string, such as one of hai, tian, da, xue) in the pinyin stream data to be queried are compared character by character with the pinyin fragments stored in all child nodes of the current node. This comparison operation can be a complete string match comparison, that is, it is necessary to check whether each character of the current syllable is completely consistent with the corresponding character in the pinyin fragment of the child node. The process is repeated for each child node under the current node, performing the above comparison process on the pinyin fragments stored in each child node, and recording all child nodes that can achieve a complete match.

[0183] For example, when running to Node_i (which stores "hai") and the current input is "tian", "tian" is compared with the pinyin fragments stored in all child nodes of Node_i (such as Node_j which stores "tian", other nodes that store "dao", etc.). Only when compared with the child node that stores "tian" will a complete match result be produced.

[0184] Using the character length of the pinyin fragment stored in the child node as the unit, extract an equal-length prefix string from the current unconsumed position of the pinyin stream data to be queried, and compare this prefix string as the current syllable with the pinyin fragment stored in the child node character by character.

[0185] Step 2: When the current syllable is completely consistent with the pinyin fragment stored in the child node, consume the current syllable from the pinyin stream data to be queried and update the current node with the matched child node.

[0186] In this implementation, for all child nodes that match completely, the complete syllable is consumed from the query Pinyin stream data all at once (i.e., the character sequence corresponding to the syllable is removed from Rem_Query), and the current node is updated to the successfully matched child node.

[0187] This operation can be viewed as a large step consumption, where the step size is equal to the character length of the current syllable. For example, the step size of "hai" is 3, the step size of "tian" is 4, the step size of "da" is 2, and the step size of "xue" is 3.

[0188] After completing consumption and node update, proceed to the next recursive level, reread the next unconsumed input syllable under the new current node, and re-execute the recursive processing mode determination in step 22.

[0189] For example, in the input of "haitiandaxue" using only full Pinyin, the first step of the comparison is performed at the root node, which finds that the current syllable "hai" is completely consistent with the "hai" stored in Node_i; the second step is performed, consuming "hai" (leaving "tiandaxue"), and updating the current node to Node_i; entering the next recursive layer, the comparison of "tian" under Node_i is found to be completely consistent with the "tian" stored in the child node, consuming "tian" (leaving "daxue"), and updating the current node to Node_j; and so on, until all are consumed.

[0190] Furthermore, in full-track mode, the syllable segmentation boundaries are not fixed in length, but dynamically determined based on the actual stored content of the current node in the prefix tree. For example, for the input: haitiandaxue, the consumption steps for each syllable are 3 (hai), 4 (tian), 2 (da), 1 (x), and 2 (ue), respectively, which can adaptively handle the equal-length consumption of variable-length syllables. When a syllable is split into multiple consecutive nodes in the prefix tree (e.g., xue stores two nodes x and ue), only the part that matches the stored content of the current node is consumed at the current level, and the remaining part is left for consumption at the next level, thus achieving non-equal-length consumption.

[0191] Optionally, when the recursive processing mode is the simplified pinyin track mode, one implementation of step 31, which involves performing matching and consumption processing of the current recursive layer on the pinyin stream data to be queried according to the recursive processing mode, could be:

[0192] Step 1: Determine the first character of the current syllable in the Pinyin stream data to be queried as the initial consonant to be queried;

[0193] In this implementation, when the simplified pinyin track mode is used in the current recursive level, the system first reads the currently unconsumed syllables in the pinyin stream data to be queried (usually with a length of 1, which is an independent initial consonant character, but in mixed pinyin scenarios, non-standard simplified pinyin fragments such as "hd" and "ht" may also appear, and their first character is taken uniformly), extracts the first character of the syllable, and determines it as the initial consonant to be queried in the current recursive level.

[0194] The initial consonant is an initial consonant character in the Chinese Pinyin system (such as "b", "p", ... "z", "c", "s", "y", "w", etc.). It is not strictly required that it must belong to the standard initial consonant set. Instead, it is used as the starting anchor point for the runtime state machine to perform syllable prediction and path divergence driving.

[0195] For example, in the pure abbreviated input "htdx", the root node reads the current syllable "h" and extracts its first character (also the only character) "h" as the initial consonant to be queried; in the next recursive layer, the remaining "t" in "tdx" is read as the initial consonant to be queried; in the next layer, the "d" in "dx" is read as the initial consonant to be queried; and in the last layer, "x" is read as the initial consonant to be queried. In the mixed input "htdaxue" where abbreviated and full pinyin are intertwined, "h" and "t" in the first two layers are extracted as the initial consonants to be queried, while in the third layer, it is determined to be a full pinyin track and does not enter the first step of the abbreviated pinyin track.

[0196] Step 2: Generate a set of candidate vowels based on the initial consonant to be queried, and match each candidate vowel in the set with the pinyin fragments stored in each child node of the current node.

[0197] In this implementation, after the initial step of determining the initial consonant to be queried, a candidate final set is dynamically generated based on this to-be-queried initial consonant; this generation process may be a comprehensive derivation based on multiple dimensions, including: the Chinese Pinyin initial-final rule table (which specifies which finals can be legally combined with the current initial consonant), the reachable paths under the current Trie node (i.e., which possible final continuations are contained in the Pinyin fragments stored in the child nodes), Chinese Pinyin validity constraints (excluding non-existent Pinyin combinations such as "buo", "fong", etc.), and the historical state of the current path. Through the joint screening of the above constraint conditions, a set of candidate full Pinyin syllables (i.e., the complete syllable set of "initial consonant + final") is generated, and then these candidate full Pinyin syllables are used as matching patterns to compare with the Pinyin fragments stored in each child node of the current node respectively.

[0198] For example, for the to-be-queried initial consonant "b", candidate full Pinyin syllables such as "ba", "bai", "ban", "bang", "bao", ..., "bu" are dynamically generated based on the initial-final rule table; then these syllables are used to find matching items in the child nodes of the current node. In the mixed full-and-abbreviated Pinyin input "亥天dx", at Node_k, "d" triggers the abbreviated Pinyin track, in the second step, candidate syllables such as "da", "dai" ... "dui", "dun", "duo" are generated based on the initial consonant "d", and the path corresponding to "da" is matched in the child nodes.

[0199] In addition, during the matching process between the candidate final set and the Pinyin fragments of the child nodes, for any candidate full Pinyin syllable, if it cannot find a match in any child node of the current node, the path is determined as a pseudo-path, which is immediately pruned and terminated on the spot, and no subsequent recursive drill-down or DFS traversal is performed on this path.

[0200] Step 3: Determine the child nodes with successful matches as candidate child nodes, consume the first character of the current syllable from the to-be-queried Pinyin stream data, and take each of the matched candidate child nodes as the current node of the next recursion layer respectively.

[0201] In this implementation, all child nodes with successful matches are determined as the candidate child node set of the current recursion level, then the first character of the current syllable (i.e., the to-be-queried initial consonant determined in the first step) is consumed from the to-be-queried Pinyin stream data, with a fixed consumption step of 1 character. Finally, each of the matched candidate child nodes is taken as the current node of the next recursion layer respectively, to trigger multi-way parallel recursion: that is, each path with a successful match continues to drill down as an independent branch.

[0202] For example, in the pure simple Pinyin input "htdx", Node_l (storing "x") is reached in the last layer of recursion, with the remaining input being "x". In the first step, the initial consonant "x" is determined. In the second step, candidate finals such as "xi", "xia", "xian", ..., "xue", "xun" are generated based on "x" and matched with child nodes, and "ue" stored in Node_m (corresponding to "xue") and "i" stored in Node_n (corresponding to "xi") are matched. In the third step, these two child nodes are determined as candidate child nodes, "x" is consumed (the remaining part is empty), and Node_m and Node_n are respectively used as the current nodes of the next recursion layer to enter the next round.

[0203] Since the input is already empty, the termination state judgment of the next recursion layer triggers recall, and the example can output ID 202 (Haitian University) and ID 999 (Haitian Grand Drama) respectively.

[0204] Step 32: If the Pinyin stream data to be queried is completely consumed, the query terms associated with the traversed current node and all leaf nodes subordinate to it are determined as candidate query term results;

[0205] In this step, when the recursive matching engine detects that the Pinyin stream data to be queried has been completely consumed (that is, Rem_Query is empty), the process enters the recall phase.

[0206] At this time, the currently traversed node may be an intermediate node (non-leaf node) or exactly a leaf node. Due to the characteristics of the trie data structure: an intermediate node may be mounted with multiple complete physical POIs (for example, the "haitian" node contains multiple complete POIs such as "Haitian", "Haitian City", "Haitian University", and "Haitian West Station"), it is not possible to only return the entity represented by the current node itself, and a subtree traversal with the current node as the root must be performed to collect all complete query terms associated with all leaf nodes under this node.

[0207] Exemplarily, it is possible to start from the current node, perform depth-first traversal down all reachable child nodes along the hierarchical association relationship until each leaf node is reached. Each complete Pinyin path from the root node to the leaf node corresponds to one or more POI entities. All these POI entities are included in the candidate query term result set, which is used as the candidate set in the rough screening stage.

[0208] For example, in the recursive execution of the input "htdx" in pure abbreviation, the last recursion reaches Node_l (stores "x") and consumes all input. At this time, all leaf nodes under Node_l are traversed, and ID 202 (Haitian University) associated with Node_m (stores "ue") and ID 999 (Haitian Daxi) associated with Node_n (stores "i") are recalled. Both of these POIs are used as candidate results for the query term.

[0209] For example, in the pure Pinyin input of "haitiandaxue", after consuming "ue", the system reaches Node_m, which is itself a leaf node, and directly recalls ID 202.

[0210] The query word completion method provided in this application embodiment performs matching and consumption processing on the query pinyin stream data of the current recursive layer according to the recursive processing mode, and enters the next recursive layer to redetermine the recursive processing mode until the query pinyin stream data is consumed. If the query pinyin stream data is consumed, the query words associated with the current node and its subordinate leaf nodes are determined as query word candidate results. In the first recursive layer, the root node of the prefix tree data is used as the current node, and each subsequent recursive layer uses the matched child node as the current node. The root node is the starting node of the hierarchical association relationship. This technical solution enables the switching between full and simplified pinyin tracks to be performed independently in each level of recursion, allowing the matching strategy to adaptively adjust in real time as the remaining input content changes. If the pinyin stream data to be queried has been consumed, the query terms associated with the current node and its subordinate leaf nodes are determined as candidate query terms. This allows the user input to trigger recall without precisely reaching the leaf nodes, and intermediate nodes can also return all the complete entities under them. It can provide forward-looking completion suggestions even when the user input is incomplete, improving the timeliness of auto-completion and user experience.

[0211] Based on the above embodiments, Figure 4 A flowchart illustrating the query term completion method provided in this application embodiment. Figure 3 ,like Figure 4 As shown, step 21 may include:

[0212] Steps 42 and 43 are executed based on the actual situation, without limiting the execution order or whether they are executed.

[0213] Step 41: Obtain the string data input by the user;

[0214] In this step, the user usually interacts with the map navigation application or the search recommendation system by typing text in the input box, and the user's input content is captured by monitoring the text change event or the input confirmation event of the input box. The captured string data may contain multiple character types, including but not limited to: English letters (corresponding to pinyin input), Chinese characters (corresponding to Chinese name input), numbers and special symbols.

[0215] In a possible implementation, when the user types "Haitian dx" in the search box, step 41 is triggered after each key press, and continuously changing string data such as "Hai", "Haitian", "Haitian d", "Haitian dx" are obtained in sequence.

[0216] When the user stops typing and triggers a completion request, the obtained string data is "Haitian dx"; for another example, when the user types "haitiandaxue" in the search box, the obtained string data is "haitiandaxue".

[0217] In addition, for the pure pinyin input scenario, the obtained string data is completely consistent with the content typed by the user, and no additional processing is required.

[0218] Exemplarily, the string data may be characters for searching some POIs, such as popular locations, which may appear in a single form or a combined form of pinyin, characters, initials of syllables, and the like.

[0219] Optionally, for polyphonic characters, disambiguation can be performed in combination with common pronunciation statistics in current POI data or user historical input preferences.

[0220] Step 42: If there are Chinese characters in the string data, convert the Chinese characters into pinyin characters to obtain pinyin stream data to be queried, and acquire feature data of the Chinese characters;

[0221] In this step, for the case where Chinese characters exist in the string data obtained in step 41, the operation of converting Chinese characters to pinyin is performed, and the feature data of the Chinese characters is extracted at the same time.

[0222] In actual application scenarios, user input often contains Chinese characters (for example, Haitian University, Haitian dx, etc.). Since the trie data structure stores pinyin paths rather than Chinese character paths, it is necessary to convert the Chinese characters into corresponding pinyin characters to perform subsequent recursive matching on the trie.

[0223] In a possible implementation, first, the string data obtained in step 41 is traversed character by character to identify Chinese characters therein. For each identified Chinese character, a pre-constructed Chinese character-to-pinyin mapping dictionary may be invoked to obtain its corresponding pinyin string. For polyphonic characters, a default pronunciation may be selected according to common pronunciation priority or context association rules (for example, the character "hai" in "haitian" is default converted to hai, and the character "chong" in "chongfeng" is default converted to chong);

[0224] After all Chinese characters are converted, the converted pinyin strings and the non-Chinese parts in the original string (such as English letters, numbers, etc.) are spliced in the original order to form a complete pinyin stream data to be queried in pure pinyin form.

[0225] At the same time, feature data of each Chinese character is extracted synchronously during the conversion process. The feature data at least includes: position boundary information of the Chinese character in the original string, and the glyph encoding or Unicode code point value of the Chinese character. These feature data are taken as context records and pushed into the context stack for retention.

[0226] Step 43: If there is no Chinese character in the string data, the string data is determined as the pinyin stream data to be queried.

[0227] In this step, for the case where there is no Chinese character in the string data obtained in step 41, the original string data can be determined as the pinyin stream data to be queried, without performing any conversion operation.

[0228] In actual application scenarios, users may directly input query content in pure pinyin form (such as haitian, haitiandaxue) or query content in pure initial form (such as ht, htd). At this time, the original string is already a pinyin character sequence composed of English letters, which can be directly used for recursive matching of the trie.

[0229] Further, the method may further include:

[0230] Step 1: Perform reverse semantic verification on the query term candidate result according to the feature data of the Chinese character;

[0231] In this implementation, the feature data of the Chinese character, such as the original Chinese character boundary information and glyph information, is obtained from the context stack, and reverse segmentation alignment verification is performed on the query term candidate result. The verification may be a Chinese character hard matching verification, that is, the characters corresponding to the positions of the original Chinese characters in the name of the query term candidate result are compared with the original Chinese characters character by character.

[0232] In a specific example, the user inputs "Hai Tian dx", and the context stack stores the original Chinese characters "Hai Tian" and their boundary information. The recalled query term candidate results are "Hai Tian University" and "Hai Tian (different character) University". A hard Chinese character match is performed on "Hai Tian University": the first two characters "Hai Tian" are extracted and compared character by character with "Hai Tian", which passes; for pinyin comparison, the trailing "University" is converted to pinyin "daxue", the simplified pinyin prefix "dx" is extracted and compared with the original pinyin "dx", which passes, so this candidate is retained.

[0233] A hard Chinese character match is performed on "Hai Tian (different character) Drama": the first two characters "Hai Tian" are extracted and compared character by character with "Hai Tian (different character)", the character "Tian" and the character "Tian (different)" are inconsistent, the hard match fails, and this candidate is eliminated.

[0234] In the hard Chinese character match verification, character-level equivalent judgment based on Unicode code points or glyph encoding is used to achieve precise glyph-level comparison, rather than similarity judgment based on pinyin pronunciation.

[0235] For example, for the original Chinese character "Tian" (Unicode code point U+5929) and the character "Tian (different)" (Unicode code point U+7530) in the candidate result, although the two have the same pronunciation (both tian), their code point values are different, so it is determined that the glyphs are inconsistent and the verification fails.

[0236] In the above reverse semantic verification process, the Chinese character boundary information of the original input can be preferentially used for positioning: if the Chinese character in the original input is located at the beginning part (e.g., the prefix) of the query term, it is subjected to character-by-character hard matching with the prefix characters at the corresponding position in the candidate POI name; if the Chinese character in the original input is located at a non-starting position of the query term, positioning and matching are performed at the corresponding position of the candidate POI name in combination with its boundary information.

[0237] Step 2: Determine the target query term that matches the string data from the query term candidate results according to the verification result.

[0238] In this implementation, the verification result of Step 1 is obtained. If the result indicates that there is one candidate, it is directly determined as the target query term; if there are multiple candidates, the optimal target is determined by sorting according to the matching degree.

[0239] Further, after the target query term is determined, it is output to the user interface and displayed as the preferred option for search completion suggestions.

[0240] If all candidates are eliminated, an empty result is returned or an approximate result is provided.

[0241] The query word completion method provided in this application obtains string data input by the user; if the string data contains Chinese characters, the Chinese characters are converted into pinyin characters to obtain the query pinyin stream data and the feature data of the Chinese characters are obtained; if the string data does not contain Chinese characters, the string data is determined as the query pinyin stream data. This technical solution, by obtaining the string data input by the user, enables subsequent processes to be compatible with various input formats such as pure pinyin, pure Chinese characters, and mixed text; if the string data contains Chinese characters, the Chinese characters are converted into pinyin characters to obtain the query pinyin stream data and the feature data of the Chinese characters are obtained. On the one hand, mixed input is normalized to a pure pinyin stream, enabling efficient matching on the prefix tree with a unified data structure; on the other hand, the Chinese character feature data is preserved, providing an independent verification dimension for the fine-tuning of the final candidate results; if the string data does not contain Chinese characters, the string data is directly determined as the query pinyin stream data, ensuring that no additional phonetic conversion processing is needed in pure pinyin input scenarios, reducing unnecessary computational overhead, and providing an input foundation for subsequent multi-track recursive matching and reverse verification.

[0242] Based on the above embodiments, Figure 5 A flowchart illustrating the query term completion method provided in this application embodiment. Figure 4 ,like Figure 5 As shown, the streaming adaptive variable step size and dynamic predictive control flow on the bottom-level prefix tree nodes are as follows:

[0243] Step 51, Start recursion: MatchLouds(Node_Index, Rem_Query);

[0244] Step 52: Is Rem_Query empty? If yes, proceed to step 58; if no, proceed to step 53.

[0245] Step 53: Read the first character and determine that it is an initial consonant;

[0246] Step 54: Has the simplified concatenation track been triggered? (Determined based on the subsequent characters and the current node's Label); if yes, proceed to step 55; if no, proceed to step 57.

[0247] Step 55, simplified track assembly, perform the following steps:

[0248] Key features: Dynamic prediction of legal vowel syllables at runtime; dynamic acquisition of all legal vowels based on the current initial consonant; generation of a set of candidate full-syllable pinyin;

[0249] Step 56: Execute the [Abbreviation-driven Full-Spelling DFS Traversal]:

[0250] Using the generated full Pinyin syllables, perform a multi-way depth-first traversal comparison in the prefix tree child nodes; for successfully matched paths, reread the next input stream character and continue the state machine recursion (back to the beginning).

[0251] Step 57, Full Rail Assembling → Execute

Full Rail Assembling Drilling

[0252] Consume the entire syllable length; input the remaining query normally; recursively call drill-down (back to the beginning);

[0253] Step 58: Return all leaf POIs under the current Node.

[0254] It should be understood that: Figure 5 The recursive execution flow shown is for Figure 3 Further refinement of step 31, Figure 3 Step 31 defines the overall logic of 'executing the matching and consumption processing of the current recursive layer according to the recursive processing mode, and entering the next recursive layer to redetermine the recursive processing mode', while Figure 5 This demonstrates the complete control flow at each recursive level, from reading the current first character to determining the track, then to full / abbreviated spelling, executing the final recursive call, or returning the candidate result.

[0255] A possible concrete example: taking "Haitian University" and "Haitian Opera" as examples:

[0256] Business application scenario: Automatic POI completion suggestions for mixed Chinese character and polymorphic Pinyin input in the navigation search box.

[0257] 1) Underlying prefix tree entity database data: (Prefix tree nodes continuously store pure Pinyin variable-length tags)

[0258] Target POI: "Haitian University" (ID: 202), physical path: Node_i ("hai") → Node_j ("tian") → Node_k ("da") → Node_l ("x") → Node_m ("ue").

[0259] Interference POI: “Haitian Daxi” (ID: 999), physical path: Node_i (“hai”) → Node_j (“tian”) → Node_k (“da”) → Node_l (“x”) → Node_n (“i”).

[0260] The following demonstrates the underlying causal data flow of the algorithm in various typical mixed scenarios of Chinese characters and polymorphic pinyin:

[0261] Scenario 1: Polymorphic Pinyin - "Pure Abbreviation Pinyin" → Input htdx.

[0262] Timing 1: Starting from the root, reach Node_i (“hai”). The input prefix is ​​ht, where t is an independent initial consonant. The full consonant track is not matched, triggering the abbreviated consonant track. The first letter 'b' is aligned, consuming only one character 'b' (the remaining 'tdx' characters). The suffix "ei" is ignored, and drill down.

[0263] Sequence 2: Arrive at Node_j (“tian”). The current input is td..., convert to simplified concatenation. Align the first letter 't', consuming only 1 't' character (remaining 'dx'). Ignore the trailing suffix "ing" and drill down.

[0264] Sequence 3: Reach Node_k("da"). The current input is dx, which is converted to abbreviated concatenation. The first letter 'd' is aligned, consuming only 1 character 'd' (leaving 'x'). The suffix "a" is ignored, and drill down to the common initial consonant node Node_l("x").

[0265] Sequence 4 (Dynamic Syllable Prediction): Upon reaching Node_l, the remaining input is x. Recognized as a simplified pinyin state, the state machine initiates syllable prediction: dynamically generating a candidate full pinyin syllable stream ["xi", "xue"...] based on the initial consonant x. Using these syllables, a multi-path DFS comparison is initiated across the child node intervals.

[0266] Path A successfully matched Node_m(“ue”), the input was cleared, and recall ID 202 was triggered.

[0267] Path B successfully matches Node_n(“i”), input is cleared, and recall ID 999 is triggered.

[0268] Post-validation: Since there are no Chinese characters in the input, the results of the multi-channel coarse screening are directly output, perfectly compatible with pure simplified pinyin.

[0269] Scenario 2: Polymorphic Pinyin - "Pure Full Pinyin" → Input haitiandaxue

[0270] Starting from the root node, the state machine continuously drills down from Node_i to Node_m. At each step, the comparison reveals that the prefix of the input stream is completely identical to the variable-length Label of the prefix tree node (which conforms to the complete evolution of initials and finals).

[0271] The state machine maintains a full-track mode throughout (large step consumption): it consumes the entire input string in one go with steps of 3, 4, 2, 1, and 2 respectively. The path converges perfectly, accurately returning ID 202.

[0272] Scenario 3: Polymorphic Pinyin: “Simplified, Full, Interwoven, and Mixed” → Input htdaxue.

[0273] First stage (abbreviated pinyin track driving): The prefix of the input stream is ht... The abbreviated pinyin track mode is continuously triggered at Node_i ("hai") and Node_j ("tian"). The characters h and t are consumed respectively with a step size of 1. At this time, the remaining input stream is transformed into daxue, and the state machine drills down to Node_k.

[0274] Second stage (automatic reset to switch to full pinyin track): The state machine re-reads the input da... at Node_k ("da"). The evaluator finds that the first character d is followed by the vowel a, which is completely identical to the physical Label "da" of the current node at the full character length.

[0275] Large step advancement: The state machine instantly closes the abbreviated pinyin track and switches back to the full pinyin track mode. It consumes da with a large step size of 2 (with xue remaining), and then smoothly completes the full pinyin exact matching process at Node_l ("x") and Node_m ("ue"). The input is cleared, and a successful hit is achieved.

[0276] Scenario ④: "Chinese character and abbreviated pinyin mixing" in Chinese characters and polymorphic pinyin → input haitian dx.

[0277] Preprocessing: The phonetic conversion engine normalizes the Chinese characters "haitian" into the pinyin "haitian", splices the suffix as it is, and the Query becomes "haitiandx". The Chinese character prefix ["haitian"] is pushed onto the stack for retention.

[0278] Tree retrieval: The full pinyin track is followed at Node_i and Node_j (consuming "haitian"), the abbreviated pinyin track is triggered at Node_k in the face of dx (consuming d and ignoring "a"), and syllable prediction and multi-path DFS are triggered at Node_l in the face of x, to perform coarse screening and recall the candidate set [202, 999].

[0279] Post-stage reverse semantic strict alignment: Pop the original input Chinese characters "haitian" from the stack:

[0280] For ID 202 (Haitian University): The original Chinese character prefix "haitian" matches its metadata "Haitian University", resulting in a perfect hit; the trailing Chinese characters "daxue" are converted to the pinyin "daxue" which is compared with the original input suffix dx for abbreviated pinyin prefix matching, resulting in a perfect hit. This entry is retained.

[0281] For ID 999 (Haitian Grand Drama): The original Chinese character prefix "haitian" matches its metadata "Haitian Grand Drama", resulting in glyph and semantic conflict, which is rejected by one vote.

[0282] Final output: Accurately prompt "Haitian University".

[0283] Scenario ⑤: "Chinese character and full pinyin mixing" in Chinese characters and polymorphic pinyin → input haitian daxue.

[0284] The pre-phonetic conversion is normalized as haitiandaxue, and the Chinese characters ["亥天"] are pushed onto the stack.

[0285] The state machine efficiently traverses the full pinyin track with a large step size throughout the prefix tree, to recall a candidate set including homophones.

[0286] The post-checker instantly eliminates homophone interference items (e.g., "亥田 University") via the original Chinese characters 亥天, and accurately outputs ID 202.

[0287] The derivation and analysis of the technical effects of the query completion method provided in the embodiments of the present application are as follows:

[0288] 1) Reasoning on the cause of high recall and high accuracy of Chinese characters and polymorphic pinyin in all scenarios:

[0289] Technical means: For all scenarios including Chinese characters, pure abbreviated pinyin, pure full pinyin, and interleaved and mixed polymorphic pinyin, the embodiments of the present application construct a dynamic track evaluator at runtime. The identity of characters is dynamically deconstructed again in each layer of recursion, and the full pinyin track and the abbreviated pinyin prediction track are concurrently drilled down without making subjective rigid prejudgments; at the same time, at the last level, the Chinese character boundary of the original Query pushed onto the stack is creatively utilized to perform strong glyph verification and reverse phonetic conversion comparison on the coarsely screened candidate set;

[0290] Technical effect: This causal mechanism completely eliminates the cascading errors caused by pre-hard segmentation due to the ambiguity of overlapping full and abbreviated pinyin (solves the missed recall problem), and completely cuts off the homophone noise pollution brought by pure pinyin retrieval (solves the false recall problem), so that the automatic completion accuracy and recall rate of polymorphic pinyin mixed input both reach over 99.5%.

[0291] 2) Reasoning on the cause of extremely low retrieval latency and extremely early pruning convergence:

[0292] Technical means: Although the embodiments of the present application trigger multi-path DFS penetration in the abbreviated pinyin state, the predicted syllable set is completely forcibly constrained by the Chinese initials and finals mapping table (that is, no illegal and useless pinyin combinations are generated or probed). At each step of recursively querying the prefix tree, once the generated syllable cannot find a corresponding counterpart in the child node label, the pseudo branch will be intercepted on the spot at the first time and pruned immediately;

[0293] Technical effect: This control flow that actively limits the search domain and dynamically changes the step size consumption at runtime frees the computational complexity of the algorithm from the dead knot of exponential explosion of the search space when the traditional character-by-character fuzzy matching processes long-tail mixed Queries, realizes extremely early pruning, greatly compresses the average response latency of automatic completion to within 5ms, and shows extremely high engineering practical value.

[0294] On the basis of the above embodiments, Figure 6This is a schematic diagram of the structure of the query term completion device provided in the embodiments of this application, as shown below. Figure 6 As shown, the device includes:

[0295] Module 61 is used to obtain the Pinyin stream data to be queried;

[0296] The first determining module 62 is used to determine the recursive processing mode of the queried pinyin stream data based on the pinyin stream data and the prefix tree data. The recursive processing mode includes: full pinyin track mode and simplified pinyin track mode. The prefix tree data includes at least one node, and each node includes: at least one pinyin segment composed of at least one character. There is a hierarchical relationship between nodes at adjacent levels. The hierarchical relationship is used to indicate that the pinyin segment stored in the parent node is spliced ​​with the pinyin segment stored in the child node to form a complete pinyin path. The full pinyin track mode is a mode of matching and consuming pinyin syllables. The simplified pinyin track mode is a mode of multi-path matching based on the initial consonant character as the starting anchor point and through the predicted set of vowels.

[0297] The second determining module 63 is used to determine the candidate query words corresponding to the Pinyin stream data to be queried in the prefix tree data according to the recursive processing mode.

[0298] In one or more embodiments, the second determining module 63, according to the recursive processing mode, determines the candidate query word results corresponding to the Pinyin stream data to be queried in the prefix tree data, specifically for:

[0299] According to the recursive processing mode, the matching and consumption processing of the Pinyin stream data to be queried is performed in the current recursive layer, and then the recursive processing mode is redefined in the next recursive layer until the Pinyin stream data to be queried is consumed.

[0300] If the Pinyin stream data to be queried has been consumed, the query terms associated with the current node and its subordinate leaf nodes will be determined as candidate query terms.

[0301] In the first recursive layer, the root node of the prefix tree data is used as the current node, and in each subsequent recursive layer, the matched child node is used as the current node, and the root node is the starting node of the hierarchical relationship.

[0302] In one or more embodiments, the recursive processing mode is the full track stitching mode;

[0303] Correspondingly, the second determining module 63, according to the recursive processing mode, performs matching and consumption processing of the current recursive layer on the Pinyin stream data to be queried, specifically for:

[0304] Compare the current syllable in the Pinyin stream data to be queried with the Pinyin segments stored in the child nodes of the current node;

[0305] When the current syllable is completely identical to the pinyin fragment stored in the child node, the current syllable is consumed from the pinyin stream data to be queried, and the current node is updated with the matched child node.

[0306] In one or more embodiments, the recursive processing mode is a simplified track assembly mode;

[0307] Correspondingly, the second determining module 63, according to the recursive processing mode, performs matching and consumption processing of the current recursive layer on the Pinyin stream data to be queried, specifically for:

[0308] The first character of the current syllable in the Pinyin stream data to be queried is determined as the initial consonant to be queried;

[0309] A candidate set of finals is generated based on the initial consonant to be queried, and each candidate final in the candidate set is matched with the pinyin fragments stored in each child node of the current node.

[0310] The successfully matched child nodes are identified as candidate child nodes. The first character of the current syllable is consumed from the Pinyin stream data to be queried, and each matched candidate child node is used as the current node of the next recursive layer.

[0311] In one or more embodiments, the first determining module 62 determines the recursive processing mode of the queried pinyin stream data based on the pinyin stream data to be queried and the prefix tree data, specifically for:

[0312] Based on the relationship between the current syllable in the queried pinyin stream data and the pinyin fragments stored in the child nodes of the current node in the prefix tree data, the recursive processing mode is determined.

[0313] The association relationship is used to indicate the degree of matching and / or matching type between the current syllable and the pinyin fragments stored in the child nodes.

[0314] In one or more embodiments, the association includes at least one of the following:

[0315] The current syllable and the pinyin fragment stored in the child node are either completely or partially matched at the character level.

[0316] The character length of the current syllable is equal to or not equal to the character length of the pinyin segment stored in the child node;

[0317] The correspondence between the current syllable's composition type and the composition type of the pinyin segment stored in the child node. The composition types include: independent initial consonant type and complete syllable type.

[0318] The consistency relationship between the first character of the current syllable and the first character of the pinyin segment stored in the child node.

[0319] In one or more embodiments, the acquisition module 61 acquires the Pinyin stream data to be queried, specifically for:

[0320] Get the string data input by the user;

[0321] If the string data contains Chinese characters, convert the Chinese characters to Pinyin characters to obtain the Pinyin stream data to be queried, and obtain the feature data of the Chinese characters;

[0322] If no Chinese characters are found in the string data, the string data will be identified as the Pinyin stream data to be queried.

[0323] In one or more embodiments, the second determining module 63 is further configured to:

[0324] Based on the feature data of Chinese characters, reverse semantic verification is performed on the candidate results of the query term;

[0325] Based on the verification results, the target query terms that match the string data are determined from the candidate query terms.

[0326] It should be noted that the division of the various modules in the above device is merely a logical functional division. In actual implementation, they can be fully or partially integrated into a single physical element, or they can be physically separated. Furthermore, these modules can be implemented entirely in software through processing element calls, or entirely in hardware. Alternatively, some modules can be implemented through processing element calls in software, while others can be implemented in hardware. Moreover, these modules can be fully or partially integrated together, or implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. During implementation, each step of the above method or each of the above modules can be completed through the integrated logic circuits in the hardware of the processor element or through software instructions.

[0327] As can be seen from the above, the query term completion device provided in this embodiment can execute the method provided in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be described in detail here.

[0328] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 7 As shown, the electronic device provided in this embodiment includes at least one processor 71 and a memory 72.

[0329] Optionally, the electronic device also includes a communication component 73.

[0330] The processor 71, memory 72, and communication component 73 are connected via bus 74.

[0331] In a specific implementation, at least one processor 71 executes computer execution instructions stored in memory 72, causing at least one processor 71 to perform the above-described method.

[0332] The specific implementation process of processor 71 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0333] 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.

[0334] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0335] 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.

[0336] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0337] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0338] 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.

[0339] 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.

[0340] 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.

[0341] 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.

[0342] 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.

[0343] 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.

[0344] 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.

[0345] 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 method for completing query terms, characterized in that, include: Retrieve the Pinyin stream data to be queried; Based on the queried pinyin stream data and prefix tree data, a recursive processing mode for the queried pinyin stream data is determined. The recursive processing mode includes a full pinyin path mode and a simplified pinyin path mode. The prefix tree data includes at least one node, and each node includes at least one pinyin segment composed of at least one character. There is a hierarchical relationship between nodes at adjacent levels. The hierarchical relationship is used to indicate how to splice the pinyin segments stored in the parent node with the pinyin segments stored in the child node to form a complete pinyin path. The full pinyin path mode is a mode that matches and consumes pinyin syllables as units, and the simplified pinyin path mode is a mode that uses the initial consonant character as the starting anchor point and performs multi-path matching through the predicted set of vowels. Based on the recursive processing mode, candidate query words corresponding to the Pinyin stream data to be queried are determined from the prefix tree data.

2. The method according to claim 1, characterized in that, The step of determining the candidate query word results corresponding to the Pinyin stream data to be queried in the prefix tree data according to the recursive processing mode includes: According to the recursive processing mode, the matching and consumption processing of the current recursive layer is performed on the Pinyin stream data to be queried, and the recursive processing mode is redefined in the next recursive layer until the Pinyin stream data to be queried is consumed. If the query Pinyin stream data is consumed, the query terms associated with the current node and its subordinate leaf nodes will be determined as the candidate results of the query terms. In the first recursive layer, the root node of the prefix tree data is used as the current node, and in each subsequent recursive layer, the matched child node is used as the current node. The root node is the starting node of the hierarchical association relationship.

3. The method according to claim 2, characterized in that, The recursive processing mode is the full track stitching mode; Accordingly, the step of performing matching and consumption processing on the Pinyin stream data to be queried according to the recursive processing mode includes: The current syllable in the queried pinyin stream data is compared with the pinyin segments stored in the child nodes of the current node; When the current syllable is completely identical to the pinyin segment stored in the child node, the current syllable is consumed from the pinyin stream data to be queried, and the current node is updated to the matched child node.

4. The method according to claim 2, characterized in that, The recursive processing mode is the simplified track assembly mode; Accordingly, the step of performing matching and consumption processing on the Pinyin stream data to be queried according to the recursive processing mode includes: The first character of the current syllable in the Pinyin stream data to be queried is determined as the initial consonant to be queried; A candidate set of finals is generated based on the initial consonant to be queried, and each candidate final in the candidate set is matched with the pinyin fragments stored in each child node of the current node. The successfully matched child nodes are identified as candidate child nodes. The first character of the current syllable is consumed from the queried pinyin stream data, and each matched candidate child node is used as the current node of the next recursive layer.

5. The method according to any one of claims 1-4, characterized in that, The step of determining the recursive processing mode of the Pinyin stream data to be queried based on the Pinyin stream data and the prefix tree data includes: Based on the association between the current syllable in the queried pinyin stream data and the pinyin fragments stored in the child nodes of the current node in the prefix tree data, the recursive processing mode is determined. The association relationship is used to indicate the degree of matching and / or matching type between the current syllable and the pinyin fragment stored in the child node.

6. The method according to claim 5, characterized in that, The association relationship includes at least one of the following: The current syllable and the pinyin fragment stored in the child node are either completely or partially matched at the character level. The character length of the current syllable is equal to or not equal to the character length of the pinyin segment stored in the child node; The correspondence between the composition type of the current syllable and the composition type of the pinyin segment stored in the child node, wherein the composition type includes: independent initial consonant type and complete syllable type; The consistency relationship between the first character of the current syllable and the first character of the pinyin segment stored in the child node.

7. The method according to claim 1, characterized in that, The process of obtaining the Pinyin stream data to be queried includes: Get the string data input by the user; If the string data contains Chinese characters, the Chinese characters are converted into Pinyin characters to obtain the Pinyin stream data to be queried, and the feature data of the Chinese characters are obtained. If the string data does not contain any Chinese characters, the string data is determined to be the Pinyin stream data to be queried.

8. The method according to claim 7, characterized in that, The method further includes: Based on the feature data of the Chinese characters, the query term candidate results are subjected to reverse semantic verification; Based on the verification results, the target query term that matches the string data is determined from the query term candidate results.

9. A query term completion device, characterized in that, include: The acquisition module is used to acquire the Pinyin stream data to be queried; The first determining module is used to determine the recursive processing mode of the queried pinyin stream data based on the queried pinyin stream data and the prefix tree data. The recursive processing mode includes a full pinyin path mode and a simplified pinyin path mode. The prefix tree data includes at least one node, and each node includes at least one pinyin segment composed of at least one character. There is a hierarchical relationship between nodes at adjacent levels. The hierarchical relationship is used to indicate that the pinyin segments stored in the parent node are spliced ​​with the pinyin segments stored in the child node to form a complete pinyin path. The full pinyin path mode is a mode of matching and consuming pinyin syllables. The simplified pinyin path mode is a mode of multi-path matching based on the initial consonant character as the starting anchor point and through the prediction of the vowel set. The second determining module is used to determine the candidate query word results corresponding to the Pinyin stream data to be queried in the prefix tree data according to the recursive processing mode.

10. An electronic device / computer-readable storage medium / computer program product, characterized in that, include: Memory, processor; The memory stores computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-8; 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-8; The computer program product includes a computer program that, when executed by a processor, is used to implement the method as described in any one of claims 1-8.