Data query method and device based on entity alignment, equipment and medium

Through entity recognition and entity alignment technology, the problem of inaccurate data query caused by user-entered abbreviations is solved, and the query accuracy and database accessibility are improved.

CN118568119APending Publication Date: 2024-08-30太保科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410636599.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-21
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

There may be abbreviated nouns in the query instructions entered by the user that the system cannot accurately recognize, causing the data query statement to be unable to accurately express the query intention, resulting in inaccurate search results or query failure.

Method used

Through entity recognition and entity alignment technology, entities in the user query text statement are obtained, their corresponding field values ​​are determined, entities are aligned, candidate values ​​are screened out, and query statements are generated based on the user query text statement and data table structure information. Perform data queries.

Benefits of technology

It improves the accuracy of data query, avoids query failure or inaccuracy caused by different values ​​in entities and data tables, reduces the professional requirements of non-technical personnel for database query language, and improves the accessibility and usability of the database. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568119A
    Figure CN118568119A
Patent Text Reader

Abstract

The embodiment of the invention provides a data query method and device based on entity alignment, equipment and a medium. After a user query text statement is obtained, an entity in the user query text statement is recognized and obtained; then, in a target data table corresponding to the user query text statement, determining a field value corresponding to the entity, and performing entity alignment on the entity and the field value to obtain a candidate value similar to the meaning expressed by the entity; and finally, performing data query according to the user query text statement, the table structure information of the target data table and the candidate values to obtain final data. By performing entity alignment on the entity and the field value, the candidate value which is stored in the target data table and has the meaning similar to that expressed by the entity in the user query text statement is determined, and finally the candidate value is used as a reference to perform data query, so that low data query accuracy or query failure caused by difference between the entity and the value in the data table is avoided, and the user experience is improved. And the data query accuracy 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 data query technology, and in particular to a data query method, apparatus, device, and medium based on entity alignment. Background Art

[0002] In related technologies, users can query data by entering query instructions. After receiving the user's query instructions, the query system needs to convert the query instructions into query statements (such as SQL statements) that can be recognized by the machine, thereby realizing data query.

[0003] However, since the query instructions entered by the user may contain some abbreviations that the system cannot accurately recognize, the converted query statements cannot accurately express the meaning of the query instructions, resulting in inaccurate data finally searched.

[0004] The approaches described in this section are not necessarily approaches that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any approach described in this section is prior art simply by virtue of its inclusion in this section. Similarly, unless otherwise indicated, the issues raised in this section should not be considered as having been recognized in any prior art. Summary of the Invention

[0005] In view of this, embodiments of the present application provide a data query method, apparatus, device, and medium based on entity alignment, aiming to improve the accuracy of data query.

[0006] In a first aspect, an embodiment of the present application provides a data query method based on entity alignment, the method comprising:

[0007] Get the user query text statement;

[0008] Performing entity recognition on the user query text sentence to obtain entities in the user query text sentence;

[0009] Determine the field value corresponding to the entity from the target data table according to the entity; the target data table is the data table corresponding to the user query text statement;

[0010] Performing entity alignment on the entity and the field value, and screening candidate values ​​from the field values;

[0011] A data query is performed based on the user query text statement, the table structure information of the target data table and the candidate values ​​to obtain data corresponding to the user query text statement.

[0012] In a possible implementation, the target data table includes multiple fields and values ​​corresponding to the fields; and determining, from the target data table according to the entity, a field value corresponding to the entity includes:

[0013] Determine the target field to which the entity belongs from the data table;

[0014] Determine the value corresponding to the target field in the data table;

[0015] The value corresponding to the target field is used as the field value.

[0016] In a possible implementation, performing data query based on the user query text statement, the table structure information of the target data table, and the candidate values ​​includes:

[0017] Inputting the user query text statement, the table structure information of the target data table and the candidate values ​​into a query statement generation model to obtain a query statement corresponding to the user query text statement;

[0018] Perform data query according to the query statement.

[0019] In a possible implementation, the query statement generation model is trained as follows:

