Query method based on query tree and related device

By building a query tree, the standard query statements in the standard query statement library are sorted by word frequency, which solves the problem of long time calculating semantic similarity, and achieves rapid matching and improves query efficiency.

CN120067152APending Publication Date: 2025-05-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311622072.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-29
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

When the standard query statement library contains more standard query statements and the statement length is longer, it takes longer to calculate the semantic similarity between the user's natural language and the standard query statement, resulting in lower query efficiency.

Method used

By building a query tree, the standard query statements in the standard query statement library are constructed into a tree structure of multiple nodes, each node corresponds to a keyword, and the keyword word frequency of the parent node is greater than or equal to the word frequency of the child node. Then, the matching time is shortened according to the order of the queried statement and the nodes in the query tree.

Benefits of technology

Through structured matching of the query tree, standard query statements that match the sentences to be query can be quickly filtered out, shortening query time and improving query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067152A_ABST
    Figure CN120067152A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a query method based on a query tree and a related device, which can be applied to the fields of natural language processing technology and the like in artificial intelligence technology, a query tree is constructed based on a plurality of standard query statements, so that one node in the query tree corresponds to one keyword, and the query efficiency is improved. The plurality of keywords in the same branch of the query tree correspond to a standard query statement, and the plurality of keywords included in the standard query statement are arranged from the root part to the end part of the query tree according to the size of the word frequency. After a to-be-queried statement is obtained, the to-be-queried statement is matched based on the query tree, that is, for each branch of the query tree, starting from the keyword with the highest word frequency, each keyword is sequentially matched with the to-be-queried statement, if matching succeeds, matching continues, and if matching fails, matching of the current branch is ended. And determining a standard query statement corresponding to the to-be-queried statement according to a matching result of the to-be-queried statement and the keyword included in each branch. The query time is shortened and the query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and particularly to a query method and related device based on a query tree. Background Art

[0002] With the development of artificial intelligence technology, the database query function can be realized through natural language statements, that is, a standard query statement for querying the database is generated based on natural language statements, so that the relevant knowledge of database query statements does not need to be mastered to realize database query.

[0003] In the related art, a standard query statement library is constructed, the semantic similarity between the user's natural language and each standard query statement in the standard query statement library is calculated, and then the standard query statement with the highest semantic similarity is used as the standard query statement for querying.

[0004] However, if the standard query statement library includes a large number of standard query statements and the length of the standard query statements is long, etc., it will cause a long time to calculate the semantic similarity between the user's natural language and each standard query statement in the standard query statement library, resulting in low query efficiency. Summary of the Invention

[0005] In order to solve the above technical problems, this application provides a query method and related device based on a query tree to improve query efficiency.

[0006] The embodiments of this application disclose the following technical solutions:

[0007] On the one hand, the embodiments of this application provide a query method based on a query tree, and the method includes:

[0008] Obtain a query statement to be queried and a query tree, where the query tree includes multiple nodes forming multiple branches, different nodes correspond to different keywords, multiple keywords in the same branch of the query tree correspond to a standard query statement, and the word frequency of the keyword corresponding to the parent node in the same branch is greater than or equal to the word frequency of the keyword corresponding to the child node;

[0009] According to the node order from the root node to the leaf node in the query tree, match the query statement to be queried with the keywords corresponding to the nodes in the query tree respectively. For the target branch among the multiple branches, if the i-th keyword of the target branch matches successfully, then match the (i + 1)-th keyword of the target branch with the query statement to be queried. If the i-th keyword of the target branch fails to match, then end the matching for the target branch, where i is a positive integer;

[0010] Determine the standard query statement corresponding to the to-be-query statement according to the matching result between the to-be-query statement and the keywords included in the multiple branches.

[0011] On the other hand, an embodiment of the present application provides a query device based on a query tree. The device includes: an acquisition unit, a matching unit, and a determination unit;

[0012] The acquisition unit is configured to acquire a to-be-query statement and a query tree. The query tree includes multiple nodes that form multiple branches. Different nodes correspond to different keywords. Multiple keywords in the same branch of the query tree correspond to a standard query statement, and the word frequency of the keyword corresponding to the parent node in the same branch is greater than or equal to the word frequency of the keyword corresponding to the child node;

[0013] The matching unit is configured to match the to-be-query statement with the keywords corresponding to the nodes in the query tree in the node order from the root node to the leaf node in the query tree. For the target branch among the multiple branches, if the i-th keyword of the target branch matches successfully, then match the (i + 1)-th keyword of the target branch with the to-be-query statement; if the i-th keyword of the target branch fails to match, then end the matching for the target branch, where i is a positive integer;

[0014] The determination unit is configured to determine the standard query statement corresponding to the to-be-query statement according to the matching result between the to-be-query statement and the keywords included in the multiple branches.

[0015] On the other hand, an embodiment of the present application provides a computer device, and the computer device includes a processor and a memory:

[0016] The memory is used to store a computer program and transmit the computer program to the processor;

[0017] The processor is configured to execute the method described in the above aspect according to the instructions in the computer program.

[0018] On the other hand, an embodiment of the present application provides a computer-readable storage medium, and the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method described in the above aspect.

[0019] On the other hand, an embodiment of the present application provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method described in the above aspect.

[0020] As can be seen from the above technical solution, multiple standard query statements included in the standard query statement library are constructed into a query tree. The query tree includes multiple nodes, and one node corresponds to one keyword, such that different nodes correspond to different keywords. Moreover, multiple keywords included in one standard query statement constitute a branch of the query tree, that is, multiple keywords in the same branch of the query tree correspond to one standard query statement. In addition, the word frequency of the keyword corresponding to the parent node of the query tree is greater than or equal to the word frequency of the keyword corresponding to the child node of the query tree, that is, multiple keywords included in one standard query statement are arranged from the root to the end of the query tree according to the size of the word frequency. After obtaining the statement to be queried, according to the node order from the root node to the leaf node in the query tree, the statement to be queried is respectively matched with the keywords corresponding to a part of the nodes in the query tree to shorten the matching time. Taking the target branch among multiple branches included in the query tree as an example, if the i-th keyword of the target branch matches successfully, then the (i + 1)-th keyword of the target branch is continuously matched with the statement to be queried; if the i-th keyword of the target branch fails to match, then the matching for the target branch ends. That is to say, for each branch of the query tree, starting from the keyword with the highest word frequency, each keyword is successively matched with the statement to be queried. If the match is successful, the matching continues; if the match fails, the matching for the current branch ends. Thus, according to the matching results between the statement to be queried and the keywords included in each branch, the standard query statement corresponding to the statement to be queried is determined.

[0021] Thus, each branch of the query tree corresponds to one standard query statement, and the keywords respectively corresponding to multiple nodes included in each branch are arranged from largest to smallest in terms of word frequency. Therefore, during the process of keyword matching based on the query tree and the statement to be queried, only some nodes in the query tree need to be traversed, and the keywords with higher word frequencies are preferentially matched. It is not only possible to quickly perform keyword matching through keywords with shorter lengths and higher word frequencies, but also possible to quickly filter out standard query statements irrelevant to the statement to be queried from multiple standard query statements, shortening the query time and improving the query efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0023] Figure 1 FIG. is a schematic diagram of an application scenario of a query method based on a query tree provided by an embodiment of the present application;

[0024] Figure 2Schematic flowchart of a query method based on a query tree provided by an embodiment of the present application;

[0025] Figure 3 Schematic diagram of a query tree provided by an embodiment of the present application;

[0026] Figure 4 Schematic diagram of constructing a query tree provided by an embodiment of the present application;

[0027] Figure 5 Schematic diagram of the construction process of a query tree provided by an embodiment of the present application;

[0028] Figure 6 Schematic diagram of a query process based on a query tree provided by an embodiment of the present application;

[0029] Figure 7 Schematic diagram of a query result provided by an embodiment of the present application;

[0030] Figure 8 Schematic structural diagram of a query device based on a query tree provided by an embodiment of the present application;

[0031] Figure 9 Schematic structural diagram of a server provided by an embodiment of the present application;

[0032] Figure 10 Schematic structural diagram of a terminal device provided by an embodiment of the present application. Detailed implementation manners

[0033] The embodiments of the present application will be described below with reference to the accompanying drawings.

[0034] Terms such as "first", "second", "third", "fourth", etc. (if any) in the specification, claims and above-mentioned accompanying drawings of the present application are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order different from those illustrated or described here. In addition, the terms "comprising" and "corresponding to" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0035] In the related art, if the standard query statement library includes a large number of standard query statements, the length of the standard query statements is long, etc., it will cause a long time to calculate the semantic similarity between the natural language of the user and each standard query statement in the standard query statement library, resulting in low query efficiency.

[0036] Based on this, the embodiments of the present application provide a query method and related device based on a query tree, which construct multiple standard query statements included in the standard query statement library into a query tree, so that each branch of the query tree corresponds to a standard query statement, and the keywords corresponding to the multiple nodes included in each branch are arranged in descending order of word frequency. Therefore, during the process of keyword matching between the query tree and the statement to be queried, only some nodes in the query tree need to be traversed, shortening the query time and improving the query efficiency.

