Product information query method and device, computer equipment and storage medium

By setting the tree-structured edit distance and multi-scale feature extraction model to optimize query statements, the problems of individual differences and repeated references when converting user natural language text into SQL statements are solved, and the accuracy and personalized matching of product information queries are improved.

CN120653743APending Publication Date: 2025-09-16PING AN FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510776715.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-10
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

When the user's natural language text is directly converted into SQL statements in the existing technology, there are problems such as small individual differences and repeated references, resulting in low accuracy of product information query results.

Method used

By setting the tree edit distance between the syntax tree of the generated query statement and the syntax tree of the target standard query statement, combined with the multi-scale feature extraction model and redundant information optimization, personalized query statements are generated to improve accuracy.

Benefits of technology

It improves the individual differences and accuracy of product information query results in response to different user query needs, reduces redundant information, and enhances the personalized matching of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653743A_ABST
    Figure CN120653743A_ABST
Patent Text Reader

Abstract

The invention provides a product information query method and device, computer equipment and a computer readable storage medium, and belongs to the field of natural language processing. The method comprises the steps that statement generation is conducted based on a dialogue text of a target product system, a generated query statement of the dialogue text is obtained, the tree form editing distance between a syntax tree of the generated query statement and a syntax tree of a target standard query statement is larger than a preset editing distance, and the target standard query statement is determined based on a query intention of the dialogue text; obtaining redundant information for generating the query statement; optimizing the generated query statement based on the redundant information to obtain a target query statement of the dialogue text; and obtaining a product information query result of the dialogue text from a database of the target product system based on the target query statement. The method can be applied to the field of finance, individual differences of product information query results on query requirements of different users can be improved, and the accuracy of the product information query results is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language processing technology, and in particular to a method, apparatus, computer device, and computer-readable storage medium for querying product information. Background Art

[0002] Product information query is an important application of query language, such as query language used for financial data query. In related technologies, the user's natural language text is directly converted into SQL (Structured Query Language) statements for querying the database. However, during the actual research and development process, the inventors of this application found that this query method directly converts text into query statements, which either results in little individual difference in different user query requirements (such as generating the same or similar query statements for two different user query requirements) or duplicate references to functional phrases such as calculation rules or data fields, resulting in deviations in the query results, and thus the low accuracy of product information query results. Summary of the Invention

[0003] The present application provides a product information query method, device, computer equipment and computer-readable storage medium, which belong to the field of natural language processing technology, and can improve the individual differences of product information query results based on different user query needs and improve the accuracy of product information query results.

[0004] In a first aspect, the present application provides a method for querying product information, the method comprising:

[0005] Generating a statement based on a conversation text of a target product system to obtain a generated query statement of the conversation text, wherein a tree edit distance between a syntax tree of the generated query statement and a syntax tree of a target standard query statement is greater than a preset edit distance, and the target standard query statement is determined based on a query intent of the conversation text;

[0006] Obtaining redundant information of the generated query statement;

[0007] Optimizing the generated query statement based on the redundant information to obtain a target query statement of the dialogue text;

[0008] Based on the target query statement, a product information query result of the dialogue text is obtained from a database of the target product system.

[0009] In a second aspect, the present application provides a device for querying product information, the device comprising:

[0010] a generating unit configured to generate a statement based on a dialog text of a target product system to obtain a generated query statement of the dialog text, wherein a tree edit distance between a syntax tree of the generated query statement and a syntax tree of a target standard query statement is greater than a preset edit distance, and the target standard query statement is determined based on a query intent of the dialog text;

[0011] an acquiring unit, configured to acquire redundant information for generating the query statement;

[0012] an optimization unit, configured to optimize the generated query statement based on the redundant information to obtain a target query statement of the dialogue text;

[0013] The query unit is configured to obtain a product information query result of the dialogue text from a database of the target product system based on the target query statement.

[0014] In a third aspect, the present application also provides a computer device, which includes a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the product information query method when executing the computer program.

[0015] In a fourth aspect, the present application also provides a computer-readable storage medium on which a computer program is stored, and the computer program is loaded by a processor to execute the product information query method.

[0016] In the present application, firstly, by setting a target standard query statement based on the query intent of the conversation text, the tree edit distance between the syntax tree of the generated query statement of the conversation text and the syntax tree of the target standard query statement is greater than a preset edit distance, thereby reducing the similarity between the generated query statement and the target standard query statement, and thus reducing the similarity of the query statement generated by the conversation text for the user's query needs. This improves the individual differences in the query results corresponding to the generated query statement for different user query needs, thereby improving the individual differences in the product information query results for different user query needs. Secondly, by optimizing the generated query statement based on redundant information in the generated query statement, it is possible to filter out duplicate or incorrect functional segments in the generated query statement, avoid the problem of excessive redundant information in the generated query statement caused by a large tree edit distance between the syntax tree of the generated query statement and the syntax tree of the target standard query statement, and reduce the duplication or incorrect reference of functional segments such as calculation rules or data fields. Thus, the present application can improve the individual differences in product information query results for different user query needs and improve the accuracy of product information query results. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0018] Figure 1 This is a flow chart of a method for querying product information provided in an embodiment of the present application;

