Artificial Intelligence-Based Data Query Method, Device, and Storage Medium
By querying and semantic indexing of query text, and querying data in combination with query understanding results and semantic understanding results, the problem that query results in relational databases are susceptible to understanding errors, and the query accuracy is improved.
Patent Information
- Application Number
- CN202210963873.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-11
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2042-08-11
AI Technical Summary
In the prior art, in relational database query, query results are susceptible to errors in query text understanding, resulting in low accuracy.
By querying and understanding the query text, obtaining ununderstood text fragments, and using the semantic feature vector library of text content in the pre-established relational database for semantic indexing, and combining querying results with semantic understanding results to ensure accurate acquisition of query results.
Improve the accuracy of query results, reduce dependence on query understanding, and ensure that results that match query text can be found as fully as possible from the relational database.
Smart Images

Figure CN115328956B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence, specifically to natural language processing, big data, knowledge graphs, and intelligent search technologies, and can be applied in scenarios such as smart cities and urban governance. In particular, it relates to a data query method, device, and storage medium based on artificial intelligence. Background Art
[0002] Currently, relational databases are usually used to store structured data. And in some scenarios, it is necessary to query the relational database to obtain query results that can satisfy the query text. How to accurately obtain the query results of the query text is very important for improving the user's query experience. Summary of the Invention
[0003] The present disclosure provides a data query method, device, and storage medium based on artificial intelligence.
[0004] According to one aspect of the present disclosure, a data query method based on artificial intelligence is provided. The method includes: obtaining a query text; performing query understanding on the query text to obtain a query understanding result of the query text and text fragments in the query text that are not understood; based on a pre-established semantic feature vector library, determining a target semantic feature vector that matches the text fragment, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database; obtaining target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determining a semantic understanding result of the text fragment based on the target text content; and performing data query in the relational database according to the query understanding result and the semantic understanding result to obtain a query result of the query text.
[0005] According to another aspect of the present disclosure, a data query device based on artificial intelligence is provided. The device includes: a first obtaining module for obtaining a query text; a query understanding module for performing query understanding on the query text to obtain a query understanding result of the query text and text fragments in the query text that are not understood; a first determining module for determining a target semantic feature vector that matches the text fragment based on a pre-established semantic feature vector library, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database; a second determining module for obtaining target text content corresponding to the target semantic feature vector from the semantic feature vector library and determining a semantic understanding result of the text fragment based on the target text content; and a data query module for performing data query in the relational database according to the query understanding result and the semantic understanding result to obtain a query result of the query text.
[0006] According to another aspect of the present disclosure, there is provided an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the artificial intelligence-based data query method of the present disclosure.
[0007] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the artificial intelligence-based data query method disclosed in the embodiments of the present disclosure.
[0008] According to another aspect of the present disclosure, there is provided a computer program product including a computer program, and when the computer program is executed by a processor, the artificial intelligence-based data query method of the present disclosure is implemented.
[0009] One embodiment in the above application has the following advantages or beneficial effects:
[0010] After obtaining the query text, query understanding is performed on the query text to obtain a query understanding result of the query text and text fragments in the query text that are not understood, and semantic indexing is performed on the text fragments that are not understood from a pre-established semantic feature vector library based on the semantic feature vectors of the text content in the relational database to obtain a semantic understanding result of the text fragment, and data query is performed in the relational database according to the query understanding result and the semantic understanding result to obtain a query result of the query text. Thus, by combining the query understanding result corresponding to the query text and the semantic understanding result of the text fragments in the query text that are not understood by query, the query result of the query text is accurately obtained from the relational database, improving the query accuracy.
[0011] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0013] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure;
[0014] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure;
[0015] Figure 3is a schematic diagram according to the third embodiment of the present disclosure;
[0016] Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure;
[0017] Figure 5 is a schematic diagram according to the fifth embodiment of the present disclosure;
[0018] Figure 6 is a schematic diagram according to the sixth embodiment of the present disclosure;
[0019] Figure 7 is a schematic diagram according to the seventh embodiment of the present disclosure;
[0020] Figure 8 is a schematic diagram according to the eighth embodiment of the present disclosure;
[0021] Figure 9 is a block diagram of an electronic device for implementing the artificial intelligence-based data query method according to the embodiments of the present disclosure. Detailed implementation manners
[0022] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to assist understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, descriptions of well-known functions and structures are omitted below for clarity and conciseness.
[0023] In the related art, in the process of querying data in a relational database, it is highly dependent on the query understanding of the query text. If there are errors or omissions in the query understanding of the query text, the query results will definitely be incorrect or incomplete.
[0024] Therefore, the present disclosure proposes an artificial intelligence-based data query method. After obtaining the query text, the query text is subjected to query understanding to obtain the query understanding result of the query text and the text fragments in the query text that are not understood. Then, semantic indexing is performed on the text fragments that are not understood from a pre-established semantic feature vector library based on the semantic feature vectors of the text content in the relational database to obtain the semantic understanding result of the text fragment. According to the query understanding result and the semantic understanding result, data query is performed in the relational database to obtain the query result of the query text. Thus, by combining the query understanding result corresponding to the query text and the semantic understanding result of the text fragments in the query text that are not understood, the query result of the query text is accurately obtained from the relational database, aiming to reduce the dependence on query understanding, so as to find as many query results that meet the query text as possible and improve the query accuracy.
[0025] The following describes a data query method, apparatus, and storage medium based on artificial intelligence according to embodiments of the present disclosure with reference to the accompanying drawings.
[0026] Figure 1 FIG. 4 is a schematic diagram according to the first embodiment of the present disclosure, which provides a data query method based on artificial intelligence.
[0027] As shown in Figure 1 FIG. 4, the data query method based on artificial intelligence may include:
[0028] Step 101, obtain a query text.
[0029] It should be noted that the execution subject of the data query method based on artificial intelligence in this embodiment is a data query apparatus based on artificial intelligence. The data query apparatus based on artificial intelligence may be implemented by software and / or hardware. The data query apparatus based on artificial intelligence may be an electronic device, or may be configured in an electronic device.
[0030] The electronic device may include, but is not limited to, a terminal device, a server, etc. This embodiment does not specifically limit the electronic device.
[0031] The query text may be provided by the user to the data query apparatus based on artificial intelligence through a terminal device.
[0032] As an example, when the user inputs a query request in text on the terminal device, correspondingly, the data query apparatus based on artificial intelligence may receive the query request sent by the terminal device and directly obtain the query text from the query request. As another example, the user may input a query request in voice on the terminal device. Correspondingly, the terminal device sends the query request to the data query apparatus based on artificial intelligence, and the data query apparatus based on artificial intelligence performs text recognition on the voice information in the query request to obtain the query text. As another example, when the user inputs a query request in the form of a picture, the data query apparatus based on artificial intelligence may receive the query request sent by the terminal device and perform text recognition on the picture in the query request to obtain the query text. It should be noted that the data query apparatus based on artificial intelligence may obtain the query text through any way that can obtain the query text. This embodiment does not specifically limit the way of obtaining the query text.
[0033] Step 102, perform query understanding on the query text to obtain a query understanding result of the query text and a text segment in the query text that is not understood.
[0034] In some exemplary embodiments, after obtaining a query text, an artificial intelligence-based data query device can perform query understanding on the query text through a query understanding module in itself to obtain a query understanding result of the query text and text fragments in the query text that are not understood.
[0035] As an exemplary embodiment, the query understanding result in the artificial intelligence-based data query device can perform query understanding on the query text based on a pre-established tag system to obtain a query understanding result of the query text.
[0036] Among them, the query understanding result in this example may include the query intent of the query text and entity-related information included in the query text.
[0037] Among them, the entity-related information may include at least one of entity attribute information and entity relationship information of the entity.
[0038] For example, the query text is "How to go to place A". Correspondingly, the query understanding module performs query understanding on the query text, and can learn that the query intent of the query text is a travel intent, and can learn that the entity in the query text is a location entity, and "A" in the query text belongs to an address name, and the attribute value of this address name is A.
[0039] Among them, the text fragment in this example refers to the text fragment that is not understood when performing query understanding on the query text.
[0040] Among them, the number of text fragments in this example can be one or more, and this embodiment does not make specific limitations on this.
[0041] Step 103, based on a pre-established semantic feature vector library, determine a target semantic feature vector that matches the text fragment, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database.
[0042] As an example, a possible implementation manner of establishing a semantic feature vector library based on the semantic feature vectors of the text content in the relational database is: for each text content in the relational database, the semantic feature vector of the text content can be determined, and a semantic feature vector library is established based on the text content and the corresponding semantic feature vector.
[0043] As an example, in order to accurately and quickly determine the semantic feature vector of the text content, the text content can be input into a pre-trained semantic model to obtain the semantic feature vector of the text content through the semantic model.
[0044] As an example, for each text content, it can be determined whether the length of the text content is greater than the text length supported by the semantic model. If it is greater than the text length supported by the semantic model, the text content can be split to obtain multiple short sentences, where the lengths of the short sentences obtained by splitting are all less than the text length supported by the semantic model. Correspondingly, the semantic feature vectors corresponding to the multiple short sentences are determined through a pre-trained semantic model, and the relationship among the multiple short sentences and their corresponding semantic feature vectors is stored in the semantic feature vector library.
[0045] As an example, the text content can be split according to the punctuation marks in the text content to obtain multiple short sentences.
[0046] Among them, the punctuation marks can include but are not limited to commas, semicolons, periods, question marks, exclamation marks, etc.
[0047] As an exemplary implementation manner, based on the pre-established semantic feature vector library, a possible implementation manner for determining the target semantic feature vector that matches the text segment is: determining the semantic feature vector of the text segment, and matching the semantic feature vector of the text segment with each semantic feature vector in the semantic feature vector library, and obtaining the target semantic feature vector with the highest matching degree with the semantic feature vector of the text segment from the semantic feature vector library.
[0048] Step 104, obtain the target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine the semantic understanding result of the text segment based on the target text content.
[0049] As an exemplary implementation manner, after obtaining the target text content corresponding to the target semantic feature vector from the semantic feature vector library, the semantic understanding result of the target text content can be determined, and the semantic understanding result of the target text content can be used as the semantic understanding result of the text segment.
[0050] Among them, the semantic understanding result can include the attribute information of the entity in the text segment. As an example, the attribute information can include the attribute name and the corresponding attribute value. As another example, the attribute information can only include the attribute value.
[0051] Step 105, perform a data query in the relational database according to the query understanding result and the semantic understanding result to obtain the query result of the query text.
[0052] As an exemplary implementation manner, the query understanding result and the semantic understanding result can be queried to determine the query condition corresponding to the query text, and a data query is performed in the relational database based on the query condition to obtain the query result of the query text.
[0053] Correspondingly, in the case where there are multiple query results, the semantic similarity and literal similarity between each query result and the query text are determined, and the total similarity between each query result and the query text is determined based on the semantic similarity and literal similarity. Then, the multiple query results are sorted in descending order of the total similarity to obtain a sorted result. Correspondingly, the sorted result can also be returned to the corresponding terminal device.
[0054] In some exemplary embodiments, the semantic similarity and literal similarity can be weighted and summed to obtain the total similarity between each query result and the query text.
[0055] In the present exemplary embodiment, during the process of determining the query result of the query text, data query is performed by combining the query understanding result and the semantic understanding result of the text fragment that has not been understood. Thus, data query is no longer based only on the query understanding result, which can reduce the dependence on the query understanding result in data query, can find as comprehensively as possible the query results that meet the query text from the relational database, improve the comprehensiveness of obtaining query results, and at the same time improve the accuracy of query results.
[0056] The data query method based on artificial intelligence according to the embodiments of the present disclosure, after obtaining the query text, performs query understanding on the query text to obtain the query understanding result of the query text and the text fragment that has not been understood in the query text, and performs semantic indexing on the text fragment that has not been understood from the semantic feature vector library pre-established based on the semantic feature vectors of the text content in the relational database to obtain the semantic understanding result of the text fragment. Then, according to the query understanding result and the semantic understanding result, data query is performed in the relational database to obtain the query result of the query text. Thus, by combining the query understanding result corresponding to the query text and the semantic understanding result of the text fragment that has not been understood in the query text, the query result of the query text is accurately obtained from the relational database, improving the query accuracy.
[0057] In order to accurately determine the target semantic feature vector that matches the text fragment, the text fragment can be divided, and the target semantic feature vector that matches the text fragment is determined by combining the multiple text blocks obtained by the division. The following is an exemplary description of this process Figure 2 An exemplary description of this process is given below. Figure 2 It is a schematic diagram according to the second embodiment of the present disclosure.
[0058] As Figure 2 shown, the method may include:
[0059] Step 201, obtain the query text.
[0060] Step 202: Conduct query understanding on the query text to obtain the query understanding result of the query text and the text fragments in the query text that have not been understood.
[0061] It should be noted that for the specific implementation manners of steps 201 to 202, reference can be made to the relevant descriptions in the foregoing embodiments, and details are not elaborated herein.
[0062] Step 203: Divide the text fragment by using a sliding window to obtain multiple text blocks.
[0063] As an example, the sliding window can be controlled to slide on the text fragment with a preset step length, and then the statements within the sliding window after each slide are divided into a text block.
[0064] The preset step length is set in advance. For example, the preset step length can be 2 characters, or 1 character, etc. In practical applications, the preset step length can be set according to actual requirements, and this embodiment does not make specific limitations thereto.
[0065] As another example, starting from the position of the i-th character in the text fragment, sliding windows with gradually decreasing window lengths are sequentially applied to the text fragment, and the text within the sliding window each time is used as a text block. Correspondingly, when the window length of the sliding window applied to the text fragment reaches the minimum window length, starting from the position of the (i + 1)-th character in the text fragment, sliding windows with gradually decreasing window lengths are sequentially applied to the text fragment, and the text within the sliding window each time is used as a text block. Here, the value range of i is from 1 to N - 1, where N is the total number of characters in the text fragment.
[0066] In an example of the present disclosure, the window length of the sliding window can be reduced according to a preset length step until the window length of the sliding window reaches the minimum window length. For example, the minimum window length can be 1 character.
[0067] As an example, the starting window length of the sliding window can be set in advance. For example, the starting window length of the sliding window can be 5 characters, or the window length corresponding to 6 characters.
[0068] The preset length step can be set in advance according to actual requirements. For example, the preset length step can be 1 character. In practical applications, the value of the preset length can be set according to application requirements, and this embodiment does not make specific limitations thereto.
[0069] Step 204: For each text block, when there is a semantic feature vector in the semantic feature vector library that matches the text block, the text block is used as a target text block.
[0070] In one embodiment of the present disclosure, for each text block, in order to accurately determine whether there is a semantic feature vector in the semantic feature vector library that matches the text block, one possible implementation of taking the text block as a target text block when there is a semantic feature vector in the semantic feature vector library that matches the text block for each text block is as follows: for each text block, determine the semantic feature vector of the text block; match the semantic feature vector of the text block with multiple semantic feature vectors in the semantic feature vector library; according to the matching result, determine that there is a semantic feature vector in the semantic feature vector library that matches the text block; take the text block as the target text block.
[0071] In one embodiment of the present disclosure, in order to accurately and quickly determine the semantic feature vector of the text block, the text block can be input into a pre-trained semantic model to obtain the semantic feature vector of the text block through the semantic model. Thus, the semantic feature vector of the text block can be quickly and accurately determined through the pre-trained semantic model, improving the accuracy and efficiency of obtaining the semantic feature vector of the text block.
[0072] In one embodiment of the present disclosure, the matching result may include: the matching degree between the semantic feature vector of the text block and each semantic feature vector in the semantic feature vector library. One possible implementation of determining that there is a semantic feature vector in the semantic feature vector library that matches the text block according to the matching result is as follows: for each matching degree, compare the matching degree with a preset matching degree threshold to obtain a comparison result; when the comparison result is that the matching degree is greater than the preset matching degree threshold, determine that there is a semantic feature vector in the semantic feature vector library that matches the text block. Thus, by combining the matching degree between the semantic feature vector of the text block and each semantic feature vector in the semantic feature vector library, it is accurately determined whether there is a semantic feature vector in the semantic feature vector library that matches the text block.
[0073] Among them, the preset matching degree threshold is based on a preset critical value of the matching degree. For example, the above preset matching degree threshold can be 0.8, 0.85, or 0.9, etc. In practical applications, the value of the preset matching degree threshold can be set according to actual application requirements, and this embodiment does not make specific limitations on this.
[0074] It can be understood that when the matching degree between the semantic feature vector of the text block and a certain semantic feature vector in the semantic feature vector library is greater than the critical value, it can be determined that there is a semantic feature vector in the semantic feature vector library that matches the text block. In addition, when the matching degree is less than or equal to the critical value, it is determined that there is no semantic feature vector in the semantic feature vector library that matches the text block.
[0075] Step 205: Determine the target semantic feature vector that matches the text segment according to the semantic feature vectors respectively matched by the target text blocks.
[0076] In an embodiment of the present disclosure, the semantic feature vectors respectively matched by the target text blocks may be concatenated, and the concatenation result is used as the target semantic feature vector that matches the text segment.
[0077] In another embodiment of the present disclosure, the semantic feature vectors respectively matched by the target text blocks may all be used as the target semantic feature vectors that match the text segment.
[0078] In another embodiment of the present disclosure, the semantic feature vector with the highest corresponding matching degree may be selected from the semantic feature vectors respectively matched by the target text blocks as the target semantic feature vector that matches the text segment.
[0079] Step 206: Obtain the target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine the semantic understanding result of the text segment based on the target text content.
[0080] Step 207: Perform a data query in the relational data database according to the query understanding result and the semantic understanding result to obtain the query result of the query text.
[0081] It should be noted that for the specific implementation manners of Step 206 and Step 207, reference may be made to the relevant descriptions in the above embodiments, which will not be elaborated here.
[0082] In the exemplary embodiment of the present disclosure, in the process of determining the semantic understanding result of the text segment in the query text that is not understood, the text segment is divided to obtain multiple text blocks, and the target semantic feature vector corresponding to the text segment is determined based on the matching situation between the semantic feature vectors of each text block and the semantic feature vectors in the pre-established semantic feature vector library. Thus, by combining each text block, the target semantic feature vector of the text segment is accurately determined, and further the accuracy of the determined semantic understanding result of the text segment can be improved.
[0083] Based on any one of the above embodiments, in order to accurately determine the query result corresponding to the query text from the relational database, before performing a data query in the relational data database according to the query understanding result and the semantic understanding result to obtain the query result of the query text, it may also be determined that there is no conflict between the semantic understanding result and the query understanding result. Thus, it can be ensured that the subsequent obtained query result has no conflict situation, and the accuracy of the determined query result is improved.
[0084] The following will be combined with Figure 3An exemplary description of the process is as follows. Figure 3 It is a schematic diagram according to the second embodiment of the present disclosure.
[0085] As Figure 3 shown, the method may include:
[0086] Step 301, obtain a query text.
[0087] Step 302, perform query understanding on the query text to obtain a query understanding result of the query text and text fragments in the query text that are not understood.
[0088] Step 303, based on a pre-established semantic feature vector library, determine a target semantic feature vector that matches the text fragment, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in a relational database.
[0089] Step 304, obtain target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine a semantic understanding result of the text fragment based on the target text content.
[0090] It should be noted that for the specific implementation manners of steps 301 to 304, reference may be made to the relevant descriptions in the above embodiments, which will not be elaborated here.
[0091] Step 305, determine the common attribute values in the semantic understanding result and the query understanding result.
[0092] The common attribute values refer to the attribute values that exist in both the semantic understanding result and the query understanding result.
[0093] Step 306, obtain the first attribute name corresponding to the common attribute value in the semantic understanding result.
[0094] Step 307, obtain the second attribute name corresponding to the common attribute value in the query understanding result.
[0095] Step 308, when the first attribute name and the second attribute name are the same, determine that there is no conflict between the semantic understanding result and the query understanding result.
[0096] As another example, when the first attribute name and the second attribute name are different, it can be determined that there is a conflict between the semantic understanding result and the query understanding result.
[0097] For example, in the query understanding result, the first attribute name corresponding to the attribute value "Zhang XX" is name, and correspondingly, in the semantic understanding result of the text fragment that is not understood, the second attribute name corresponding to the attribute value "Zhang XX" is place name. At this time, it can be determined that there is a conflict between the query understanding result and the semantic understanding result.
[0098] Step 309: Perform a data query in the relational database based on the query understanding result and the semantic understanding result to obtain the query result of the query text.
[0099] In the present exemplary embodiment, after determining the query understanding result and the semantic understanding result of the text fragment that has not been understood, the common attribute values in the query understanding result and the semantic understanding result are determined, and it is determined whether there is a conflict between the query understanding result and the semantic understanding result by combining whether the attribute names of the common attribute values in the query understanding result and the semantic understanding result are the same. In the case where there is no conflict, a data query is performed in the relational database based on the query understanding result and the semantic understanding result to obtain the query result of the query text. Thus, the situation of conflicting query results can be avoided, and the accuracy of the query result is further improved.
[0100] In some scenarios, there may be attribute values without attribute names in the query understanding result and the semantic understanding result. For such a situation, in order to clearly illustrate how to determine whether there is a conflict between the query understanding result and the semantic understanding result, the following is an exemplary description of this process in combination with Figure 4 to describe this process. Figure 4 is a schematic diagram according to the fourth embodiment of the present disclosure.
[0101] As Figure 4 shown, the method may include:
[0102] Step 401: Obtain the query text.
[0103] Step 402: Perform query understanding on the query text to obtain the query understanding result of the query text and the text fragment in the query text that has not been understood.
[0104] Step 403: Based on the pre-established semantic feature vector library, determine the target semantic feature vector that matches the text fragment, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database.
[0105] Step 404: Obtain the target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine the semantic understanding result of the text fragment based on the target text content.
[0106] It should be noted that for the specific implementation manners of steps 401 to 404, reference may be made to the relevant descriptions in the embodiments of the present disclosure, and details are not described herein again.
[0107] Step 405: Determine the common attribute values in the semantic understanding result and the query understanding result.
[0108] Step 406: When there is no attribute name corresponding to the common attribute value in the semantic understanding result and there is no attribute name corresponding to the common attribute value in the query understanding result, it is determined that there is no conflict between the semantic understanding result and the query understanding result.
[0109] In an embodiment of the present disclosure, when there is an attribute name corresponding to the common attribute value in the semantic understanding result and there is no attribute name corresponding to the common attribute value in the query understanding result, it is determined that there is a conflict between the semantic understanding result and the query understanding result.
[0110] In another embodiment of the present disclosure, when there is no attribute name corresponding to the common attribute value in the semantic understanding result and there is an attribute name corresponding to the common attribute value in the query understanding result, it is determined that there is a conflict between the semantic understanding result and the query understanding result.
[0111] Step 407: According to the query understanding result and the semantic understanding result, data query is performed in the relational data database to obtain the query result of the query text.
[0112] In the exemplary embodiment of the present disclosure, after determining the query understanding result and the semantic understanding result of the text fragment that has not been understood, the common attribute value in the query understanding result and the semantic understanding result is determined, and when the attribute name of the common attribute value does not exist in the query understanding result and the attribute name of the common attribute does not exist in the semantic understanding result, it is determined that there is no conflict between the query understanding result and the semantic understanding result, and in the case of no conflict, data query is performed in the relational data database according to the query understanding result and the semantic understanding result to obtain the query result of the query text. Thus, the situation of conflicting query results can be avoided, and the accuracy of the query result is further improved.
[0113] The following Figure 5 is an exemplary description of this process. Figure 5 is a schematic diagram according to the fifth embodiment of the present disclosure.
[0114] As Figure 5 shown, the method may include:
[0115] Step 501: Obtain the query text.
[0116] Step 502: Perform query understanding on the query text to obtain the query understanding result of the query text and the text fragment in the query text that has not been understood.
[0117] Step 503: Based on the pre-established semantic feature vector library, determine the target semantic feature vector that matches the text fragment, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database.
[0118] Step 504: Obtain the target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine the semantic understanding result of the text segment based on the target text content.
[0119] It should be noted that for the specific implementation manners of steps 501 to 504, reference may be made to the relevant descriptions in the embodiments of the present disclosure, and details are not described herein again.
[0120] Step 505: In the case where there are multiple text segments, determine a target semantic understanding result that does not conflict with the query understanding result from the semantic understanding results corresponding to the multiple text segments.
[0121] It should be noted that for each text segment, it is possible to determine whether there is a conflict between the semantic understanding result and the query understanding result of the corresponding text segment based on the manner disclosed in the embodiments of the present disclosure. For the specific implementation manner, reference may be made to the relevant descriptions in the embodiments of the present disclosure, and details are not described herein again.
[0122] Step 506: Perform a data query in the relational data database according to the query understanding result and the target semantic understanding result to obtain the query result of the query text.
[0123] In an embodiment of the present disclosure, in order to accurately obtain the query result of the query text, a possible implementation manner of performing a data query in the relational data database according to the query understanding result and the target semantic understanding result to obtain the query result of the query text may be: merging the query understanding result and the target semantic understanding result to obtain a data merge result; obtaining the target attribute value without an attribute name in the data merge result; performing a data query in the relational database according to the target attribute value to obtain a first query result; performing a data query in the relational database according to the other content in the data merge result except for the target attribute value to obtain a second query result; and determining the query result of the query text according to the first query result and the second query result.
[0124] In this exemplary embodiment, after determining the query understanding result and the semantic understanding results of multiple text segments, a target semantic understanding result that does not conflict with the query understanding result is obtained from the semantic understanding results of the multiple text segments, and a data query is performed in the relational data database according to the query understanding result and the target semantic understanding result to obtain the query result of the query text. Thus, the situation of conflicting query results can be avoided, and the accuracy of the query result is further improved.
[0125] Based on any one of the above embodiments, in order to accurately obtain the query result corresponding to the query text, according to the query understanding result and the semantic understanding result, a possible way to perform data query in the relational database to obtain the query result of the query text is as follows Figure 6 It may include:
[0126] Step 601, obtain the query text.
[0127] Step 602, perform query understanding on the query text to obtain the query understanding result of the query text and the text fragment that is not understood in the query text.
[0128] Step 603, based on the pre-established semantic feature vector library, determine the target semantic feature vector that matches the text fragment, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database.
[0129] Step 604, obtain the target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine the semantic understanding result of the text fragment based on the target text content.
[0130] It should be noted that for the specific implementation manners of Step 601 and Step 604, reference can be made to the relevant descriptions in the embodiments of the present disclosure, which will not be elaborated here.
[0131] Step 605, perform data merging on the query understanding result and the semantic understanding result to obtain a data merging result.
[0132] Step 606, obtain the target attribute values that do not have attribute names in the data merging result.
[0133] Step 607, generate a first query condition according to the target attribute value, and generate a second query condition based on the other content in the data merging result except for the target attribute.
[0134] It can be understood that the other content except for the target attribute value may include the query intention and at least one entity and the attribute pair information and entity relationship information corresponding to each entity, etc., and this embodiment does not make specific limitations thereto.
[0135] Among them, the attribute pair may include an attribute name and the corresponding attribute value.
[0136] Step 608, perform data query in all attribute fields of the relational database according to the first query condition, and perform data query in the specified attribute fields of the relational database according to the second query condition to obtain a query result that matches both the first query condition and the second query condition, where the specified attribute fields are determined based on the second query condition.
[0137] That is to say, in the process of querying data in the relational database based on the first query condition and the second query condition, in order to obtain as comprehensive a query result as possible, the relational database can be retrieved full-text according to the first query condition, and the relational database can be retrieved non-full-text according to the second query condition to obtain a query result that matches both the first query condition and the second query condition.
[0138] Among them, full-text retrieval refers to querying data for all attribute fields in the relational database based on the first query condition.
[0139] In an embodiment of the present disclosure, the specified attribute fields to be queried in the relational database can be determined according to the attributes of the entity in the second query condition for the attribute names in the information.
[0140] Step 609, using the obtained query result as the query result of the query text.
[0141] In this exemplary embodiment, after obtaining the query understanding result and the semantic understanding result, the query understanding result and the semantic understanding result are merged to obtain a data merge result, and the target attribute value without an attribute name and other content except the target attribute value in the data merge result are determined. Then, a full-text retrieval is performed in the relational database based on the target attribute value, and a data query is performed in the relational database based on other content to determine the query result of the query text. Thus, all query results that conform to the query text can be found as comprehensively as possible, improving the comprehensiveness and accuracy of the obtained query results.
[0142] To implement the above embodiment, the present disclosure embodiment also provides an artificial intelligence-based data query device.
[0143] Figure 7 It is a schematic diagram according to the seventh embodiment of the present disclosure, and this embodiment provides an artificial intelligence-based data query device.
[0144] As Figure 7 shown, the artificial intelligence-based data query device 7 may include a first acquisition module 71, a query understanding module 72, a first determination module 73, a second determination module 74, and a data query module 75, where:
[0145] The first acquisition module 71 is configured to acquire a query text.
[0146] The query understanding module 72 is configured to perform query understanding on the query text to obtain a query understanding result of the query text and a text segment in the query text that is not understood.
[0147] The first determination module 73 is configured to determine a target semantic feature vector that matches the text segment based on a pre-established semantic feature vector library, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database.
[0148] The second determination module 74 is configured to obtain the target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine the semantic understanding result of the text segment based on the target text content.
[0149] The data query module 75 is configured to perform a data query in the relational database according to the query understanding result and the semantic understanding result to obtain the query result of the query text.
[0150] After obtaining the query text, the data query device based on artificial intelligence according to an embodiment of the present disclosure performs query understanding on the query text to obtain the query understanding result of the query text and the text segment in the query text that is not understood, and performs semantic indexing on the text segment that is not understood from the semantic feature vector library pre-established based on the semantic feature vectors of the text content in the relational database to obtain the semantic understanding result of the text segment, and performs a data query in the relational database according to the query understanding result and the semantic understanding result to obtain the query result of the query text. Thus, by combining the query understanding result corresponding to the query text and the semantic understanding result of the text segment in the query text that is not understood by the query, the query result of the query text is accurately obtained from the relational database, improving the query accuracy.
[0151] In an embodiment of the present disclosure, as Figure 8 shown, the data query device 8 based on artificial intelligence may include: a first acquisition module 81, a query understanding module 82, a first determination module 83, a second determination module 84, a data query module 85, a third determination module 86, and a fourth determination module 87, where the first determination module 83 includes a division unit 831, a first determination unit 832, and a second determination unit 833, and the first determination unit 832 may include: a first determination subunit 8321, a matching subunit 8322, a second determination subunit 8323, and a third determination subunit 8324; the third determination module 86 may include a third determination unit 861, a first acquisition unit 862, a second acquisition unit 863, a fourth determination unit 864, a fifth determination unit 865, and a sixth determination unit 866.
[0152] It should be noted that for the detailed descriptions of the first acquisition module 81, the query understanding module 82, and the second determination module 84, reference may be made to the descriptions of the first acquisition module 71, the query understanding module 72, and the second determination module 74 above, and no further description will be given here. Figure 7
[0153] In one embodiment of the present disclosure, the first determination module 83 includes:
[0154] A partitioning unit 831, configured to partition a text segment by using a sliding window to obtain a plurality of text blocks;
[0155] A first determination unit 832, configured to, for each text block, use the text block as a target text block if there is a semantic feature vector in the semantic feature vector library that matches the text block;
[0156] A second determination unit 833, configured to determine a target semantic feature vector that matches the text segment according to the semantic feature vectors respectively matched by the target text blocks.
[0157] In one embodiment of the present disclosure, the first determination unit 832 includes:
[0158] A first determination subunit 8321, configured to determine the semantic feature vector of each text block;
[0159] A matching subunit 8322, configured to match the semantic feature vector of the text block with a plurality of semantic feature vectors in the semantic feature vector library;
[0160] A second determination subunit 8323, configured to determine that there is a semantic feature vector in the semantic feature vector library that matches the text block according to the matching result;
[0161] A third determination subunit 8324, configured to use the text block as a target text block.
[0162] In one embodiment of the present disclosure, the first determination subunit 8321 is specifically configured to: input the text block into a pre-trained semantic model to obtain the semantic feature vector of the text block through the semantic model.
[0163] In one embodiment of the present disclosure, the matching result includes: the matching degrees between the semantic feature vector of the text block and each semantic feature vector in the semantic feature vector library. The second determination subunit 8323 is specifically configured to: compare each matching degree with a preset matching degree threshold to obtain a comparison result; and determine that there is a semantic feature vector in the semantic feature vector library that matches the text block when the comparison result is that the matching degree is greater than the preset matching degree threshold.
[0164] In one embodiment of the present disclosure, the artificial intelligence-based data query device 8 may further include:
[0165] A third determination module 86, configured to determine that there is no conflict between the semantic understanding result and the query understanding result.
[0166] In an embodiment of the present disclosure, the third determination module 86 includes:
[0167] A third determination unit 861, configured to determine the common attribute values in the semantic understanding result and the query understanding result;
[0168] A first acquisition unit 862, configured to acquire the first attribute name corresponding to the common attribute value in the semantic understanding result;
[0169] A second acquisition unit 863, configured to acquire the second attribute name corresponding to the common attribute value in the query understanding result;
[0170] A fourth determination unit 864, configured to determine that there is no conflict between the semantic understanding result and the query understanding result when the first attribute name and the second attribute name are the same.
[0171] In an embodiment of the present disclosure, the third determination module 86 includes:
[0172] A fifth determination unit 865, configured to determine the common attribute values in the semantic understanding result and the query understanding result;
[0173] A sixth determination unit 866, configured to determine that there is no conflict between the semantic understanding result and the query understanding result when there is no attribute name corresponding to the common attribute value in the semantic understanding result and there is no attribute name corresponding to the common attribute value in the query understanding result.
[0174] In an embodiment of the present disclosure, the artificial intelligence-based data query device 8 may further include:
[0175] A fourth determination module 87, configured to determine a target semantic understanding result that does not conflict with the query understanding result from the semantic understanding results corresponding to multiple text segments when there are multiple text segments.
[0176] The data query module 85 is specifically configured to: perform data query in the relational data database according to the query understanding result and the target semantic understanding result to obtain the query result of the query text.
[0177] In one embodiment of the present disclosure, a data query module 85 is configured to: perform data merging on the query understanding result and the semantic understanding result to obtain a data merging result; obtain a target attribute value that does not have an attribute name in the data merging result; perform data query in a relational database according to the target attribute value to obtain a first query result; generate a first query condition according to the target attribute value and generate a second query condition based on other content in the data merging result except the target attribute; perform data query in all attribute fields of the relational database according to the first query condition and perform data query in specified attribute fields of the relational database according to the second query condition to obtain a query result that matches both the first query condition and the second query condition, where the specified attribute fields are determined based on the second query condition; and use the obtained query result as the query result of the query text.
[0178] It should be noted that the above explanation of the data query method based on artificial intelligence also applies to the data query device based on artificial intelligence in this embodiment, and this embodiment will not be elaborated herein.
[0179] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0180] Figure 9 FIG. shows a schematic block diagram of an exemplary electronic device 900 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0181] As Figure 9 shown, the electronic device 900 may include a computing unit 901, which can execute various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded from a storage unit 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The computing unit 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0182] Multiple components in device 900 are connected to I / O interface 905, including: input unit 906, such as a keyboard, mouse, etc.; output unit 907, such as various types of displays, speakers, etc.; storage unit 908, such as a disk, optical disc, etc.; and communication unit 909, such as a network card, modem, wireless communication transceiver, etc. Communication unit 909 allows device 900 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0183] Computing unit 901 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Computing unit 901 executes the various methods and processes described above, such as the artificial-intelligence-based data query method. For example, in some embodiments, the artificial-intelligence-based data query method can be implemented as a computer software program that is tangibly embodied in a machine-readable medium, such as storage unit 908. In some embodiments, part or all of the computer program can be loaded and / or installed onto device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by computing unit 901, one or more steps of the artificial-intelligence-based data query method described above can be executed. Alternatively, in other embodiments, computing unit 901 can be configured to execute the artificial-intelligence-based data query method in any other suitable manner (e.g., by means of firmware).
[0184] The various embodiments of the devices and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit devices, field-programmable gate arrays (FPGA), application-specific integrated circuits (ASIC), application-specific standard products (ASSP), systems-on-chip (SOC) of devices on a chip, complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: implemented in one or more computer programs that can be executed and / or interpreted on a programmable device including at least one programmable processor, which can be a special or general-purpose programmable processor, and can receive data and instructions from a storage device, at least one input device, and at least one output device, and transmit the data and instructions to the storage device, the at least one input device, and the at least one output device.
[0185] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing devices, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, executed partially on the machine and partially on a remote machine as an independent software package, or executed entirely on a remote machine or server.
[0186] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution device, apparatus, or equipment. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor devices, apparatuses, or equipment, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include electrical connections based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0187] In order to provide interaction with a user, the apparatuses and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other kinds of apparatuses can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and the input received from the user can be in any form (including acoustic input, voice input, or tactile input).
[0188] The devices and techniques described herein can be implemented in a computing device including a backend component (e.g., as a data server), or a computing device including a middleware component (e.g., an application server), or a computing device including a frontend component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the devices and techniques described herein), or a computing device including any combination of such backend components, middleware components, or frontend components. The components of the device can be interconnected with each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), the Internet, and blockchain networks.
[0189] A computer device can include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. The client-server relationship is created by computer programs running on respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS" for short). The server can be a cloud server, or a server of a distributed device, or a server combined with blockchain.
[0190] It should be noted that artificial intelligence is a discipline that studies enabling a computer to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), and there are both hardware-level technologies and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include several major directions such as computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, and knowledge graph technology.
[0191] It should be understood that various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitations are imposed herein.
[0192] The above specific embodiments do not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principle of the present disclosure shall be included within the protection scope of the present disclosure.
Claims
1. A data query method based on artificial intelligence, comprising: Obtaining a query text; Performing query understanding on the query text to obtain a query understanding result of the query text and text fragments in the query text that are not understood; Based on a pre-established semantic feature vector library, determining a target semantic feature vector that matches the text fragment, wherein the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in the relational database; Obtaining target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determining a semantic understanding result of the text fragment based on the target text content; Performing data query in the relational database according to the query understanding result and the semantic understanding result to obtain a query result of the query text, including: Performing data merging on the query understanding result and the semantic understanding result to obtain a data merging result; Obtaining target attribute values that do not have attribute names in the data merging result; Generating a first query condition according to the target attribute value, and generating a second query condition based on other content in the data merging result except the target attribute; Performing data query in all attribute fields of the relational database according to the first query condition, and performing data query in specified attribute fields of the relational database according to the second query condition to obtain a query result that matches both the first query condition and the second query condition, wherein the specified attribute field is determined based on the second query condition; Using the obtained query result as the query result of the query text.
2. The method according to claim 1, wherein, The determining, based on a pre-established semantic feature vector library, a target semantic feature vector that matches the text fragment includes: Dividing the text fragment using a sliding window to obtain multiple text blocks; For each text block, when there is a semantic feature vector in the semantic feature vector library that matches the text block, using the text block as a target text block; Determining a target semantic feature vector that matches the text fragment according to the semantic feature vectors respectively matched by the target text blocks.
3. The method according to claim 2, wherein The for each text block, when there is a semantic feature vector in the semantic feature vector library that matches the text block, using the text block as a target text block includes: For each text block, determining the semantic feature vector of the text block; Matching the semantic feature vector of the text block with multiple semantic feature vectors in the semantic feature vector library; According to the matching result, determining that there is a semantic feature vector in the semantic feature vector library that matches the text block; Using the text block as a target text block.
4. The method according to claim 3, wherein The determining the semantic feature vector of the text block includes: Inputting the text block into a pre-trained semantic model to obtain the semantic feature vector of the text block through the semantic model.
5. The method according to claim 3, wherein, The matching result includes: the matching degrees between the semantic feature vector of the text block and each semantic feature vector in the semantic feature vector library. Determining that there is a semantic feature vector in the semantic feature vector library that matches the text block according to the matching result includes: For each matching degree, comparing the matching degree with a preset matching degree threshold to obtain a comparison result; When the comparison result is that the matching degree is greater than the preset matching degree threshold, determining that there is a semantic feature vector in the semantic feature vector library that matches the text block.
6. The method according to claim 1, wherein Before querying data in the relational data database according to the query understanding result and the semantic understanding result to obtain the query result of the query text, the method further includes: Determining that there is no conflict between the semantic understanding result and the query understanding result.
7. The method according to claim 6, wherein determining that there is no conflict between the semantic understanding result and the query understanding result includes: Determining the common attribute values in the semantic understanding result and the query understanding result; Obtaining the first attribute name corresponding to the common attribute value in the semantic understanding result; Obtaining the second attribute name corresponding to the common attribute value in the query understanding result; When the first attribute name and the second attribute name are the same, determining that there is no conflict between the semantic understanding result and the query understanding result.
8. The method according to claim 6, wherein determining that there is no conflict between the semantic understanding result and the query understanding result includes: Determining the common attribute values in the semantic understanding result and the query understanding result; When there is no attribute name corresponding to the common attribute value in the semantic understanding result and there is no attribute name corresponding to the common attribute value in the query understanding result, determining that there is no conflict between the semantic understanding result and the query understanding result.
9. The method according to claim 1, before querying data in the relational data database according to the query understanding result and the semantic understanding result to obtain the query result of the query text, the method further includes: When there are multiple text fragments, determining a target semantic understanding result that does not conflict with the query understanding result from the semantic understanding results corresponding to the multiple text fragments; Querying data in the relational data database according to the query understanding result and the semantic understanding result to obtain the query result of the query text includes: Querying data in the relational data database according to the query understanding result and the target semantic understanding result to obtain the query result of the query text.
10. An artificial intelligence-based data query device, comprising: A first acquisition module, configured to acquire a query text; A query understanding module, configured to perform query understanding on the query text to obtain a query understanding result of the query text and text fragments in the query text that are not understood; A first determination module, configured to determine a target semantic feature vector that matches the text segment based on a pre-established semantic feature vector library, where the semantic feature vector library is pre-established based on the semantic feature vectors of the text content in a relational database; A second determination module, configured to obtain target text content corresponding to the target semantic feature vector from the semantic feature vector library, and determine a semantic understanding result of the text segment based on the target text content; A data query module, specifically configured to perform data merging on the query understanding result and the semantic understanding result to obtain a data merging result; obtain target attribute values that do not have attribute names in the data merging result; generate a first query condition according to the target attribute values, and generate a second query condition based on other content in the data merging result except the target attribute; perform data query in all attribute fields of the relational database according to the first query condition, and perform data query in specified attribute fields of the relational database according to the second query condition to obtain a query result that matches both the first query condition and the second query condition, where the specified attribute fields are determined based on the second query condition; use the obtained query result as the query result of the query text.
11. The apparatus according to claim 10, wherein The first determination module includes: A division unit, configured to divide the text segment by using a sliding window to obtain a plurality of text blocks; A first determination unit, configured to, for each text block, use the text block as a target text block when there is a semantic feature vector in the semantic feature vector library that matches the text block; A second determination unit, configured to determine a target semantic feature vector that matches the text segment according to the semantic feature vectors respectively matched by the target text blocks.
12. The apparatus according to claim 11, wherein, The first determination unit includes: A first determination subunit, configured to, for each text block, determine the semantic feature vector of the text block; A matching subunit, configured to match the semantic feature vector of the text block with multiple semantic feature vectors in the semantic feature vector library; A second determination subunit, configured to determine that there is a semantic feature vector in the semantic feature vector library that matches the text block according to the matching result; A third determination subunit, configured to use the text block as a target text block.
13. The apparatus according to claim 12, wherein, The first determination subunit is specifically configured to: Input the text block into a pre-trained semantic model to obtain the semantic feature vector of the text block through the semantic model.
14. The apparatus according to claim 12, wherein, The matching result includes: the matching degrees between the semantic feature vector of the text block and each semantic feature vector in the semantic feature vector library. The second determination subunit is specifically configured to: For each matching degree, compare the matching degree with a preset matching degree threshold to obtain a comparison result; When the comparison result is that the matching degree is greater than the preset matching degree threshold, determine that there is a semantic feature vector in the semantic feature vector library that matches the text block.
15. The apparatus according to claim 10, wherein, The device further includes: A third determination module, configured to determine that there is no conflict between the semantic understanding result and the query understanding result.
16. The apparatus according to claim 15, wherein the third determination module comprises: A third determination unit, configured to determine common attribute values in the semantic understanding result and the query understanding result; A first acquisition unit, configured to acquire a first attribute name corresponding to the common attribute value in the semantic understanding result; A second acquisition unit, configured to acquire a second attribute name corresponding to the common attribute value in the query understanding result; A fourth determination unit, configured to determine that there is no conflict between the semantic understanding result and the query understanding result when the first attribute name is the same as the second attribute name.
17. The apparatus according to claim 15, wherein the third determination module comprises: A fifth determination unit, configured to determine common attribute values in the semantic understanding result and the query understanding result; A sixth determination unit, configured to determine that there is no conflict between the semantic understanding result and the query understanding result when there is no attribute name corresponding to the common attribute value in the semantic understanding result and there is no attribute name corresponding to the common attribute value in the query understanding result.
18. The apparatus according to claim 10, wherein the apparatus further comprises: A fourth determination module, configured to determine a target semantic understanding result that has no conflict with the query understanding result from the semantic understanding results corresponding to multiple text segments when there are multiple text segments; The data query module is specifically configured to: Perform data query in the relational data database according to the query understanding result and the target semantic understanding result to obtain a query result of the query text.
19. An electronic device, comprising: At least one processor; And A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method according to any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
21. A computer program product, comprising a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1-9.
Citation Information
Patent Citations
Search processing method and device, computer equipment and medium
CN111753167A
Answer generation method and device based on artificial intelligence, computer equipment and medium
CN112417885A