Entity query method, apparatus, computer program product, storage medium, and device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2023-01-06
- Publication Date
- 2026-06-09
AI Technical Summary
When analyzing user requests, existing intelligent assistants struggle to accurately interpret user query texts that do not contain explicit entity names, thus failing to find implicit transaction entities and resulting in a decline in service effectiveness and quality.
By semantically parsing the query text input by the user, query statements are generated. Using a pre-trained neural network model and a machine reading comprehension model, conditional text fragments are extracted, semantic entities and their category relationships are determined, query statements are generated and combined, and an execution-guided approach is used to determine the query statement combination with the highest joint probability, thereby enabling querying of the entity database.
It enhances the intelligence of the smart assistant and the accuracy of its analysis of user needs, thereby improving service effectiveness and quality and providing users with a better service experience.
Smart Images

Figure CN116069920B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of artificial intelligence technology, and in particular to an entity query method, apparatus, computer program product, storage medium and device. Background Technology
[0002] With the advent of the information age, a new generation of information technologies, represented by the internet, big data, and artificial intelligence, are developing rapidly. Against this backdrop, intelligent assistant services have been widely applied in various internet sectors. An intelligent assistant, through intelligent dialogue with the user, extracts the user's needs from the user's input text and provides the necessary information accordingly.
[0003] Accurately interpreting user needs and accurately finding the information users require is a fundamental prerequisite for intelligent assistants to provide good service. Summary of the Invention
[0004] This specification provides an entity query method, apparatus, computer program product, storage medium, and device. These can generate query statements by parsing user query text, thereby allowing users to retrieve the implicit transaction entities corresponding to the query text from an entity database. The technical solution is as follows:
[0005] Firstly, embodiments of this specification provide an entity query method, the method comprising:
[0006] Obtain the query text entered by the user for the target firm;
[0007] The query text is subjected to semantic parsing to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category;
[0008] Generate a query statement corresponding to the query text based on the semantic entity, entity category, and the correspondence.
[0009] Based on the query statement, the implicit transaction entity corresponding to the query text is obtained from the entity database.
[0010] Secondly, embodiments of this specification provide an entity query device, the device comprising:
[0011] The query text acquisition module is used to acquire the query text entered by the user for the target firm.
[0012] The semantic parsing module is used to perform semantic parsing processing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category;
[0013] The query statement generation module is used to generate a query statement corresponding to the query text based on the semantic entity, entity category and the correspondence.
[0014] The hidden entity query module is used to query the entity database based on the query statement to obtain the hidden transaction entity corresponding to the query text.
[0015] Thirdly, embodiments of this specification provide a computer program product that stores at least one instruction, the at least one instruction being adapted to be loaded by a processor and executed in accordance with the above-described method steps.
[0016] Fourthly, embodiments of this specification provide a storage medium storing a computer program adapted to be loaded by a processor and to execute the above-described method steps.
[0017] Fifthly, embodiments of this specification provide an electronic device that may include: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the above-described method steps.
[0018] The beneficial effects of the technical solutions provided in some embodiments of this specification include at least the following:
[0019] The entity query method provided in this specification first obtains the query text input by the user for the target transaction. Then, it performs semantic parsing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category. Based on the semantic entity, entity category, and correspondence, a query statement corresponding to the query text is generated. Finally, based on the query statement, the implicit transaction entity corresponding to the query text is retrieved from the entity database. Through the above method, a query statement is generated by parsing the user's query text, and then the implicit transaction entity corresponding to the query text is retrieved from the entity database for the user. This improves the intelligence of the intelligent assistant and the accuracy of its interpretation of user needs, thereby enhancing the service effectiveness and quality of the intelligent assistant. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1A flowchart illustrating an entity query method provided in an embodiment of this specification;
[0022] Figure 2 A flowchart illustrating an entity query method provided in an embodiment of this specification;
[0023] Figure 3 A flowchart illustrating an entity query method provided in an embodiment of this specification;
[0024] Figure 4 This is a schematic diagram illustrating an example of a query data table provided in an embodiment of this specification.
[0025] Figure 5 This is a schematic diagram of the structure of an entity query device provided in an embodiment of this specification;
[0026] Figure 6 This is a schematic diagram of the structure of an entity query device provided in an embodiment of this specification;
[0027] Figure 7 This is a structural block diagram of an electronic device provided as an embodiment of this specification. Detailed Implementation
[0028] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0029] In the description of this specification, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this specification, it should be noted that, unless otherwise expressly specified and limited, "comprising" and "having," 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 is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices. Those skilled in the art can understand the specific meaning of the above terms in this specification based on the specific circumstances. Furthermore, in the description of this specification, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.
[0030] In related technologies, when parsing user requests, intelligent assistants can only extract explicit entity names from the user's query text, and then retrieve the corresponding entity information from the entity database based on the explicit entity names. However, in some scenarios, the user's query text may not contain explicit entity names, or the user's true intent may not be the entity names explicitly stated in the query text. In such cases, correctly parsing the user's true intent and retrieving implicit transaction entities not appearing in the user's query text from the database to provide the user with the necessary information is key to improving the effectiveness and quality of intelligent assistant services.
[0031] Based on this, the embodiments of this specification propose an entity query method. First, the query text input by the user for the target transaction is obtained. By performing semantic parsing on the query text, the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category are obtained. Then, a query statement corresponding to the query text is generated based on the semantic entity, entity category, and correspondence. Finally, the implicit transaction entity corresponding to the query text is retrieved from the entity database based on the query statement. This method enables the generation of a query statement corresponding to the implicit transaction entity through semantic parsing of the semantic entity in the query text, even when there is no explicit entity name in the query text. This improves the intelligence of the intelligent assistant and the accuracy of its interpretation of user needs, thereby enhancing the service effect and quality of the intelligent assistant and bringing a better service experience to the user.
[0032] The following detailed description is provided in conjunction with embodiments of the examples in this specification. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims. The flowcharts shown in the accompanying drawings are merely illustrative and are not necessarily to be performed in accordance with the steps shown. For example, some steps are parallel and do not have a strict logical order; therefore, the actual execution order is variable.
[0033] Please see Figure 1 This is a flowchart illustrating an entity query method provided in an embodiment of this specification. In the embodiments of this specification, the entity query method is applied to an entity query device or an electronic device equipped with an entity query device. The following will focus on... Figure 1 The process shown will be described in detail. The entity query method may specifically include the following steps:
[0034] S102, Obtain the query text entered by the user for the target firm;
[0035] In the embodiments of this specification, during the intelligent dialogue between the user and the intelligent assistant, the query text input by the user for the target matter is obtained.
[0036] The target transaction is the transaction that the user needs to query from the set of transactions that the intelligent assistant can provide assistance with.
[0037] For example, a smart assistant can be a financial assistant, which can provide users with assistance with matters such as funds, stocks, futures, bonds, and insurance. In this case, the target matter can be fund-related matters.
[0038] The query text is the text content that expresses the user's query request for a specific transaction. The intelligent assistant can understand the user's needs by interpreting the query text and then provide corresponding assistance.
[0039] S104, perform semantic parsing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category;
[0040] In the embodiments of this specification, the query text input by the user for the target transaction is semantically parsed to obtain the explicit semantic entities in the query text, and the entity category corresponding to the semantic entity in the entity database and the correspondence between the voice entity and the entity category are determined.
[0041] In this context, semantic entities are explicit entities identified in the query text through semantic parsing. Explicit entities are those that directly exist within the query text. For example, in the query "What is the mixed fund managed by Zhang San?", "Zhang San" and "mixed fund" are explicit entities.
[0042] It is understandable that the semantic entities retrieved from the query text have corresponding entities existing in the entity database. For example, the semantic entities "Zhang San" and "mixed fund" both have corresponding records in the entity database.
[0043] Based on this semantic entity, the corresponding entity category and the relationship between the semantic entity and its corresponding entity category can be found in the entity database. For example, what is the mixed fund managed by Zhang San? Here, the entity category corresponding to "Zhang San" is "fund manager", and the entity category corresponding to "mixed fund" is "fund type". The relationship between "Zhang San" and "fund manager" is a "belonging" relationship, and the relationship between "mixed fund" and "fund type" is also a "belonging" relationship.
[0044] For example, the query text is: "Funds managed by Zhang San with a size of less than 5 billion." Here, "5 billion" corresponds to the entity category "Fund Size," and the relationship between "5 billion" and "Fund Size" is: Fund size is less than 5 billion.
[0045] It should be noted that semantic parsing of query text to obtain the semantic entities corresponding to the query text, the entity categories of the semantic entities in the entity database, and the correspondence between speech entities and entity categories can be achieved based on a pre-trained neural network model. By constructing a training dataset and training the neural network model until a neural network model that meets preset convergence conditions is obtained, the trained neural network model can accurately parse the query text to obtain the semantic entities corresponding to the query text, the entity categories of the semantic entities in the entity database, and the correspondence between speech entities and entity categories.
[0046] Optionally, in the embodiments of this specification, before performing semantic parsing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category, conditional text fragments can be extracted from the query text, and then semantic parsing is performed on the conditional text fragments to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category.
[0047] S106, Generate the query statement corresponding to the query text based on semantic entities, entity categories and corresponding relationships;
[0048] In the embodiments of this specification, after semantic parsing the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category, a query statement corresponding to the query text is generated based on the semantic entity, the entity category, and the correspondence. The query statement is used to query the corresponding implicit transaction entity in the entity database.
[0049] In the embodiments described in this specification, the query statement can be a Structured Query Language (SQL).
[0050] For example, in the query "What is the mixed fund managed by Zhang San?", the entity category corresponding to "Zhang San" is "Fund Manager", and the entity category corresponding to "Mixed Fund" is "Fund Type". The relationship between "Zhang San" and "Fund Manager" is a "belonging" relationship, and the relationship between "Mixed Fund" and "Fund Type" is also a "belonging" relationship. Therefore, two query statements can be generated for the text "What is the mixed fund managed by Zhang San?": "Fund Manager = Zhang San" and "Fund Type = Mixed Fund".
[0051] S108: Based on the query statement, retrieve the implicit transaction entity corresponding to the query text from the entity database.
[0052] In the embodiments of this specification, a query statement may include multiple queries. When there are multiple queries, the queries are combined to obtain at least one query statement combination. An execution-guided approach is used to determine the query statement combination with the highest joint probability value among the at least one query statement combination as the target query statement combination. Based on the target query statement combination, the implicit transaction entity corresponding to the query text is retrieved from the entity database.
[0053] In the embodiments of this specification, after determining the target query statement combination, a query data table is generated based on each query statement in the query statement combination and the data stored in the entity database. Then, the implicit transaction entity corresponding to the query text is obtained by querying the query data table based on the target query statement combination.
[0054] In the embodiments of this specification, after obtaining the implicit transaction entity corresponding to the query text, a response text corresponding to the query text is generated based on the implicit transaction entity and the preset template text, and the response text is displayed to the user through the chat window.
[0055] It should be noted that steps S104-S108 in this embodiment can be implemented based on a pre-trained neural network model. The neural network model is trained by constructing a training dataset until a neural network model that meets the preset convergence conditions is obtained. The trained neural network model can parse the input query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category. Based on the semantic entity, entity category, and correspondence, it generates a query statement corresponding to the query text. Then, based on the query statement, it queries the entity database to obtain the implicit transaction entity corresponding to the query text.
[0056] In the embodiments of this specification, the query text input by the user for the target transaction is first obtained. Semantic parsing is then performed on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category. Then, a query statement corresponding to the query text is generated based on the semantic entity, entity category, and correspondence. Finally, the implicit transaction entity corresponding to the query text is retrieved from the entity database based on the query statement. This enables the generation of a query statement corresponding to an implicit transaction entity even when there is no explicit entity name in the query text, and the retrieval of the implicit transaction entity from the entity database. This improves the intelligence of the intelligent assistant and the accuracy of its interpretation of user needs, thereby enhancing the service effectiveness and quality of the intelligent assistant and providing users with a better service experience.
[0057] Please see Figure 2This is a flowchart illustrating an entity query method provided in an embodiment of this specification. The entity query method may include the following steps:
[0058] S202, Obtain the query text entered by the user for the target firm;
[0059] In the embodiments of this specification, during the intelligent dialogue between the user and the intelligent assistant, the query text input by the user for the target matter is obtained.
[0060] The target transaction is the transaction that the user needs to query from the set of transactions that the intelligent assistant can provide assistance with.
[0061] For example, a smart assistant can be a financial assistant, which can provide users with assistance with matters such as funds, stocks, futures, bonds, and insurance. In this case, the target matter can be fund-related matters.
[0062] The query text is the text content that expresses the user's query request for a specific transaction. The intelligent assistant can understand the user's needs by interpreting the query text and then provide corresponding assistance.
[0063] S204, Perform semantic parsing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category;
[0064] Specifically, for step S204, please refer to the detailed description of step S104 in another embodiment of this specification, which will not be repeated here.
[0065] S206, Generate the query statement corresponding to the query text based on semantic entities, entity categories and corresponding relationships;
[0066] In the embodiments of this specification, after semantic parsing the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category, a query statement corresponding to the query text is generated based on the semantic entity, the entity category, and the correspondence. The query statement is used to query the corresponding implicit transaction entity in the entity database.
[0067] In the embodiments described in this specification, the query statement can be a Structured Query Language (SQL).
[0068] S208, combine the query statements to obtain at least one query statement combination;
[0069] It is important to understand that semantic parsing of the query text to generate the corresponding query statement essentially involves extracting query conditions from the query text for searching for implicit transaction entities. In the embodiments of this specification, the query text may contain more than one query condition; that is, the query statement generated through semantic parsing of the query text may be more than one.
[0070] In the embodiments of this specification, when there are multiple query statements, the multiple query statements are combined to obtain at least one query statement combination.
[0071] S210, Using an execution-guided approach, determine the query statement combination with the highest joint probability value among at least one combination of query statements as the target query statement combination;
[0072] In the embodiments of this specification, after obtaining at least one combination of query statements, the query statement combination with the largest joint probability value among the at least one combination of query statements is determined as the target query statement combination by an execution-guided method. That is, each query statement is executed to query the entity database, and the query results corresponding to each query statement are verified. Based on the query results corresponding to each query statement, the joint probability value corresponding to each combination of query statements is calculated, and the query statement combination with the largest joint probability value is taken as the target query statement combination.
[0073] Understandably, after semantic parsing the query text, multiple query conditions may be extracted, resulting in multiple query statements. However, not every query statement is necessarily targeting the implicit transaction entity; there may be unrealizable or biased queries. By combining multiple query statements to generate at least one query statement combination, and then calculating the joint probability value of each query statement combination through execution guidance, the query statement combination with the highest joint probability value is taken as the target query statement combination. Subsequently, based on the target query statement combination, the implicit transaction entity is queried in the entity database, which can ensure the accuracy of the query for the implicit transaction entity.
[0074] S212, based on the combination of target query statements, query the entity database to obtain the implicit transaction entity.
[0075] In the embodiments of this specification, after obtaining the implicit transaction entity corresponding to the query text, a response text corresponding to the query text is generated based on the implicit transaction entity and the preset template text, and the response text is displayed to the user through the chat window.
[0076] In the embodiments of this specification, the query text input by the user for the target transaction is first obtained. Semantic parsing is then performed on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category. Then, a query statement corresponding to the query text is generated based on the semantic entity, entity category, and correspondence. Multiple query statements are combined to generate at least one query statement combination. The joint probability value of each query statement combination is then calculated through a guided execution method. The query statement combination with the highest joint probability value is selected as the target query statement combination. Subsequently, the implicit transaction entity is queried in the entity database based on the target query statement combination. This ensures the accuracy of the query for implicit transaction entities. Even when there is no explicit entity name in the query text, the query statement corresponding to the implicit transaction entity can be generated through semantic parsing of the semantic entity in the query text, and then the implicit transaction entity corresponding to the query text can be retrieved from the entity database. This improves the intelligence of the intelligent assistant and the accuracy of its interpretation of user needs, thereby enhancing the service effect and quality of the intelligent assistant and providing users with a better service experience.
[0077] Please see Figure 3 This is a flowchart illustrating an entity query method provided in an embodiment of this specification. The entity query method may include the following steps:
[0078] S302, Obtain the query text entered by the user for the target firm;
[0079] In the embodiments of this specification, during the intelligent dialogue between the user and the intelligent assistant, the query text input by the user for the target matter is obtained.
[0080] The target transaction is the transaction that the user needs to query from the set of transactions that the intelligent assistant can provide assistance with.
[0081] For example, a smart assistant can be a financial assistant, which can provide users with assistance with matters such as funds, stocks, futures, bonds, and insurance. In this case, the target matter can be fund-related matters.
[0082] The query text is the text content that expresses the user's query request for a specific transaction. The intelligent assistant can understand the user's needs by interpreting the query text and then provide corresponding assistance.
[0083] S304, Extract conditional text fragments from the query text;
[0084] It's understandable that not all text in the query text is valid for finding the implicit transaction entity; the user-input query text contains conditional text fragments. A machine reading comprehension model is used to extract these conditional text fragments from the query text.
[0085] In the embodiments of this specification, a pre-trained machine reading comprehension model scores each text word in the query text to obtain the score value corresponding to each text word. The two target text words with the largest sum of scores are determined among the text words, and the text segment between the two target text words in the query text is determined as the conditional text segment.
[0086] Understandably, machine reading comprehension models are pre-trained neural network models. These models are trained using a constructed training dataset until they meet pre-defined convergence criteria. Once trained, these models can extract conditional text fragments from the input query text.
[0087] For example, a user inputs the query: "Why has the mixed fund managed by Zhang San recently plummeted?" In this query, the conditional text fragment is "the mixed fund managed by Zhang San." When this query is input into a machine reading comprehension model, the model extracts and scores each character in the query text. Then, using the maximum coverage method, it pairs characters from different positions. The two positions with the highest sum of scores are designated as the last two positions. The first position is called the start position, and the second position is called the end position. The text fragment between the start and end positions is the required conditional text fragment.
[0088] S306, Perform semantic parsing on the conditional text fragments to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category;
[0089] In the embodiments of this specification, semantic parsing processing is performed on the conditional text fragments to obtain the explicit semantic entities in the conditional text fragments, and the entity category corresponding to the semantic entity in the entity database and the correspondence between the speech entity and the entity category are determined.
[0090] In this context, semantic entities are explicit entities identified in the conditional text fragment through semantic parsing. Explicit entities are those that directly exist within the conditional text fragment. For example, in the question "What is the mixed fund managed by Zhang San?", "Zhang San" and "mixed fund" are explicit entities.
[0091] It is understandable that the semantic entities retrieved from the conditional text fragments have corresponding entities existing in the entity database. For example, the semantic entities "Zhang San" and "mixed fund" mentioned above both have corresponding records in the entity database.
[0092] Based on this semantic entity, the corresponding entity category and the relationship between the semantic entity and its corresponding entity category can be found in the entity database. For example, the condition fragment is: "Mixed Funds Managed by Zhang San". Here, the entity category corresponding to "Zhang San" is "Fund Manager", the entity category corresponding to "Mixed Funds" is "Fund Type", the relationship between "Zhang San" and "Fund Managers" is a "belonging" relationship, and the relationship between "Mixed Funds" and "Fund Types" is also a "belonging" relationship.
[0093] For example, the conditional text fragment is: "Zhang San manages funds with a size of less than 5 billion." Here, the entity category corresponding to "5 billion" is "fund size," and the relationship between "5 billion" and "fund size" is: fund size is less than 5 billion.
[0094] It should be noted that semantic parsing of conditional text fragments to obtain the corresponding semantic entities, entity categories in the entity database, and the correspondence between speech entities and entity categories can be achieved based on a pre-trained neural network model. By constructing a training dataset and training the neural network model until a model meeting preset convergence conditions is obtained, the trained neural network model can accurately parse the semantic entities, entity categories, and correspondence between speech entities and entity categories from conditional text fragments.
[0095] S308, Generate the query statement corresponding to the query text based on semantic entities, entity categories and corresponding relationships;
[0096] In the embodiments of this specification, step S308 is described in detail in another embodiment of this specification for step S206, and will not be repeated here.
[0097] S310, combine the query statements to obtain at least one query statement combination;
[0098] In the embodiments of this specification, step S310 is described in detail in another embodiment of this specification for step S208, and will not be repeated here.
[0099] S312, Using an execution-guided approach, determine the query statement combination with the highest joint probability value among at least one combination of query statements as the target query statement combination;
[0100] In the embodiments of this specification, step S312 is described in detail in another embodiment of this specification for step S210, and will not be repeated here.
[0101] S314, Generate a query data table based on each query statement and the data stored in the entity database;
[0102] In the embodiments of this specification, after determining the target query statement combination, a query data table is generated based on each query statement in the target query statement combination and the data stored in the entity database.
[0103] For example, when the target query statement combination is "Fund Manager = Zhang San & Fund Type = Hybrid Fund", a query data table can be generated based on the query statements in the target query statement combination and the data stored in the entity database. Please refer to [link / reference]. Figure 4 This is an example diagram illustrating a data table query provided in an embodiment of this application. Figure 4 As shown, based on the target query statement combination "Fund Manager = Zhang San & Fund Type = Mixed Fund", it can be determined that the content of the query data table should include a column for funds managed by fund manager Zhang San and a column for funds of mixed type. By querying fund manager Zhang San, the funds managed by Zhang San are found to be: Fund 5, Fund 16, Fund 54, and Fund 60. By querying mixed funds, the mixed funds are found to be: Fund 19, Fund 54, Fund 66, and Fund 88. Based on the two types of fund columns shown, it can be determined that the mixed fund managed by Zhang San is Fund 54. The mixed fund managed by Zhang San that is finally queried is the hidden transaction entity.
[0104] In one embodiment of this specification, the data stored in the entity database includes static attribute data and dynamic attribute data. The static attribute data consists of fixed entity data, while the dynamic attribute data consists of real-time collected user behavior data. A query data table is generated based on the query statement, the static attribute data, and the dynamic attribute data.
[0105] It is understandable that entity databases include not only static entity data, but also dynamic user behavior data. Based on dynamic user behavior data, personalized query data tables can be generated for users when generating query data tables.
[0106] User behavior data can include user browsing data, user-selected data, user holding data, user buy / sell data, and user transaction data. When generating query data tables, personalized query data tables are generated for each user based on their behavior data. This user behavior data can also help understand user query text and improve the accuracy of queries for hidden transaction entities.
[0107] S316, based on the combination of target query statements, retrieve the hidden transaction entity from the query data table.
[0108] In the embodiments of this specification, after obtaining the implicit transaction entity corresponding to the query text, a response text corresponding to the query text is generated based on the implicit transaction entity and the preset template text, and the response text is displayed to the user through the chat window.
[0109] In the embodiments of this specification, the query text input by the user for the target transaction is first obtained. Before semantic parsing the query text, a pre-trained machine reading comprehension model is used to extract conditional text fragments from the query text. This avoids interference from non-conditional fragments of the query text on the semantic parsing process, ensuring the accuracy of entity extraction. Then, the conditional text fragments are semantically parsed to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category. Based on the semantic entity, entity category, and correspondence, a query statement corresponding to the query text is generated. Multiple query statements are combined to generate at least one query statement combination, which is then processed. By calculating the joint probability value of each query statement combination through execution guidance, the query statement combination with the highest joint probability value is selected as the target query statement combination. Then, based on the target query statement combination, the implicit transaction entity is queried in the entity database. This ensures the accuracy of the query for implicit transaction entities. It also enables the generation of query statements corresponding to implicit transaction entities through semantic parsing of semantic entities in the query text, even when there is no explicit entity name in the query text. The implicit transaction entity corresponding to the query text is then retrieved from the entity database. This improves the intelligence of the intelligent assistant and the accuracy of its interpretation of user needs, thereby enhancing the service effect and quality of the intelligent assistant and bringing a better service experience to users.
[0110] In one or more embodiments of this specification, the above-described entity query method can be implemented based on a pre-trained entity query model. The entity query model includes a preprocessing module, a semantic parsing module, and a post-processing module. The preprocessing module is used to acquire the query text input by the user for the target transaction during intelligent dialogue between the user and the intelligent assistant, and encode the query text to obtain a query text vector corresponding to the query text. The semantic parsing module is used to perform semantic parsing on the query text based on the query text vector, generate query statements corresponding to the query text, and combine the query statements into various query statement combinations. The post-processing module is used to determine the target query statement combination with the highest joint probability value among the various query statement combinations through a guided execution method. Finally, based on the target query statement combination, the implicit transaction entity is retrieved from the entity database, and the implicit transaction entity is matched with a preset template to generate the response text corresponding to the query text. The response text is then displayed to the user through a chat window.
[0111] The aforementioned entity query model can be trained and generated based on a constructed training dataset. Specifically, the training dataset includes sample query texts and corresponding validation data. The sample query texts are input into the entity query model. The preprocessing module encodes the sample query texts to obtain sample text vectors. The semantic parsing module performs semantic parsing on the sample query texts based on the sample text vectors, generating sample query statements corresponding to the sample query texts. These sample query statements are then combined into sample query statement combinations. The post-processing module, through execution guidance, determines the target sample query statement combination with the highest joint probability value among these combinations. Finally, based on the target sample query statement combination, the model retrieves the sample implicit transaction entities from the entity database. The model loss value is calculated based on the sample implicit transaction entities and the corresponding validation data. The model parameters of the entity query model are then adjusted based on the model loss value. The entity query model is iteratively trained using the sample query texts in the training dataset until an entity query model that meets the preset convergence conditions is obtained.
[0112] In one embodiment of this specification, the entity query model further includes a data augmentation module, which is used to generate unknown sample query text based on sample query text when the entity query model is trained on the training dataset, so as to increase the number of training samples and reduce the difference between training data and real data.
[0113] Please see Figure 5 This is a schematic diagram of the structure of an entity query device provided in an embodiment of this specification. Figure 5 As shown, the entity query device 1 can be implemented as all or part of an electronic device through software, hardware, or a combination of both. According to some embodiments, the entity query device 1 includes a query text acquisition module 11, a semantic parsing module 12, a query statement generation module 13, and a hidden entity query module 14, specifically including:
[0114] The query text acquisition module 11 is used to acquire the query text entered by the user for the target transaction.
[0115] The semantic parsing module 12 is used to perform semantic parsing processing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category;
[0116] Query statement generation module 13 is used to generate a query statement corresponding to the query text based on the semantic entity, entity category and the correspondence.
[0117] The hidden entity query module 14 is used to query the entity database based on the query statement to obtain the hidden transaction entity corresponding to the query text.
[0118] Optional, please see Figure 6 This is a schematic diagram of the structure of an entity query device provided in an embodiment of this specification. Figure 6 As shown, the entity query device further includes:
[0119] The text fragment extraction module 15 is used to extract conditional text fragments from the query text;
[0120] The semantic parsing module is specifically used for:
[0121] The conditional text fragment is subjected to semantic parsing to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category.
[0122] Optionally, the text fragment extraction module is specifically used for:
[0123] The pre-trained machine reading comprehension model scores each word in the query text, obtaining the score value corresponding to each word.
[0124] Identify the two target text words with the largest sum of their scores from among all the text words;
[0125] The text segment between two target text words in the query text is identified as the condition text segment.
[0126] Optionally, the hidden entity query module is specifically used for:
[0127] The query statements are combined to obtain at least one query statement combination;
[0128] The query statement combination with the highest joint probability value among the at least one query statement combination is determined as the target query statement combination by using an execution-guided approach.
[0129] The implicit transaction entity is obtained by querying the entity database based on the combination of the target query statements.
[0130] Optionally, when the hidden entity query module executes the query based on the target query statement combination to obtain the hidden transaction entity in the entity database, it is specifically used for:
[0131] A query data table is generated based on each of the query statements and the data stored in the entity database.
[0132] The implicit transaction entity is obtained by querying the query data table based on the combination of the target query statements.
[0133] Optionally, the data stored in the entity database includes static attribute data and dynamic attribute data, wherein the static attribute data is fixed entity data and the dynamic attribute data is real-time collected user behavior data;
[0134] When the hidden entity query module executes the generation of the query data table based on each query statement and the data stored in the entity database, it is specifically used for:
[0135] A query data table is generated based on each of the query statements, the static attribute data, and the dynamic attribute data.
[0136] Optional, such as Figure 6 As shown, the entity query device further includes a response text display module 16, which is specifically used for:
[0137] Based on the implicit transaction entity and the preset template text, generate the response text corresponding to the query text;
[0138] The reply text will be displayed to the user through the chat window.
[0139] In the embodiments of this specification, the query text input by the user for the target transaction is first obtained. Semantic parsing is then performed on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category. Then, a query statement corresponding to the query text is generated based on the semantic entity, entity category, and correspondence. Finally, the implicit transaction entity corresponding to the query text is retrieved from the entity database based on the query statement. This enables the generation of a query statement corresponding to an implicit transaction entity even when there is no explicit entity name in the query text, and the retrieval of the implicit transaction entity from the entity database. This improves the intelligence of the intelligent assistant and the accuracy of its interpretation of user needs, thereby enhancing the service effectiveness and quality of the intelligent assistant and providing users with a better service experience.
[0140] This specification also provides an embodiment of a computer storage medium that can store multiple instructions adapted to be loaded and executed by a processor as described above. Figures 1-4 The entity query method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-4 The specific details of the illustrated embodiments will not be elaborated here.
[0141] This specification also provides a computer program product that stores at least one instruction, said at least one instruction being loaded and executed by the processor as described above. Figures 1-4 The entity query method described in the illustrated embodiment can be found in the following document for a detailed execution process: Figures 1-4 The specific details of the illustrated embodiments will not be elaborated here.
[0142] Please refer to Figure 7 This is a structural block diagram of an electronic device provided in an embodiment of this specification. The electronic device in this specification may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, memory 120, input device 130, and output device 140 can be connected via the bus 150.
[0143] Processor 110 may include one or more processing cores. Processor 110 connects to various parts of the terminal using various interfaces and lines, and performs various functions and processes data of terminal 100 by running or executing instructions, programs, code sets, or instruction sets stored in memory 120, and by calling data stored in memory 120. Optionally, processor 110 may be implemented using at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), or programmable logic array (PLA). Processor 110 may integrate one or more of a central processing unit (CPU), graphics processing unit (GPU), and modem. The CPU mainly handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem is used for wireless communication. It is understood that the modem may also not be integrated into processor 110, but implemented separately through a communication chip.
[0144] The memory 120 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory 120 may include non-transitory computer-readable storage medium. The memory 120 may be used to store instructions, programs, code, code sets, or instruction sets.
[0145] The input device 130 is used to receive input instructions or data, and includes, but is not limited to, a keyboard, mouse, camera, microphone, or touch device. The output device 140 is used to output instructions or data, and includes, but is not limited to, a display device and a speaker. In this embodiment, the input device 130 can be a temperature sensor to obtain the operating temperature of the terminal. The output device 140 can be a speaker to output audio signals.
[0146] In addition, those skilled in the art will understand that the structure of the terminal shown in the above figures does not constitute a limitation on the terminal. The terminal may include more or fewer components than shown, or combine certain components, or have different component arrangements. For example, the terminal may also include radio frequency circuits, input units, sensors, audio circuits, wireless fidelity (WIFI) modules, power supplies, Bluetooth modules, etc., which will not be described in detail here.
[0147] In the embodiments of this specification, the executing entity for each step can be the terminal described above. Optionally, the executing entity for each step is the terminal's operating system. The operating system can be Android, iOS, or other operating systems; this specification does not limit this.
[0148] exist Figure 7 In the electronic device, the processor 110 can be used to call an entity query program stored in the memory 120 and execute it to implement the entity query method as described in the various method embodiments of this specification.
[0149] In the embodiments of this specification, the query text input by the user for the target transaction is first obtained. Semantic parsing is then performed on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the voice entity and the entity category. Then, a query statement corresponding to the query text is generated based on the semantic entity, entity category, and correspondence. Finally, the implicit transaction entity corresponding to the query text is retrieved from the entity database based on the query statement. This enables the generation of a query statement corresponding to an implicit transaction entity even when there is no explicit entity name in the query text, and the retrieval of the implicit transaction entity from the entity database. This improves the intelligence of the intelligent assistant and the accuracy of its interpretation of user needs, thereby enhancing the service effectiveness and quality of the intelligent assistant and providing users with a better service experience.
[0150] Those skilled in the art will clearly understand that the technical solutions in this specification can be implemented using software and / or hardware. In this specification, "unit" and "module" refer to software and / or hardware capable of independently performing or cooperating with other components to perform a specific function. Hardware may include, for example, a Field-Programmable Gate Array (FPGA), an Integrated Circuit (IC), etc.
[0151] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this specification is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this specification. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this specification.
[0152] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0153] In the several embodiments provided in this specification, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some service interface; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0154] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0155] Furthermore, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0156] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0157] The foregoing descriptions are merely exemplary embodiments of this specification and should not be construed as limiting the scope of this specification. Any equivalent changes and modifications made in accordance with the teachings of this specification shall still fall within the scope of this specification. Other embodiments of this specification will be readily apparent to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This specification is intended to cover any variations, uses, or adaptations that follow the general principles of this specification and include common knowledge or customary techniques in the art not described herein. The specification and embodiments are to be considered exemplary only, and the scope and spirit of this specification are defined by the claims.
Claims
1. An entity query method, the method comprising: Obtain the query text entered by the user for the target firm; The query text is subjected to semantic parsing to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category; Generate a query statement corresponding to the query text based on the semantic entity, entity category, and the correspondence. Based on the query statement, the implicit transaction entity corresponding to the query text is obtained by querying the entity database. The query statement includes multiple statements, and the step of retrieving the implicit transaction entity corresponding to the query text from the entity database based on the query statement includes: The query statements are combined to obtain at least one query statement combination; The execution-guided approach is used to determine the query statement combination with the largest joint probability value among the at least one query statement combination as the target query statement combination. The execution-guided approach is to execute each query statement separately to query the entity database, verify the query results corresponding to each query statement, and calculate the joint probability value corresponding to each query statement combination based on the query results corresponding to each query statement. The implicit transaction entity is obtained by querying the entity database based on the combination of the target query statements.
2. The method according to claim 1, before performing semantic parsing processing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category, includes: Extract conditional text fragments from the query text; The step of performing semantic parsing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category includes: The conditional text fragment is subjected to semantic parsing to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category.
3. The method according to claim 2, wherein extracting conditional text fragments from the query text comprises: The pre-trained machine reading comprehension model scores each word in the query text, obtaining the score value corresponding to each word. Identify the two target text words with the largest sum of their scores from among all the text words; The text segment between two target text words in the query text is identified as the condition text segment.
4. The method according to claim 1, wherein obtaining the implicit transaction entity from the entity database based on the target query statement combination includes: A query data table is generated based on each of the query statements and the data stored in the entity database. The implicit transaction entity is obtained by querying the query data table based on the combination of the target query statements.
5. The method according to claim 4, wherein the data stored in the entity database includes static attribute data and dynamic attribute data, wherein the static attribute data is fixed entity data, and the dynamic attribute data is real-time collected user behavior data; The process of generating a query data table based on each of the query statements and the data stored in the entity database includes: A query data table is generated based on each of the query statements, the static attribute data, and the dynamic attribute data.
6. The method according to claim 1, further comprising, after obtaining the implicit transaction entity corresponding to the query text from the entity database based on the at least two query statements: Based on the implicit transaction entity and the preset template text, generate the response text corresponding to the query text; The reply text will be displayed to the user through the chat window.
7. An entity query device, comprising: The query text acquisition module is used to acquire the query text entered by the user for the target firm. The semantic parsing module is used to perform semantic parsing processing on the query text to obtain the semantic entity corresponding to the query text, the entity category corresponding to the semantic entity in the entity database, and the correspondence between the speech entity and the entity category; The query statement generation module is used to generate a query statement corresponding to the query text based on the semantic entity, entity category and the correspondence. The hidden entity query module is used to query the entity database based on the query statement to obtain the hidden transaction entity corresponding to the query text; The hidden entity query module is specifically used for: The query statements are combined to obtain at least one query statement combination; The execution-guided approach is used to determine the query statement combination with the largest joint probability value among the at least one query statement combination as the target query statement combination. The execution-guided approach is to execute each query statement separately to query the entity database, verify the query results corresponding to each query statement, and calculate the joint probability value corresponding to each query statement combination based on the query results corresponding to each query statement. The implicit transaction entity is obtained by querying the entity database based on the combination of the target query statements.
8. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to execute the steps of the method as claimed in any one of claims 1 to 6.
10. A computer program product having at least one instruction stored thereon, characterized in that, When the at least one instruction is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.