[0019] Figure 2 This is a flow chart of an embodiment of step 101 in the embodiment of the present application;

[0020] Figure 3 This is a flowchart of an embodiment of step 1012A in the embodiment of the present application;

[0021] Figure 4 This is a flow chart of an embodiment of step 302 in the embodiment of the present application;

[0022] Figure 5 This is another example flow chart of step 101 in the embodiment of the present application;

[0023] Figure 6 This is a schematic diagram of the structure of an embodiment of a device for querying product information provided in an embodiment of the present application;

[0024] Figure 7 This is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.

[0026] The flowcharts shown in the accompanying drawings are for illustrative purposes only and do not necessarily include all contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may be decomposed, combined, or partially merged, so the actual execution order may vary depending on the actual situation.

[0027] In the description of the embodiments of the present application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0028] In order to enable any person skilled in the art to implement and use the present application, the following description is provided. In the following description, details are listed for the purpose of explanation. It should be understood that one of ordinary skill in the art will recognize that the present application can be implemented without using these specific details. In other examples, well-known processes will not be elaborated in detail to avoid obscuring the description of the embodiments of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest range of principles and features disclosed in accordance with the embodiments of the present application.

[0029] Embodiments of the present application provide a method, apparatus, computer device, and computer-readable storage medium for querying product information.

[0030] The executing entity of the product information query method of the embodiment of the present application can be the product information query device provided in the embodiment of the present application, or the computer device provided in the embodiment of the present application, wherein the product information query device can be implemented in hardware or software.

[0031] The following embodiments of the present application are described in detail with reference to the accompanying drawings. In the absence of conflict, the following embodiments and features therein may be combined with each other.

[0032] See also Figure 1 , Figure 1 101 to 104, wherein:

[0033] 101. Generate a statement based on the dialogue text of the target product system to obtain a generated query statement of the dialogue text.

[0034] The tree edit distance between the syntax tree of the generated query statement and the syntax tree of the target standard query statement is greater than a preset edit distance, and the target standard query statement is determined based on the query intent of the dialogue text.

[0035] The target product system is a system that can provide product information query. For example, in the financial field, the target product system can be a financial management system. In another example, in the digital healthcare field, the target product system can be a medical information query system.

[0036] The generated query statement is a statement obtained by semantic analysis and mapping based on the conversation text.

[0037] There are many ways to implement step 101, illustratively including:

[0038] (1) In some embodiments, Figure 2 As shown, step 101 includes the following steps 1011A to 1015A:

[0039] 1011A. Generate a statement based on the dialogue text of the target product system to obtain a first query statement of the dialogue text.

[0040] The first query statement is a query statement generated based on the conversation text.

[0041] For example, natural language processing technology can be used to segment and annotate the dialogue text of the target product system (e.g., the dialogue text is "Query the total returns of all stable financial products I purchased in the past year"). For example, the dialogue text is broken down into multiple words or phrases, with each word or phrase serving as a segmented word. At the same time, each segmented word is annotated with a part-of-speech, such as noun, verb, adjective, etc., to facilitate subsequent processing. Then, condition recognition is performed based on each segmented word and its part-of-speech in the dialogue text to determine the query conditions of the dialogue text, such as the query account, query time, query product type, etc. (e.g., for the dialogue text "Query the total returns of all stable financial products I purchased in the past year" given by a user with account ID001 in the financial management system, it can be determined that the query account is "ID001", the query time is "past year", and the query product type is "stable financial products"). And based on each word segment and its part of speech in the dialogue text, purpose recognition is performed to determine the query purpose of the dialogue text (for example, for the dialogue text "Query the total returns of all stable financial products I purchased in the past year", the query purpose can be determined to be "Calculate the total returns"); then, according to the target product knowledge graph and predefined mapping rules, the query conditions of the dialogue text, the query purpose of the dialogue text and other key information are mapped and processed to convert them into SQL statements to obtain the first query statement of the dialogue text.

[0042] 1012A. Obtain a first tree edit distance between a first syntax tree of the first query statement and a target standard syntax tree of the target standard query statement.

[0043] The first syntax tree is a syntax tree constructed based on the first query statement.

[0044] The target standard syntax tree is a syntax tree constructed based on the target standard query statement.

[0045] The first tree edit distance is the edit distance required to convert the first syntax tree into the target standard syntax tree, and is used to indicate the similarity between the first syntax tree and the target standard syntax tree.

[0046] The tree edit distance between two syntax trees can be represented by the minimum number of edits required for conversion between the two syntax trees (eg, conversion of the first syntax tree into the target standard syntax tree).

[0047] The target standard query statement is a preset standard query statement corresponding to the query intent of the conversation text.

[0048] For example, the target standard query statement can be determined as follows: First, a standard query statement can be preset for each query intent, and the query intent and standard query statement are associated and recorded in a preset statement library. Then, intent recognition can be performed based on the conversation text to obtain the query intent of the conversation text. Next, a standard query statement that matches the query intent of the conversation text can be searched from the preset statement library and used as the target query statement.

[0049] For example, Figure 3 As shown, step 1012A may specifically include the following steps 301 to 303:

[0050] 301. Obtain first editing operation nodes required for converting the first syntax tree into the target standard syntax tree.

