Method and system for querying a database
Patent Information
- Application Number
- FR2023009145
- Authority / Receiving Office
- FR · FR
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-08-31
- Publication Date
- 2025-03-07
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Title of the invention: Method and system for querying a database Technical field
[0001] The present disclosure relates to the field of database querying. More specifically, the present disclosure relates to a method for querying in natural language a database containing descriptive data relating to various entities. The present disclosure also relates to a corresponding system, computer program and recording medium. Prior art
[0002] Traditional methods of querying databases often require a thorough understanding of Structured Query Language (SQL) or other programming languages. This technical barrier prevents many non-technical users from effectively extracting information from databases.
[0003] Attempts to circumvent this problem have been implemented by integrating natural language understanding rules, hoping to make querying more intuitive.
[0004] A disadvantage of this approach is the large number of rules that need to be defined to take into account the different formulations of the questions that may be asked. An additional difficulty arises from the fact that when the system correctly answers the questions provided for most of the formulations, the anthropomorphic illusion pushes the user to also ask questions outside the intended scope, which can lead to confusion.
[0005] There is therefore a need for a solution capable of handling a wide range of question formulations as well as managing user expectations for anthropomorphic interactions without requiring a multitude of pre-established rules. Abstract
[0006] The present disclosure improves the situation.
[0007] According to one aspect, there is provided a method of querying in natural language a database storing descriptive data relating to an entity, the method comprising: obtaining a response to a query comprising a question in natural language via a processing interface to which a text resulting from a transformation by a natural language generator of the descriptive data relating to the entity and the question is provided, the processing interface being configured to requesting, based on a result obtained by the processing interface in a first mode, a language model by providing it with the text and the question asked in a second mode, the first and second modes being distinct.
[0008] The proposed method provides a robust mechanism for querying the database in natural language, without the need to define a multitude of pre-established rules corresponding to a vast number of possible formulations of expected questions.
[0009] It also offers query flexibility due to the dynamic interface that can switch between different processing modes, thus allowing greater adaptability to various types of natural language questions.
[0010] The use of the language model in the second mode makes it possible in particular to answer unexpected questions which may or may not relate to the content of the database.
[0011] In one example, the method also includes receiving the request via a human-machine interface.
[0012] The incorporation of a human-machine interface increases the accessibility and efficiency of interaction, providing a more intuitive user experience.
[0013] In one example, the method also includes triggering the transformation of the descriptive data after receiving the request.
[0014] Transforming data after receiving the query provides the ability to prepare the most relevant data in response to a specific request, optimizing the relevance of the responses.
[0015] In one example, the method also includes updating the descriptive data between receiving the request and triggering the transformation of the descriptive data.
[0016] The ability to update descriptive data before transformation allows for the evolving nature of the database to be taken into account. This ensures that the most up-to-date information is used, thereby increasing the accuracy and reliability of responses.
[0017] In one example, the method also comprises obtaining by the natural language generator the text resulting from the transformation of the descriptive data.
[0018] Using the natural language generator to transform the data ensures consistent human interpretation of the data, making the responses more understandable to the user.
[0019] In one example, the method also includes use by the natural language generator of a predetermined rule when transforming the descriptive data.
[0020] The use of predetermined rules during transformation ensures consistency in how data is interpreted, improving the predictability of answers.
[0021] In one example, the descriptive data is in the form of predicates with any number of arguments.
[0022] Support for predicates with a variable number of arguments allows for great flexibility in data representation, thus providing a wide range of query possibilities.
[0023] In one example, the descriptive data is filtered and / or a portion of the descriptive data is masked prior to transformation of the descriptive data.
[0024] In one example, the text is filtered and / or a portion of the text is masked before providing the text to the language model.
[0025] The ability to filter or mask certain portions of the descriptive data or text provides security and privacy options, ensuring that only relevant and approved information is exposed.
[0026] In one example, the processing interface is configured to perform, in the first mode, processing of the question by a query mechanism having a natural language understanding rule.
[0027] In one example, the result obtained by the processing interface in the first mode is indicative of obtaining the response or not obtaining the response in the first mode, and the processing interface is configured to request the language model in the second mode when the result is indicative of not obtaining the response in the first mode.
[0028] In one example, the result obtained by the processing interface in the first mode comprises a response proposal and an evaluative data item of the response proposal, and the processing interface is configured to provide the response proposal as a response when the evaluative data item is favorable and to request the language model in the second mode when the evaluative data item is unfavorable.
[0029] According to another aspect, a computer program is provided comprising instructions for implementing the above method when this program is executed by a processor.
[0030] According to another aspect, there is provided a non-transitory recording medium readable by a computer on which the above computer program is recorded.
[0031] According to another aspect, there is proposed a system for querying a database storing descriptive data relating to an entity, the system comprising: a processing interface being capable of obtaining a response to a query comprising a question in natural language as a function of a text resulting from a transformation by a natural language generator of the descriptive data relating to the entity and of the question, the processing interface being configured to request, as a function of a result obtained by the processing interface in a first mode, a language model by providing it with the text and the question in a second mode, the first and second modes being distinct.
[0032] In one example, the system also includes a human-machine interface capable of obtaining a query comprising a question in natural language.
[0033] In one example, the system also includes a natural language generator capable of obtaining the text resulting from the transformation of the descriptive data. Brief description of the drawings
[0034] Other characteristics, details and advantages will appear on reading the detailed description below, and on analyzing the attached drawings, in which: Fig.l
[0035] [Fig.l] represents a natural language query system for a database in an exemplary embodiment. Fig. 2
[0036] [Fig.2] represents a processing circuit adapted to implement a method natural language query of a database in an example implementation. Fig. 3
[0037] [Fig.3] illustrates an operation of a processing interface for providing a response to a question expressed in natural language according to a first mode, in an exemplary embodiment. Fig. 4
[0038] [Fig.4] illustrates an operation of a processing interface to provide a response to a question expressed in natural language according to a second mode, in the example embodiment of [Fig.3]. Fig. 5
[0039] [Fig.5] illustrates an operation of a processing interface for providing a response to a question expressed in natural language according to a first mode, in another exemplary embodiment. Fig. 6
[0040] [Fig.6] illustrates an operation of a processing interface to provide an answer to a question expressed in natural language according to a second mode, in the exemplary embodiment of [Fig.5]. Fig. 7
[0041] [Fig.7] illustrates an operation of a processing interface to provide a response to a question expressed in natural language, in another example of implementation. Description of the embodiments
[0042] In the following description, identical reference numerals designate identical elements or elements having similar functions.
[0043] [Fig-1] represents the main elements of a system (100) suitable for in query a database in natural language.
[0044] A human-machine interface (102) makes it possible to collect a query containing a question formulated by a user and expressed in natural language, for example in the form of one or more sentences. The human-machine interface may comprise, for example, a textual graphical interface or a sound sensor coupled to a voice recognition interface.
[0045] A processing interface (104) is configured to process the question contained in the query. Upon completion of this processing, the response may be provided to the user via an appropriate interface, for example a display device or a voice rendering device.
[0046] A database (106) stores descriptive data relating to an entity which may be, for example, a dwelling, a site, a company, a community or an organization. This descriptive data may belong to one or more fields of application. As examples of fields of application, it is possible to cite, for example, the management of a connected home, assistance for industrial operators or assistance for technicians in the tertiary sector to, for example, carry out maintenance operations. The descriptive data may be of any nature and have varying levels of confidentiality. The descriptive data may be stored in any format.
[0047] For example, descriptive data may take the form of predicates. Predicates may have as many arguments as necessary, for example zero, one, two, or more. Such a format is particularly suitable for consulting and modifying a database with simple queries expressed in standard programming languages.
[0048] For example: (age robert 57) stores the fact that Robert's age is 57, (occupation robert “developer at Orange Business”) allows you to store knowledge about Robert’s job, (state living-room-lamp on) stores the fact that the living room lamp, whose local identifier is "living-room-lamp", is on.
[0049] In an example of application to a home automation system, the descriptive data may include, among other things, personal data of a resident of the dwelling as a user of the interrogation system, such as pre usage preferences, as well as any data useful for the management of communicating devices placed in the accommodation and / or the provision of home automation services to the user.
[0050] At the latest during the processing of the query, at least a part of the descriptive data contained in the database is transmitted to a natural language generator (108) which transforms it into text, for example in the form of one or more sentences. The natural language generator can be configured to implement one or more predetermined rules in order to transform a received descriptive data into a corresponding text or a corresponding part of text.
[0051] This transmission can be controlled by the processing interface and in particular triggered by the processing interface following the obtaining of the request. The descriptive data may or may not pass through the processing interface. The processing interface may also require an update of the descriptive data before their transmission.
[0052] Alternatively, the database may be designed to automatically transmit all or part of the descriptive data to the natural language generator without requiring prior request by the processing interface. This transmission may, for example, be periodic or follow an update of the contents of the database.
[0053] For the purpose of preserving the confidentiality of certain descriptive data, a masking component may be provided to mask this data before providing it to the natural language generator. A filtering component may also be provided for a similar purpose by preventing the transmission of certain descriptive data to the natural language generator.
[0054] The processing interface also has a data link with a language model (110) capable of interpreting a question in natural language and providing an answer to the question by relying, when the question requires it, on descriptive data which are also provided to it in natural language. The use of the language model also makes it possible to answer possible questions beyond a possible predefined scope of application by relying on general knowledge, external to the database, on which it has previously been trained.
[0055] The processing interface is configured to obtain one or more descriptive data from the database in the form of a text resulting from the transformation of this or these descriptive data by the natural language generator. In this text, the descriptive data may optionally be masked.
[0056] The processing interface has two distinct modes of processing the query.
[0057] Firstly, according to a first mode, the processing interface attempts to provide an answer to the question without calling on the language model. For this, the processing interface processing is based on a query mechanism which may or may not be integrated into the processing interface and which may, for example, be equipped with one or more natural language understanding rules.
[0058] The result obtained by the processing interface according to the first mode directs the rest of the request processing process. The result is based on at least one criterion. An example of a criterion is whether or not a response is obtained according to the first mode, so that in the absence of a response, the result obtained is interpreted as a failure.
[0059] Another example of a criterion involves obtaining a response proposal according to the first mode and evaluating this response proposal, for example, as to its quality or relevance. Thus, the result may include not only the response proposal but also at least one favorable or unfavorable evaluative data item, so that if the evaluative data item is unfavorable, the result obtained is interpreted as a failure.
[0060] When the result obtained according to the first mode is a success, it is not necessary to implement processing according to the second mode and the response obtained according to the first mode can be provided to the user.
[0061] When the result obtained according to the first mode is a failure, the processing interface triggers the second mode and then requests the language model by providing it with the question as well as the text. The question and the text can be provided together or successively. It is useful for the text to be provided to the language model first and even, possibly, in anticipation of the triggering of the processing according to the second mode. Indeed, the prior processing of the text by the language model generally makes it possible to minimize the delay between the triggering of the second mode and obtaining the response.
[0062] A masking component may be provided at this stage to mask certain portions of text before providing them to the language model. A filtering component may also be provided to filter the text by preventing certain portions of text from being passed to the language model.
[0063] This mechanism ensures that an adequate answer to the question asked is obtained while avoiding unnecessary use of the language model. It also allows the confidentiality of stored and processed data to be respected.
[0064] [Fig.2] represents a processing circuit (200) adapted to implement the steps of a method for querying the database (106). It comprises a processor (202), a memory (204) storing computer program instructions and a communication interface (206) with all or part of the elements of a system (100) for querying the database.
[0065] More generally, the database query method can be implemented by many types of hardware and / or computing means arrangements software, centralized and / or distributed. For example, the processing circuit can represent a database manager or a search engine.
[0066] [Fig.3] and [Fig.4] illustrate an example of a query processing process across two distinct scenarios.
[0067] The difference between the two scenarios lies in the nature of the question contained in the request to be processed.
[0068] In the first scenario which corresponds to the example of [Fig.3], the question posed is such that the processing interface manages to process the request by implementing only the first mode.
[0069] In the second scenario which corresponds to the example of [Fig.4], the question asked is such that the processing interface implements the two modes to process the request.
[0070] In the example considered, the first steps of the treatment process are common to both scenarios.
[0071] This involves obtaining (302) by the human-machine interface a question expressed in natural language, obtaining (304) descriptive data from a database linked to an entity and implementing (312) the first mode of processing the question.
[0072] In the first scenario, it is considered that the first mode is sufficient to determine the answer to the question by extracting the relevant data from the descriptive data and formulating a response in natural language indicating the relevant data.
[0073] The extraction of the relevant data and the formulation of the response may result, in a manner known per se, from the application of a predetermined rule associated with the question when this question and its formulation had been anticipated when designing the rule.
[0074] After verifying (314) that the response is obtained, the process ends with a transmission (328) of the response for its return to the user.
[0075] In the second scenario, it is considered that the first mode does not allow determining an answer to the question asked.
[0076] After verifying (314) that the answer has not been obtained, the process continues by implementing (322) the second mode of processing the question.
[0077] The process comprises a transmission (308) of the descriptive data to a natural language generator responsible for transforming them into text and, consequently, an obtaining (310) of the text by the generator.
[0078] The process then comprises a request (324) to the language model which receives the text and the question and a provision (328) by the language model of an answer to the question.
[0079] This example of processing process has the advantage of simplicity, implementing a minimum of steps in scenarios where only the first mode is implemented and reserving the solicitation of the natural language generator only in cases where this solicitation is made necessary due to an absence of response obtained in the first mode.
[0080] [Fig.5] and [Fig.6] illustrate another example of query processing, still in two distinct scenarios corresponding to the same queries as previously.
[0081] In this new example, the obtaining (304) of the descriptive data, their transmission (308) to the natural language generator and the obtaining (310) of the text by the natural language generator are carried out systematically and before obtaining the question and the implementation (312) of the first processing mode.
[0082] The implementation of these steps (304, 308, 310) is fundamentally independent of the nature of the question asked. Thus, they can be carried out at any time before the possible request of the language model. It may in particular be judicious to trigger them at an early stage of the query processing process so as to facilitate the management of the resources used by the process and minimize the total duration, in particular in scenarios where the answer is finally obtained through the second processing mode.
[0083] In the example considered, the database query system is designed so that the natural language generator, the query mechanism according to the first mode and the language model do not have access to certain sensitive information. This makes it possible, for example, to protect the sensitive data contained in the database from the risk of interception during their transmission between the different elements of the database query system.
[0084] For this purpose, a processing (306) of the obtained descriptive data is implemented in the form of masking. Generally, a masking may be, for example, a substitution of specific predicates or arguments by unique codes which are not affected by the subsequent transformation (308) of the descriptive data into text. The unique codes may be associated with the predicates or arguments which they substitute in a correspondence table for the purposes of a subsequent unmasking (326) by inverse substitution. Thus, the masking concerns the data extracted from the database, so that any sensitive information extracted from the database, in this case a Wi-Fi security key, is substituted by a code before transformation by the generator into natural language.
[0085] To provide additional security, the query mechanism according to the first mode is configured, in the example considered, not to have direct access to the database but only to receive the text obtained by the ge- natural language generator.
[0086] Thus, in the scenario of [Fig.5], a code appears in the response obtained according to the first mode and the associated sensitive information is substituted for the code by unmasking (326) only just before the provision (328) of the response to the user. In the scenario of [Fig.6], the response is obtained in the second mode, the code does not appear there and the unmasking of the response has no effect.
[0087] Another specific feature of the example of [Fig.5] and [Fig.6] lies in the nature of the result obtained according to the first processing mode. In addition to the verification (314) that a proposed response is obtained, an additional verification (316) is provided that the proposed response has been the subject of a favorable evaluation. When one of these two verifications is unfavorable, the automatic triggering (322) of the second processing mode can be provided. This approach makes it possible, depending on the nature of the evaluation, to increase the relevance and / or the quality of the response obtained and provided to the user.
[0088] Different mechanisms for evaluating the response proposal can be envisaged, for example by relying on an explicit or implicit evaluation of the response proposal by the user or on a determination of a level of satisfaction of the user relative to the response proposal, this determination being able for example to be implemented by inference using a machine learning module.
[0089] [Fig.7] illustrates another example of a query processing process, in a scenario corresponding to a query whose processing requires the successive use of the two modes.
[0090] In this example, the obtaining (304) of the descriptive data is implemented after the reception (302) of the question asked but before the implementation (312) of the processing according to the first mode.
[0091] In a context where the content of the database evolves over time, this approach makes it possible to guarantee obtaining an up-to-date response to the question asked.
[0092] Furthermore, a processing (320) of the text is implemented before providing the text to the language model. In the example considered, this processing involves masking like the example of [Fig.5] and [Fig.6], and also involves filtering by removing specific parts of the text relating to specific predicates or arguments.
[0093] This approach is particularly useful in the case where the database query system is primarily managed by the organization that owns the database, with the notable exception of the language model which is managed by a third-party organization.
[0094] Thus, the various elements of the database query system managed by the organization that owns the database have extensive access to the contents of the database, which increases the possibilities of answering the question posed according to the first mode. Conversely, for security reasons, the language model only has access to a limited set of data, possibly in hidden form, with a limited impact on obtaining relevant answers to the questions provided to it.
Claims
Claims
1. Method, implemented by at least one processing circuit, for querying in natural language a database (106) storing descriptive data relating to an entity, the method comprising: obtaining a response to a query comprising a question in natural language via a processing interface (104) to which a text resulting from a transformation by a natural language generator (108) of the descriptive data relating to the entity and the question is provided, the processing interface being configured to request (324), as a function of a result obtained by the processing interface in a first mode, a language model (110) by providing it with the text and the question asked in a second mode, the first and second modes being distinct.
2. The method of claim 1, comprising receiving the request via a human-machine interface.
3. Method according to claim 2, comprising triggering the transformation of the descriptive data after receiving the request.
4. Method according to claim 3, comprising an update of the descriptive data between the reception of the request and the triggering of the transformation of the descriptive data.
5. Method according to any one of claims 1 to 4, comprising obtaining by the natural language generator the text resulting from the transformation of the descriptive data.
6. A method according to any one of claims 1 to 5, comprising use by the natural language generator of a predetermined rule when transforming the descriptive data.
7. A method according to any one of claims 1 to 6, wherein the descriptive data is in the form of predicates with any number of arguments.
8. A method according to any one of claims 1 to 7, wherein the descriptive data is filtered and / or a portion of the descriptive data is masked before the transformation of the descriptive data.
9. A method according to any one of claims 1 to 8, wherein the text is filtered and / or a portion of the text is masked before providing the text to the language model.
10. A method according to any one of claims 1 to 9, wherein the processing interface is configured to perform, in the first mode, a processing of the question by a query mechanism equipped with a natural language understanding rule.
11. The method of any one of claims 1 to 10, wherein: the result obtained by the processing interface in the first mode is indicative of obtaining the response or not obtaining the response in the first mode, and the processing interface is configured to request the language model in the second mode when the result is indicative of not obtaining the response in the first mode.
12. A method according to any one of claims 1 to 11, wherein the result obtained by the processing interface in the first mode comprises a response proposal and an evaluative data item of the response proposal, and the processing interface is configured to provide the response proposal as a response when the evaluative data item is favorable and to request the language model in the second mode when the evaluative data item is unfavorable.
13. Computer program comprising instructions for implementing the method according to one of claims 1 to 12 when this program is executed by a processor.
14. A non-transitory computer-readable recording medium (204) having recorded thereon the computer program of claim 13.
15. System (100) for querying a database (106) storing descriptive data relating to an entity, the system comprising: a processing interface (104) being capable of obtaining a response to a query comprising a question in natural language as a function of a text resulting from a transformation by a natural language generator (108) of the descriptive data relating to the entity and of the question, the processing interface being configured to request (324), as a function of a result obtained by the processing interface in a first mode, a language model (110) by providing it with the text and the question in a second mode, the first and second modes being distinct.
16. System according to claim 15, the system comprising: a human-machine interface capable of obtaining a query comprising a question in natural language.
17. A system according to claim 15 or 16, the system comprising: a natural language generator capable of obtaining the text resulting from the transformation of the descriptive data.