[0020] Taking the sample query text statement, the table structure information of the sample data table and the sample candidate values ​​as inputs of the to-be-trained model, and obtaining the query statement corresponding to the sample query text statement;

[0021] The model to be trained is adjusted according to the sample query statement corresponding to the sample query text statement and the query statement corresponding to the sample query text statement until the query statement output by the model to be trained is the same as the sample query statement; the sample query statement is a query statement manually written based on the sample query text statement, and the sample query statement is used to query and obtain the data indicated by the query text statement.

[0022] In a possible implementation, before determining the field value corresponding to the entity from the target data table according to the entity, the method further includes:

[0023] Recalling a data table in the database to obtain the target data table corresponding to the user query text statement.

[0024] In a possible implementation, the step of retrieving a data table in a database to obtain the target data table corresponding to the user query text statement includes:

[0025] Semantically match the user query text statement with the data table overviews of multiple data tables in the database, and use the data table corresponding to the target data table overview as the target data table; the target data table overview is the data table overview with the highest semantic matching degree with the user query text statement among the data table overviews of the multiple data tables.

[0026] In a possible implementation, the step of retrieving a data table in a database to obtain the target data table corresponding to the user query text statement includes:

[0027] Vector matching is performed using the entity and multiple data tables in the database to obtain the target data table.

[0028] In a second aspect, an embodiment of the present application provides a data query device based on entity alignment, comprising:

[0029] The acquisition module is used to obtain the user query text statement;

[0030] An identification module is used to perform entity recognition on the user query text sentence to obtain entities in the user query text sentence;

[0031] A determination module, configured to determine a field value corresponding to the entity from a target data table according to the entity; the target data table is a data table corresponding to the user query text statement;

[0032] A screening module, configured to perform entity alignment on the entity and the field value, and screen candidate values ​​from the field values;

[0033] The query module is used to perform data query based on the user query text statement, the table structure information of the target data table and the candidate values, and obtain data corresponding to the user query text statement.

[0034] In a possible implementation, the target data table includes multiple fields and values ​​corresponding to the fields; the determination module is specifically configured to:

[0035] Determine the target field to which the entity belongs from the data table;

[0036] Determine the value corresponding to the target field in the data table;

[0037] The value corresponding to the target field is used as the field value.

[0038] In a possible implementation, the query module is specifically configured to:

[0039] Inputting the user query text statement, the table structure information of the target data table and the candidate values ​​into a query statement generation model to obtain a query statement corresponding to the user query text statement;

[0040] Perform data query according to the query statement.

[0041] In a possible implementation, the query statement generation model is trained as follows:

[0042] Taking the sample query text statement, the table structure information of the sample data table and the sample candidate values ​​as inputs of the to-be-trained model, and obtaining the query statement corresponding to the sample query text statement;

[0043] The model to be trained is adjusted according to the sample query statement corresponding to the sample query text statement and the query statement corresponding to the sample query text statement until the query statement output by the model to be trained is the same as the sample query statement; the sample query statement is a query statement manually written based on the sample query text statement, and the sample query statement is used to query and obtain the data indicated by the query text statement.

[0044] In a possible implementation, the apparatus further includes a recall module, wherein the recall module is configured to:

[0045] Recalling a data table in the database to obtain the target data table corresponding to the user query text statement.

[0046] In a possible implementation, the recall module is specifically configured to:

[0047] Semantically match the user query text statement with the data table overviews of multiple data tables in the database, and use the data table corresponding to the target data table overview as the target data table; the target data table overview is the data table overview with the highest semantic matching degree with the user query text statement among the data table overviews of the multiple data tables.

[0048] In a possible implementation, the recall module is specifically configured to:

[0049] Vector matching is performed using the entity and multiple data tables in the database to obtain the target data table.

[0050] In a third aspect, an embodiment of the present application provides a device comprising a memory and a processor, wherein the memory is used to store instructions or codes, and the processor is used to execute the instructions or codes so that the device executes the entity alignment-based data query method described in any one of the first aspects above.