[0051] The first editing operation node includes at least one of an insert operation node, a delete operation node, and a replace operation node.

[0052] Wherein, the insertion operation node refers to the node required to be inserted when converting one syntax tree to another syntax tree (such as converting the first syntax tree to the target standard syntax tree). Exemplarily, first determine whether a node insertion operation is required when converting from one syntax tree to another syntax tree (such as converting the first syntax tree to the target standard syntax tree). If a node insertion operation is required, it is determined that there is an insertion operation node, and the inserted node is used as the insertion operation node; if a node insertion operation is not required, it is determined that there is no insertion operation node; the method for determining the insertion operation node can be as follows: compare two syntax trees. If one syntax tree is converted to another syntax tree (such as converting the first syntax tree to the target standard syntax tree), it is necessary to insert a node representing a conditional judgment, an aggregate function, a grouping, etc., then it is determined that a node insertion operation is required; for example, if converting from one syntax tree to another syntax tree (such as converting the first syntax tree to the target standard syntax tree) requires inserting a "BETWEEN...AND..." time range condition node and a "GROUP BY product_type" grouping node, then it is determined that a node insertion operation is required, and the inserted "BETWEEN...AND..." time range condition node and the "GROUP BY product_type" grouping node can both be used as insertion operation nodes.

[0053] Among them, the deletion operation node refers to the node that needs to be deleted when converting one syntax tree to another syntax tree (such as converting the first syntax tree to the target standard syntax tree). For example, first determine whether a node deletion operation is required when converting from one syntax tree to another syntax tree (such as converting the first syntax tree to the target standard syntax tree). If a node deletion operation is required, it is determined that there is a deletion operation node, and the deleted node is used as the deletion operation node; if a node deletion operation is not required, it is determined that there is no deletion operation node; the method for determining the deletion operation node can be as follows: compare two syntax trees. If one syntax tree is converted to another syntax tree (such as converting the first syntax tree to the target standard syntax tree), it is necessary to delete related nodes such as redundant statements, then it is determined that a node deletion operation is required; for example, when converting from one syntax tree to another syntax tree (such as, the generated first query statement writes a redundant statement "ORDER BY...", the first syntax tree is converted to the target standard syntax tree) and it is necessary to delete the nodes related to "ORDER BY...", then it is determined that a node deletion operation is required, and the deleted "ORDERBY..." related nodes can be used as deletion operation nodes.

[0054] Wherein, the replacement operation node refers to the node that needs to be replaced when converting one syntax tree to another syntax tree (such as converting the first syntax tree to the target standard syntax tree). Exemplarily, first determine whether a node replacement operation is required when converting from one syntax tree to another syntax tree (such as converting the first syntax tree to the target standard syntax tree). If a node replacement operation is required, then determine that there is a replacement operation node, and use the replaced node as the replacement operation node; if no node replacement operation is required, then determine that there is no replacement operation node; the determination method of the replacement operation node can be as follows: compare two syntax trees, if one syntax tree is converted to another syntax tree (such as converting the first syntax tree to the target standard syntax tree), it is necessary to replace nodes representing conditional judgments, aggregate functions, grouping, etc., then determine that a node replacement operation is required; for example, when converting from one syntax tree to another syntax tree (such as the generated first query statement uses "AVG(income)" to calculate the average income, and the target standard query statement requires "SUM(income)" to calculate the total income, and the first syntax tree is converted to the target standard syntax tree), it is necessary to replace the "AVG" function node with the "SUM" function node, then determine that a node replacement operation is required, and the replaced "AVG" function node can be used as the replacement operation node.

[0055] 302. Obtain an edit distance score of the first syntax tree based on the number of the first edit operation nodes.

[0056] There are many different implementations of step 302 for different first editing operation nodes. For example, they include the following: ①, ②, ③, and ④:

[0057] ① The first edit operation node includes an insert operation node, and the edit distance score includes an insert distance score. In this case, the insert distance score can be determined based on the number of insert operation nodes required to convert the first syntax tree into the target standard syntax tree. Figure 4 As shown, step 302 may specifically include the following steps 3021A to 3033A:

[0058] 3021A. Obtain a first distance weight coefficient corresponding to the insertion operation node.

[0059] The first distance weight coefficient refers to the distance weight coefficient of the insertion operation node.

[0060] In some embodiments, the distance weight coefficient is set according to the node type. For example, the distance weight coefficient corresponding to the node of the insertion class is a first preset value, the distance weight coefficient corresponding to the node of the deletion class is a second preset value, the distance weight coefficient corresponding to the node of the replacement class is a third preset value, and so on. At this time, step 3021A may specifically include: obtaining the first node type of the insertion operation node; using the preset weight coefficient of the first node type as the first distance weight coefficient; since the insertion operation node is a node of the insertion class, the preset distance weight coefficient corresponding to the node of the insertion class (i.e., the first preset value) can be directly used as the first distance weight coefficient.