[0037] The query method based on the query tree provided by the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence (AI), data intelligence, etc. Taking the scenario of "intelligent AI analysis assistant" in artificial intelligence as an example, the user asks questions in the form of natural language, so that the intelligent AI analysis assistant obtains the statement to be queried. The intelligent AI analysis assistant matches the statement to be queried with the keywords corresponding to the nodes in the query tree in the order of arrangement of the nodes in the query tree to determine the standard query statement corresponding to the statement to be queried.

[0038] The query method based on the query tree provided by the present application can be applied to computer devices with the query ability based on the query tree, such as terminal devices and servers. Among them, the terminal device can specifically be a desktop computer, a laptop computer, a mobile phone, a tablet computer, an Internet of Things device, and a portable wearable device. The Internet of Things device can be a smart speaker, a smart TV, a smart air conditioner, a smart vehicle-mounted device, etc. The smart vehicle-mounted device can be a vehicle-mounted navigation terminal and a vehicle-mounted computer, etc. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, etc., but is not limited thereto; the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery network (CDN), and big data and artificial intelligence platforms. The terminal device and the server can be directly or indirectly connected through wired or wireless communication methods, and the present application does not make any restrictions here.

[0039] To facilitate the understanding of the query method based on a query tree provided in the embodiments of the present application, taking the execution subject of the query method based on a query tree as a server as an example, the application scenario of the query method based on a query tree will be introduced exemplarily below.

[0040] Refer to Figure 1 , which is a schematic diagram of the application scenario of a query method based on a query tree provided in the embodiments of the present application. As Figure 1 shown, this application scenario includes a server 100. The server 100 can be a server that provides corresponding query services for various products and is used to execute the query method based on a query tree provided in the embodiments of the present application. The following is a specific description.

[0041] The server 100 constructs multiple standard query statements included in the standard query statement library into a query tree. The query tree includes multiple nodes, and one node corresponds to one keyword, so that different nodes correspond to different keywords. As Figure 1 shown, the nodes in the first layer of the query tree include 3 nodes, and the keywords corresponding to the 3 nodes are "APP", "mini program", and "coupon" respectively. Moreover, multiple keywords included in a standard query statement constitute a branch of the query tree, that is, multiple keywords in the same branch of the query tree correspond to a standard query statement. As Figure 1 shown, the standard query statement "APP message sent successfully" corresponds to a branch of the query tree. In addition, the word frequency of the keyword corresponding to the parent node of the query tree is greater than or equal to the word frequency of the keyword corresponding to the child node of the query tree, that is, multiple keywords included in a standard query statement are arranged from the root to the end of the query tree according to the size of the word frequency. As Figure 1 shown, the 4 keywords in the standard query statement "APP message sent successfully" are sorted from largest to smallest word frequency as "APP", "message", "sent", and "success".

[0042] Continue to refer to Figure 1After the server 100 obtains the query statement to be queried, "I always fail to send messages through the APP. How can I solve this?", it matches the query statement with the keywords corresponding to a part of the nodes in the query tree according to the arrangement order of each node in the query tree, so as to shorten the matching time. For example, the query statement to be queried, "I always fail to send messages through the APP. How can I solve this?", is first matched with the keywords corresponding to the 3 nodes included in the first layer of the query tree. Only the keyword "APP" is successfully matched, and the branches where the keywords "mini-program" and "coupon" are located are no longer matched. Instead, it continues to match the keywords corresponding to the nodes included in the branch where the keyword "APP" is located. This reduces the matching of a large number of keywords and shortens the matching time. For the branch where the keyword "APP" is located, the query statement to be queried, "I always fail to send messages through the APP. How can I solve this?", is continued to be matched with the keywords "message" and "exit", and so on, to obtain the matching results of the query statement with the keywords included in each branch.

[0043] The server 100 determines the standard query statement corresponding to the query statement to be queried according to the matching results of the query statement to be queried with the keywords included in each branch. Continue to refer to Figure 1 The standard query statement corresponding to the query statement to be queried, "I always fail to send messages through the APP. How can I solve this?", is "APP message sending fails".

[0044] Thus, each branch of the query tree corresponds to a standard query statement, and the keywords corresponding to the multiple nodes included in each branch are arranged in descending order of word frequency. Therefore, during the process of keyword matching based on the query tree and the query statement to be queried, only some nodes in the query tree need to be traversed, and the keywords with higher word frequency are preferentially matched. It can not only quickly perform keyword matching through the keywords with shorter length and higher word frequency, but also quickly filter out the standard query statements irrelevant to the query statement to be queried from multiple standard query statements, shortening the query time and improving the query efficiency.

[0045] The query method based on the query tree provided by the embodiments of the present application can be executed by the server. However, in other embodiments of the present application, the terminal device can also have a similar function to the server, so as to execute the query method based on the query tree provided by the embodiments of the present application, or the query method based on the query tree provided by the embodiments of the present application can be jointly executed by the terminal device and the server. This embodiment does not make any limitations in this regard.

[0046] Next, a query method based on a query tree provided by the present application will be introduced in detail through method embodiments.

[0047] Refer to Figure 2, This figure is a schematic flowchart of a query method based on a query tree provided by an embodiment of the present application. For ease of description, in the following embodiments, the execution subject of the query method based on the query tree is still taken as an example of a server. As Figure 2 shown, the query method based on the query tree includes S201 - S203, which will be specifically described below.

[0048] S201: Obtain the query statement to be queried and the query tree.

[0049] The query statement to be queried is a statement including the intention of querying the database, which can be a natural language input by the user, etc. It can be understood that in the specific implementation manner of the present application, when it comes to obtaining data related to the natural language input by the user, etc., when the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards in relevant countries and regions.

[0050] As can be seen from the foregoing, in the related art, the time for calculating the semantic similarity between a query statement such as the user's natural language and each standard query statement in the standard query statement library is relatively long, resulting in low query efficiency. Based on this, in the embodiment of the present application, the semantic similarity between the two is no longer directly calculated, but a query tree is constructed based on the standard query statement library, and then the query tree is matched with the query statement to be queried to obtain the standard query statement corresponding to the query statement to be queried, so as to realize extracting the intention of querying the database in the query statement to be queried. The query tree will be described below.

[0051] The query tree has the following three characteristics:

[0052] (1) It includes multiple nodes that form multiple branches. Each branch in the query data includes multiple nodes, and each node corresponds to a keyword, and different nodes correspond to different keywords. See Figure 3 , This figure is a schematic diagram of a query tree provided by an embodiment of the present application. In Figure 3 , the 3 nodes located in the first layer of the query tree correspond to the keywords "APP", "mini program", and "coupon" respectively, and the 6 nodes located in the first layer of the query tree correspond to the keywords "message", "exit", "page", "start", "receive", and "issue" respectively. Thus, subsequent matching can be based on the keywords corresponding to each node, rather than calculating the semantic similarity. The length of the keywords is short, and the semantics is accurate, making the subsequent matching speed faster, shortening the matching time, and improving the matching efficiency.

[0053] (2) Multiple keywords in the same branch of the query tree correspond to a standard query statement.

[0054] A standard query statement generally includes multiple keywords. For example, the standard query statement "APP message sent successfully" includes the keywords "APP", "message", "sent", and "successfully". Multiple keywords belonging to the same standard query statement belong to the same branch in the query tree. Continue to refer to Figure 3 , the keywords "APP", "message", "sent", and "successfully" belong to the same branch so that during subsequent queries, matching can be performed level by level based on the branches of the query tree, and then the standard query statement corresponding to the query statement to be queried can be obtained.

[0055] (3) The word frequency of the keyword corresponding to the parent node of the same branch in the query tree is greater than or equal to the word frequency of the keyword corresponding to the child node of the query tree.

[0056] A node with a lower-level node is the parent node, and a node with a higher-level node is the child node. Continue to refer to Figure 3 , the node corresponding to the keyword "message" is the child node of the node corresponding to the keyword "APP", and the node corresponding to the keyword "APP" is the parent node of the node corresponding to the keyword "message". That is to say, multiple keywords belonging to the same standard query statement are not only in the same branch in the query tree but also arranged in descending order of word frequency on the query tree so that during subsequent matching, keywords with higher word frequencies can be preferentially matched, quickly and accurately removing branches irrelevant to the query statement to be queried, shortening the matching time, and improving the accuracy of matching.

[0057] After introducing the query tree, the matching based on the query tree and the query statement to be queried will be described below.

[0058] S202: According to the node order from the root node to the leaf node in the query tree, match the query statement to be queried with the keywords corresponding to the nodes in the query tree respectively. For the target branch among the multiple branches included in the query tree, if the i-th keyword of the target branch matches successfully, then match the (i + 1)-th keyword of the target branch with the query statement to be queried. If the i-th keyword of the target branch fails to match, then end the matching for the target branch.

[0059] Each node in the query tree corresponds to a keyword. Keywords belonging to the same branch not only belong to the same standard query statement but are also arranged according to the word frequency. Therefore, by matching the query statement to be queried with the keywords corresponding to the nodes in the query tree according to the node order in the query tree, that is, the node order from the root node to the leaf node, keywords with higher word frequencies can be preferentially matched, thereby quickly and accurately removing branches irrelevant to the query statement to be queried, shortening the matching time, and improving the accuracy of matching. Among them, the root node is the node in the query tree without a parent node, such as Figure 3 the node corresponding to the keyword "APP" inFigure 3 The node corresponding to the keyword "success" in