[0051] In a fourth aspect, an embodiment of the present application provides a computer storage medium, in which a code is stored. When the code is executed, the device executing the code implements the entity alignment-based data query method described in any one of the first aspects above.

[0052] The embodiments of the present application provide a data query method, apparatus, device and medium based on entity alignment. After obtaining the user query text statement, the entity in the user query text statement is identified; then, in the target data table corresponding to the user query text statement, the field value corresponding to the entity is determined, and the entity and field value are entity aligned to obtain candidate values ​​similar to the meaning expressed by the entity; finally, data query is performed based on the user query text statement, the table structure information of the target data table and the candidate values ​​to obtain the final data. By performing entity alignment on the entity and field values, the candidate values ​​stored in the target data table and expressing similar meanings to the entity in the user query text statement are determined, and finally the candidate values ​​are used as a reference for data query, thereby avoiding low data query accuracy or query failure caused by different values ​​between the entity and the data table, and improving data query accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0054] Figure 1 A flowchart of a data query method based on entity alignment provided in an embodiment of the present application;

[0055] Figure 2 A schematic structural diagram of a data query device based on entity alignment provided in an embodiment of the present application. DETAILED DESCRIPTION

[0056] Obviously, the embodiments described in this application are only a part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0057] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. The terms used in the following embodiments are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the embodiments of the present application, "one or more" refers to one, two or more; "and / or" describes the association relationship of associated objects, indicating that three relationships may exist; for example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the related objects before and after are in an "or" relationship.

[0058] As an exemplary data query method, after the user inputs a query text statement, the query system needs to generate a query statement corresponding to the query text statement based on the entities in the query text statement, and then perform data query through the query statement. Various entities and the data corresponding to the entities are stored in the database, and the machine can query the database based on the entities in the query statement. However, the entities stored in the database and the entities in the query text statement input by the user may be different entities expressing the same meaning. For example, the entity in the query text statement input by the user is the first entity, and the entity stored in the database is the second entity. The first entity and the second entity express the same meaning, but the generated query statement is the first entity. Using a query statement including the first entity in a database storing the second entity, the data corresponding to the second entity cannot be queried, resulting in low data query accuracy or even data query failure.

[0059] In response to this technical problem, an embodiment of the present application provides a data query method based on entity alignment. After obtaining the user query text statement, the entity in the user query text statement is identified; then, in the target data table corresponding to the user query text statement, the field value corresponding to the entity is determined, and the entity and field value are entity aligned to obtain candidate values ​​similar to the meaning expressed by the entity; finally, data query is performed based on the user query text statement, the table structure information of the target data table and the candidate values ​​to obtain the final data. By performing entity alignment on the entity and field values, the candidate values ​​stored in the target data table that are similar to the entity expression in the user query text statement are determined, and finally the candidate values ​​are used as a reference for data query, thereby avoiding low data query accuracy or query failure caused by different values ​​between the entity and the data table, and improving data query accuracy.

[0060] See also Figure 1 , Figure 1 A flowchart of a data query method based on entity alignment provided in an embodiment of the present application includes:

[0061] S101: Obtain a user query text statement.

[0062] A user query is a text statement entered by a user to search for data. It can be a query condition written in natural language to describe the data information the user requires. A user query includes entities, which guide the retrieval of data from a dataset that meets the user's requirements.

[0063] In the fields of natural language processing and information extraction, an entity typically refers to a word or phrase in a text that represents a specific real-world entity. An entity can be a specific person, place, organization, time, date, product, or event, or it can be an abstract concept. In text, an entity typically has a specific referential or naming form, used to identify the specific thing mentioned in the text.

[0064] For example, a user may enter the following query text:

[0065] “Show sales from 2019 to 2022”;

[0066] “Find out John Smith’s order information for May 2024”;

[0067] “List the products that received the most customer returns last quarter.”

[0068] S102: Perform entity recognition on the user query text sentence to obtain entities in the user query text sentence.

[0069] Entity recognition (ER) involves automatically identifying and extracting meaningful entities, such as names, locations, organizations, times, or dates, from text using natural language processing techniques. Entity recognition is a crucial component of information extraction, aiming to identify and annotate entities within user query text for further semantic understanding and analysis.