[0061] In some embodiments, the distance weight coefficient is set according to the field type of the node. For example, the distance weight coefficient corresponding to the node whose field type is a keyword (such as keywords such as "SELECT", "FROM", "WHERE", "GROUP BY", "ORDER BY") is a first preset value, the distance weight coefficient corresponding to the node whose field type is a comment (such as the comment statement "--This is a comment for income calculation") is a second preset value, and the distance weight coefficient corresponding to the node whose field type is a function (such as "SUM(income)", "AVG(income)" and other functions) is a third preset value. At this time, step 3021A can specifically include: obtaining the first field type of the insert operation node; and using the preset weight coefficient of the first field type as the first distance weight coefficient.

[0062] In some embodiments, a distance weight coefficient is set based on the node type and the node field type. In this case, step 3021A may specifically include: obtaining a first field type of the insert operation node; obtaining a first node type of the insert operation node; and determining the first distance weight coefficient based on a preset weight coefficient of the first field type and a preset weight coefficient of the first node type.

[0063] Furthermore, different preset weight coefficients can be assigned to different field types, so that field types that have different degrees of influence on the query statement are assigned different preset weight coefficients, and the editing distance scores of editing operation nodes of different field types are different. For example, the first field type includes at least one of keywords, functions, and comments. The preset weight coefficient of keywords is greater than the preset weight coefficient of functions, and the preset weight coefficient of functions is greater than the preset weight coefficient of comments.

[0064] 3022A. Obtain the number of the insert operation nodes.

[0065] 3023A. Determine an insertion distance score of the first syntax tree according to the first distance weight coefficient and the number of the insertion operation nodes.

[0066] Corresponding to the implementation of step 3021A, there are multiple implementations of steps 3022A to 3023A, illustratively including:

[0067] In some embodiments, a distance weight coefficient is set based on the node type. In this case, each insertion operation node uses the same first distance weight coefficient. In step 3022A, the number of all insertion operation nodes is counted. In step 3023A, the number of insertion operation nodes can be multiplied by the first distance weight coefficient to obtain the insertion distance score of the first syntax tree.

[0068] In some embodiments, a distance weight coefficient is set based on the field type of the node. In this case, different first distance weight coefficients are used for insert operation nodes of different field types. In step 3021A, the first distance weight coefficient of the insert operation node of each field type is obtained respectively. In step 3022A, the number of insert operation nodes of each field type is counted respectively. In step 3023A, the first distance weight coefficient of the insert operation node of each field type is multiplied by the number of insert operation nodes of each field type to obtain a distance score corresponding to each field type. The distance scores corresponding to all field types are then summed, and the result obtained is used as the insertion distance score of the first syntax tree.

[0069] Through steps 3021A to 3033A, the insertion distance score of the first syntax tree can be determined in combination with the insertion operation node. The insertion distance score of the first syntax tree is used to determine the first tree edit distance, which can improve the accuracy of the first tree edit distance.

[0070] ② The first edit operation node includes a delete operation node, and the edit distance score includes a delete distance score. In this case, the delete distance score can be determined based on the number of delete operation nodes required to convert the first syntax tree into the target standard syntax tree. In this case, step 302 may specifically include the following steps 3021B to 3033B:

[0071] 3021B. Obtain a second distance weight coefficient corresponding to the deletion operation node.

[0072] The second distance weight coefficient refers to the distance weight coefficient of the deletion operation node.

[0073] In some embodiments, step 3021B may specifically include: obtaining the second field type of the deletion operation node, wherein the second field type includes at least one of keywords, function functions, and comments, the preset weight coefficient of the keyword is greater than the preset weight coefficient of the function function, and the preset weight coefficient of the function function is greater than the preset weight coefficient of the comment; obtaining the second node type of the deletion operation node; determining the second distance weight coefficient based on the preset weight coefficient of the second field type and the preset weight coefficient of the second node type.

[0074] 3022B. Obtain the number of the deletion operation nodes.

[0075] 3023B. Determine a deletion distance score of the first syntax tree according to the second distance weight coefficient and the number of the deletion operation nodes.

[0076] Steps 3021B-3033B are similar to steps 3021A-3033A. For details, please refer to the previous description and will not be repeated here. Steps 3021B-3033B can be combined with the deletion operation node to determine the deletion distance score of the first syntax tree. Using the deletion distance score of the first syntax tree to determine the first tree-form edit distance can improve the accuracy of the first tree-form edit distance.

[0077] ③ The first edit operation node includes a replacement operation node, and the edit distance score includes a replacement distance score. In this case, the replacement distance score can be determined based on the number of replacement operation nodes required to convert the first syntax tree into the target standard syntax tree. In this case, step 302 may specifically include the following steps 3021C to 3033C:

[0078] 3021C. Obtain a third distance weight coefficient corresponding to the replacement operation node.

[0079] The third distance weight coefficient refers to the distance weight coefficient of the replacement operation node.

[0080] In some embodiments, step 3021C may specifically include: obtaining the third field type of the replacement operation node, wherein the third field type includes at least one of keywords, function functions, and comments, the preset weight coefficient of the keyword is greater than the preset weight coefficient of the function function, and the preset weight coefficient of the function function is greater than the preset weight coefficient of the comment; obtaining the third node type of the replacement operation node; determining the third distance weight coefficient based on the preset weight coefficient of the third field type and the preset weight coefficient of the third node type.

[0081] 3022C. Obtain the number of replacement operation nodes.