[0060] The embodiments of the present application do not specifically limit the manner of keyword matching, and those skilled in the art can set it according to actual needs. For example, using a brute-force matching algorithm, the keyword is compared with each character of the statement to be matched to obtain a matching result. Another example is to use a string search algorithm (Knuth-Morris-Pratt, KMP), which utilizes the information after the keyword and the statement to be matched fail to match, and tries to reduce the number of matches as much as possible to achieve the purpose of fast matching, etc.

[0061] During the matching process of the statement to be queried, not only can the matching be performed according to the node order from the root node to the leaf node, that is, after all the nodes included in one branch are matched, then continue to match with the nodes included in the next branch, that is, match according to the branch. It can also be matched according to the node order from the root node to the leaf node. After the first nodes of all branches are matched, then continue to match with the child nodes of the successfully matched nodes, that is, match according to the layer. The following will be described separately.

[0062] Method 1: Match according to the branch.

[0063] During the matching process, for each branch of the query tree, starting from the keyword with the highest word frequency, each keyword is sequentially matched with the statement to be queried. If the match is successful, continue the match; if the match fails, end the match for the current branch. The following takes one branch among multiple branches, that is, the target branch, as an example for illustration.

[0064] For the target branch among the multiple branches included in the query tree, taking the matching of the i-th keyword as an example, where i is a positive integer. If the i-th keyword of the target branch is successfully matched, then the (i + 1)-th keyword of the target branch is matched with the statement to be queried, that is, the statement to be queried is continued to be matched with the next keyword of this branch. If the i-th keyword of the target branch fails to match, it means that the standard query statement corresponding to this branch has a lower matching degree with the statement to be queried than other standard query statements, then end the matching for the target branch, and the matching for other branches can be performed.

[0065] For example, the statement to be queried can be matched with the keyword corresponding to the node in the first layer of the query tree. If the match fails, then no longer match with the keywords of this branch. If the match is successful, then enter the branch where the keyword is located and continue the match until all the keywords of this branch are matched or one keyword fails to match.

[0066] Method 2: Match according to the layer.

[0067] During the matching process, for the nodes at each layer of the query tree, starting from the keyword with the highest word frequency, the keywords at each layer are sequentially matched with the query statement to be searched. If the match is successful, the matching continues; if the match fails, the matching of the current branch ends.

[0068] Continuing with Figure 3 as an example, first match the query statement to be searched with the keywords "APP", "mini-program", and "coupon" corresponding to the nodes in the first layer. If the keywords "mini-program" and "coupon" match successfully, then match the keywords "page", "start", "receive", and "issue" corresponding to the second layer of these two keywords respectively, and so on until the leaf nodes are matched. Thus, the word frequency of the keyword corresponding to the parent node of the query tree is greater than or equal to the word frequency of the keyword corresponding to the child node of the query tree. Therefore, through one keyword matching using the query tree, it is obtained that the query statement to be searched matches and does not match multiple standard query statements, thereby quickly filtering out the non-matching standard query statements and continuing to match in the branches corresponding to the multiple matching standard query statements, thus shortening the matching time and improving the matching efficiency.

[0069] S203: Determine the standard query statement corresponding to the query statement to be searched according to the matching results between the query statement to be searched and the keywords included in multiple branches.

[0070] The matching results between the query statement to be searched and the keywords included in multiple branches are used to identify the matching situations between the query statement to be searched and the standard query statements corresponding to multiple branches respectively. For example, the query statement to be searched may match all the keywords included in branch A of the query tree and fail to match the first keyword included in branch B of the query tree, that is, the query statement to be searched does not match all the keywords included in branch B of the query tree. It can be seen that the query statement to be searched is more matched with the standard query statement corresponding to branch A, so the standard query statement corresponding to branch A can be used as the standard query statement corresponding to the query statement to be searched. Thus, according to the matching situations between the query statement to be searched and the standard query statements corresponding to multiple branches respectively, the standard query statement corresponding to the query statement to be searched can be determined.

[0071] As can be seen from the above technical solution, multiple standard query statements included in the standard query statement library are constructed into a query tree. The query tree includes multiple nodes, and one node corresponds to one keyword, so that different nodes correspond to different keywords. Moreover, multiple keywords included in one standard query statement constitute a branch of the query tree, that is, multiple keywords in the same branch of the query tree correspond to one standard query statement. In addition, the word frequency of the keyword corresponding to the parent node of the query tree is greater than or equal to the word frequency of the keyword corresponding to the child node of the query tree, that is, multiple keywords included in one standard query statement are arranged from the root to the end of the query tree according to the size of the word frequency. After obtaining the statement to be queried, according to the node order from the root node to the leaf node in the query tree, the statement to be queried is respectively matched with the keywords corresponding to a part of the nodes in the query tree to shorten the matching time. Taking the target branch among multiple branches included in the query tree as an example, if the i-th keyword of the target branch matches successfully, then the (i + 1)-th keyword of the target branch is continued to be matched with the statement to be queried; if the i-th keyword of the target branch fails to match, then the matching for the target branch ends. That is to say, for each branch of the query tree, starting from the keyword with the highest word frequency, each keyword is sequentially matched with the statement to be queried. If the match is successful, the matching continues; if the match fails, the matching of the current branch ends. Thus, according to the matching results of the statement to be queried and the keywords included in each branch, the standard query statement corresponding to the statement to be queried is determined.

[0072] Therefore, each branch of the query tree corresponds to one standard query statement, and the keywords respectively corresponding to multiple nodes included in each branch are arranged from largest to smallest according to the word frequency. Thus, during the process of keyword matching based on the query tree and the statement to be queried, only part of the nodes in the query tree need to be traversed, and the keywords with higher word frequencies are preferentially matched. It can not only quickly perform keyword matching through keywords with shorter lengths and higher word frequencies, but also quickly filter out the standard query statements irrelevant to the statement to be queried from multiple standard query statements, shortening the query time and improving the query efficiency.

[0073] The embodiment of the present application does not specifically limit the manner of determining the standard query statement corresponding to the statement to be queried according to the matching results of the statement to be queried and the keywords included in multiple branches. For example, algorithms such as the longest common subsequence and n-gram (N-Gram) are used to calculate the similarity between the statement to be queried and each standard query statement. The following takes one way as an example for illustration.

[0074] Since the lengths of each standard query statement are different and the number of keywords included in them is different, if the degree of matching between the query statement to be queried and the keywords included in multiple branches is measured by the number of successfully matched keywords, there will be a deviation. For example, Matching result 1: The query statement to be queried successfully matches 3 keywords with Branch 1 which includes 10 keywords; Matching result 2: The query statement to be queried successfully matches 1 keyword with Branch 2 which includes 2 keywords. It cannot be simply concluded that the matching result of Branch 1 is better than that of Branch 2. Based on this, in the embodiments of the present application, the proportion of the successfully matched keywords in all the keywords of this branch is used as the similarity of each branch.

[0075] Specifically, according to the matching results between the query statement to be queried and the keywords included in multiple branches, the similarity of each branch in the query tree is obtained. According to the similarity of each branch, the standard query statement corresponding to the query statement to be queried is determined. Among them, the similarity is used to identify the ratio of the number of successfully matched keywords in the branch to the number of nodes included in the branch. Since one node corresponds to one keyword, the number of nodes included in this branch is

[0076] Continuing with Matching result 1 and Matching result 2 as examples, based on Matching result 1, the similarity between Branch 1 and the query statement to be queried is determined to be 30%, and based on Matching result 2, the similarity between Branch 2 and the query statement to be queried is determined to be 50%. Therefore, the matching result of Branch 2 is better than that of Branch 1, and the standard query statement corresponding to Branch 2 can be determined as the standard query statement of the query statement to be queried.

[0077] Thus, by using the proportion of the successfully matched keywords in all the keywords of this branch as the similarity of each branch, standard query statements with different numbers of keywords can be aligned to the same standard for comparison, so as to more accurately determine the standard query statement that is more similar to the query statement to be queried, that is, the standard query statement that can better reflect the query intention of the query statement to be queried.

[0078] As a possible implementation manner, although the similarity is used as the standard for determining the standard query statement corresponding to the query statement to be queried, since the number of standard query statements is large, there may be standard query statements with the same similarity. At this time, the larger number of successfully matched keywords can be used as a supplementary standard. The larger the number of successfully matched keywords in the standard query statement, the more it indicates that this standard query statement can reflect the intention of the query statement to be queried, and thus the higher the accuracy of using it as the standard query statement corresponding to the query statement to be queried.