[0070] Entity recognition can be achieved through machine learning and deep learning techniques, which are trained on large annotated datasets to identify different types of entities in text. These systems can identify single words, phrases, or combinations of entities and classify them into predefined categories.

[0071] In the embodiments of this application, entity recognition is used to extract entity information from user query text sentences to help the system understand the user's query intent. Through entity recognition, key information in the user's query text sentences can be extracted more accurately, providing support for subsequent data query and analysis. The accuracy and efficiency of entity recognition are crucial to the smooth progress of the entire data query process.

[0072] In one possible implementation, an entity recognition model can be used to identify entities in user query text. Entity recognition models can include conditional random fields (CRFs), support vector machines (SVMs), and deep learning models. Entity recognition models can be trained using labeled datasets. They can learn the characteristics of different entity types, enabling accurate entity recognition.

[0073] S103: Determine the field value corresponding to the entity from the target data table according to the entity.

[0074] The target data table is the data table corresponding to the user's query text statement. The target data table describes the fields and their corresponding values. Field values ​​are the values ​​of the fields in the target data table corresponding to the entity. Field values ​​include multiple entities belonging to the field. Values ​​can also be understood as entities.

[0075] As an example, the target data table is shown in Table 1.

[0076] Table 1: Target data table

[0077] Field Value (field value) com_name(company name) A City First Company assert_info(asset information) ****** update_time (latest update time) ******

[0078] In one possible implementation, determining the field value corresponding to the entity from the target data table according to the entity includes:

[0079] Determine the target field to which the entity belongs from the data table;

[0080] Determine the value corresponding to the target field in the data table;

[0081] Use the value corresponding to the target field as the field value.

[0082] Based on the entity's category, determine the target field where the entity should be assigned a value. For example, if the entity is a person's name, this might correspond to the "Name" field; if the entity is a location, this might correspond to the "Location" field. Search the target table for the target field that corresponds to the entity and find the specific value for the target field. Once the value for the target field is found, use this value as the value for the corresponding field in the table for the entity. Field values ​​should include values ​​that have a similar meaning to the entity.

[0083] In an embodiment of the present application, entity recognition technology and database query operations are combined to automatically extract entity information from user query text statements and map them to corresponding field values ​​in the database.

[0084] S104: Entity alignment is performed on the entity and the field value, and candidate values ​​are screened out from the field values.

[0085] Entity alignment is the process of matching entities identified from user query text with field values ​​in the target database table. Multiple values ​​in the matching field whose matching degree with the entity is greater than or equal to a preset value are selected as candidate values.

[0086] In one possible implementation, the most suitable candidate value can be determined by calculating the similarity between the entity and the field value. Alternatively, field values ​​can be filtered using preset rules and conditions to obtain candidate values. Alternatively, a machine learning model can be used to automatically select the most appropriate candidate value based on training data.

[0087] In another possible implementation, knowledge graphs can be used for entity alignment. The rich entity and relationship information in knowledge graphs can assist the entity alignment process, providing more contextual information and semantic constraints to help achieve more accurate entity alignment.

[0088] In the embodiments of the present application, the process of entity alignment and candidate value screening is a very important part of information extraction and data processing, ensuring that the correct correspondence is established between the entities extracted from the user query text statement and the field values ​​in the database, thereby providing a reliable data foundation for subsequent data analysis and mining.

[0089] S105: Perform data query based on the user query text statement, the table structure information of the target data table, and the candidate values ​​to obtain data corresponding to the user query text statement.

[0090] The table structure information of the target data table is structure-related information such as the fields, field types, and field values ​​contained in the data table. As an example, the table structure information can be a schema. In the database field, schema refers to the definition of the organization and structure of data in the database. The schema includes the definition of all tables in the database, the names and types of fields, and the relationships between data (such as primary key and foreign key constraints). Simply put, the schema defines the data storage relationship and the association relationship between data. Through the table structure information, the system can clearly understand the structure of the target data table and the corresponding relationships in the table.

