Data query methods, devices, storage media, and electronic devices
By defining the knowledge base and relationships within a preset scenario, the problem of low accuracy and completeness in data queries is solved, achieving the effect of accurately displaying relevant data even when the user's input is inaccurate.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-10
- Publication Date
- 2026-03-06
AI Technical Summary
In existing technologies, the accuracy and completeness of the data retrieved during data queries are low, and the correct query results cannot be provided based on the query information entered by the user.
By obtaining query information from the user's end, a knowledge base is determined for a preset scenario. The target language model is used to generate relationships, obtain the target data and its related data, and return them to the user's end.
It improves the accuracy and completeness of data queries, enabling the display of relevant data even when user input is inaccurate, thus enhancing the accuracy of user information queries.
Smart Images

Figure CN117033744B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and more specifically, to a data query method, apparatus, storage medium, and electronic device. Background Technology
[0002] With the increasing availability of open-source information online, more and more users are able to retrieve larger amounts of data. However, because the data retrieved is only displayed based on the user's input, incomplete data display may occur. Furthermore, if the user's input is inaccurate, the system may fail to provide correct search results, resulting in users not obtaining complete and accurate data.
[0003] There is currently no effective solution to the problem of low accuracy and completeness of data retrieved when querying data in related technologies. Summary of the Invention
[0004] This application provides a data query method, apparatus, storage medium, and electronic device to solve the problem of low accuracy and completeness of the data retrieved when querying data in related technologies.
[0005] According to one aspect of this application, a data query method is provided. The method includes: acquiring query information sent by a user terminal; determining a preset scenario indicated by the query information; and determining a knowledge base under the preset scenario, wherein the knowledge base consists of target data and related relationships, and the related relationships are obtained by inputting a set of text information under the preset scenario obtained from a public database into a target language model; acquiring data associated with the query information from the knowledge base under the preset scenario to obtain target data, and acquiring data associated with the target data from the knowledge base to obtain related data; and returning the target data and related data to the user terminal.
[0006] Optionally, the target language model consists of a first language model and a second language model. The database is generated as follows: Text information under a preset scenario is obtained from a public database to obtain a text information set. Each text information in the text information set is preprocessed to obtain M statement sets, where each text information set includes M text information. The M statement sets are input into the first language model to obtain N sets of related statements. The first language model is used to identify whether there is a relationship between the statements. Each set of related statements includes two statements and one relationship. The two statements belong to the same statement set or different statement sets. The N sets of related statements are classified according to the attribute information of each set of related statements to obtain P sets of related statements. The P sets of related statements are input into the second language model to obtain Q relationships, where each relationship is a relationship between a set of related statements. The Q relationships and the P sets of related statements are used as a knowledge base.
[0007] Optionally, the first language model is trained as follows: multiple historical sentences in a preset scenario are obtained, and the content of each historical sentence is determined; the relationship between multiple historical sentences is determined based on the content of the sentences, resulting in multiple first historical relationships; each first historical relationship and a set of historical sentences corresponding to the first historical relationship are taken as a set of first samples, resulting in multiple sets of first samples, and the first initial language model is trained using the multiple sets of first samples to obtain the first language model.
[0008] Optionally, the second language model is trained as follows: Multiple historical statements in a preset scenario are acquired, and the content of each historical statement is determined; the relationships between the multiple historical statements are determined based on their content, resulting in multiple sets of first historical related statements; the multiple sets of first historical related statements are classified according to their attribute information, resulting in multiple sets of historical related statements, and the relationships between these sets are determined, resulting in multiple second historical related relationships, wherein the attribute information of each set of first historical related statements in the historical related statement set is the same; each second historical related relationship and the corresponding set of historical related statements are taken as a set of second samples, resulting in multiple sets of second samples, and the second initial language model is trained using these multiple sets of second samples to obtain the second language model.
[0009] Optionally, preprocessing each text message in the text information set to obtain M sentence sets includes: identifying the language type of each text message in the text information set; segmenting each text message into sentences according to the sentence segmentation rules corresponding to the language type to obtain a sentence set for each text message; and filtering the sentences in each sentence set using a preset dictionary to obtain M filtered sentence sets.
[0010] Optionally, filtering the statements in each statement set using a preset dictionary to obtain M filtered statement sets includes: obtaining any two target statements from any two statement sets in the M filtered statement sets, and sequentially searching the two target statements in a preset database to obtain two search results; obtaining the Uniform Resource Locator (URL) of each search result, and determining whether the URLs of the two search results are the same; if the URLs are the same, deleting any one target statement from the M statement sets to obtain an updated set of M statements.
[0011] Optionally, obtaining text information in a preset scenario from a public database to obtain a text information set includes: obtaining all first text information from the public database and obtaining scene information of the preset scenario; sequentially calculating the matching degree between each first text information and the scene information, and determining the initial text information with a matching degree greater than a preset matching degree as second text information, thereby obtaining multiple second text information; obtaining the generation time of each second text information, and determining the second text information with a generation time greater than a preset time as text information in the preset scenario.
[0012] According to another aspect of this application, a data query apparatus is provided. The apparatus includes: a first acquisition unit, configured to acquire query information sent by a user terminal, determine a preset scenario indicated by the query information, and determine a knowledge base under the preset scenario, wherein the knowledge base consists of target data and related relationships, and the related relationships are obtained by inputting a set of text information under the preset scenario obtained from a public database into a target language model; a second acquisition unit, configured to acquire data associated with the query information from the knowledge base under the preset scenario to obtain target data, and acquire data associated with the target data from the knowledge base to obtain related data; and a return unit, configured to return the target data and related data to the user terminal.
[0013] According to another aspect of the present invention, a computer storage medium is also provided for storing a program, wherein the program, when running, controls the device where the computer storage medium is located to execute a data query method.
[0014] According to another aspect of the present invention, an electronic device is also provided, comprising one or more processors and a memory; the memory stores computer-readable instructions, and the processor is configured to execute the computer-readable instructions, wherein the computer-readable instructions execute a data query method when they are run.
[0015] This application employs the following steps: obtaining query information sent by the user, determining the preset scenario indicated by the query information, and determining the knowledge base under the preset scenario. The knowledge base consists of target data and related relationships, which are obtained by inputting a set of text information under the preset scenario obtained from a public database into a target language model; retrieving data associated with the query information from the knowledge base under the preset scenario to obtain target data, and retrieving data associated with the target data from the knowledge base to obtain related data; and returning the target data and related data to the user. This solves the problem of low accuracy and completeness of the data retrieved when querying data in related technologies. By determining the preset scenario indicated by the query information, selecting the corresponding knowledge base, and querying within that knowledge base, the required information can be accurately obtained. Simultaneously, related data associated with the target data retrieved through the knowledge base can be obtained, thus displaying relevant data to the user even when the user's query information is inaccurate, thereby improving the accuracy of user information queries. Attached Figure Description
[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0017] Figure 1 This is a flowchart of a data query method provided according to an embodiment of this application;
[0018] Figure 2 This is a flowchart of an optional knowledge base creation method provided according to an embodiment of this application;
[0019] Figure 3 This is a schematic diagram of a data query device provided according to an embodiment of this application;
[0020] Figure 4 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation
[0021] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0022] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0023] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0024] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties. For example, this system has an interface with relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving consent information from the aforementioned user or organization.
[0025] It should be noted that the data query methods, devices, storage media, and electronic devices defined in this disclosure can be used in the field of artificial intelligence, or in any field other than artificial intelligence. The application fields of the data query methods, devices, storage media, and electronic devices defined in this disclosure are not limited.
[0026] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:
[0027] LLM: Large Language Model, is a deep learning-based natural language processing model that learns the syntax and semantics of natural language, thereby generating readable text.
[0028] According to an embodiment of this application, a data query method is provided.
[0029] Figure 1This is a flowchart of a data query method provided according to an embodiment of this application. For example... Figure 1 As shown, the method includes the following steps:
[0030] Step S101: Obtain the query information sent by the user terminal, determine the preset scenario indicated by the query information, and determine the knowledge base under the preset scenario. The knowledge base consists of target data and related relationships. The related relationships are obtained by inputting the set of text information under the preset scenario obtained from the public database into the target language model.
[0031] Specifically, after a user sends a query, the pre-defined scenario for that query needs to be determined first. For example, the query might be in the financial sector or the technology sector. When determining the pre-defined scenario, it can be based on the specific content of the query. For instance, if the query includes information like "Product A's returns in month X," then detecting the keyword "returns" indicates the query is in the financial sector. Therefore, the query will be retrieved from the corresponding knowledge base in the financial field, improving data acquisition efficiency and accuracy.
[0032] After determining the preset scenario, it is necessary to obtain the knowledge base under the preset scenario. This knowledge base is obtained by processing the text information under the preset scenario through the target language model. In this way, the target data related to the preset scenario can be obtained from the knowledge base, thereby completing the user's query operation.
[0033] Step S102: Obtain data related to the query information from the knowledge base under the preset scenario to obtain target data, and obtain data related to the target data from the knowledge base to obtain associated data.
[0034] Specifically, after obtaining the target data from the knowledge base in the preset scenario, it is also necessary to obtain the related data associated with the target data from the knowledge base. The relationship is located in the knowledge base. That is, after obtaining the target data, the related data can be obtained directly based on the relationship between the data in the database. Thus, even when the query information entered by the user is relatively vague, the user can still obtain the query data they need.
[0035] For example, if a user wants to query loan information but enters interest rate information, the loan information related to the interest rate can be displayed simultaneously after showing the user the relevant interest rate information. This allows the user to successfully find the information they want by simply performing the query sequentially.
[0036] Step S103: Return the target data and related data to the user terminal.
[0037] Specifically, after obtaining the target data and related data from the database, the target data and related data can be displayed on the user's device, thereby completing the user's data query operation.
[0038] The data query method provided in this application embodiment obtains query information sent by the user terminal, determines the preset scenario indicated by the query information, and determines the knowledge base under the preset scenario. The knowledge base consists of target data and related relationships. The related relationships are obtained by inputting a set of text information under the preset scenario obtained from a public database into a target language model. Data associated with the query information is obtained from the knowledge base under the preset scenario to obtain the target data, and data associated with the target data is obtained from the knowledge base to obtain the related data. The target data and related data are then returned to the user terminal. This solves the problem of low accuracy and completeness of the queried data in related technologies. By determining the preset scenario indicated by the query information, selecting the knowledge base corresponding to the preset scenario, and querying within the knowledge base, the required information is accurately obtained. Simultaneously, related data associated with the target data obtained through the knowledge base is obtained, so that even if the user's query information is inaccurate, relevant data can still be displayed to the user, thereby improving the accuracy of user information queries.
[0039] To improve the accuracy of the data stored in the knowledge base and the accuracy of the relationships, optionally, Figure 2 This is a flowchart of an optional knowledge base creation method provided according to an embodiment of this application, such as... Figure 2 As shown, in the data query method provided in this application embodiment, the target language model consists of a first language model and a second language model. In step S101, the database is generated in the following manner:
[0040] Step S201: Obtain text information under a preset scenario from a public database to obtain a text information set, and preprocess each text information in the text information set to obtain a set of M statements, wherein the text information set includes M text information.
[0041] Step S202: Input the M sets of statements into the first language model to obtain N sets of related statements. The first language model is used to identify whether there is a relationship between the statements. Each set of related statements includes two statements and a relationship. The two statements belong to the same set of statements or to different sets of statements.
[0042] Step S203: Classify the N sets of related statements according to the attribute information of each set of related statements to obtain P sets of related statements. Input the P sets of related statements into the second language model to obtain Q related relations, where each related relation is a related relation between a set of related statements.
[0043] Step S204: The Q sets of relationships and P sets of related statements are determined as the knowledge base, wherein each statement in the set of related statements is a target data.
[0044] Specifically, before using a knowledge base, it's necessary to generate one for a pre-defined scenario. During knowledge base generation, text information relevant to the scenario can be retrieved from public databases to create a text information set. For example, an information retrieval system can be used to search and retrieve real-time articles from the entire internet. It can search for articles published online by specifying the following options: keywords or phrases, publication date, source domain, and language. In a scenario where the pre-defined scenario is finance, the information retrieval system can be used to collect 100 news articles from 2023 on finance-related topics. The collected text contains varying numbers of words, ranging from 50 to over 4200, resulting in a text information set, where each news article can be considered a single piece of text information.
[0045] After obtaining the text information set, each text information needs to be preprocessed, such as word segmentation and filtering. After preprocessing, the text information set is processed into M sentence sets, where each sentence can be a part of an article, a phrase, or key data.
[0046] After obtaining a set of M statements, the relationships between the statements can be determined using a first language model. This allows us to identify all the relationships between the statements in the M statement sets, resulting in N sets of related statements. It should be noted that related statements can be statements with similar content or statements with related content. For example, statement A can be the loan amount for Company X, and statement B can be the loan interest rate in the region where Company X is located. Therefore, statements A and B are related and can be identified as related statements.
[0047] Furthermore, after obtaining N sets of related statements, it is necessary to classify the statements according to the attribute information of each set of related statements. The attribute information can be the business scenario used by the set of related statements or the target audience of the set of related statements. After classification, the relationship between categories is determined according to the second language model. For example, if there is a relationship between business scenario A and target audience B, multiple sets of related statements under business scenario A can be associated with multiple sets of related statements under target audience B. Thus, when a user queries multiple sets of related statements under business scenario A, multiple sets of related statements under target audience B will be displayed simultaneously, thereby achieving the effect of pushing information to the user.
[0048] Optionally, in the data query method provided in this application embodiment, the first language model is trained in the following manner: acquiring multiple historical statements under a preset scenario and determining the statement content of each historical statement; determining the association relationship between multiple historical statements based on the statement content to obtain multiple first historical association relationships; taking each first historical association relationship and a set of historical statements corresponding to the first historical association relationship as a set of first samples to obtain multiple sets of first samples, and using multiple sets of first samples to train the first initial language model to obtain the first language model.
[0049] Specifically, when training the first language model, it is necessary to acquire multiple historical sentences in a preset scenario and use annotation to identify sentences with related relationships through their content, thereby obtaining multiple first historical relationships. Furthermore, the annotated historical sentences with related relationships and the relationships between sentences can be used as the first sample to train the first initial language model, thereby obtaining the trained first language model and achieving the effect of accurately determining the related data of the target data.
[0050] Optionally, in the data query method provided in this application embodiment, the second language model is trained as follows: multiple historical statements in a preset scenario are obtained, and the content of each historical statement is determined; the relationship between multiple historical statements is determined according to the content of the statements to obtain multiple sets of first historical related statements; the multiple sets of first historical related statements are classified according to the attribute information of each set of first historical related statements to obtain multiple sets of historical related statements, and the relationship between multiple sets of historical related statements is determined to obtain multiple second historical related relationships, wherein the attribute information of each set of first historical related statements in the historical related statement set is the same; each second historical related relationship and the set of historical related statements corresponding to the second historical related relationship are taken as a set of second samples to obtain multiple sets of second samples, and the second initial language model is trained using multiple sets of second samples to obtain the second language model.
[0051] Specifically, when training the second language model, multiple sets of first historical related statements are first obtained, and these sets of first historical related statements are classified according to attribute information. The attribute information can be the business scenario in which the related statements are used, or the target audience for the related statements. After classification, the relationship between multiple sets of historical related statements can be determined by annotation. The relationship and the set of historical related statements corresponding to the relationship are used as a second sample. Multiple second samples are used to train the second initial language model to obtain the second language model, thereby achieving the effect of accurately determining the related data of the target data.
[0052] Optionally, in the data query method provided in this application embodiment, preprocessing each text information in the text information set to obtain M statement sets includes: identifying the language type of each text information in the text information set; segmenting each text information into sentences according to the sentence segmentation rules corresponding to the language type to obtain a statement set for each text information; and filtering the statements in each statement set through a preset dictionary to obtain M filtered statement sets.
[0053] Specifically, when preprocessing the text in the acquired text information set, the text can first be segmented into sentences, thus dividing the entire text into multiple small paragraphs or sentences. After segmentation, the sentences obtained from the segmentation are filtered using a preset dictionary to obtain the filtered sentence information. The preset dictionary can record sentences or words with query significance, such as financial-related terms, such as loan amount, loan time, etc. If a sentence does not contain a sentence with query significance, for example, a sentence in a financial article that is "Thank you everyone" will be filtered out, thus ensuring that the information contained in the knowledge base is all useful information.
[0054] For example, the text can be an article. When segmenting sentences, the article can be segmented according to the content of different sentences in different paragraphs. After obtaining multiple sentences, the sentences are filtered to retain sentences with useful information and delete duplicate and invalid sentences, thereby achieving the effect of simplifying the information in the knowledge base.
[0055] Optionally, in the data query method provided in this application embodiment, filtering the statements in each statement set through a preset dictionary to obtain M filtered statement sets includes: obtaining any two target statements from any two statement sets in the M filtered statement sets, and sequentially searching the two target statements in a preset database to obtain two search results; obtaining the Uniform Resource Locator (URL) of each search result, and determining whether the URLs of the two search results are the same; if the URLs are the same, deleting any one target statement from the M statement sets to obtain an updated M statement set.
[0056] Specifically, during the filtering process, in addition to deleting invalid sentences based on their content, it is also necessary to filter and delete duplicate sentences. To determine whether duplicate sentences exist, two sentences can be input into a third-party database simultaneously. The database will then search for these sentences, and the URL (Uniform Resource Locator) of the search results will be used to determine whether the two sentences are duplicates. If both sentences are duplicates, the duplicate sentences in either sentence set will be deleted, thus completing the filtering operation and reducing the redundancy of the generated knowledge base.
[0057] Optionally, in the data query method provided in this application embodiment, obtaining text information in a preset scenario from a public database to obtain a text information set includes: obtaining all first text information in the public database and obtaining scene information of the preset scenario; sequentially calculating the matching degree between each first text information and the scene information, and determining the initial text information with a matching degree greater than a preset matching degree as second text information, thereby obtaining multiple second text information; obtaining the generation time of each second text information, and determining the second text information with a generation time greater than a preset time as text information in the preset scenario.
[0058] Specifically, when collecting text information sets, one can first obtain all the first text information in the public database, such as searching all articles published online, and then calculate the matching degree of each article with the preset scenario in turn, so as to obtain multiple matching degrees. In the process of calculating the matching degree, the content, summary and other information of the article can be compared with the features of the preset scenario to obtain an accurate matching degree.
[0059] After obtaining the matching degree, the initial text information with a matching degree greater than the preset matching degree is determined as the second text information, and the second text information whose generation time is greater than the preset time is determined as the text information under the preset scenario. That is, in order to ensure the timeliness of the text information, the text information whose generation time is earlier than the preset time is deleted, and only the text information whose generation time is later than the preset time is used, thereby ensuring the timeliness of the text in the knowledge base.
[0060] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0061] This application also provides a data query device. It should be noted that the data query device of this application can be used to execute the data query method provided in this application. The data query device provided in this application is described below.
[0062] Figure 3 This is a schematic diagram of a data query device provided according to an embodiment of this application. For example... Figure 3 As shown, the device includes: a first acquisition unit 31, a second acquisition unit 32, and a return unit 33.
[0063] The first acquisition unit 31 is used to acquire query information sent by the user terminal, determine the preset scenario indicated by the query information, and determine the knowledge base under the preset scenario. The knowledge base consists of target data and association relationships. The association relationships are obtained by inputting the set of text information under the preset scenario obtained from the public database into the target language model.
[0064] The second acquisition unit 32 is used to acquire data related to the query information from the knowledge base under the preset scenario, obtain target data, and acquire data related to the target data from the knowledge base, obtain associated data.
[0065] Return unit 33 is used to return the target data and related data to the user terminal.
[0066] The data query device provided in this application embodiment acquires query information sent by the user terminal through a first acquisition unit 31, determines a preset scenario indicated by the query information, and determines a knowledge base under the preset scenario. The knowledge base consists of target data and related relationships, which are obtained by inputting a set of text information under the preset scenario obtained from a public database into a target language model. A second acquisition unit 32 acquires data associated with the query information from the knowledge base under the preset scenario to obtain target data, and acquires data associated with the target data from the knowledge base to obtain related data. A return unit 33 returns the target data and related data to the user terminal. This solves the problem of low accuracy and completeness of the data retrieved when querying data in related technologies. By determining the preset scenario indicated by the query information, selecting the knowledge base corresponding to the preset scenario, and querying within the knowledge base, the required information is accurately obtained. Simultaneously, related data associated with the target data obtained through the knowledge base is acquired, so that even if the user's query information is inaccurate, relevant data can still be displayed to the user, thereby improving the accuracy of user information queries.
[0067] Optionally, in the data query device provided in this application embodiment, the target language model is composed of a first language model and a second language model. The first acquisition unit 31 includes: an acquisition module, used to acquire text information under a preset scenario from a public database, obtain a text information set, and preprocess each text information in the text information set to obtain M statement sets, wherein the text information set includes M text information; an input module, used to input the M statement sets into the first language model to obtain N sets of related statements, wherein the first language model is used to identify whether there is a relationship between the statements, each set of related statements includes two statements and one relationship, the two statements belong to the same statement set or belong to different statement sets; a classification module, used to classify the N sets of related statements according to the attribute information of each set of related statements to obtain P sets of related statements, input the P sets of related statements into the second language model to obtain Q relationships, wherein each relationship is a relationship between a set of related statements; and a determination module, used to determine the Q relationships and the P sets of related statements as a knowledge base.
[0068] Optionally, in the data query device provided in this application embodiment, the first language model is trained in the following manner: acquiring multiple historical statements in a preset scenario and determining the statement content of each historical statement; determining the association between multiple historical statements based on the statement content to obtain multiple first historical associations; taking each first historical association and a set of historical statements corresponding to the first historical association as a set of first samples to obtain multiple sets of first samples, and using the multiple sets of first samples to train the first initial language model to obtain the first language model.
[0069] Optionally, in the data query device provided in this application embodiment, the second language model is trained in the following manner: acquiring multiple historical statements in a preset scenario and determining the statement content of each historical statement; determining the association between multiple historical statements based on the statement content to obtain multiple sets of first historical related statements; classifying multiple sets of first historical related statements based on the attribute information of each set of first historical related statements to obtain multiple sets of historical related statements, and determining the association between multiple sets of historical related statements to obtain multiple second historical related relationships, wherein the attribute information of each set of first historical related statements in the historical related statement set is the same; taking each second historical related relationship and the set of historical related statements corresponding to the second historical related relationship as a set of second samples to obtain multiple sets of second samples, and using multiple sets of second samples to train the second initial language model to obtain the second language model.
[0070] Optionally, in the data query device provided in this application embodiment, the first acquisition module includes: an identification submodule, used to identify the language type of each text information in the text information set; a sentence segmentation module, used to segment each text information into sentences according to the sentence segmentation rules corresponding to the language type, to obtain a sentence set of each text information; and a filtering submodule, used to filter the sentences in each sentence set through a preset dictionary, to obtain M filtered sentence sets.
[0071] Optionally, in the data query device provided in this application embodiment, the identification submodule includes: a search submodule, configured to obtain any two target statements from any two statement sets from M filtered statement sets, and sequentially search the two target statements in a preset database to obtain two search results; a judgment submodule, configured to obtain the Uniform Resource Locator (URL) of each search result and determine whether the URLs of the two search results are the same; and an update submodule, configured to delete any one target statement from the M statement sets if the URLs are the same, to obtain an updated set of M statements.
[0072] Optionally, in the data query device provided in this application embodiment, the first acquisition module includes: an acquisition submodule, used to acquire all first text information in a public database and acquire scene information of a preset scene; a calculation submodule, used to sequentially calculate the matching degree of each first text information with the scene information, and determine the initial text information with a matching degree greater than a preset matching degree as second text information, thereby obtaining multiple second text information; and a determination submodule, used to acquire the generation time of each second text information, and determine the second text information with a generation time greater than a preset time as text information under the preset scene.
[0073] The aforementioned data query device includes a processor and a memory. The first acquisition unit 31, the second acquisition unit 32, the return unit 33, etc., are all stored in the memory as program units. The processor executes the aforementioned program units stored in the memory to realize the corresponding functions.
[0074] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured; by adjusting kernel parameters, the problem of low accuracy and completeness of retrieved data during data queries in related technologies can be addressed.
[0075] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0076] This invention provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements the data query method.
[0077] This invention provides a processor for running a program, wherein the program executes the data query method during runtime.
[0078] like Figure 4 As shown, this embodiment of the invention provides an electronic device 40, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: obtaining query information sent by a user terminal; determining a preset scenario indicated by the query information; and determining a knowledge base under the preset scenario. The knowledge base consists of target data and related relationships, which are obtained by inputting a set of text information under the preset scenario obtained from a public database into a target language model; obtaining data associated with the query information from the knowledge base under the preset scenario to obtain target data; and obtaining data associated with the target data from the knowledge base to obtain related data; and returning the target data and related data to the user terminal. The device in this document can be a server, PC, PAD, mobile phone, etc.
[0079] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: obtaining query information sent by a user terminal, determining a preset scenario indicated by the query information, and determining a knowledge base under the preset scenario, wherein the knowledge base consists of target data and association relationships, and the association relationships are obtained by inputting a set of text information under the preset scenario obtained from a public database into a target language model; obtaining data associated with the query information from the knowledge base under the preset scenario to obtain target data, and obtaining data associated with the target data from the knowledge base to obtain associated data; and returning the target data and associated data to the user terminal.
[0080] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0081] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0082] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0083] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0084] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0085] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0086] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0087] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0088] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A data query method, characterized by, The method comprises the following steps: acquiring query information sent by a user terminal, determining a preset scene indicated by the query information, and determining a knowledge base under the preset scene, wherein the knowledge base is composed of target data and an association relationship, and the association relationship is obtained by inputting a set of text information under the preset scene acquired from a public database into a target language model; acquiring data associated with the query information in the knowledge base under the preset scene to obtain target data, and acquiring data associated with the target data in the knowledge base to obtain associated data; returning the target data and the associated data to the user terminal; wherein the target language model is composed of a first language model and a second language model, and the knowledge base is generated in the following manner: acquiring text information under the preset scene in a public database to obtain a set of text information, and pre-processing each piece of text information in the set of text information to obtain M sets of sentences, wherein the set of text information includes M pieces of text information; inputting the M sets of sentences into the first language model to obtain N groups of associated sentences, wherein the first language model is used to identify whether there is an association relationship between sentences, each group of associated sentences includes two sentences and an association relationship, and the two sentences belong to the same set of sentences or belong to different sets of sentences; classifying the N groups of associated sentences according to the attribute information of each group of associated sentences to obtain P sets of associated sentences, inputting the P sets of associated sentences into the second language model to obtain Q association relationships, wherein each association relationship is an association relationship between a set of associated sentences; and determining the Q association relationships and the P sets of associated sentences as the knowledge base, wherein each sentence in the set of associated sentences is a target data.
2. The method of claim 1, wherein, The first language model is trained in the following manner: acquiring a plurality of historical sentences under the preset scene, and determining the sentence content of each historical sentence; determining the association relationship between the plurality of historical sentences according to the sentence content to obtain a plurality of first historical association relationships; using each first historical association relationship and a group of historical sentences corresponding to the first historical association relationship as a group of first samples to obtain a plurality of groups of first samples, and using the plurality of groups of first samples to train a first initial language model to obtain the first language model.
3. The method of claim 1, wherein, The second language model is trained in the following manner: acquiring a plurality of historical sentences under the preset scene, and determining the sentence content of each historical sentence; determining the association relationship between the plurality of historical sentences according to the sentence content to obtain a plurality of groups of first historical associated sentences; classifying the plurality of groups of first historical associated sentences according to the attribute information of each group of first historical associated sentences to obtain a plurality of sets of historical associated sentences, and determining the association relationship between the plurality of sets of historical associated sentences to obtain a plurality of second historical association relationships, wherein the attribute information of each group of first historical associated sentences in the set of historical associated sentences is the same. Each second historical association relationship and a set of historical association sentences corresponding to the second historical association relationship are taken as a second sample set, a plurality of second sample sets are obtained, and the second initial language model is trained using the plurality of second sample sets to obtain the second language model.
4. The method of claim 1, wherein, The M sets of sentences are obtained by preprocessing each text information in the set of text information, including: identifying the language type of each text information in the set of text information; segmenting each text information according to the segmentation rule corresponding to the language type to obtain a set of sentences for each text information; screening the sentences in each set of sentences through a preset dictionary to obtain M sets of screened sentences.
5. The method of claim 4, wherein, Screening the sentences in each set of sentences through a preset dictionary to obtain M sets of screened sentences includes: obtaining any two target sentences in any two sets of sentences from the M sets of screened sentences, and sequentially searching the two target sentences in a preset database to obtain two search results; obtaining the uniform resource locator of each search result, and determining whether the uniform resource locators of the two search results are the same; in the case that the uniform resource locators are the same, deleting any one target sentence from the M sets of sentences to obtain updated M sets of sentences.
6. The method of claim 1, wherein, Obtaining text information under the preset scene in the public database to obtain a set of text information includes: obtaining all first text information in the public database and obtaining scene information of the preset scene; sequentially calculating the matching degree of each first text information and the scene information, and determining the initial text information with a matching degree greater than a preset matching degree as a second text information to obtain a plurality of second text information; obtaining the generation time of each second text information, and determining the second text information with a generation time greater than a preset time as the text information under the preset scene.
7. A data query apparatus, characterized by comprising: including: The first acquisition unit is configured to acquire query information sent by a user terminal, determine a preset scene indicated by the query information, and determine a knowledge base under the preset scene, wherein the knowledge base is composed of target data and association relationships, and the association relationships are obtained by inputting a set of text information under the preset scene acquired from a public database into a target language model; The second acquisition unit is configured to acquire data associated with the query information in the knowledge base under the preset scene to obtain target data, and acquire data associated with the target data in the knowledge base to obtain associated data. The return unit is configured to return the target data and the associated data to the user terminal; The target language model is composed of a first language model and a second language model, the first obtaining unit comprises: an obtaining module, configured to obtain text information in a preset scene in a public database to obtain a text information set, and to preprocess each text information in the text information set to obtain M sentence sets, wherein the text information set comprises M text information; an input module, configured to input the M sentence sets into the first language model to obtain N groups of associated sentences, wherein the first language model is configured to identify whether there is an associated relationship between sentences, each group of associated sentences comprises two sentences and an associated relationship, and the two sentences belong to the same sentence set or belong to different sentence sets; a classification module, configured to classify the N groups of associated sentences according to attribute information of each group of associated sentences to obtain P associated sentence sets, input the P associated sentence sets into the second language model to obtain Q associated relationships, wherein each associated relationship is an associated relationship between a group of associated sentence sets; and a determination module, configured to determine the Q associated relationships and the P associated sentence sets as the knowledge base, wherein each sentence in the associated sentence set is a target data.
8. A computer storage medium, characterized in that, The computer storage medium is configured to store a program, wherein the program controls a device where the computer storage medium is located to execute the data query method in any one of claims 1 to 6 when the program is running.
9. An electronic device, comprising: The device comprises one or more processors and a memory, and the memory is configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the data query method in any one of claims 1 to 6.
Citation Information
Patent Citations
Information processing method and device, electronic equipment and storage medium
CN111090739A