[0079] For example, sort the similarities of each branch from largest to smallest to obtain a similarity ranking. Taking two branches, the first branch and the second branch, among multiple branches as an example, if the similarity of the first branch is equal to the similarity of the second branch, then obtain the number of successfully matched keywords in the first branch and the number of successfully matched keywords in the second branch. If the number of successfully matched keywords in the first branch is greater than the number of successfully matched keywords in the second branch, then in the similarity ranking, the ranking of the first branch is higher than that of the second branch. That is, although the similarities of the first branch and the second branch are the same, the number of successfully matched keywords in the first branch is greater than the number of successfully matched keywords in the second branch, indicating that the first branch is more similar to the query statement to be queried. Then, let the ranking of the first branch be before that of the second branch. Subsequently, the standard query statements corresponding to the branches that meet the preset similarity conditions in the similarity ranking can also be determined as the standard query statements corresponding to the query statement to be queried.

[0080] The embodiments of the present application do not specifically limit the preset similarity conditions, and those skilled in the art can set them according to actual needs. For example, determine the standard query statements corresponding to the query statement to be queried as the top 20 standard query statements in the similarity ranking.

[0081] As a possible implementation manner, the similarities of each branch can be roughly sorted first, and tags can be added to the branches with the same similarity. Then, if the standard query statements corresponding to the top k branches are selected as candidates for the standard query statements corresponding to the query statement to be queried, and the similarity of the (k + 1)-th branch is the same as that of the k-th branch, then use the k-th branch as the first branch and the (k + 1)-th branch as the second branch to judge their sorting order, thereby reducing the number of branches that need to be sorted twice, shortening the matching time, and improving the matching efficiency.

[0082] Thus, when the similarities of two branches are the same, factors such as the number of successfully matched keywords included in each branch and the rough sorting results of each branch can be used as supplementary judgment criteria. Among them, the more the number of successfully matched keywords, the higher the matching degree between the standard query statement corresponding to this branch and the query statement to be queried, improving the accuracy of subsequent matching. The rough sorting results of each branch reduce the number of branches to be sorted twice, shorten the matching time, and improve the matching efficiency.

[0083] In the related art, all standard query statements included in the standard query statement library and the statement to be queried are all input into a natural language model. This natural language model can learn the potential semantic feature identifiers between texts, and determine the similarity between texts by calculating the distance between two semantic feature representations. That is, the semantic similarity between the statement to be queried and each standard query statement is calculated through the natural language model to obtain the standard query statement corresponding to the statement to be queried. However, this method will take all standard query statements as the input of the natural language model, resulting in a slow calculation speed.

[0084] Based on this, in the embodiment of the present application, first, according to the matching results between the statement to be queried and the keywords included in multiple branches, multiple to-be-determined standard query statements are determined. According to the multiple to-be-determined standard query statements, the similarity between each to-be-determined standard query statement and the statement to be queried is determined through the natural language model, and the to-be-determined standard query statement with the highest similarity is determined as the standard query statement corresponding to the statement to be queried.

[0085] Therefore, it is no longer the case that all standard query statements are used as the input of the natural language model, resulting in a slow calculation speed. Instead, after roughly screening out some standard query statements from all standard query statements as to-be-determined standard query statements through a query tree, the standard query statement corresponding to the statement to be queried is obtained from some to-be-determined standard query statements through the trained natural language model. The matching degree between the standard statements that are roughly screened out and the statement to be queried is relatively low. Not using them as the input of the subsequent natural language model will not only not affect the prediction accuracy of the natural language model, but also enable the natural language model to make targeted predictions. Thus, while not affecting the accuracy, the number of standard query statements input into the natural language model is reduced, the matching time is shortened, and the matching efficiency is improved.

[0086] The embodiment of the present application does not specifically limit the method for determining multiple to-be-determined standard query statements. For example, the similarities corresponding to multiple branches are sorted, and the standard query statements corresponding to the top 20 branches are used as the to-be-determined standard query statements.

[0087] The embodiment of the present application does not specifically limit the natural language model, and those skilled in the art can set it according to actual needs. As a possible implementation, the natural language model can be trained through artificial intelligence technology.

[0088] Among them, Artificial Intelligence (AI) uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, including theories, methods, technologies, and application systems for perceiving the environment, acquiring knowledge, and using knowledge to achieve the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines to enable machines to have the functions of perception, reasoning, and decision-making.

[0089] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields involved, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, autonomous driving, and intelligent transportation.

[0090] In the embodiments of this application, the artificial intelligence technologies mainly involved include directions such as the above-mentioned natural language processing technology.

[0091] Natural Language Processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between humans and computers in natural language. Natural language processing involves natural language, that is, the language people use in daily life, and is closely related to linguistics research; at the same time, it involves important technologies in the fields of computer science, mathematics, and artificial intelligence model training. Among them, the pre-trained model is developed from the large language model in the NLP field. After fine-tuning, the large language model can be widely applied to downstream tasks. Natural language processing technology usually includes technologies such as text processing, semantic understanding, machine translation, robot question answering, and knowledge graphs.

[0092] The pre-training model (PTM), also known as the foundation model or large model, refers to a deep neural network (DNN) with a large number of parameters. It is trained on a large amount of unlabeled data, and uses the function approximation ability of the large-parameter DNN to enable the PTM to extract common features from the data. Through techniques such as fine-tuning, parameter-efficient fine-tuning (PEFT), and prompt-tuning, it is applicable to downstream tasks. Therefore, the pre-training model can achieve ideal results in few-shot or zero-shot scenarios. PTMs can be classified into language models (such as ELMO, BERT, GPT, etc.), vision models (such as swin-transformer, ViT, V-MOE, etc.), speech models (such as VALL-E), multi-modal models (such as ViBERT, CLIP, Flamingo, Gato, etc.) according to the data modalities they process, where multi-modal models refer to models that establish feature representations of two or more data modalities. The pre-training model is an important tool for outputting artificial intelligence generated content (AIGC), and can also be used as a general interface connecting multiple specific task models.

[0093] In the query method based on the query tree provided in the embodiments of the present application, the natural language model can be a model obtained based on a pre-training model, or a large language model (LLM), bidirectional encoder representations from transformers (BERT), etc. As a possible implementation, the embodiments of the present application provide a specific implementation for matching the (i + 1)-th keyword of the target branch with the query statement to be queried. Specifically, the i-th keyword of the target branch is deleted from the query statement to be queried to obtain a transformed query statement to be queried, and the (i + 1)-th keyword of the target branch is matched with the transformed query statement to be queried.

[0094] For example, continue to refer to Figure 3, the query statement to be queried is "I always fail to send messages through the APP. How can I solve this problem?". After the first keyword "APP" is successfully matched, the transformed query statement obtained based on the query statement to be queried "I always fail to send messages through the APP. How can I solve this problem?" is "I always fail to send messages. How can I solve this problem?". The transformed query statement "I always fail to send messages. How can I solve this problem?" is respectively matched with the keyword "message" and the keyword "exit". The second keyword "message" is successfully matched. Then, the transformed query statement obtained based on the transformed query statement "I always fail to send messages. How can I solve this problem?" is "I always fail to send. How can I solve this problem?". And so on, until the matching is completed.

[0095] Thus, after the keyword is successfully matched, the keyword is deleted from the query statement to be queried to obtain a transformed query statement, which not only shortens the length of the transformed query statement, reduces the matching time, but also removes the information that is useless for subsequent matching, improving the matching accuracy.

[0096] As a possible implementation manner, the embodiment of the present application provides a method for constructing a query tree, specifically refer to S401-S406.

[0097] See Figure 4 , this figure is a schematic diagram of a query tree provided by the embodiment of the present application.

[0098] S401: Obtain multiple standard query statements.

[0099] As a possible implementation manner, multiple standard query statements can be obtained from a standard query statement library. The standard query statement library is a field information library associated with the database to be queried, which includes all possible events, dimensions, etc. Among them, the events can be app opening, sending text messages, authorizing subscribed messages, etc., and the dimensions can be cities, shared page paths, browser names, etc. It can be understood that different industries correspond to different standard query statement libraries. In some industries, there may be thousands of standard query statements associated with the database, that is, the standard query statement library includes thousands of standard query statements. In order to ensure rapid and accurate positioning of the query statement to be queried, it is necessary to construct a query tree for rapid search for the standard query statement libraries of different industries and accurately filter out possible candidates.

[0100] Each query criterion sentence includes multiple keywords. As a possible implementation, each standard query sentence can be tokenized to obtain multiple keywords included in each standard query sentence. For example, the open-source Chinese NLP preprocessing and parsing tool JioNLP (a toolkit for NLP developers that provides NLP task preprocessing and parsing functions) can be used for Chinese word segmentation. Through word segmentation, each standard query sentence can be split into one or more words or phrases. It should be noted that the granularity of keywords can be words, characters, phrases, etc., and the present application does not make specific limitations in this regard. Those skilled in the art can set it according to actual needs.

[0101] S402: Determine the word frequency of each keyword included in multiple standard query sentences.

[0102] After tokenizing the standard query sentences included in the standard query sentence library, it is necessary to count the word frequency of each keyword in the keywords included in the standard query sentence library. For example, if the number of keywords included in the standard query sentence library is 10,000 and a certain keyword appears 100 times, then the word frequency of this keyword is 1%.

[0103] S403: According to the word frequency of each keyword, determine the internal word frequency sorting corresponding to each standard query sentence.