[0091] In step S105, the query system can perform data query based on the user's query requirements (user query text statement) and the data table structure (table structure information), combined with candidate values, and finally return the query results to the user to achieve the conversion and presentation from natural language query to database data, helping users to obtain the required information and perform data analysis more conveniently.

[0092] In one possible implementation, performing data query based on a user query text statement, table structure information of a target data table, and candidate values ​​includes:

[0093] Input the user query text statement, the table structure information of the target data table and the candidate values ​​into the query statement generation model to obtain the query statement corresponding to the user query text statement;

[0094] Query data based on query statements.

[0095] The query generation model combines the user's query text, the target table's table structure, and candidate values ​​to generate a corresponding query statement (such as an SQL statement) based on predefined rules, models, or machine learning algorithms. During the generation process, natural language processing techniques can be used to understand the user's query intent and convert it into a query statement executable by the database. The generated SQL query statement is sent to the query system for execution, retrieving data from the database that meets the user's query criteria. The query system searches and filters data in the database based on the query statement and returns the query results.

[0096] This approach significantly improves the user experience, reduces the need for specialized database query languages, and enables even ordinary users to easily query database information. Furthermore, the candidate values ​​derived from entity alignment ensure the accuracy of data queries.

[0097] As an example, the query generation model first parses the user's query text, extracts key information, and performs semantic understanding on this parsed key information, translating the natural language intent into specific database query operations. Then, based on preset query templates or rules, the query generation model maps the results of this semantic understanding into database query templates, such as SELECT, WHERE, and JOIN. Furthermore, based on candidate values ​​and table structure information, it generates matching conditions for database table fields. Finally, based on the query template and matching conditions, it constructs the final SQL query statement.

[0098] Through the above steps, the query generation model can convert user query text statements into database-executable query statements, building a bridge between the user and the database, helping users to more conveniently perform data query and retrieval operations. This significantly reduces the barrier to entry for non-technical personnel to query the database, improving the database's accessibility and usability.

[0099] In one possible implementation, the query generation model training process is as follows:

[0100] Taking the sample query text statement, the table structure information of the sample data table and the sample candidate values ​​as inputs of the to-be-trained model, and obtaining the query statement corresponding to the sample query text statement;

[0101] The model to be trained is adjusted according to the sample query statement corresponding to the sample query text statement and the query statement corresponding to the sample query text statement until the query statement output by the model to be trained is the same as the sample query statement; the sample query statement is a query statement manually written based on the sample query text statement, and the sample query statement is used to query and obtain the data indicated by the query text statement.

[0102] In an embodiment of the present application, a sample query text statement, table structure information of a sample data table, and sample candidate values ​​are obtained. Then, a model architecture suitable for the task is selected, which can be a rule-based method, a statistical method (such as a sequence-to-sequence model), or a deep learning model (such as a Transformer). Further, a loss function of the model to be trained is defined to measure the difference between the query statement to be trained and the sample query statement, and a cross entropy loss function or other suitable loss function can be used. The prepared training data (sample query text statement, table structure information of the sample data table, and sample candidate values) is input into the model to be trained for training, and the model parameters of the model to be trained are adjusted so that the model to be trained can generate a query statement that is the same or similar to the sample query statement. Finally, the performance of the trained model is evaluated, and the model is tuned according to the evaluation results.

[0103] The data query method based on entity alignment provided by the embodiment of the present application. The entities extracted from the user query text statement are aligned with the field values ​​stored in the data table to obtain candidate values ​​that can express the same or similar meaning as the entity, and then a query statement corresponding to the user query text statement is generated based on the candidate values. Even if the user is not clear about the values ​​stored in the data table, the entity input by the user can be aligned with the value in the data table through entity alignment, solving the problem of data query failure or inaccuracy caused by the difference between the user input entity and the value in the data table. In addition, the embodiment of the present application can automatically generate a corresponding machine-recognizable query statement based on the user query text statement, which greatly reduces the threshold for non-technical personnel to query the database and improves the accessibility and usability of the database.