[0082] 3023C. Determine a replacement distance score of the first syntax tree according to the third distance weight coefficient and the number of replacement operation nodes.

[0083] Steps 3021C to 3033C are similar to steps 3021A to 3033A. For details, please refer to the previous description and will not be repeated here. Steps 3021C to 3033C can be combined with the replacement operation node to determine the replacement distance score of the first syntax tree. Using the replacement distance score of the first syntax tree to determine the first tree-form edit distance can improve the accuracy of the first tree-form edit distance.

[0084] ④ The first edit operation node includes an insert operation node, a delete operation node, and a replace operation node, and the edit distance score includes an insert distance score. At this time, the insert distance score, delete distance score, and replace distance score can be determined based on the number of insert operation nodes, the number of delete operation nodes, and the number of replace operation nodes required to convert the first syntax tree into the target standard syntax tree. In this case, step 302 may specifically include the following steps 3021D to 3033D:

[0085] 3021D. Based on the number of inserted nodes, obtain an insertion distance score of the first syntax tree.

[0086] 3022D. Based on the number of deleted nodes, obtain a deletion distance score of the first syntax tree.

[0087] 3023D. Based on the number of replacement nodes, obtain a replacement distance score of the first syntax tree.

[0088] For the specific implementation of steps 3021D to 3033D, please refer to the relevant descriptions of steps 3021A to 3033A, 3021B to 3033B and steps 3021C to 3033C above, which will not be repeated here.

[0089] 303. Determine a first tree edit distance between the first syntax tree and a target standard syntax tree based on the edit distance score of the first syntax tree.

[0090] Corresponding to the implementation of step 302, there are also multiple implementations of step 303, illustratively including:

[0091] In some embodiments, the edit distance score of the first syntax tree includes an insertion distance score. In this case, in step 303, the insertion distance score of the first syntax tree can be directly used as the first tree edit distance.

[0092] In some embodiments, the edit distance score of the first syntax tree includes a deletion distance score. In this case, in step 303, the deletion distance score of the first syntax tree can be directly used as the first tree edit distance.

[0093] In some embodiments, the edit distance score of the first syntax tree includes a substitution distance score. In this case, in step 303, the substitution distance score of the first syntax tree can be directly used as the first tree edit distance.

[0094] In some embodiments, the edit distance score of the first syntax tree includes an insertion distance score, a deletion distance score, and a replacement distance score. In this case, in step 303, the insertion distance score, the deletion distance score, and the replacement distance score of the first syntax tree can be summed, and the result obtained is used as the first tree edit distance.

[0095] In this way, the first editing operation node required for converting the first syntax tree into the target standard syntax tree is obtained through steps 301 to 303, and the edit distance score of the first syntax tree is determined, which is used to determine the first tree-shaped edit distance, so that the first tree-shaped edit distance can be as close as possible to the similarity between the first syntax tree and the target standard syntax tree, so that a generated query statement with the largest possible distance from the target standard query can be obtained subsequently, thereby improving the personalized differences of the generated query statement and matching different user query requirements as much as possible.

[0096] 1013A. If the first tree-structured edit distance is less than or equal to a preset distance threshold, deep semantic information is extracted from the conversation text using a trained multi-scale feature extraction model to obtain deep semantic information of the conversation text.

[0097] Exemplarily, to improve the ability to extract contextual information, deep semantic information of the conversation text can be extracted at multiple levels, such as local scale features (used to capture features of individual words, phrases, or characters, such as word vectors or character-level features), intermediate scale features (used to capture relationships between words or phrase structures, such as using a convolutional network layer to capture the local context of the conversation text), and global scale features (used to capture high-level semantic information of the entire sentence or document, such as using a recurrent network layer to capture long-range dependencies and cross-sentence and cross-paragraph relationships of the conversation text). To improve the ability to extract contextual information, thereby increasing the granularity of the second query statement and thereby improving the matching degree between the second query statement and the user's query requirements, the multi-scale feature extraction model is a hybrid architecture combining a convolutional neural network (CNN) and a recurrent neural network (such as an RNN, LSTM, GRU, etc.). In this case, the multi-scale feature extraction model can be set to include an input layer, a convolutional network layer, a recurrent network layer, a multi-scale information fusion layer, etc.

[0098] The input layer is used to convert the input conversation text into word vectors to obtain local scale features. For example, models such as Word2Vec, GloVe, or BERT embeddings can be used as the input layer.

[0099] The convolutional network layer is used to capture intermediate-scale features of the conversation text based on local-scale features. Following the input layer, the convolutional network layer uses convolution kernels of varying sizes to extract local text features, generating intermediate-scale features. This enriches the local contextual information extracted from the conversation text. This richer local contextual information can then be used to generate a second query statement that better matches the user's query, improving the quality of the generated second query statement.

[0100] The recurrent network layer is used to capture the global-scale features of the conversation text based on local-scale features and / or intermediate-scale features. Following the convolutional layer, a recurrent network layer (such as an LSTM or GRU) is used to capture long-range dependencies and contextual information in the text, generating global-scale features and improving the richness of the global contextual information extracted from the conversation text. This avoids the problem of convolutional networks being able to simultaneously consider local details and certain contextual information, but potentially having limited long-range dependencies. This allows the generation of a second query statement that better matches the user's query requirements based on this richer global contextual information, improving the quality of the generated second query statement.