[0104] Among them, the internal word frequency sorting is used to identify the sorting between multiple keywords included in the standard query sentence. For example, in the standard query sentence "APP message sent successfully", the word frequency of the keyword "APP" is 0.3, the word frequency of "message" is 0.2, the word frequency of "sent" is 0.15, and the word frequency of "successfully" is 0.1. Then the internal word frequency sorting corresponding to the standard query sentence "APP message sent successfully" is "APP", "message", "sent", "successfully".

[0105] It should be noted that for the standard query sentence library, the same keyword may be included in different standard query sentences, such as APP startup, APP activation, and APP browsing. By determining the word frequency of keywords, the same keywords in multiple standard query sentences can be merged to reduce the number of subsequent matches and shorten the matching time.

[0106] S404: Construct an initial query tree.

[0107] The multiple nodes in the first layer of the initial query tree are respectively the keywords with the highest word frequency in each standard query sentence, that is, the keywords with high word frequency in each standard query sentence are used as the nodes in the first layer of the query tree, and multiple standard query sentences with the same keyword will also be merged together to achieve keyword grouping.

[0108] Among them, the multiple nodes in the first layer include the first node in multiple branches. SeeFigure 3 Among them, the nodes in the first layer of the query tree include 3 nodes, and the corresponding keywords of the 3 nodes are "APP", "mini program", and "coupon" respectively.

[0109] S405: For the first target node among the nodes in the i-th layer of the initial query tree, obtain the target standard query statement including the keyword corresponding to the first target node, and use the (i + 1)-th keyword of the internal sorting identifier of the word frequency corresponding to the target standard query statement as the child node of the first target node.

[0110] After determining the nodes in the first layer of the initial query tree, subsequent branches can be determined based on each keyword and its corresponding standard query statement, thereby obtaining the query tree. Taking a node among the nodes in the i-th layer of the initial query tree, that is, the first target node as an example, obtain the target standard query statement including the keyword corresponding to the first target node, and use the (i + 1)-th keyword of the internal sorting identifier of the word frequency corresponding to the target standard query statement as the child node of the first target node. Among them, the nodes in the i-th layer include the i-th nodes in each branch, that is, the i-th nodes in each branch constitute the i-th layer of the query tree.

[0111] Continue to refer to Figure 3 When i is equal to 1, the nodes in the first layer of the initial query tree include 3 keywords "APP", "mini program", and "coupon". After taking the node corresponding to the keyword "APP" as the first target node, obtain the target standard query statements including the keyword corresponding to the first target node, which are "APP message sent successfully", "APP message sent", "APP message clicked", and "APP exited". Use the 2nd keyword of the internal sorting identifier of the word frequency corresponding to the target standard query statement as the child node of the first target node, that is, use the keywords "message" and "exited" as the child nodes of the first target node.

[0112] As a possible implementation, the internal sorting of word frequency can be in an ordered form such as "APP", "message", "sent", "successfully", or in an unordered form. If the internal sorting of word frequency is in an ordered form, the (i + 1)-th keyword can be directly obtained after using the i-th keyword. If the internal sorting of word frequency is in an unordered form, after using the i-th keyword, the i-th keyword can be deleted from the keywords included in the standard query statement library, so as to obtain the keyword with the highest word frequency among the keywords included in the target standard query statement, and obtain the (i + 1)-th keyword.

[0113] S406: Take each node in the initial query tree as the first target node respectively to obtain the query tree.

[0114] By continuously adjusting the value of i, each node in the initial query tree is used as the first target node respectively, and the process ends when the child nodes of the first target node are found or the first target node has no child nodes, thus obtaining the query tree.

[0115] Therefore, based on the word frequencies of the keywords included in the standard query statement, the child nodes can be determined layer by layer for each branch, and the query tree can be automatically built conveniently and quickly.

[0116] As a possible implementation, since there may be an inclusion relationship between standard query statements. For example, there is an inclusion relationship between the standard query statement "APP message sent successfully" and the standard query statement "APP message sent". If the statement to be queried is related to "APP message sent", it is impossible to accurately determine whether the statement to be queried is more matched with the standard query statement "APP message sent" or the standard query statement "APP message sent successfully".

[0117] Based on this, in the embodiments of the present application, a node can be added to the shorter standard query statement among the standard query statements with an inclusion relationship to make them of the same length while not affecting the similarity judgment. The following takes the first standard query statement and the second standard query statement as examples for illustration.

[0118] Among them, the first standard query statement includes n - j keywords, the second standard query statement includes n keywords, and the first n - j keywords included in the second standard query statement are the same as the n - j keywords included in the first standard query statement. Therefore, in the initial query tree, a discrimination node is added after the branch corresponding to the first standard query statement to obtain the query tree. The discrimination node is the (n - j + 1)-th node in the branch corresponding to the first standard query statement, the keyword corresponding to the discrimination node is empty, and it is used to distinguish the first standard query statement and the second standard query statement. n and j are positive integers.

[0119] The keyword corresponding to the discrimination node is "empty", which can be understood that the keyword corresponding to the discrimination node is non-word content used to mark "empty", such as symbols, numbers, etc. In this way, the discrimination node cannot match successfully with any keyword in the statement to be queried, avoiding the following situation: the keyword corresponding to the discrimination node matches successfully with the keyword in the statement to be queried, and the keyword corresponding to the (n - j + 1)-th node of the second standard query statement also matches successfully with the keyword in the statement to be queried.

[0120] The following uses a specific example to illustrate the above content. Continue to refer to Figure 3, the first standard query statement is "APP message sending", which includes 3 keywords. The second standard query statement is "APP message sending successful", which includes 4 keywords. That is, n is 4, j is 1, and 3 keywords in the first standard query statement and the second standard query statement are the same, so they are in an inclusion relationship. In the initial query tree, after the node corresponding to the keyword "sending", there are not only one child node, but two child nodes, corresponding to the keywords "successful" and "null" respectively. The keyword "null" is the 4th node added in the first query standard statement. The first standard statement and the second standard statement are distinguished by the keyword "null". For example, if the keyword "null" matches successfully, the statement to be queried completely matches the first standard statement.

[0121] As a possible implementation, if the statement to be queried matches the first n - j keywords included in the second standard query statement, and the statement to be queried fails to match the (n - j + 1)-th keyword included in the second standard query statement, then make the statement to be queried match the keyword corresponding to the discrimination node successfully. That is to say, if the statement to be queried matches the first n - j keywords included in the second standard query statement, then the statement to be queried matches the first n - j keywords included in the first standard query statement, and the keyword corresponding to the discrimination node included in the statement to be queried and the first standard query statement will not match successfully through the keyword matching method. That is, through the keyword matching method, the statement to be queried fails to match the (n - j + 1)-th keyword in the first query statement and fails to match the (n - j + 1)-th keyword in the second query statement. At this time, force the statement to be queried to match the (n - j + 1)-th keyword in the first query statement, that is, the keyword corresponding to the discrimination node, successfully.

[0122] In other words, if the statement to be queried matches the target keyword successfully, and the statement to be queried fails to match the keywords corresponding to multiple target child nodes, then the statement to be queried matches the (n - j + 1)-th node of the first standard query statement successfully, where the multiple target child nodes are the multiple child nodes of the node corresponding to the target keyword, and the target keyword is the (n - j)-th keyword in the first standard query statement.

[0123] For example, continue to refer to Figure 3, multiple target child nodes are the multiple child nodes of the node corresponding to the keyword "send", or the keywords corresponding to the multiple target child nodes are "success" and "empty" respectively. If the query statement to be queried "I always fail to send messages, how to solve it" fails to match all the keywords corresponding to the target child nodes, then the query statement to be queried is made to match successfully with the keyword "empty", that is, the query statement to be queried completely matches all the keywords in "APP message sending", and the corresponding similarity is 1. The query statement to be queried matches 3 keywords in "APP message sending successfully", and the corresponding similarity is 3 / 4. Thus, even if the first standard statement and the second standard statement have an inclusion relationship, by setting distinguishable nodes in the query tree, it is possible to distinguish which standard query statement in the standard query statements with an inclusion relationship is more matched with the query statement to be queried.

[0124] Therefore, by adding distinguishable nodes for multiple standard query statements with an inclusion relationship to distinguish these standard query statements, subsequent matching becomes more accurate.

[0125] As a possible implementation, since the user asks questions in the form of natural language, that is, the query statement to be queried is not a standard query statement according to certain rules, there are similar expressions related to the standard query statement. For example, "subscribe to messages" can be expressed as "subscribe to notifications", "receive subscription reminders", "subscribe to information", etc. Therefore, in order to improve the accuracy of retrieving standard query statements, a synonym table needs to be maintained for all the keywords in the query tree.

[0126] Specifically, obtain the synonyms of the keyword corresponding to the second target node in the initial query tree, and add the synonyms to the second target node to obtain the query tree. The second target node can be some nodes or all nodes in the initial query tree, and the present application does not make specific limitations on this.

[0127] Therefore, by adding synonyms for the keywords corresponding to the nodes of the initial query tree, the query tree includes multiple expressions with the same meaning in one node, which improves the accuracy of subsequent matching.