[0104] In a possible implementation, before step S103 , the method further includes: recalling a data table in the database to obtain a target data table corresponding to the user query text statement.

[0105] The database includes multiple data tables, and a target data table corresponding to the user query text statement needs to be matched from the database.

[0106] By searching and matching database tables, we determine which tables are likely to be relevant to the user's query. Based on the results of the table recall, we identify the most relevant table as the target table. By performing table recall in the database and identifying the target table relevant to the user's query text, we improve the accuracy and efficiency of subsequent query generation, better understanding the user's query intent in complex database environments and providing more precise query results.

[0107] In one possible implementation, a data table is retrieved from a database to obtain a target data table corresponding to a user query text statement, including:

[0108] Semantically match the user query text statement with the data table overviews of multiple data tables in the database, and use the data table corresponding to the target data table overview as the target data table. The target data table overview is the data table overview with the highest semantic match with the user query text statement among the multiple data table overviews.

[0109] In an embodiment of the present application, a user query text sentence input by a user is first semantically parsed to extract key information therein. Then, based on the parsing results, a semantic match is performed between the user query text and the data table overviews of multiple data tables in a database. A data table overview is a summary description of the contents of a data table, used to describe the function or purpose of the data table. A semantic matching algorithm is used to determine the data table overview with the highest semantic match to the user query text. Finally, based on the results of the semantic matching, the data table corresponding to the data table overview with the highest match is selected as the target data table.

[0110] Through this method, the target data table that best matches the semantics of the query text is determined, which improves the pertinence and accuracy of query statement generation.

[0111] In another possible implementation, a data table is retrieved from the database to obtain a target data table corresponding to the user query text statement, including:

[0112] Use entities to perform vector matching with multiple data tables in the database to obtain the target data table.

[0113] In an embodiment of the present application, multiple data tables in a database can be vectorized. For example, natural language processing models such as Word2Vec and BERT can be used to convert the table structure information of the data table into a vector representation to obtain a data table vector corresponding to each data table. Each data table will use a vector to represent its features. In addition, the entities extracted from the user query text are also vectorized, and the entity information is converted into a vector form to obtain an entity vector corresponding to the entity. Then, the entity vector is matched with the data table vector, and a similarity calculation method (such as cosine similarity) is used to measure the similarity between the entity vector and the data table vector. Finally, based on the result of the vector matching, the data table that is most relevant to the entity extracted from the user query text statement is determined as the target data table, and the data table with the highest degree of matching between the data table vector and the entity vector will be selected as the target data table.

[0114] Using vector matching to recall data tables in the database can more accurately determine the target data table corresponding to the user's query text statement, thereby improving the system's understanding of the user's query intent and the accuracy of the query results.

[0115] Below, the data query method based on entity alignment provided in the embodiment of the present application is further explained with reference to examples.

[0116] First, the user query text sentence is obtained, which is "Query the accidental injury insurance products sold by Tai Ping Property & Casualty Insurance"; then, entity recognition is performed on "Query the accidental injury insurance products sold by A Property & Casualty Insurance" to obtain the entities "A Property & Casualty Insurance" and "Accidental Injury Insurance".

[0117] The target data table corresponding to “Query the accidental injury insurance products sold by Tai Ping Property & Casualty Insurance” is shown in Table 2.

[0118] Table 2: Target data table

[0119]

[0120]

[0121] The target data table matches "A Property Insurance" and "Accidental Injury Insurance" with the corresponding fields "com_name" and "product_type." The corresponding field values ​​are "A Property Insurance Co., Ltd., B Property Insurance Co., Ltd." and "Accidental Injury Insurance, Cargo Transportation Insurance." Through entity alignment, the candidate values ​​are determined to be "A Property Insurance Co., Ltd." and "Accidental Injury Insurance."

[0122] The candidate values ​​"A Property & Casualty Insurance Co., Ltd." and "Accidental Injury Insurance" are used, along with the user query "Query accidental injury insurance products sold by A Property & Casualty Insurance Co., Ltd." and the target table structure to generate the corresponding query statement: select * from insurance_product_table where com_name = 'China Pacific Property & Casualty Insurance Co., Ltd.' and product_type = 'Accidental Injury Insurance'. Finally, the corresponding data is retrieved based on the query statement.