[0101] Among them, the multi-scale information fusion layer is used to fuse the intermediate-scale features with the global-scale features, and the fusion result is used as the deep semantic information of the conversation text.

[0102] 1014A. Generate a query statement based on the deep semantic information and the first query statement to obtain a second query statement for the conversation text.

[0103] The second query statement is generated based on the deep semantic information of the conversation text and the first query statement, thereby obtaining the query statement.

[0104] In this way, because deep semantic information integrates intermediate-scale features and global-scale features and contains more local and global context information, the query statement can be reconstructed using deep semantic information and the second query statement to generate a more refined and context-relevant second query statement. For example, in the financial product query, the original first query statement is:

[0105] "SELECT*FROM financial_products".

[0106] Based on the deep semantic information and the first query, the second query is generated as follows:

[0107] "SELECT*FROM financial_products

[0108] WHERE product_type = 'Fund'

[0109] AND risk_level = 'low risk'

[0110] AND investment_term='1 year'".

[0111] 1015A: If a second tree edit distance between the second syntax tree of the second query statement and the target standard syntax tree is greater than a preset edit distance, use the second query statement as the generated query statement.

[0112] The second syntax tree is a syntax tree constructed based on the second query statement.

[0113] The second tree-form edit distance is the edit distance required to convert the second syntax tree into the target standard syntax tree, indicating the similarity between the second syntax tree and the target standard syntax tree. The second tree-form edit distance is determined similarly to the first tree-form edit distance. For details, please refer to the previous description and will not be repeated here.

[0114] (2) In some embodiments, Figure 5 As shown, step 101 includes the following steps 1011B to 1013B:

[0115] 1011B. Generate a statement based on the dialogue text of the target product system to obtain a first query statement of the dialogue text.

[0116] 1012B. Obtain a first tree edit distance between the first syntax tree of the first query statement and the target standard syntax tree of the target standard query statement.

[0117] 1013B: If the first tree edit distance is greater than a preset distance threshold, use the first query statement as the generated query statement.

[0118] By determining the query statement generation method of steps 1011A to 1015A and steps 1011B to 1013B, the tree edit distance between the syntax tree of the generated query statement and the syntax tree of the target standard query statement can be greater than the preset edit distance, thereby improving the difference between the generated statement and the standard query statement. As a result, query statements can be generated more personalized according to different dialogue texts, adapting to the personalized query requirements of different users, improving the matching degree between the generated query statement and the user's query requirements, and improving the personalized difference of the generated query statement.

[0119] 102. Obtain redundant information of the generated query statement.

[0120] Redundant information refers to redundant or erroneous parts included in the generated query statement. The generated query statement may include multiple functional segments. In some cases, the generated query statement may include irrelevant conditions or unnecessary fields. To reduce the impact of redundant information and improve the matching degree between the product information query result and the user's query requirements, similar segment detection can be performed on the generated query statement in step 102. When it is detected that the similarity between the first functional segment and the second functional segment in the generated query statement is greater than a pre-similarity threshold, the deep semantic information of the conversation text is determined based on the deep semantic information of the conversation text (wherein, the deep semantic information of the conversation text is extracted using a trained multi-scale feature extraction model. The specific implementation can be based on the relevant description above and will not be repeated here). The repeated or erroneous functional segments are selected as redundant information for the generated query statement.

[0121] 103. Optimize the generated query statement based on the redundant information to obtain a target query statement of the dialogue text.

[0122] Specifically, redundant information may be filtered out from the generated query statement to optimize the generated query statement and obtain the target query statement.

[0123] 104. Based on the target query statement, obtain product information query results of the dialogue text from a database of the target product system.

[0124] For example, in a financial management scenario, a user may provide the following dialogue text in the financial management system: "Query the total income of all stable financial products I purchased in the past year." Through the processing of steps 101 to 103 above, a target query statement such as "SELECT SUM(income) FROM financial_products JOIN customer_holdings ON financial_products.product_id = customer_holdings.product_id WHERE customer_holdings.customer_id = {user_id} AND financial_products.product_type = 'Stable financial products' AND purchase_date > = DATE_SUB(CURDATE(), INTERVAL 1YEAR)" may be generated and optimized.

[0125] From the above, it can be seen that, firstly, by setting the target standard query statement based on the query intent of the conversation text, the tree edit distance between the syntax tree of the generated query statement of the conversation text and the syntax tree of the target standard query statement is greater than the preset edit distance, thereby reducing the similarity between the generated query statement and the target standard query statement, thereby making the similarity of the query statement generated by the conversation text for the user's query needs even lower, improving the individual differences of the query results corresponding to the generated query statement for different user query needs, and thus improving the individual differences of the product information query results for different user query needs; secondly, by optimizing the generated query statement based on the redundant information of the generated query statement, it is possible to filter out repeated or incorrect functional segments in the generated query statement, avoid the problem of excessive redundant information in the generated query statement caused by the large tree edit distance between the syntax tree of the generated query statement and the syntax tree of the target standard query statement, and reduce the duplication or incorrect reference of functional segments such as calculation rules or data fields. Therefore, the present application can improve the individual differences of product information query results for different user query needs and improve the accuracy of product information query results.