[0128] As a possible implementation, the synonyms and the keyword corresponding to the second target node can be formed into a keyword string. For example, the synonyms "notification", "reminder", and "information" corresponding to the keyword "message" corresponding to the second target node are formed into a keyword string "message notification reminder information". That is, in the query tree, the second target node no longer corresponds to the keyword "message", but corresponds to the keyword string "message notification reminder information". Thus, the query statement to be queried is respectively matched with the keyword strings corresponding to the nodes in the query tree.

[0129] Therefore, in the form of keyword strings, the number of matches between the query statement to be queried and the keywords and their synonyms can be reduced, the matching time can be shortened, and the matching efficiency can be improved.

[0130] To facilitate a further understanding of the technical solution provided in the embodiments of the present application, the following takes the execution subject of the query method based on the query tree provided in the embodiments of the present application as a terminal device and constructs a query tree based on a server as an example to give an overall exemplary introduction to the query method based on the query tree.

[0131] The following combines Figure 5 to first explain the construction process of the query tree.

[0132] Refer to Figure 5 , which is a schematic diagram of the construction process of a query tree provided in the embodiments of the present application.

[0133] S1: Obtain a plurality of standard query statements from the standard query statement library.

[0134] S2: Segment each standard query statement to obtain a plurality of keywords.

[0135] Taking the standard query statement "The mini-program subscription message is sent successfully" as an example, the keywords are "mini-program", "subscription message", and "sent successfully".

[0136] S3: Determine the word frequency of each keyword included in the plurality of standard query statements.

[0137] For example, the word frequency of the keyword "mini-program" is 30, the word frequency of the keyword "subscription message" is 10, the word frequency of the keyword "sent successfully" is 9, etc.

[0138] S4: Construct a query tree according to the word frequency of the keywords.

[0139] Specifically, an initial query tree can be constructed such that the multiple nodes in the first layer of the initial query tree are respectively the keywords with the highest word frequency in each standard query statement, and the keywords that have been used as nodes are deleted from the multiple keywords included in the standard query statement library. Then for each node, the keyword with the highest word frequency in the target standard query statement where it is located is used as the child node of this node, and the keywords that have been used as nodes are deleted from the multiple keywords included in the standard query statement library. The above steps are continuously repeated until all the multiple keywords included in the standard query statement library have been deleted, and a query tree is obtained.

[0140] After introducing the construction process of the query tree, queries can be implemented based on the query tree. The following combines Figure 6 to illustrate.

[0141] Refer to Figure 6 , which is a schematic diagram of a query process based on a query tree provided in the embodiments of the present application.

[0142] S6: Obtain a query request.

[0143] The terminal device has an "intelligent AI analysis assistant", which enables users to ask questions in the form of natural language. The "intelligent AI analysis assistant" obtains a query request, which includes a statement to be queried. For example, the statement to be queried can be "the total number of people who launched the mini-program in the last 7 days". There is no need for specific commands or syntax. It provides a more convenient interaction method and conducts personalized data analysis and decision support for different scenarios, which is a typical application empowered by AI.

[0144] It should be noted that the content input by the user included in the query request can be preprocessed to obtain the statement to be queried. The preprocessing can be to split the user's question into multiple text segments through punctuation marks. For each text segment, it is uniformly converted to lowercase, and the numbers, modal particles, and stop words irrelevant to the metrics are removed, etc.

[0145] S7: According to the node order from the root node to the leaf node in the query tree, match the statement to be queried with the keywords corresponding to the nodes in the query tree respectively.

[0146] It can be understood that the query tree can be obtained after obtaining the query request, or it can be stored in the server all the time. This application does not make specific limitations on this.

[0147] During the matching process, for the target branch among the multiple branches included in the query tree, if the i-th keyword of the target branch matches successfully, then match the (i + 1)-th keyword of the target branch with the statement to be queried. If the i-th keyword of the target branch fails to match, then end the matching for the target branch.

[0148] S8: According to the matching results of the statement to be queried and the keywords included in the multiple branches, obtain the similarity of each branch in the query tree.

[0149] S9: Determine multiple pending standard query statements according to the similarity of each branch.

[0150] Take the standard query statements corresponding to the top 20 branches with the highest similarity as multiple pending standard query statements. For example, they can be "total number of mini-program launches", "total number of mini-program launches", "total number of mini-program shares", "total number of APP launches", etc.

[0151] S10: According to the multiple pending standard query statements, determine the similarity between each of the multiple pending standard query statements and the statement to be queried through a natural language model, and determine the standard query statement corresponding to the statement to be queried as the pending standard query statement with the highest similarity.

[0152] For example, the standard query statement corresponding to the statement to be queried is "total number of mini-program launches".

[0153] S11: Query the database according to the standard query statement corresponding to the statement to be queried, and obtain the query result of the standard query statement corresponding to the statement to be queried.

[0154] As a possible implementation, the "Intelligent AI Analysis Assistant" takes the standard query statements corresponding to the statement to be queried as key information such as "total number of times the applet is launched" and time, and generates the corresponding database query statement. By querying the database, the corresponding query result is obtained.

[0155] S12: Return the query result.

[0156] As a possible implementation, the "Intelligent AI Analysis Assistant" can also parse the query result and display it in the form of text conclusions and charts, such as Figure 7 shown.

[0157] Thus, the "Intelligent AI Analysis Assistant" will extract the to-be-determined standard query statements before using the natural language model. First, it roughly ranks multiple standard query statements based on the statement to be queried. On the premise of ensuring accuracy, after significantly reducing the number of to-be-determined standard query statements, it provides the to-be-determined standard query statements to the natural language model for predicting the final standard query statement. Through rough ranking, not only can the number of to-be-determined standard query statements be reduced, but also the query efficiency can be significantly improved, enhancing the user's product experience. At the same time, the demand for natural language model services is reduced, the training and prediction difficulty of the model is lowered, and the corresponding costs are reduced. In the experiment, for a standard query statement library containing about 150 standard query statements, 2000 different statements to be queried were used for testing. The first 20 standard query statements were selected as the to-be-determined standard query statements and input into the natural language model. The average recall rate of the standard query statements was 95.8%. The calculation method of the average recall rate is the number of data entries with standard query statements among the 20 to-be-determined standard query statements / the total test data volume.

[0158] Regarding the query method based on the query tree described above, the present application also provides a corresponding query device based on the query tree to enable the above-mentioned query method based on the query tree to be applied and implemented in practice.

[0159] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.

[0160] SeeFigure 8 , this figure is a schematic structural diagram of a query device based on a query tree provided by an embodiment of the present application. As Figure 8 shown, the query device 800 based on the query tree includes: an acquisition unit 801, a matching unit 802, and a determination unit 803;

[0161] The acquisition unit 801 is configured to acquire a query statement to be queried and a query tree. The query tree includes a plurality of nodes forming a plurality of branches. Different nodes correspond to different keywords. A plurality of keywords in the same branch of the query tree correspond to a standard query statement, and the word frequency of the keyword corresponding to the parent node in the same branch is greater than or equal to the word frequency of the keyword corresponding to the child node;

[0162] The matching unit 802 is configured to match the query statement to be queried with the keywords corresponding to the nodes in the query tree in the order of nodes from the root node to the leaf node in the query tree. For a target branch among the plurality of branches, if the i-th keyword of the target branch is successfully matched, the (i + 1)-th keyword of the target branch is matched with the query statement to be queried; if the i-th keyword of the target branch fails to be matched, the matching for the target branch ends, where i is a positive integer;

[0163] The determination unit 803 is configured to determine a standard query statement corresponding to the query statement to be queried according to the matching result between the query statement to be queried and the keywords included in the plurality of branches.

[0164] As can be seen from the above technical solution, multiple standard query statements included in the standard query statement library are constructed into a query tree. The query tree includes multiple nodes, and one node corresponds to one keyword, such that different nodes correspond to different keywords. Moreover, multiple keywords included in one standard query statement form a branch of the query tree, that is, multiple keywords in the same branch of the query tree correspond to one standard query statement. In addition, the word frequency of the keyword corresponding to the parent node of the query tree is greater than or equal to the word frequency of the keyword corresponding to the child node of the query tree, that is, multiple keywords included in one standard query statement are arranged from the root to the end of the query tree according to the size of the word frequency. After obtaining the statement to be queried, according to the node order from the root node to the leaf node in the query tree, the statement to be queried is respectively matched with the keywords corresponding to a part of the nodes in the query tree to shorten the matching time. Taking the target branch among multiple branches included in the query tree as an example, if the i-th keyword of the target branch is successfully matched, the (i + 1)-th keyword of the target branch is continued to be matched with the statement to be queried; if the i-th keyword of the target branch fails to be matched, the matching for the target branch is ended. That is to say, for each branch of the query tree, starting from the keyword with the highest word frequency, each keyword is successively matched with the statement to be queried. If the match is successful, the matching continues; if the match fails, the matching for the current branch is ended. Thus, according to the matching results of the statement to be queried and the keywords included in each branch, the standard query statement corresponding to the statement to be queried is determined.

[0165] Thus, each branch of the query tree corresponds to one standard query statement, and the keywords respectively corresponding to multiple nodes included in each branch are arranged from largest to smallest according to the word frequency. Therefore, during the process of keyword matching based on the query tree and the statement to be queried, only some nodes in the query tree need to be traversed, and the keywords with higher word frequencies are preferentially matched. It can not only quickly perform keyword matching through keywords with shorter lengths and higher word frequencies, but also quickly filter out standard query statements irrelevant to the statement to be queried from multiple standard query statements, shortening the query time and improving the query efficiency.