[0123] The above are some specific implementations of the data query method based on entity alignment provided in the embodiment of the present application. Based on this, the present application also provides a corresponding device. The device provided in the embodiment of the present application will be introduced from the perspective of functional modularization.

[0124] See also Figure 2 The structure diagram of the data query device based on entity alignment is shown, and the device includes an acquisition module 201, an identification module 202, a determination module 203, a screening module 204 and a query module 205.

[0125] Acquisition module 201, used to obtain user query text statement;

[0126] Identification module 202, configured to perform entity recognition on the user query text sentence to obtain entities in the user query text sentence;

[0127] Determination module 203, for determining the field value corresponding to the entity from the target data table according to the entity; the target data table is the data table corresponding to the user query text statement;

[0128] A screening module 204 is configured to perform entity alignment on the entity and the field value, and screen candidate values ​​from the field values;

[0129] The query module 205 is configured to perform data query based on the user query text statement, the table structure information of the target data table, and the candidate values, to obtain data corresponding to the user query text statement.

[0130] The embodiment of the present application provides a data query device based on entity alignment. After obtaining the user query text sentence, the entity in the user query text sentence is identified; then, in the target data table corresponding to the user query text sentence, the field value corresponding to the entity is determined, and the entity and field value are entity aligned to obtain candidate values ​​similar to the meaning expressed by the entity; finally, data query is performed based on the user query text sentence, the table structure information of the target data table and the candidate values ​​to obtain the final data. By performing entity alignment on the entity and field values, the candidate values ​​stored in the target data table and expressing similar meanings to the entity in the user query text sentence are determined, and finally the candidate values ​​are used as a reference for data query, thereby avoiding low data query accuracy or query failure caused by different values ​​between the entity and the data table, and improving data query accuracy.

[0131] In a possible implementation, the target data table includes multiple fields and values ​​corresponding to the fields; the determination module 203 is specifically configured to:

[0132] Determine the target field to which the entity belongs from the data table;

[0133] Determine the value corresponding to the target field in the data table;

[0134] The value corresponding to the target field is used as the field value.

[0135] In a possible implementation, the query module 205 is specifically configured to:

[0136] Inputting the user query text statement, the table structure information of the target data table and the candidate values ​​into a query statement generation model to obtain a query statement corresponding to the user query text statement;

[0137] Perform data query according to the query statement.

[0138] In a possible implementation, the query statement generation model is trained as follows:

[0139] Taking the sample query text statement, the table structure information of the sample data table and the sample candidate values ​​as inputs of the to-be-trained model, and obtaining the query statement corresponding to the sample query text statement;

[0140] The model to be trained is adjusted according to the sample query statement corresponding to the sample query text statement and the query statement corresponding to the sample query text statement until the query statement output by the model to be trained is the same as the sample query statement; the sample query statement is a query statement manually written based on the sample query text statement, and the sample query statement is used to query and obtain the data indicated by the query text statement.

[0141] In a possible implementation, the apparatus further includes a recall module, wherein the recall module is configured to:

[0142] Recalling a data table in the database to obtain the target data table corresponding to the user query text statement.

[0143] In a possible implementation, the recall module is specifically configured to:

[0144] Semantically match the user query text statement with the data table overviews of multiple data tables in the database, and use the data table corresponding to the target data table overview as the target data table; the target data table overview is the data table overview with the highest semantic matching degree with the user query text statement among the data table overviews of the multiple data tables.

[0145] In a possible implementation, the recall module is specifically configured to:

[0146] Vector matching is performed using the entity and multiple data tables in the database to obtain the target data table.

[0147] The embodiments of the present application also provide corresponding devices and computer storage media for implementing the solutions provided by the embodiments of the present application.

[0148] The device includes a memory and a processor, the memory is used to store instructions or codes, and the processor is used to execute the instructions or codes so that the device executes the entity alignment-based data query method described in any embodiment of the present application.