[0126] In addition, in order to better implement the product information query method in the embodiment of the present application, based on the product information query method, the embodiment of the present application also provides a product information query device, such as Figure 6 FIG. 1 is a schematic diagram of a structure of an embodiment of a device for querying product information provided in an embodiment of the present application. The device 600 for querying product information includes:

[0127] A generating unit 601 is configured to generate a statement based on a dialog text of a target product system to obtain a generated query statement of the dialog text, wherein a tree edit distance between a syntax tree of the generated query statement and a syntax tree of a target standard query statement is greater than a preset edit distance, and the target standard query statement is determined based on a query intent of the dialog text;

[0128] An acquiring unit 602 is configured to acquire redundant information for generating the query statement;

[0129] An optimization unit 603 is configured to optimize the generated query statement based on the redundant information to obtain a target query statement of the dialogue text;

[0130] The query unit 604 is configured to obtain a product information query result of the conversation text from a database of the target product system based on the target query statement.

[0131] In some embodiments, the generating unit 601 is configured to:

[0132] Generating a statement based on the dialogue text of the target product system to obtain a first query statement of the dialogue text;

[0133] Obtaining a first tree edit distance between a first syntax tree of the first query statement and a target standard syntax tree of the target standard query statement;

[0134] If the first tree-shaped edit distance is less than or equal to a preset distance threshold, extracting deep semantic information from the conversation text using a trained multi-scale feature extraction model to obtain deep semantic information of the conversation text;

[0135] generating a query statement based on the deep semantic information and the first query statement to obtain a second query statement of the conversation text;

[0136] If a second tree edit distance between the second syntax tree of the second query statement and the target standard syntax tree is greater than a preset edit distance, the second query statement is used as the generated query statement.

[0137] In some embodiments, the generating unit 601 is configured to:

[0138] Obtaining first editing operation nodes required for converting the first syntax tree into the target standard syntax tree, wherein the first editing operation nodes include at least one of an insert operation node, a delete operation node, and a replace operation node;

[0139] Obtaining an edit distance score of the first syntax tree based on the number of the first edit operation nodes;

[0140] Based on the edit distance score of the first syntax tree, a first tree edit distance between the first syntax tree and a target standard syntax tree is determined.

[0141] In some embodiments, the first edit operation node includes an insert operation node, and the edit distance score includes an insert distance score; the generating unit 601 is configured to:

[0142] Obtaining a first distance weight coefficient corresponding to the insertion operation node;

[0143] Obtain the number of insertion operation nodes;

[0144] An insertion distance score of the first syntax tree is determined according to the first distance weight coefficient and the number of the insertion operation nodes.

[0145] In some embodiments, the generating unit 601 is configured to:

[0146] Obtaining a first field type of an insert operation node, wherein the first field type includes at least one of a keyword, a function, and a comment, a preset weight coefficient of the keyword is greater than a preset weight coefficient of the function, and the preset weight coefficient of the function is greater than a preset weight coefficient of the comment;

[0147] Obtaining a first node type of the insertion operation node;

[0148] The first distance weight coefficient is determined according to a preset weight coefficient of the first field type and a preset weight coefficient of the first node type.

[0149] In some embodiments, the first edit operation node includes a delete operation node, and the edit distance score includes a delete distance score; the generating unit 601 is configured to:

[0150] Obtaining a second distance weight coefficient corresponding to the deletion operation node;

[0151] Obtain the number of deletion operation nodes;

[0152] A deletion distance score of the first syntax tree is determined according to the second distance weight coefficient and the number of the deletion operation nodes.

[0153] In some embodiments, the first edit operation node includes a replacement operation node, and the edit distance score includes a replacement distance score; the generating unit 601 is configured to:

[0154] Obtaining a third distance weight coefficient corresponding to the replacement operation node;

[0155] Obtaining the number of replacement operation nodes;

[0156] A replacement distance score of the first syntax tree is determined according to the third distance weight coefficient and the number of the replacement operation nodes.

[0157] In specific implementation, the above units can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units can be found in the previous product information query method embodiment, which will not be repeated here.

[0158] See also Figure 7 , Figure 7 This is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a server.

[0159] like Figure 7 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0160] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any product information query method.

[0161] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0162] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any product information query method.

[0163] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0164] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0165] In one embodiment, the processor is configured to execute a computer program stored in the memory to implement the following steps:

[0166] A method for generating a generated query statement for a dialog text of a target product system is provided. The method comprises generating a generated query statement for the dialog text, wherein a tree edit distance between a syntax tree of the generated query statement and a syntax tree of a target standard query statement is greater than a preset edit distance, and the target standard query statement is determined based on a query intent of the dialog text; obtaining redundant information of the generated query statement; optimizing the generated query statement based on the redundant information to obtain a target query statement for the dialog text; and obtaining a product information query result for the dialog text from a database of the target product system based on the target query statement.

[0167] Those skilled in the art will appreciate that all or part of the steps in the above-mentioned product information query method may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0168] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores multiple computer programs. The computer programs can be loaded by a processor to execute any product information query method provided in the embodiment of the present application.