[0166] As a possible implementation manner, the determining unit 803 is specifically configured to:

[0167] According to the matching results of the statement to be queried and the keywords included in the multiple branches, obtain the similarity of each branch in the query tree, where the similarity is used to identify the ratio of the number of keywords successfully matched in the branch to the number of nodes included in the branch;

[0168] According to the similarities of the branches, determine the standard query statement corresponding to the statement to be queried.

[0169] As a possible implementation manner, the determining unit 803 is specifically configured to:

[0170] Arrange the similarities of the respective branches in descending order to obtain a similarity ranking;

[0171] If the similarity of the first branch is equal to the similarity of the second branch, obtain the number of successfully matched keywords in the first branch and the number of successfully matched keywords in the second branch;

[0172] If the number of successfully matched keywords in the first branch is greater than the number of successfully matched keywords in the second branch, in the similarity ranking, the ranking of the first branch is higher than the ranking of the second branch;

[0173] Determine the standard query statement corresponding to the branch that meets the preset similarity condition in the similarity ranking as the standard query statement corresponding to the to-be-query statement.

[0174] As a possible implementation manner, the determining unit 803 is specifically configured to:

[0175] Determine a plurality of to-be-determined standard query statements according to the matching result between the to-be-query statement and the keywords included in the plurality of branches;

[0176] According to the plurality of to-be-determined standard query statements, determine the similarity between each of the plurality of to-be-determined standard query statements and the to-be-query statement through a natural language model, and determine the to-be-determined standard query statement with the highest similarity as the standard query statement corresponding to the to-be-query statement.

[0177] As a possible implementation manner, the matching unit 802 is specifically configured to:

[0178] Delete the i-th keyword of the target branch from the to-be-query statement to obtain a deformed to-be-query statement;

[0179] Match the (i + 1)-th keyword of the target branch with the deformed to-be-query statement.

[0180] As a possible implementation manner, the query device 800 based on the query tree further includes a construction unit for:

[0181] Obtain a plurality of standard query statements, each of the query standard statements including a plurality of the keywords;

[0182] Determine the word frequency of each keyword included in the plurality of standard query statements;

[0183] According to the word frequency of each keyword, determine the internal word frequency sorting corresponding to each of the standard query statements, and the internal word frequency sorting is used to identify the sorting between the multiple keywords included in the standard query statement;

[0184] Construct an initial query tree, where multiple nodes in the first layer of the initial query tree are respectively the keywords with the highest word frequencies in each of the standard query statements, and the multiple nodes in the first layer include the first node in the multiple branches;

[0185] For a first target node among the nodes in the i-th layer of the initial query tree, obtain a target standard query statement including the keyword corresponding to the first target node, and use the (i + 1)-th keyword of the internal sorting identifier of the word frequency corresponding to the target standard query statement as the child node of the first target node. The nodes in the i-th layer include the i-th nodes in each of the branches;

[0186] Use each node in the initial query tree as the first target node to obtain the query tree.

[0187] As a possible implementation, the first standard query statement includes n - j keywords, the second standard query statement includes n keywords, and the first n - j keywords included in the second standard query statement are the same as the n - j keywords included in the first standard query statement; the query device 800 based on the query tree further includes a construction unit for:

[0188] In the initial query tree, add a discrimination node after the branch corresponding to the first standard query statement to obtain the query tree. The keyword corresponding to the discrimination node is empty and is used to distinguish the first standard query statement and the second standard query statement. n and j are positive integers.

[0189] As a possible implementation, the matching unit 802 is further configured to:

[0190] If the to-be-query statement successfully matches the first n - j keywords included in the second standard query statement and fails to match the (n - j + 1)-th keyword included in the second standard query statement, then make the to-be-query statement successfully match the keyword corresponding to the discrimination node.

[0191] As a possible implementation, the query device 800 based on the query tree further includes a construction unit for:

[0192] Obtain synonyms of the keyword corresponding to the second target node in the initial query tree;

[0193] Add the synonyms to the second target node to obtain the query tree.

[0194] As a possible implementation, the query device 800 based on the query tree further includes a construction unit for forming a keyword string from the synonyms and the keyword corresponding to the second target node to obtain the query tree;

[0195] The matching unit 802 is specifically configured to match the to-be-query statement with the keyword strings corresponding to the nodes in the query tree respectively.

[0196] As a possible implementation manner, the obtaining unit 801 is specifically configured to obtain a query request, where the query request includes the to-be-query statement;

[0197] The query device 800 based on the query tree further includes an application unit, configured to:

[0198] After determining the standard query statement corresponding to the to-be-query statement according to the matching result between the to-be-query statement and the keywords included in the multiple branches, query in the database according to the standard query statement corresponding to the to-be-query statement, and obtain the query result of the standard query statement corresponding to the to-be-query statement;

[0199] Return the query result.

[0200] An embodiment of the present application further provides a computer device, which is the computer device introduced above. The computer device can be a server or a terminal device. The query device based on the query tree described above can be built in the server or the terminal device. Below, the computer device provided by the embodiment of the present application will be introduced from the perspective of hardware implementation. Among them, Figure 9 The figure shows a schematic structural diagram of a server. Figure 10 The figure shows a schematic structural diagram of a terminal device.

[0201] See Figure 9 , which is a schematic structural diagram of a server provided by an embodiment of the present application. The server 1400 may vary greatly due to different configurations or performances, and may include one or more processors 1422, such as a central processing unit (CPU), a memory 1432, and a storage medium 1430 (for example, one or more mass storage devices) for storing one or more application programs 1442 or data 1444. Among them, the memory 1432 and the storage medium 1430 may be transient storage or persistent storage. The program stored in the storage medium 1430 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the server. Further, the processor 1422 may be configured to communicate with the storage medium 1430 and execute a series of instruction operations in the storage medium 1430 on the server 1400.

[0202] The server 1400 may also include one or more power supplies 1426, one or more wired or wireless network interfaces 1450, one or more input / output interfaces 1458, and / or one or more operating systems 1441, such as Windows Server TM , Mac OS X TM , Unix TM , Linux TM , FreeBSD TM and so on.

[0203] In the above embodiments, the steps executed by the server may be based on the Figure 9 server structure shown.

[0204] Among them, the CPU 1422 is used to execute the following steps:

[0205] Obtain the statement to be queried and the query tree. The query tree includes multiple nodes that form multiple branches. Different nodes correspond to different keywords. Multiple keywords in the same branch of the query tree correspond to a standard query statement, and the frequency of the keyword corresponding to the parent node in the same branch is greater than or equal to the frequency of the keyword corresponding to the child node;

[0206] According to the node order from the root node to the leaf node in the query tree, match the statement to be queried with the keywords corresponding to the nodes in the query tree respectively. For the target branch among the multiple branches, if the i-th keyword of the target branch matches successfully, then match the (i + 1)-th keyword of the target branch with the statement to be queried. If the i-th keyword of the target branch fails to match, then end the matching for the target branch, where i is a positive integer;

[0207] Determine the standard query statement corresponding to the statement to be queried according to the matching result between the statement to be queried and the keywords included in the multiple branches.

[0208] Optionally, the CPU 1422 may also execute the method steps of any specific implementation manner of the query method based on the query tree in the embodiments of the present application.

[0209] Refer to Figure 10 , which is a schematic structural diagram of a terminal device provided in the embodiments of the present application. Taking this terminal device as a smart phone as an example for illustration, Figure 10The block diagram of a partial structure of the smart phone is shown. The smart phone includes components such as a Radio Frequency (RF) circuit 1510, a memory 1520, an input unit 1530, a display unit 1540, a sensor 1550, an audio circuit 1560, a Wi-Fi (Wireless Fidelity) module 1570, a processor 1580, and a power supply 1590. Those skilled in the art can understand that Figure 10 the smart phone structure shown in

[0210] does not limit the smart phone and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Figure 10 The following specifically introduces each component of the smart phone:

[0211] The RF circuit 1510 can be used for receiving and sending signals during information reception or call processes. Specifically, after receiving the downlink information from the base station, it is given to the processor 1580 for processing; in addition, it sends the designed uplink data to the base station.

[0212] The memory 1520 can be used to store software programs and modules. The processor 1580 realizes various functional applications and data processing of the smart phone by running the software programs and modules stored in the memory 1520.

[0213] The input unit 1530 can be used to receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the smart phone. Specifically, the input unit 1530 can include a touch panel 1531 and other input devices 1532. The touch panel 1531, also known as a touch screen, can collect touch operations of the user on or near it, and drive the corresponding connection device according to a pre-set program. In addition to the touch panel 1531, the input unit 1530 can also include other input devices 1532. Specifically, the other input devices 1532 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power on / off keys, etc.), a trackball, a mouse, a joystick, etc.

[0214] The display unit 1540 can be used to display information input by the user or information provided to the user, as well as various menus of the smart phone. The display unit 1540 can include a display panel 1541. Optionally, the display panel 1541 can be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), etc.

