Graph database query method and device, computer equipment and storage medium
By verifying the accuracy of the intent of the text to be replied input by the user terminal and determining the code to be replied based on the verification results, the problem of inaccurate intent in the graph database query is solved, and the accuracy of the query results and the smoothness of the data query service are improved.
Patent Information
- Application Number
- CN202411732524.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-14
AI Technical Summary
The prior art cannot accurately obtain the user's true intentions when querying the graph database, resulting in the inability to accurately select data that meets the user's intentions from the graph database, affecting the smooth progress of the data query service.
By obtaining the text to be replied to by the user terminal, verifying its intent accuracy, using the relationship between the candidate intent text and the target intent text for verification, and determining the code to be replied to for graph database query.
Effectively ensure that the intentions contained in the text to be replied to exist objectively in the graph database, improve the degree of matching between the text to be answered and the graph database, ensure the accuracy of query results, and ensure the smooth operation of data query services.
Smart Images

Figure CN119621908A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of graph database technology, and in particular to a graph database query method, apparatus, computer equipment and storage medium. Background Art
[0002] With the continuous development of random artificial intelligence technology, intelligent reply technology has been able to successfully complete the operation of responding to the query text input by the user. Especially in the query process of graph databases, efficient data query can be achieved for graph databases through intelligent reply technology.
[0003] However, the existing technology cannot accurately obtain the user's true intention when querying the graph database, which leads to the inability to accurately select data that meets the user's true intention from the graph database, affecting the smooth progress of the data query business. Summary of the invention
[0004] Based on this, it is necessary to provide a graph database query method, device, computer equipment and storage medium that can accurately obtain the user's true intentions in response to the above technical problems.
[0005] In a first aspect, the present application provides a graph database query method. The method comprises:
[0006] Acquire a text to be replied input by a user terminal; wherein the text to be replied contains at least one target intention text;
[0007] Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and the at least one target intent text;
[0008] Determine the reply code corresponding to the reply text according to the intention verification result;
[0009] A graph database query is performed using the code to be replied to, to obtain a reply text corresponding to the text to be replied to.
[0010] In one embodiment, determining the code to be replied corresponding to the text to be replied to according to the intention verification result includes:
[0011] If the intention verification result is that the intention is accurate, the text to be replied to is converted into a code to be replied to corresponding to the text to be replied to;
[0012] When the intention verification result is that the intention is inaccurate, the text to be replied is converted into synonyms to obtain a new text to be replied; and based on the fact that the new text to be replied contains at least one new target intention text, the step of verifying the accuracy of the intention of the text to be replied based on the association between at least one candidate intention text and the at least one target intention text is returned to execute, until the intention verification result is that the intention is accurate.
[0013] In one embodiment, the performing synonym conversion on the text to be replied to obtain a new text to be replied to includes:
[0014] Determining, from the at least one target intent text, an abnormal intent text having inaccurate intent;
[0015] Determine a synonymous intent text corresponding to the abnormal intent text;
[0016] The abnormal intention text in the text to be replied is converted into a synonym according to the synonym intention text to obtain a new text to be replied.
[0017] In one embodiment, the step of obtaining the text to be replied input by the user terminal includes:
[0018] Receiving initial text input from a user terminal;
[0019] The initial text is parsed for reply intent to obtain the text to be replied to input by the user terminal.
[0020] In one embodiment, verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and at least one target intent text includes:
[0021] For each target intent text, verify whether at least one candidate intent text contains a reference intent text that is the same as the target intent text;
[0022] If the reference intention text corresponding to each target intention text can be determined, then the intention verification result is determined to be accurate;
[0023] If the reference intention text corresponding to each target intention text cannot be determined, the intention verification result is determined to be inaccurate intention.
[0024] In one embodiment, the at least one candidate intention text includes a first candidate intention text belonging to a subject type, a second candidate intention text belonging to a relationship type, a third candidate intention text belonging to an object type, a fourth candidate intention text belonging to an object attribute, and a fifth candidate intention text belonging to a reply target.
[0025] In a second aspect, the present application also provides a graph database query device. The device comprises:
[0026] An acquisition module, used for acquiring a text to be replied input by a user terminal; wherein the text to be replied contains at least one target intention text;
[0027] A verification module, used to verify the accuracy of the intent of the text to be replied according to the association relationship between at least one candidate intent text and the at least one target intent text;
[0028] A determination module, used to determine the code to be replied corresponding to the text to be replied according to the intention verification result;
[0029] The query module is used to query the graph database through the code to be replied to, and obtain the reply text corresponding to the text to be replied to.
[0030] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0031] Acquire a text to be replied input by a user terminal; wherein the text to be replied contains at least one target intention text;
[0032] Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and the at least one target intent text;
[0033] Determine the reply code corresponding to the reply text according to the intention verification result;
[0034] A graph database query is performed using the code to be replied to, to obtain a reply text corresponding to the text to be replied to.
[0035] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0036] Acquire a text to be replied input by a user terminal; wherein the text to be replied contains at least one target intention text;
[0037] Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and the at least one target intent text;
[0038] Determine the reply code corresponding to the reply text according to the intention verification result;
[0039] A graph database query is performed using the code to be replied to, to obtain a reply text corresponding to the text to be replied to.
[0040] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0041] Acquire a text to be replied input by a user terminal; wherein the text to be replied contains at least one target intention text;
[0042] Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and the at least one target intent text;
[0043] Determine the reply code corresponding to the reply text according to the intention verification result;
[0044] A graph database query is performed using the code to be replied to, to obtain a reply text corresponding to the text to be replied to.
[0045] The above-mentioned graph database query method, device, computer equipment and storage medium obtain the text to be replied input by the user terminal to realize the verification of the accuracy of the intention of the text to be replied, and then, according to the intention verification result, determine the code to be replied corresponding to the text to be replied, so as to realize the query of the graph database through the code to be replied, and obtain the reply text corresponding to the text to be replied. According to the above content, it can be seen that in the process of querying the graph database, the present application does not directly perform the query operation through the text to be replied input by the user terminal, but first verifies the accuracy of the intention of the text to be replied. Since the present application verifies the accuracy of the intention based on the association relationship between at least one candidate intention text and at least one target intention text, it can effectively ensure that at least one target intention text contained in the text to be replied can objectively exist in the graph database, thereby improving the matching degree between the text to be replied and the graph database, thereby ensuring that the reply text that meets the text to be replied can be accurately obtained when the graph database is queried later, and ensuring the smooth and effective operation of the data query service. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 An application environment diagram of a graph database query method provided in an embodiment of the present application;
[0047] Figure 2 A schematic diagram of the process of the first graph database query method provided in the embodiment of the present application;
[0048] Figure 3 A schematic diagram of the flow of the second graph database query method provided in the embodiment of the present application;
[0049] Figure 4 A schematic diagram of the flow of the third graph database query method provided in the embodiment of the present application;
[0050] Figure 5 A schematic diagram of the flow of the fourth graph database query method provided in the embodiment of the present application;
[0051] Figure 6 A schematic diagram of the flow of the fifth graph database query method provided in the embodiment of the present application;
[0052] Figure 7 A structural block diagram of a graph database query device provided in an embodiment of the present application;
[0053] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. In the description of the present application, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms is not necessarily for the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples without contradicting each other.
[0056] The graph database query method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. By obtaining the text to be replied input by the user terminal, the accuracy of the intention of the text to be replied can be verified. Then, according to the intention verification result, the code to be replied corresponding to the text to be replied is determined to query the graph database through the code to be replied, and the reply text corresponding to the text to be replied is obtained. Among them, the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0057] In one embodiment, Figure 2 As shown, a graph database query method is provided, which is applied to Figure 1 Taking the server 104 in the example as an example, the following steps are included:
[0058] S201, obtaining a text to be replied to input by a user terminal.
[0059] The text to be replied contains at least one target intention text.
[0060] It should be noted that when it is necessary to obtain the text to be replied input by the user terminal, a demand receiving window can be generated to the user terminal, so that the user can input his own database query requirements in the demand receiving window through the user terminal, and determine the text to be replied input by the user terminal based on the input text feedback from the user terminal.
[0061] In one embodiment of the application, audio information input by the user through the user terminal can be received, and then the audio information can be converted into text, and the text conversion result can be input into the demand receiving window to reduce the complexity of user operations while ensuring that the subsequent text to be replied to by the user terminal can be smoothly determined based on the input text fed back by the user terminal.
[0062] To further explain, the target intent text can be divided into the following five categories, specifically: the first target intent text belonging to the subject type, the second target intent text belonging to the relationship type, the third target intent text belonging to the object type, the fourth target intent text belonging to the object attribute and the fifth target intent text belonging to the reply target.
[0063] S202: Verify the accuracy of the intent of the text to be replied to based on the association relationship between at least one candidate intent text and at least one target intent text.
[0064] It should be noted that in order to ensure that the accuracy of the intent of the text to be replied can be accurately obtained, it is necessary to ensure that when the graph database is queried based on the text to be replied, the data for each target intent text can be found in the graph database; therefore, at least one candidate intent text can be set in advance according to the data types corresponding to the data contained in the graph database, and then, by verifying the association between at least one candidate intent text and at least one target intent text, the accuracy of the intent of the text to be replied can be verified.
[0065] Specifically, verify whether there is an abnormal intention text that is different from at least one candidate intention text in at least one target intention text; then, based on the inclusion of the abnormal intention text, verify the accuracy of the intention of the text to be replied.
[0066] S203: Determine the code to be replied corresponding to the text to be replied according to the intention verification result.
[0067] It should be noted that when the intent verification result is that the intent is accurate, the text to be replied can be converted into codes to obtain the code to be replied corresponding to the text to be replied; when the intent verification result is that the intent is inaccurate, the text to be replied can be calibrated for text intent to determine the code to be replied based on the text to be replied after the text intent is calibrated.
[0068] S204, query the graph database through the code to be replied to, and obtain the reply text corresponding to the text to be replied to.
[0069] The above-mentioned graph database query method obtains the text to be replied input by the user terminal to realize the verification of the accuracy of the intention of the text to be replied, and then, according to the intention verification result, determines the code to be replied corresponding to the text to be replied, so as to realize the query of the graph database through the code to be replied, and obtains the reply text corresponding to the text to be replied. According to the above content, it can be known that in the process of querying the graph database, the present application does not directly perform the query operation through the text to be replied input by the user terminal, but first verifies the accuracy of the intention of the text to be replied. Since the present application verifies the accuracy of the intention based on the association relationship between at least one candidate intention text and at least one target intention text, it can effectively ensure that at least one target intention text contained in the text to be replied can objectively exist in the graph database, thereby improving the matching degree between the text to be replied and the graph database, thereby ensuring that the reply text that meets the text to be replied can be accurately obtained when the graph database query is performed later, and the smooth and effective operation of the data query service is ensured.
[0070] In one embodiment, if Figure 3 As shown, when it is necessary to determine the code to be replied corresponding to the text to be replied to based on the intent verification result, the following contents may be specifically included:
[0071] S301, when the intention verification result is that the intention is accurate, code conversion is performed on the text to be replied to, and a code to be replied corresponding to the text to be replied to is obtained.
[0072] It should be noted that when the text to be replied needs to be converted into code, the code format corresponding to the code to be replied can be determined in advance, and then, based on the code format, the text to be replied is converted into code to be replied corresponding to the text to be replied.
[0073] In one embodiment of the present application, if the code format is pre-defined as gremlin code, and the text to be replied is "subject type: user, subject id: abc, relationship: purchase, object type: policy, target: number of items", after the text to be replied is converted into code, the code to be replied corresponding to the text to be replied is as follows:
[0074] gV().hasLabel("kehu").has("id", "abc")
[0075] .bothE().hasLabel("toubao").values("baodanhao").count()
[0076] S302, when the intent verification result is that the intent is inaccurate, perform synonym conversion on the text to be replied to obtain a new text to be replied to; and based on the fact that the new text to be replied to contains at least one new target intent text, return to execute the step of verifying the intent accuracy of the text to be replied to based on the association relationship between at least one candidate intent text and at least one target intent text, until the intent verification result is that the intent is accurate.
[0077] It should be noted that when it is necessary to perform synonym conversion on the text to be replied to and obtain a new text to be replied to, it may specifically include the following contents: determining an abnormal intention text with inaccurate intention from at least one target intention text; determining a synonymous intention text corresponding to the abnormal intention text; and performing synonym conversion on the abnormal intention text in the text to be replied to according to the synonymous intention text to obtain a new text to be replied to.
[0078] As an example, if it is determined that the first target intent text, the second target intent text, the third target intent text, the fourth target intent text and the fifth target intent text are all abnormal intent texts, and the text to be replied is "subject type: user, subject id: abc, relationship: purchase, object type: policy, reply target: number of pieces"; among them, the "user" entity does not exist in the graph database, and is replaced by the synonym "customer"; "purchase" is replaced by "insurance"; it is missing in the question, and is automatically completed with the primary key attribute of the object, that is, "policy number"; "number of pieces" is replaced by "quantity".
[0079] To further explain, when it is necessary to determine an abnormal intent text with inaccurate intent, the following contents may be included: for each target intent text, verify whether at least one candidate intent text contains a candidate intent text that is different from the target intent text. If so, determine that the target intent text is not an abnormal intent text; if not, determine that the target intent text is an abnormal intent text.
[0080] For the fifth target intention text belonging to the reply target, it can also be verified whether the fifth target intention text is the same as the fifth candidate intention text. The fifth candidate intention text includes at least one of: "list", "quantity", "sum", "minimum value", "maximum value", and "average value"; and the content contained in the fifth candidate intention text can be added, deleted or adjusted according to actual conditions and actual needs.
[0081] In one embodiment of the present application, in order to verify whether at least one target intent text contained in the text to be replied matches the metadata in the graph database, it can also be verified whether at least one target intent text contained in the text to be replied exists in the graph database. Specifically, if the target intent text includes a first target intent text belonging to a subject type, a second target intent text belonging to a relationship type, a third target intent text belonging to an object type, a fourth target intent text belonging to an object attribute, and a fifth target intent text belonging to a reply target, then it is verified whether the first target intent text, the second target intent text, the third target intent text, the fourth target intent text, and the fifth target intent text exist in the graph database. If they all exist, the intent verification result is determined to be accurate in intent; if they do not all exist, the intent verification result is determined to be inaccurate in intent.
[0082] The above-mentioned graph database query method determines the code to be replied corresponding to the text to be replied through the intent verification result, which effectively ensures that at least one target intent text contained in the subsequent text to be replied can objectively exist in the graph database, and improves the matching degree between the text to be replied and the graph database. In this way, it is ensured that when the graph database is queried subsequently, the reply text that meets the text to be replied can be accurately obtained, thereby ensuring the smooth and effective operation of the data query business.
[0083] In one embodiment, if Figure 4 As shown, when it is necessary to obtain the text to be replied input by the user terminal, the following contents may be specifically included:
[0084] S401: receiving an initial text input by a user terminal.
[0085] In one embodiment of the present application, the user can input initial information through a user terminal in the form of voice input, text input, etc.; the initial information is converted into text to obtain the initial text input by the user terminal.
[0086] Furthermore, in order to ensure the accuracy of subsequent graph database queries and reduce the interference of redundant information and erroneous information on graph database queries, the initial information can also be preprocessed, where the preprocessing may include but is not limited to: removing redundant data, removing erroneous data, data normalization and other operations.
[0087] S402, parsing the reply intention of the initial text to obtain the text to be replied to input by the user terminal.
[0088] It should be noted that a large language model may be pre-trained, and the reply intent of the initial text may be parsed according to the large language model, so as to parse the initial text input by the user terminal into a formatted text to be replied.
[0089] As an example, the text to be replied may be {subject type: user, subject id: abc, relationship: purchase, object type: insurance policy, reply target: number of items}.
[0090] The above-mentioned graph database query method obtains the initial text and performs reply intent analysis on the initial text to obtain the text to be replied to input by the user terminal, so as to provide a data basis for subsequent processes and ensure the accuracy of subsequent graph database queries.
[0091] In one embodiment, if Figure 5 As shown, when it is necessary to verify the accuracy of the intent of the text to be replied based on the association relationship between at least one candidate intent text and at least one target intent text, the following contents may be specifically included:
[0092] S501, for each target intent text, verify whether at least one candidate intent text contains a reference intent text that is the same as the target intent text.
[0093] It should be noted that at least one candidate intent text is text data contained in the graph database.
[0094] Among them, at least one candidate intention text includes a first candidate intention text belonging to a subject type, a second candidate intention text belonging to a relationship type, a third candidate intention text belonging to an object type, a fourth candidate intention text belonging to an object attribute, and a fifth candidate intention text belonging to a reply target.
[0095] S502: If the reference intention text corresponding to each target intention text can be determined, the intention verification result is determined to be accurate.
[0096] It should be noted that since at least one candidate intent text is text data contained in the graph database, if each target intent text is determined to have a reference intent text, and it is determined that each target intent text matches the text data in the graph database, then the intent verification result is determined to be accurate.
[0097] S503: If the reference intention text corresponding to each target intention text cannot be determined, the intention verification result is determined to be inaccurate.
[0098] It should be noted that since at least one candidate intent text is text data contained in the graph database, if the reference intent text corresponding to each target intent text cannot be determined, it means that it cannot be determined that each target intent text matches the text data in the graph database. Therefore, the intent verification result is determined to be inaccurate.
[0099] The above-mentioned graph database query method verifies the accuracy of the intention of the text to be replied, thereby realizing the process of code conversion of the text to be replied and obtaining the code to be replied corresponding to the text to be replied, thereby ensuring the smooth progress of the subsequent process.
[0100] In one embodiment, if Figure 6 As shown, when it is necessary to obtain the reply text corresponding to the to-be-replied text, the following contents may be specifically included:
[0101] S601: receiving an initial text input by a user terminal.
[0102] S602, performing reply intent analysis on the initial text to obtain the text to be replied to input by the user terminal, wherein the text to be replied to contains at least one target intent text.
[0103] S603: Verify the accuracy of the intent of the text to be replied based on the association relationship between at least one candidate intent text and at least one target intent text.
[0104] S604, when the intention verification result is that the intention is accurate, code conversion is performed on the text to be replied to, and a code to be replied corresponding to the text to be replied to is obtained.
[0105] S605, when the intent verification result is that the intent is inaccurate, determine an abnormal intent text with inaccurate intent from at least one target intent text.
[0106] S606, determining the synonymous intention text corresponding to the abnormal intention text.
[0107] S607, performing synonym conversion on the abnormal intention text in the text to be replied according to the synonymous intention text to obtain a new text to be replied.
[0108] S608, based on the fact that the new text to be replied contains at least one new target intent text, return to execute the step of verifying the intent accuracy of the text to be replied based on the association relationship between at least one candidate intent text and at least one target intent text, until the intent verification result is that the intent is accurate.
[0109] S609, query the graph database through the code to be replied to, and obtain the reply text corresponding to the text to be replied to.
[0110] The above-mentioned graph database query method obtains the text to be replied input by the user terminal to realize the verification of the accuracy of the intention of the text to be replied, and then, according to the intention verification result, determines the code to be replied corresponding to the text to be replied, so as to realize the query of the graph database through the code to be replied, and obtains the reply text corresponding to the text to be replied. According to the above content, it can be known that in the process of querying the graph database, the present application does not directly perform the query operation through the text to be replied input by the user terminal, but first verifies the accuracy of the intention of the text to be replied. Since the present application verifies the accuracy of the intention based on the association relationship between at least one candidate intention text and at least one target intention text, it can effectively ensure that at least one target intention text contained in the text to be replied can objectively exist in the graph database, thereby improving the matching degree between the text to be replied and the graph database, thereby ensuring that the reply text that meets the text to be replied can be accurately obtained when the graph database query is performed later, and the smooth and effective operation of the data query service is ensured.
[0111] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0112] Based on the same inventive concept, the embodiment of the present application also provides a graph database query device for implementing the graph database query method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more graph database query device embodiments provided below can refer to the limitations of the graph database query method above, and will not be repeated here.
[0113] In one embodiment, Figure 7 As shown, a graph database query device is provided, including: an acquisition module 10, a verification module 20, a determination module 30 and a query module 40, wherein:
[0114] The acquisition module 10 is used to acquire the text to be replied input by the user terminal; wherein the text to be replied contains at least one target intention text.
[0115] The verification module 20 is used to verify the accuracy of the intent of the text to be replied based on the association relationship between at least one candidate intent text and at least one target intent text.
[0116] The determination module 30 is used to determine the code to be replied corresponding to the text to be replied according to the intention verification result.
[0117] The query module 40 is used to query the graph database through the code to be replied to, and obtain the reply text corresponding to the text to be replied to.
[0118] The above-mentioned graph database query device obtains the text to be replied input by the user terminal to realize the verification of the accuracy of the intention of the text to be replied, and then, according to the intention verification result, determines the code to be replied corresponding to the text to be replied, so as to realize the query of the graph database through the code to be replied, and obtain the reply text corresponding to the text to be replied. According to the above content, it can be known that in the process of querying the graph database, the present application does not directly perform the query operation through the text to be replied input by the user terminal, but first verifies the accuracy of the intention of the text to be replied. Since the present application verifies the accuracy of the intention based on the association relationship between at least one candidate intention text and at least one target intention text, it can effectively ensure that at least one target intention text contained in the text to be replied can objectively exist in the graph database, thereby improving the matching degree between the text to be replied and the graph database, thereby ensuring that the reply text that meets the text to be replied can be accurately obtained when the graph database query is performed later, and ensuring the smooth and effective operation of the data query service.
[0119] In one embodiment, when the intention verification result is that the intention is accurate, the text to be replied is converted into a code to obtain a code to be replied corresponding to the text to be replied;
[0120] When the intent verification result is that the intent is inaccurate, the text to be replied is converted into synonyms to obtain a new text to be replied; and based on the fact that the new text to be replied contains at least one new target intent text, the step of verifying the accuracy of the intent of the text to be replied based on the association between at least one candidate intent text and at least one target intent text is returned to execute, until the intent verification result is that the intent is accurate.
[0121] In one embodiment, determining an abnormal intent text with inaccurate intent from at least one target intent text;
[0122] Determine the synonymous intent text corresponding to the abnormal intent text;
[0123] According to the synonymous intention text, the abnormal intention text in the text to be replied is converted into a synonym to obtain a new text to be replied.
[0124] In one embodiment, receiving initial text input by a user terminal;
[0125] The initial text is parsed for reply intent to obtain the text to be replied to input by the user terminal.
[0126] In one embodiment, for each target intent text, verify whether at least one candidate intent text contains a reference intent text that is the same as the target intent text;
[0127] If the reference intention text corresponding to each target intention text can be determined, the intention verification result is determined to be accurate;
[0128] If the reference intent text corresponding to each target intent text cannot be determined, the intent verification result is determined to be inaccurate.
[0129] In one embodiment, at least one candidate intention text includes a first candidate intention text belonging to a subject type, a second candidate intention text belonging to a relationship type, a third candidate intention text belonging to an object type, a fourth candidate intention text belonging to an object attribute, and a fifth candidate intention text belonging to a reply target.
[0130] Each module in the above-mentioned graph database query device can be implemented in whole or in part by software, hardware and their combination. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0131] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a graph database query method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0132] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0133] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0134] Acquire the text to be replied input by the user terminal; wherein the text to be replied contains at least one target intention text;
[0135] Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and at least one target intent text;
[0136] According to the intent verification result, determine the reply code corresponding to the reply text;
[0137] The graph database is queried through the code to be replied to, and the reply text corresponding to the text to be replied to is obtained.
[0138] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0139] When the intent verification result is that the intent is accurate, the text to be replied to is converted into a code to obtain a reply code corresponding to the text to be replied to;
[0140] When the intent verification result is that the intent is inaccurate, the text to be replied is converted into synonyms to obtain a new text to be replied; and based on the fact that the new text to be replied contains at least one new target intent text, the step of verifying the accuracy of the intent of the text to be replied based on the association between at least one candidate intent text and at least one target intent text is returned to execute, until the intent verification result is that the intent is accurate.
[0141] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0142] Determine, from at least one target intent text, an abnormal intent text with inaccurate intent;
[0143] Determine the synonymous intent text corresponding to the abnormal intent text;
[0144] According to the synonymous intention text, the abnormal intention text in the text to be replied is converted into a synonym to obtain a new text to be replied.
[0145] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0146] Receiving initial text input from a user terminal;
[0147] The initial text is parsed for reply intent to obtain the text to be replied to input by the user terminal.
[0148] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0149] For each target intent text, verify whether at least one candidate intent text contains the same reference intent text as the target intent text;
[0150] If the reference intention text corresponding to each target intention text can be determined, the intention verification result is determined to be accurate;
[0151] If the reference intent text corresponding to each target intent text cannot be determined, the intent verification result is determined to be inaccurate.
[0152] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0153] The at least one candidate intention text includes a first candidate intention text belonging to a subject type, a second candidate intention text belonging to a relationship type, a third candidate intention text belonging to an object type, a fourth candidate intention text belonging to an object attribute, and a fifth candidate intention text belonging to a reply target.
[0154] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0155] Acquire the text to be replied input by the user terminal; wherein the text to be replied contains at least one target intention text;
[0156] Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and at least one target intent text;
[0157] According to the intent verification result, determine the reply code corresponding to the reply text;
[0158] The graph database is queried through the code to be replied to, and the reply text corresponding to the text to be replied to is obtained.
[0159] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0160] When the intent verification result is that the intent is accurate, the text to be replied to is converted into a code to obtain a reply code corresponding to the text to be replied to;
[0161] When the intent verification result is that the intent is inaccurate, the text to be replied is converted into synonyms to obtain a new text to be replied; and based on the fact that the new text to be replied contains at least one new target intent text, the step of verifying the accuracy of the intent of the text to be replied based on the association between at least one candidate intent text and at least one target intent text is returned to execute, until the intent verification result is that the intent is accurate.
[0162] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0163] Determine, from at least one target intent text, an abnormal intent text with inaccurate intent;
[0164] Determine the synonymous intent text corresponding to the abnormal intent text;
[0165] According to the synonymous intention text, the abnormal intention text in the text to be replied is converted into a synonym to obtain a new text to be replied.
[0166] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0167] Receiving initial text input from a user terminal;
[0168] The initial text is parsed for reply intent to obtain the text to be replied to input by the user terminal.
[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0170] For each target intent text, verify whether at least one candidate intent text contains the same reference intent text as the target intent text;
[0171] If the reference intention text corresponding to each target intention text can be determined, the intention verification result is determined to be accurate;
[0172] If the reference intent text corresponding to each target intent text cannot be determined, the intent verification result is determined to be inaccurate.
[0173] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0174] The at least one candidate intention text includes a first candidate intention text belonging to a subject type, a second candidate intention text belonging to a relationship type, a third candidate intention text belonging to an object type, a fourth candidate intention text belonging to an object attribute, and a fifth candidate intention text belonging to a reply target.
[0175] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0176] Acquire the text to be replied input by the user terminal; wherein the text to be replied contains at least one target intention text;
[0177] Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and at least one target intent text;
[0178] According to the intent verification result, determine the reply code corresponding to the reply text;
[0179] The graph database is queried through the code to be replied to, and the reply text corresponding to the text to be replied to is obtained.
[0180] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0181] When the intent verification result is that the intent is accurate, the text to be replied to is converted into a code to obtain a reply code corresponding to the text to be replied to;
[0182] When the intent verification result is that the intent is inaccurate, the text to be replied is converted into synonyms to obtain a new text to be replied; and based on the fact that the new text to be replied contains at least one new target intent text, the step of verifying the accuracy of the intent of the text to be replied based on the association between at least one candidate intent text and at least one target intent text is returned to execute, until the intent verification result is that the intent is accurate.
[0183] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0184] Determine, from at least one target intent text, an abnormal intent text with inaccurate intent;
[0185] Determine the synonymous intent text corresponding to the abnormal intent text;
[0186] According to the synonymous intention text, the abnormal intention text in the text to be replied is converted into a synonym to obtain a new text to be replied.
[0187] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0188] Receiving initial text input from a user terminal;
[0189] The initial text is parsed for reply intent to obtain the text to be replied to input by the user terminal.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0191] For each target intent text, verify whether at least one candidate intent text contains the same reference intent text as the target intent text;
[0192] If the reference intention text corresponding to each target intention text can be determined, the intention verification result is determined to be accurate;
[0193] If the reference intent text corresponding to each target intent text cannot be determined, the intent verification result is determined to be inaccurate.
[0194] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0195] The at least one candidate intention text includes a first candidate intention text belonging to a subject type, a second candidate intention text belonging to a relationship type, a third candidate intention text belonging to an object type, a fourth candidate intention text belonging to an object attribute, and a fifth candidate intention text belonging to a reply target.
[0196] It should be noted that the user terminal information (including but not limited to user terminal device information, user terminal personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user terminal or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0197] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0198] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0199] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A graph database query method, characterized in that: The method comprises: Acquire a text to be replied input by a user terminal; wherein the text to be replied contains at least one target intention text; Verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and the at least one target intent text; Determine the reply code corresponding to the reply text according to the intention verification result; A graph database query is performed using the code to be replied to, to obtain a reply text corresponding to the text to be replied to.
2. The method according to claim 1, characterized in that The step of determining the code to be replied corresponding to the text to be replied to according to the intention verification result includes: If the intention verification result is that the intention is accurate, the text to be replied to is converted into a code to be replied to corresponding to the text to be replied to; When the intention verification result is that the intention is inaccurate, the text to be replied is converted into synonyms to obtain a new text to be replied; and based on the fact that the new text to be replied contains at least one new target intention text, the step of verifying the accuracy of the intention of the text to be replied based on the association between at least one candidate intention text and the at least one target intention text is returned to execute, until the intention verification result is that the intention is accurate.
3. The method according to claim 2, characterized in that The step of performing synonym conversion on the text to be replied to obtain a new text to be replied to includes: Determining, from the at least one target intent text, an abnormal intent text having inaccurate intent; Determine a synonymous intent text corresponding to the abnormal intent text; The abnormal intention text in the text to be replied is converted into a synonym according to the synonym intention text to obtain a new text to be replied.
4. The method according to claim 1, characterized in that: The step of obtaining the text to be replied input by the user terminal includes: Receiving initial text input from a user terminal; The initial text is parsed for reply intent to obtain the text to be replied to input by the user terminal.
5. The method according to claim 1, characterized in that The verifying the accuracy of the intent of the text to be replied to according to the association relationship between at least one candidate intent text and at least one target intent text includes: For each target intent text, verify whether at least one candidate intent text contains a reference intent text that is the same as the target intent text; If the reference intention text corresponding to each target intention text can be determined, then the intention verification result is determined to be accurate; If the reference intention text corresponding to each target intention text cannot be determined, the intention verification result is determined to be inaccurate intention.
6. The method according to claim 5, characterized in that The at least one candidate intention text includes a first candidate intention text belonging to a subject type, a second candidate intention text belonging to a relationship type, a third candidate intention text belonging to an object type, a fourth candidate intention text belonging to an object attribute, and a fifth candidate intention text belonging to a reply target.
7. A graph database query device, characterized in that: The device comprises: An acquisition module, used for acquiring a text to be replied input by a user terminal; wherein the text to be replied contains at least one target intention text; A verification module, used to verify the accuracy of the intent of the text to be replied according to the association relationship between at least one candidate intent text and the at least one target intent text; A determination module, used to determine the code to be replied corresponding to the text to be replied according to the intention verification result; The query module is used to query the graph database through the code to be replied to, and obtain the reply text corresponding to the text to be replied to.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.