[0149] The computer storage medium stores code. When the code is executed, the device executing the code implements the data query method based on entity alignment described in any embodiment of the present application.

[0150] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in yet other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0151] The "multiple" involved in the embodiments of the present application means greater than or equal to two. It should be noted that in the description of the embodiments of the present application, the words "first" and "second" are only used for the purpose of distinguishing the description and cannot be understood as indicating or implying relative importance or order.

[0152] Through the description of the above embodiments, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above embodiment methods can be implemented by means of software plus a general hardware platform. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment or certain parts of the embodiments of the present application.

[0153] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, refer to the partial description of the method embodiment. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment. Those of ordinary skill in the art can understand and implement it without paying any creative work.

[0154] The above description is merely an exemplary embodiment of the present application and is not intended to limit the scope of protection of the present application.

Claims

1. A data query method based on entity alignment, characterized in that: include: Get the user query text statement; Performing entity recognition on the user query text sentence to obtain entities in the user query text sentence; Determine the field value corresponding to the entity from the target data table according to the entity; the target data table is a data table corresponding to the user query text statement; Performing entity alignment on the entity and the field value, and screening out candidate values ​​from the field values; Data query is performed according to the user query text statement, the table structure information of the target data table and the candidate values ​​to obtain data corresponding to the user query text statement.

2. The method according to claim 1, characterized in that The target data table includes multiple fields and values ​​corresponding to the fields; determining the field value corresponding to the entity from the target data table according to the entity includes: Determine the target field to which the entity belongs from the data table; Determine the value corresponding to the target field in the data table; The value corresponding to the target field is used as the field value.

3. The method according to claim 1, characterized in that The performing of data query according to the user query text statement, the table structure information of the target data table and the candidate values ​​includes: Inputting the user query text statement, the table structure information of the target data table and the candidate values ​​into a query statement generation model to obtain a query statement corresponding to the user query text statement; Perform data query according to the query statement.

4. The method according to claim 3, characterized in that The training process of the query statement generation model is as follows: Taking the sample query text statement, the table structure information of the sample data table and the sample candidate values ​​as the input of the model to be trained, and obtaining the query statement corresponding to the sample query text statement; According to the sample query statement corresponding to the sample query text statement and the query statement corresponding to the sample query text statement, the model to be trained is adjusted until the query statement output by the model to be trained is the same as the sample query statement; The sample query statement is a query statement manually written based on the sample query text statement, and the sample query statement is used to query and obtain the data indicated by the sample query text statement.

5. The method according to claim 1, characterized in that Before determining the field value corresponding to the entity from the target data table according to the entity, the method further includes: Recalling a data table in a database to obtain the target data table corresponding to the user query text statement.

6. The method according to claim 5, characterized in that The step of retrieving a data table in a database to obtain the target data table corresponding to the user query text statement includes: Semantically match the user query text statement with the data table overviews of the multiple data tables in the database, and use the data table corresponding to the target data table overview as the target data table; the target data table overview is the data table overview with the highest semantic match with the user query text statement among the data table overviews of the multiple data tables.

7. The method according to claim 5, characterized in that The step of retrieving a data table in a database to obtain the target data table corresponding to the user query text statement includes: The entity is used to perform vector matching with a plurality of data tables in the database to obtain the target data table.

8. A data query device based on entity alignment, characterized in that: include: An acquisition module is used to acquire user query text statements; An identification module, used to perform entity identification on the user query text sentence to obtain entities in the user query text sentence; A determination module, used to determine the field value corresponding to the entity from a target data table according to the entity; the target data table is a data table corresponding to the user query text statement; A screening module, used for performing entity alignment on the entity and the field value, and screening candidate values ​​from the field value; The query module is used to perform data query according to the user query text statement, the table structure information of the target data table and the candidate values ​​to obtain data corresponding to the user query text statement.

9. A computer device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the data query method based on entity alignment as described in any one of claims 1 to 7 is implemented.

10. A computer storage medium, characterized in that: The computer storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the data query method based on entity alignment as described in any one of claims 1 to 7.