[0215] The smart phone may further include at least one sensor 1550, such as a light sensor, a motion sensor, and other sensors. As for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc. that the smart phone may also be configured with, they will not be elaborated here.

[0216] The audio circuit 1560, the speaker 1561, and the microphone 1562 may provide an audio interface between the user and the smart phone. The audio circuit 1560 may transmit the electrical signal converted from the received audio data to the speaker 1561, and the speaker 1561 converts it into a sound signal for output; on the other hand, the microphone 1562 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1560 and then converted into audio data. After the audio data is output to the processor 1580 for processing, it is sent through the RF circuit 1510 to, for example, another smart phone, or the audio data is output to the memory 1520 for further processing.

[0217] The processor 1580 is the control center of the smart phone, connecting various parts of the entire smart phone through various interfaces and lines. By running or executing the software programs and / or modules stored in the memory 1520, and by calling the data stored in the memory 1520, it executes various functions of the smart phone and processes data. Optionally, the processor 1580 may include one or more processing units.

[0218] The smart phone further includes a power supply 1590 (such as a battery) for powering each component. Preferably, the power supply can be logically connected to the processor 1580 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system.

[0219] Although not shown, the smart phone may further include a camera, a Bluetooth module, etc., which will not be elaborated here.

[0220] In the embodiment of the present application, the memory 1520 included in the smart phone may store a computer program and transmit the computer program to the processor.

[0221] The processor 1580 included in the smart phone may execute the query method based on the query tree provided in the above embodiment according to the instructions in the computer program.

[0222] The embodiment of the present application further provides a computer-readable storage medium for storing a computer program, and the computer program is used to execute the query method based on the query tree provided in the above embodiment.

[0223] The embodiments of the present application also provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the query method based on the query tree provided in various optional implementation manners of the above aspects.

[0224] Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium can be at least one of the following media: read-only memory (abbreviation: ROM), RAM, magnetic disk, or optical disc, etc., which can store computer programs.

[0225] It should be noted that the embodiments in this specification are all described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the relevant parts, reference can be made to the partial description of the method embodiments. The device and system embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.

[0226] As described above, it is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered by the protection scope of the present application. On the basis of the implementation manners provided in the above aspects of the present application, further combinations can be made to provide more implementation manners. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A query method based on a query tree, characterized in that, the method includes: obtaining a query statement to be queried and a query tree, the query tree includes multiple nodes forming multiple branches, different nodes correspond to different keywords, multiple keywords in the same branch of the query tree correspond to a standard query statement, and the word frequency of the keyword corresponding to the parent node in the same branch is greater than or equal to the word frequency of the keyword corresponding to the child node; according to the node order from the root node to the leaf node in the query tree, matching the query statement to be queried with the keywords corresponding to the nodes in the query tree respectively. For the target branch among the multiple branches, if the i-th keyword of the target branch matches successfully, then match the (i + 1)-th keyword of the target branch with the query statement to be queried. If the i-th keyword of the target branch fails to match, then end the matching for the target branch, where i is a positive integer; determine the standard query statement corresponding to the query statement to be queried according to the matching result between the query statement to be queried and the keywords included in the multiple branches.

2. The method according to claim 1, characterized in that, the determining the standard query statement corresponding to the query statement to be queried according to the matching result between the query statement to be queried and the keywords included in the multiple branches includes: obtaining the similarity of each branch in the query tree according to the matching result between the query statement to be queried and the keywords included in the multiple branches, where the similarity is used to identify the ratio of the number of keywords that match successfully in the branch to the number of nodes included in the branch; determine the standard query statement corresponding to the query statement to be queried according to the similarities of the respective branches.

3. The method according to claim 2, characterized in that, the determining the standard query statement corresponding to the query statement to be queried according to the similarities of the respective branches includes: arranging the similarities of the respective branches from large to small to obtain a similarity ranking; if the similarity of the first branch is equal to the similarity of the second branch, then obtain the number of keywords that match successfully in the first branch and the number of keywords that match successfully in the second branch; if the number of keywords that match successfully in the first branch is greater than the number of keywords that match successfully in the second branch, then in the similarity ranking, the ranking of the first branch is higher than the ranking of the second branch; determine the standard query statement corresponding to the branch that meets the preset similarity condition in the similarity ranking as the standard query statement corresponding to the query statement to be queried.

4. The method according to claim 1, characterized in that, the determining the standard query statement corresponding to the query statement to be queried according to the matching result between the query statement to be queried and the keywords included in the multiple branches includes: determine multiple candidate standard query statements according to the matching result between the query statement to be queried and the keywords included in the multiple branches. Query the multiple to-be-determined standard query statements, determine the similarity between each of the multiple to-be-determined standard query statements and the to-be-query statement through a natural language model, and determine the to-be-determined standard query statement with the highest similarity as the standard query statement corresponding to the to-be-query statement.

5. The method according to claim 1, wherein, the matching of the (i + 1)-th keyword of the target branch with the to-be-query statement includes: deleting the i-th keyword of the target branch from the to-be-query statement to obtain a deformed to-be-query statement; matching the (i + 1)-th keyword of the target branch with the deformed to-be-query statement.

6. The method according to claim 1, wherein, the method further includes: obtaining multiple standard query statements, each of the query standard statements including multiple of the keywords; determining the word frequency of each keyword included in the multiple standard query statements; determining the internal word frequency sorting corresponding to each of the standard query statements according to the word frequency of each keyword, the internal word frequency sorting being used to identify the sorting between the multiple keywords included in the standard query statement; constructing an initial query tree, where the multiple nodes in the first layer of the initial query tree are respectively the keywords with the highest word frequency in each of the standard query statements, and the multiple nodes in the first layer include the first node in the multiple branches; for a first target node among the nodes in the i-th layer of the initial query tree, obtaining a target standard query statement including the keyword corresponding to the first target node, and using the (i + 1)-th keyword identified by the internal word frequency sorting corresponding to the target standard query statement as the child node of the first target node; using each node in the initial query tree as the first target node to obtain the query tree.

7. The method according to claim 6, wherein, the first standard query statement includes n - j keywords, the second standard query statement includes n keywords, and the first n - j keywords included in the second standard query statement are the same as the n - j keywords included in the first standard query statement; the method further includes: in the initial query tree, adding a distinguishing node after the branch corresponding to the first standard query statement to obtain the query tree, the keyword corresponding to the distinguishing node being empty and used to distinguish the first standard query statement and the second standard query statement, where n and j are positive integers.

8. The method according to claim 7, wherein, the method further includes: if the to-be-query statement matches successfully with the first n - j keywords included in the second standard query statement and fails to match with the (n - j + 1)-th keyword included in the second standard query statement, then making the to-be-query statement match successfully with the keyword corresponding to the distinguishing node.

9. The method according to claim 6, wherein, the method further includes: obtaining synonyms of the keyword corresponding to a second target node in the initial query tree; adding the synonyms to the second target node to obtain the query tree.

10. The method according to claim 9, It is characterized in that the step of adding the synonym to the second target node to obtain the query tree includes: forming a keyword string by the synonym and the keyword corresponding to the second target node to obtain the query tree; the step of matching the to-be-query statement with the keyword corresponding to the node in the query tree respectively includes: matching the to-be-query statement with the keyword string corresponding to the node in the query tree respectively.

11. The method according to any one of claims 1-10, it is characterized in that the step of obtaining the to-be-query statement includes: obtaining a query request, where the query request includes the to-be-query statement; after determining the standard query statement corresponding to the to-be-query statement according to the matching result between the to-be-query statement and the keywords included in the multiple branches, the method further includes: querying in a database according to the standard query statement corresponding to the to-be-query statement to obtain a query result of the standard query statement corresponding to the to-be-query statement; returning the query result.

12. A query device based on a query tree, it is characterized in that the device includes: an acquisition unit, a matching unit and a determination unit; the acquisition unit is configured to acquire a to-be-query statement and a query tree, where the query tree includes multiple nodes forming multiple branches, different nodes correspond to different keywords, multiple keywords in the same branch of the query tree correspond to a standard query statement, and the word frequency of the keyword corresponding to the parent node in the same branch is greater than or equal to the word frequency of the keyword corresponding to the child node; the matching unit is configured to match the to-be-query statement with the keyword corresponding to the node in the query tree in the node order from the root node to the leaf node of the query tree. For the target branch among the multiple branches, if the i-th keyword of the target branch matches successfully, then match the (i + 1)-th keyword of the target branch with the to-be-query statement; if the i-th keyword of the target branch fails to match, then end the matching for the target branch, where i is a positive integer; the determination unit is configured to determine the standard query statement corresponding to the to-be-query statement according to the matching result between the to-be-query statement and the keywords included in the multiple branches.

13. A computer device, it is characterized in that the computer device includes a processor and a memory: the memory is used to store a computer program and transmit the computer program to the processor; the processor is configured to execute the method according to any one of claims 1-11 according to the computer program.

14. A computer-readable storage medium, it is characterized in that the computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1-11.

15. A computer program product including a computer program, it is characterized in that when it runs on a computer device, it causes the computer device to execute the method according to any one of claims 1-11.