[0169] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0170] In the above-described embodiments of the product information query device and computer-readable storage medium, the descriptions of each embodiment have different emphases. For portions not described in detail in a particular embodiment, reference can be made to the relevant descriptions of other embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes and beneficial effects of the above-described product information query device, computer-readable storage medium, and corresponding units can be referred to in the description of the product information query method in the above embodiments, and the details will not be repeated here.

[0171] The above is a detailed introduction to a product information query method, device, computer equipment and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application. At the same time, for those skilled in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as limiting the present application. The non-company software tools or components that appear in the embodiments of the present application are merely examples and do not represent actual use.

Claims

1. A method for querying product information, characterized in that: The method comprises: Generating a statement based on a conversation text of a target product system to obtain a generated query statement of the conversation text, wherein a tree edit distance between a syntax tree of the generated query statement and a syntax tree of a target standard query statement is greater than a preset edit distance, and the target standard query statement is determined based on a query intent of the conversation text; Obtaining redundant information of the generated query statement; Optimizing the generated query statement based on the redundant information to obtain a target query statement of the dialogue text; Based on the target query statement, a product information query result of the dialogue text is obtained from a database of the target product system.

2. The product information query method according to claim 1, characterized in that: The generating of a query statement based on the dialogue text of the target product system to obtain the generated query statement of the dialogue text includes: Generating a statement based on the dialogue text of the target product system to obtain a first query statement of the dialogue text; Obtaining a first tree edit distance between a first syntax tree of the first query statement and a target standard syntax tree of the target standard query statement; If the first tree-shaped edit distance is less than or equal to a preset distance threshold, extracting deep semantic information from the conversation text using a trained multi-scale feature extraction model to obtain deep semantic information of the conversation text; generating a query statement based on the deep semantic information and the first query statement to obtain a second query statement of the conversation text; If a second tree edit distance between the second syntax tree of the second query statement and the target standard syntax tree is greater than a preset edit distance, the second query statement is used as the generated query statement.

3. The product information query method according to claim 2, characterized in that: The obtaining a first tree edit distance between the first syntax tree of the first query statement and the target standard syntax tree of the target standard query statement includes: Obtaining first editing operation nodes required for converting the first syntax tree into the target standard syntax tree, wherein the first editing operation nodes include at least one of an insert operation node, a delete operation node, and a replace operation node; Obtaining an edit distance score of the first syntax tree based on the number of the first edit operation nodes; Based on the edit distance score of the first syntax tree, a first tree edit distance between the first syntax tree and a target standard syntax tree is determined.

4. The product information query method according to claim 3, characterized in that: The first edit operation node includes an insert operation node, and the edit distance score includes an insert distance score; The acquiring the edit distance score of the first syntax tree based on the number of the first edit operation nodes includes: Obtaining a first distance weight coefficient corresponding to the insertion operation node; Obtain the number of insertion operation nodes; An insertion distance score of the first syntax tree is determined according to the first distance weight coefficient and the number of the insertion operation nodes.

5. The product information query method according to claim 4, characterized in that: The obtaining of a first distance weight coefficient corresponding to the insertion operation node includes: Obtaining a first field type of an insert operation node, wherein the first field type includes at least one of a keyword, a function, and a comment, a preset weight coefficient of the keyword is greater than a preset weight coefficient of the function, and the preset weight coefficient of the function is greater than a preset weight coefficient of the comment; Obtaining a first node type of the insertion operation node; The first distance weight coefficient is determined according to a preset weight coefficient of the first field type and a preset weight coefficient of the first node type.

6. The product information query method according to claim 3, characterized in that: The first edit operation node includes a delete operation node, and the edit distance score includes a delete distance score; The acquiring the edit distance score of the first syntax tree based on the number of the first edit operation nodes includes: Obtaining a second distance weight coefficient corresponding to the deletion operation node; Obtain the number of deletion operation nodes; A deletion distance score of the first syntax tree is determined according to the second distance weight coefficient and the number of the deletion operation nodes.

7. The product information query method according to claim 3, characterized in that: The first edit operation node includes a replacement operation node, and the edit distance score includes a replacement distance score; The acquiring the edit distance score of the first syntax tree based on the number of the first edit operation nodes includes: Obtaining a third distance weight coefficient corresponding to the replacement operation node; Obtaining the number of replacement operation nodes; A replacement distance score of the first syntax tree is determined according to the third distance weight coefficient and the number of the replacement operation nodes.

8. A product information query device, characterized in that: The product information query device includes: a generating unit configured to generate a statement based on a dialog text of a target product system to obtain a generated query statement of the dialog text, wherein a tree edit distance between a syntax tree of the generated query statement and a syntax tree of a target standard query statement is greater than a preset edit distance, and the target standard query statement is determined based on a query intent of the dialog text; an acquiring unit, configured to acquire redundant information for generating the query statement; an optimization unit, configured to optimize the generated query statement based on the redundant information to obtain a target query statement of the dialogue text; The query unit is configured to obtain a product information query result of the dialogue text from a database of the target product system based on the target query statement.

9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is configured to execute the computer program and implement the product information query method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that A computer program is stored thereon, and the computer program is loaded by a processor to execute the product information query method according to any one of claims 1 to 7.