Natural language processing device for database control and control method thereof

KR102999649B1Active Publication Date: 2026-08-05KAKAO ENTERPRISE CORP +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
KR1020230094749
Authority / Receiving Office
KR · KR
Patent Type
Patents
Current Assignee / Owner
Priority Date
2022-12-07
Filing Date
2023-07-20
Publication Date
2026-08-05
Estimated Expiration
2043-07-20

Smart Images

  • Figure R1020230094749_ABST
    Figure R1020230094749_ABST
Patent Text Reader

Abstract

The present invention relates to a natural language processing technology that converts a natural language query into an SQL query. More specifically, the present invention relates to a natural language processing technology that classifies a database based on a natural language query and converts the natural language query into an SQL query corresponding to the classified database.
Need to check novelty before this filing date? Find Prior Art

Description

Technology Field

[0001] The present invention relates to natural language processing, and more specifically, to natural language processing that converts natural language input into a language for controlling a database. Background Technology

[0003] Recently, with the technological advancement of the natural language processing field, there has been a growing use of natural language-mediated conversational methods to obtain desired services, moving away from operations based on traditional machine-centric command input / output methods.

[0004] SQL refers to a language that enables communication between a database and a computer language for the retrieval, storage, and deletion of data. Through the standard SQL language, one can connect to and control the majority of databases (e.g., Oracle, DB2, SQL Server, MySQL, etc.).

[0005] Translating natural language queries into SQL queries (hereinafter referred to as NL2SQL) refers to converting natural language queries into SQL language corresponding to them. Recently, many methods utilizing artificial intelligence technology for NL2SQL have been developed, but there are problems such as relatively low accuracy or inability to process various types of natural languages.

[0006] Accordingly, there is a need for research on technologies that can perform NL2SQL effectively with higher accuracy while supporting various natural languages ​​(especially Korean). The problem to be solved

[0008] The problem that the present invention aims to solve is to provide NL2SQL technology capable of supporting various types of natural languages.

[0009] Another problem that the present invention aims to solve is to provide a technology that improves the efficiency and accuracy of NL2SQL technology.

[0010] Another problem that the present invention aims to solve is to provide a pre-manipulation process applied to a large language model (LLM) to increase the accuracy of the conversion when implementing NL2SQL using a large language model.

[0011] The technical problems to be solved by the present invention are not limited to those mentioned above, and other technical problems not mentioned will be clearly understood by those skilled in the art to which the present invention belongs from the description below. means of solving the problem

[0013] According to one aspect of the present invention to solve the above or other problems, a natural language processing device is provided, comprising: a classification unit that classifies a database based on a natural language query; and a conversion model that converts the natural language query into an SQL query corresponding to the classified database.

[0014] It may further include a normalization unit that applies normalization to the above-mentioned transformed SQL query.

[0015] The above normalization unit can apply the above normalization by utilizing entity tagging information.

[0016] The above entity tagging information may be information for normalizing names used in the above classified database.

[0017] The above normalization may include a transformation of at least one of dates, times, and numbers to correspond to the classified database.

[0018] The above transformation model may be composed of a transformer encoder that performs encoding for the above natural language query; and a transformer decoder that decodes the output value of the encoder to output the above SQL query.

[0019] The above transformer encoder can use a database schema together with the above natural language query when performing the above encoding.

[0020] The above transformer may be a Relation-Aware Transformer (RAT) that encodes specific relationships between multiple tokens constituting the above natural language query.

[0021] The above-mentioned converted SQL query may include a domain attribute addition model to reflect domain attributes.

[0023] According to another aspect of the present invention to solve the above or other problems, a method for controlling a natural language processing device is provided, comprising: a step in which a classification unit classifies a database based on a natural language query; and a step in which a conversion model converts the natural language query into an SQL query corresponding to the classified database.

[0024] It may further include a normalization step that applies normalization to the above-mentioned transformed SQL query.

[0025] The above normalization step can apply the normalization by utilizing entity tagging information.

[0026] The above entity tagging information may be information for normalizing names used in the above classified database.

[0027] The above normalization may include a transformation of at least one of dates, times, and numbers to correspond to the classified database.

[0028] The above transformation model may be composed of a transformer encoder that performs encoding for the above natural language query; and a transformer decoder that decodes the output value of the encoder to output the above SQL query.

[0029] The above transformer encoder can use a database schema together with the above natural language query when performing the above encoding.

[0030] The above transformer may be a Relation-Aware Transformer (RAT) that encodes specific relationships between multiple tokens constituting the above natural language query.

[0031] The above converted SQL may further include a step of adding domain attributes to reflect domain attributes. Effects of the invention

[0033] The effects of the natural language processing technology according to the present invention are described as follows.

[0034] According to at least one of the embodiments of the present invention, there is an advantage in that NL2SQL technology capable of supporting various types of natural languages ​​can be provided.

[0035] In addition, according to at least one of the embodiments of the present invention, there is an advantage in that a technology can be provided that improves the efficiency and accuracy of NL2SQL technology.

[0036] Additionally, according to at least one embodiment of the present invention, in implementing NL2SQL using a Large Language Model (LLM), there is an advantage in that a pre-manipulation process applied to the Large Language Model can be provided to increase the accuracy of the conversion.

[0037] Further scopes of the applicability of the present invention will become apparent from the following detailed description. However, since various changes and modifications within the spirit and scope of the present invention are clearly understood by those skilled in the art, specific embodiments, such as the detailed description and preferred embodiments of the present invention, should be understood as being given merely as examples. Brief explanation of the drawing

[0039] FIG. 1 is a block diagram illustrating a natural language processing device (100) according to an embodiment of the present invention. FIG. 2 is a diagram illustrating a conceptual diagram of a conversion model (102) according to an embodiment of the present invention. FIG. 3 is a diagram illustrating a flowchart of a natural language processing method according to an embodiment of the present invention. FIG. 4 is a drawing for explaining the structure of a transformer model according to one embodiment. FIG. 5 is a drawing for explaining the detailed structure of an encoder (510) according to one embodiment of the present invention. FIG. 6 is a drawing for explaining the structure of a decoder (520) according to one embodiment of the present invention. FIG. 7 is a diagram illustrating the concept of relationship recognition attention according to an embodiment of the present invention. FIG. 8 illustrates a converted SQL query (801) for an example of a natural language query (701) of FIG. 7. FIG. 9 illustrates an example of an SQL template (901, SQL Query sketch) according to an embodiment of the present invention. Specific details for implementing the invention

[0040] Hereinafter, embodiments disclosed in this specification will be described in detail with reference to the attached drawings. Identical or similar components regardless of drawing symbols will be assigned the same reference number, and redundant descriptions thereof will be omitted. The suffixes "module" and "part" used for components in the following description are assigned or used interchangeably solely for the ease of drafting the specification and do not inherently possess distinct meanings or roles. Furthermore, in describing embodiments disclosed in this specification, if it is determined that a detailed description of related prior art could obscure the essence of the embodiments disclosed in this specification, such detailed description will be omitted. Additionally, the attached drawings are intended only to facilitate understanding of the embodiments disclosed in this specification; the technical concept disclosed in this specification is not limited by the attached drawings, and it should be understood that they include all modifications, equivalents, and substitutions that fall within the spirit and technical scope of the present invention.

[0041] Terms including ordinal numbers, such as first, second, etc., may be used to describe various components, but said components are not limited by said terms. These terms are used solely for the purpose of distinguishing one component from another.

[0042] When it is stated that one component is "connected" or "connected" to another component, it should be understood that while it may be directly connected or connected to that other component, there may also be other components in between. On the other hand, when it is stated that one component is "directly connected" or "directly connected" to another component, it should be understood that there are no other components in between.

[0043] A singular expression includes a plural expression unless the context clearly indicates otherwise.

[0044] In this application, terms such as “comprising” or “having” are intended to specify the existence of the features, numbers, steps, actions, components, parts, or combinations thereof described in the specification, and should be understood as not precluding the existence or addition of one or more other features, numbers, steps, actions, components, parts, or combinations thereof.

[0046] FIG. 1 is a block diagram illustrating a natural language processing device (100) according to an embodiment of the present invention.

[0047] Referring to FIG. 1, a natural language processing device (100) according to an embodiment of the present invention may be configured to include a classification unit (101), a transformation model (102), a normalization unit (103), a domain feature addition model (104), a classification training unit (114), a transformation model training unit (115), a training DB (106), a schema DB (107), an entity tagging information DB (108), and a domain feature DB (109).

[0048] Since the components illustrated in FIG. 1 are not essential for implementing the natural language processing device (100), the natural language processing device (100) described herein may have more or fewer components than the components listed above.

[0050] The classification unit (101) is configured to classify databases related to the input natural language query and databases unrelated to the input natural language query when the natural language query is input. That is, the classification unit (101) receives the natural language query as input and determines the database related to the input natural language query.

[0051] The conversion model (102) is a configuration that converts natural language queries into SQL queries.

[0052] In particular, the conversion model (102) according to one embodiment of the present invention can use the classification result of the classification unit (101) to refer to what database is related to the input natural language query and generate an SQL query to control or query the database related to the input natural language query.

[0053] Referring to FIG. 2 below, the conversion model (102) will be examined in more detail.

[0055] FIG. 2 is a diagram illustrating a conceptual diagram of a conversion model (102) according to an embodiment of the present invention.

[0056] A conversion model (102) according to one embodiment of the present invention receives a natural language query (201) and converts it into an SQL query (202) by referring to the classification result (203) of the classification unit (101). The SQL query (202) is likely a command for controlling a database related to the received natural language query (201).

[0058] In the illustrated example, the natural language query (201) is a question that requires querying a database named "Participates_in", and the classification unit (101) interprets the natural language query (201) and transmits to the transformation model (102) as a classification result (203) that the database named "Participates_in" is a related database. Upon receiving this, the transformation model (102) can generate an SQL query that can query (control) the database named "Participates_in".

[0059] Returning to Figure 1, the remaining components will be explained.

[0061] The normalization unit (103) is configured to perform normalization on the SQL query transformed by the transformation model (102). Normalization may refer to the process of matching the form expressed in the database. That is, depending on the type of database, the formats used for table names, specific data item names included in the table, dates / times / numbers, etc., may differ, and normalization may refer to the operation of matching these formats with the format of the database to be queried.

[0062] For example, converting 'last year' or 'the previous year' into the database's year format, '2022', could be normalization.

[0064] Furthermore, the normalization unit (103) according to one embodiment of the present invention may further include performing entity tagging by considering entity tagging information.

[0065] Entity tagging information refers to matching information regarding a specific target and term(s) when a database uses a different term for a particular target, or when multiple terms exist to refer to a specific target. Entity tagging refers to the process of converting various terms into names used within the database using entity tagging information.

[0066] In other words, if there are names received via a natural language query that are not used in the database, the information used to convert those names into names used in the database can be referred to as entity tagging information.

[0067] As a specific example, when the entity 'Momo Rabbit' is used as the term 'Momo Rabbit diaper' in the database, the entity tagging information includes information that matches 'Momo Rabbit' with 'Momo Rabbit diaper'.

[0068] And converting 'Momo Rabbit' into 'Momo Rabbit Diaper' using this entity tagging information can be called entity tagging.

[0070] A domain characteristic addition model (104) according to one embodiment of the present invention is configured to add domain characteristics to an SQL query in order to operate differently according to the customer's business logic. As a specific example, the domain characteristic addition model (104) can add domain characteristics through modifications such as changing the name of an output column or adding a where clause.

[0071] To add domain characteristics, the domain characteristic addition model (104) can use domain characteristic information stored in the domain characteristic DB (109).

[0073] The classification training unit (114) is a configuration that trains the classification unit (101) using training data stored in the training DB (106).

[0074] The transformation model training unit (115) is configured to train the transformation model (102) based on the training data stored in the training DB (106) and the schema data stored in the schema DB.

[0075] The training DB (106) is configured to store at least one training data. Training data refers to a dataset that serves as a standard for utilizing an artificial neural network or other artificial intelligence program. More specifically, training data is a dataset in which a specific input and an output that is the correct answer to the specific input are paired, and is used to train an artificial intelligence model so that the correct output can be produced.

[0076] The training data according to one embodiment of the present invention may be composed of a dataset in which natural language queries and correct answer SQL queries converted therefrom form pairs.

[0078] A schema DB (107) according to an embodiment of the present invention is a configuration that stores schema data for each database. Schema data refers to data that includes a structure in which the structure of data, the method of representing data, and the relationships between data are defined in a formal language in a specific database. It can be viewed as a kind of user manual for using a specific database.

[0079] The entity tagging information DB (108) is a configuration that stores at least one entity tagging information. Entity tagging information refers to matching information for a specific target and term(s) as described above.

[0080] The domain characteristic DB (109) is a configuration that stores domain characteristic information. The domain characteristic information is used to reflect domain characteristics in the aforementioned domain characteristic addition model (104).

[0081] Below, we examine a natural language processing technology according to an embodiment of the present invention with reference to a specific flowchart.

[0083] FIG. 3 is a diagram illustrating a flowchart of a natural language processing method according to an embodiment of the present invention.

[0084] In step S301, the classification unit (101) receives a natural language query input. A natural language query is a natural language containing a question to be converted into an SQL query, and means a target to be converted into an SQL query for controlling or querying at least one of a plurality of databases.

[0085] Then, in step S302, the classification unit (101) classifies the databases for the input natural language query (databases related to the natural language query). The classification unit (101) distinguishes between databases related to the natural language query and databases not related to the query among the aforementioned multiple databases.

[0086] Next, in step S303, the conversion model (102) converts the input natural language query into an SQL query. As described above together with FIG. 2, the conversion of the SQL query performed by the conversion model (102) can be performed by utilizing the classification result (203) of the classification unit (101).

[0087] The specific configuration of this conversion model (102) will be examined in more detail below with reference to FIG. 4.

[0089] In step S304, normalization is performed on the SQL query transformed in step S303. As mentioned above, normalization refers to the process of matching the form expressed in the database and includes performing entity tagging.

[0090] If normalization is performed to include entity tagging, the entity tagging information stored in the aforementioned entity tagging information DB (108) can be used.

[0091] In step S305, the domain characteristic addition model (104) applies domain rules to the result of normalization. As previously described, when applying domain rules, the domain characteristic addition model (104) can use domain characteristic information stored in the domain characteristic DB.

[0093] A transformation model (102) according to one embodiment of the present invention may be based on the structure of a transformer model. The structure of a transformer model will be described below with reference to FIGS. 4 to 6.

[0095] FIG. 4 is a drawing for explaining the structure of a transformer model according to one embodiment.

[0096] The Transformer model follows the encoder-decoder structure of the existing seq2seq but is implemented using attention (or self-attention).

[0097] Transformer models are characterized by generally superior performance compared to recurrent neural networks (RNNs), despite employing an encoder-decoder structure instead of using RNNs. Transformer models are primarily used for tasks such as natural language processing (NLP), translation, and question and answering (Q&A).

[0098] The layers that make up the Transformer consist of self-attention models instead of models such as CNNs or RNNs.

[0100] Referring to FIG. 4, the transformer model (400) can provide an SQL query that transforms the given input data (natural language query) as output data. The transformer model (400) can determine the output data at the current time based on the input data and the previous output data from the previous time.

[0101] However, if only natural language queries are provided as input, there is a problem in that the transformer model (400) cannot perform conversion into accurate SQL queries. Accordingly, it is proposed that the input data of the transformer model (400) according to an embodiment of the present invention include not only natural language queries but also a database schema. The database schema included therein may be a schema for a database classified by the classification unit (101).

[0102] According to one embodiment of the present invention, a database schema provided as input data is proposed to be serialized.

[0104] The transformer model (400) may include a plurality of encoders (420) and a plurality of decoders (440). The transformer model (400) may have a structure in which encoders (420) and decoders (440), each having self-attention as a basic block, are stacked. The encoders (420) may include N (N is a natural number greater than or equal to 2) encoders, and the decoders (440) may include N decoders. The encoders (420) and decoders (440) may each be implemented in a form in which the same layer is repeated N times.

[0105] Encoders (420) according to one embodiment of the present invention are proposed to replace self-attention or apply relation-aware attention together with self-attention.

[0106] The structure of a transformer with relationship-aware attention applied in this way is called a Relation-Aware Transformer (RAT).

[0107] The concept of relationship recognition attention will be examined in more detail below with reference to Fig. 7.

[0109] Among the encoders (420), the first encoder (Encoder 1) can receive an embedding vector of input data derived by the first embedding (410), and among the decoders (440), the first decoder (Decoder 1) can receive an embedding vector of previous output data derived by the second embedding (430). Here, the input data and the previous output data may be, for example, a specific word or sentence. Before the embedding vector is input to Encoder 1 and Decoder 1, a positional encoding value may be added to the embedding vector. The positional encoding value may be used to provide positional information of the word within the sentence.

[0110] The encoders (420) can sequentially perform layer operations equal to the number of encoders (420) and then transmit the output value of the last encoder (encoder N) to each decoder (440). Afterward, the decoders (440) also perform layer operations equal to the number of decoders (440), and the output value transmitted by encoder N can be used each time an operation is performed. The output value from the last decoder N can be linearly transformed by a linear process (450), and output data can be determined based on the linearly transformed value.

[0111] The structure of the transformer model (400) shown in FIG. 4 is merely one embodiment, and the structure of the transformer model used in the embodiments may vary, and the scope of the embodiments should not be interpreted as being limited by the structure of the transformer model (400).

[0113] FIG. 5 is a drawing for explaining the detailed structure of an encoder (510) according to one embodiment of the present invention.

[0114] Referring to FIG. 5, the encoder (510) may correspond to any one of the encoders (420) of the transformer model (400) illustrated in FIG. 4. The encoder (510) may include an attention block (512), Add & Norm blocks (514, 518), and a feedforward block (516).

[0115] When the encoder (510) is implemented as a layer of a neural network, the encoder (510) may include a first sub-layer corresponding to an attention block (512) and a second sub-layer corresponding to a feedforward block (516).

[0116] The attention block (512) determining the attention value may correspond to multi-head self-attention. Multi-head self-attention may mean performing self-attention operations in parallel. Self-attention operation means performing an attention operation on itself, and attention operation means processing to obtain an attention value.

[0117] The feedforward block (516) can correspond to a general feedforward neural network.

[0118] Add & Norm blocks (514, 518) can perform residual connection operations that add inputs and outputs together and layer normalization operations that perform normalization using mean and variance.

[0119] The attention block (512) can determine the similarity with each key for a given query and reflect the determined similarity as a weight to each value mapped to the key. The attention block (512) can provide the attention value by performing a weighted sum of the values ​​with the reflected similarity.

[0120] Here, the query, key, and value can be, for example, all word vectors of the input sentence. In the self-attention performed by the attention block (512), the similarity between words within the input sentence is calculated, so the probability that a specific word is associated with another word can be determined.

[0122] FIG. 6 is a drawing for explaining the structure of a decoder (520) according to one embodiment of the present invention.

[0123] Referring to FIG. 6, the decoder (520) may correspond to any one of the decoders (440) of the transformer model (400) illustrated in FIG. 4. Similar to the encoder (510) of FIG. 5, the decoder (520) may include blocks for performing self-attention operations and feedforward operations.

[0124] The decoder (520) may include a masked attention block (622), Add & Norm blocks (632, 634, 636), an attention block (624), and a feedforward block (626).

[0125] When the decoder (520) is implemented as a layer of a neural network, the decoder (520) may include a first sub-layer corresponding to a masked attention block (622), a second sub-layer corresponding to an attention block (624), and a third sub-layer corresponding to a feedforward block (516).

[0126] The masked attention block (622) and the attention block (624) determine the attention value and can correspond to multi-head attention. Multi-head attention may mean performing attention operations in parallel. The masked attention block (622) and the attention block (624) can perform the same operations as the attention block (512).

[0127] However, the masked attention block (622) differs from the attention block (624) in that masking is applied to the attention score matrix. The masking serves to prevent the attention score matrix from referencing words at a future point in time rather than its own word. In the attention block (624), a self-attention operation can be performed.

[0128] The feedforward block (626) can correspond to a general feedforward neural network.

[0129] The Add & Norm blocks (632, 634, 636) can perform a residual linking operation that adds the inputs and outputs together and a layer normalization operation that performs normalization using the mean and variance.

[0131] FIG. 7 is a diagram illustrating the concept of relationship recognition attention according to an embodiment of the present invention.

[0132] FIG. 8 illustrates a converted SQL query (801) for an example of a natural language query (701) of FIG. 7.

[0133] Looking at FIG. 7, a database schema (702) corresponding to a natural language query (701) "For the cars with 4 cylinders, which model has the largest horsepower?" is shown.

[0134] The schema (702) may include information (table title, row title, column title, etc.) about a plurality of tables (702-1, 702-2, ...) included in the database. In the illustrated drawings, the first to fourth tables (702-1 to 702-4) are illustrated as examples.

[0136] It can be seen that among the natural language queries (701), 'cars' matches, in whole or in part, the table names of the first and second tables (702-1, 702-2) (hereinafter referred to as corresponding, Question → Table linking (711) in FIG. 7). If a word corresponds to a table name, it is desirable to increase the attention weight for that word.

[0137] If 'cylinders' and 'model' in the natural language query (701) correspond to column names in the first table (702-1) and 'horsepower' corresponds to column names in the second table (702-2) (Question → Column linking (712) in FIG. 7), it would be desirable to increase the attention weight for the corresponding words.

[0139] Furthermore, since the name of the first table (702-1) includes the word 'cars', the column names 'cylinders' and 'model' can be recognized as having a high association with the word 'cars'. In other words, the attention weights between them should be increased.

[0140] Likewise, since the name of the second table (702-2) also contains the word 'cars', the column name 'horsepower' is recognized as having a high association with the word 'cars', so the attention weight between them should be increased.

[0142] The second column 'model' of the second table (702-2) corresponds to the first column 'model_id' of the third table (702-3), and the second column 'maker' of the third table (702-3) corresponds to the first column 'maker_id' of the fourth table (702-4) (Column → Column linking (713) in FIG. 7).

[0144] As such, in one embodiment of the present invention, it is proposed to calculate attention weights by encoding specific relationships between tokens when considering a natural language query (701) and a schema (702) together. Encoding that further considers such specific relationships can be expressed by the following mathematical formulas 1 and 2.

[0145]

[0146] e in mathematical formula 1 ijrepresents the attention score. The input sequence is and the output sequence is am.

[0147] r in Equation 1 and Equation 2 below ij is x i w x j It is an element intended to reflect the relationship.

[0148] r ij e excluding the element ij is two input elements x i w x j It is calculated as a compatibility function that compares r ij The element reflects that if a specific token in the question corresponds to a schema table name, the embedding for the corresponding i and j indices is enabled.

[0150]

[0151] Mathematical Equation 2 is each output element z i It is a formula for calculating, and r ij It can be seen that the remaining formulas, excluding , are calculated as the weighted sum of the linearly transformed input elements. Similarly, r ij The element reflects that if a specific token in the question corresponds to a schema table name, the embedding for the corresponding i and j indices is enabled.

[0153] Compared to the basic self-attention module, there is a higher possibility of converting into SQL queries suitable for the database schema.

[0155] Below, we examine the specific operation of the decoder.

[0156] A decoder (520) according to one embodiment of the present invention is proposed to have a sketch-based decoder structure.

[0157] More specifically, a decoder (520) according to one embodiment of the present invention proposes to pre-define an SQL template (SQL Query sketch). The SQL template will be explained with reference to FIG. 9.

[0159] FIG. 9 illustrates an example of an SQL template (901, SQL Query sketch) according to an embodiment of the present invention.

[0160] It expresses the information that the table is fixed (so it can be omitted), the SELECT statement contains one COLUMN and one AGGREGATOR, and the WHERE clause can contain multiple COLUMNs, OPRATOR(OP), and VALUE conditions combined with AND.

[0161] If such an SQL template (901) exists, the decoder (520) will simply need to fill in the corresponding slots based on the input natural language query (201) and the encoder output.

[0162] In this case, multiple classifiers are used. The classifier classifies which columns to select and which aggregator to use in the SELECT clause (classifying as NONE if not used), and in the WHERE clause, classifies based on the total number of conditions and how (COLUMN, OPERATOR, VALUE) to fill in each condition.

[0164] FIG. 10 is a diagram illustrating the configuration of a natural language processing device (100) according to one embodiment.

[0165] The natural language processing device (100) according to the various embodiments disclosed in this document may be of various forms. The natural language processing device (100) may include, for example, a portable communication device (e.g., a smartphone), a computer device, a portable multimedia device, a portable medical device, a camera, a wearable device, a home appliance, or a server. The natural language processing device (100) according to the embodiments of this document is not limited to the aforementioned devices.

[0167] Referring to FIG. 10, the natural language processing device (100) includes a processor (1001) and a memory (1002).

[0168] Memory (1002) stores one or more instructions executable by the processor (1001) and various data used in one or more components. The data may include, for example, software (e.g., a program), input or output data for the associated instructions, and data regarding the transformer model. Memory (1002) may include volatile memory such as RAM, DRAM, SRAM, and / or non-volatile memory known in the art such as flash memory.

[0169] The processor (1001) executes one or more instructions stored in memory (1002).

[0170] The processor (1001) can execute one or more operations described above in relation to FIGS. 1 to 9 by executing instructions. Additionally, the configuration of the present invention described above together with FIG. 1 may be a configuration implemented by instructions executed by the processor (1001).

[0171] In one embodiment, the processor (1001) may perform SQL transformation using a transformer model comprising a plurality of encoders and a plurality of decoders. Each of the encoders and decoders may include an attention block that determines an attention value. Here, the attention may be self-attention, which performs attention on itself. Self-attention means, for example, determining the similarity between words within an input sentence as an attention value, and the attention value derived through self-attention may indicate the degree of association each word has with other words. The attention value may represent a probability value that a specific element of the input data (e.g., a specific word within the input sentence) is associated with another element (e.g., another word within the input sentence).

[0173] Although embodiments of the technology for converting natural language queries into SQL queries according to the present invention have been described above, these are described as at least one embodiment, and the technical concept, configuration, and operation of the present invention are not limited thereby. Furthermore, the scope of the technical concept of the present invention is not limited or restricted by the drawings or the description with reference to the drawings. In addition, the concept and embodiments of the invention presented in this invention may be used by those skilled in the art as a basis for modifying or designing other structures to perform the same purpose of the present invention. An equivalent structure modified or changed by those skilled in the art is bound by the technical scope of the present invention as described in the claims, and various changes, substitutions, and modifications are possible within the limits of not departing from the concept or scope of the invention as described in the claims.

Claims

Claim 1 A method for controlling a natural language processing device comprising a memory for storing instructions and a processor configured to execute said stored instructions, wherein the method comprises: a step in which a classification unit executed by the processor classifies a database based on a natural language query; a step in which a transformation model executed by the processor converts said natural language query into an SQL query corresponding to the classified database; and a normalization step in which a normalization unit executed by the processor applies normalization to said transformed SQL query, wherein the normalization step is characterized in that the normalization unit applies the normalization by utilizing entity tagging information. Claim 2 delete Claim 3 delete Claim 4 A method for controlling a natural language processing device, wherein the entity tagging information is information for normalizing names used in the classified database. Claim 5 A method for controlling a natural language processing device, wherein the normalization comprises a conversion of at least one of a date, time, and number to correspond to the classified database. Claim 6 A method for controlling a natural language processing device according to claim 1, wherein the transforming step comprises: a step in which an encoder of a transformer executed by the processor performs encoding for the natural language query; and a step in which a transformer decoder decodes the output value of the encoder and outputs the SQL query. Claim 7 In claim 6, the step of performing the encoding is a method for controlling a natural language processing device, wherein the database schema is used together with the natural language query when performing the encoding. Claim 8 A method for controlling a natural language processing device, wherein, in claim 6, the transformer is a Relation-Aware Transformer (RAT) that encodes specific relationships between a plurality of tokens constituting the natural language query. Claim 9 A method for controlling a natural language processing device according to claim 1, further comprising a domain feature addition step for a domain feature addition model executed by the processor to reflect domain features in the converted SQL. Claim 10 A natural language processing device comprising: a classification unit that classifies a database based on a natural language query; a conversion model that converts the natural language query into an SQL query corresponding to the classified database; and a normalization unit that applies normalization to the converted SQL query, wherein the normalization unit applies the normalization by utilizing entity tagging information.

Citation Information

Patent Citations

  • Text query method and apparatus, device and storage medium

    KR1020210038471A

  • Semantic linking of natural language words with columns and tables in databases

    KR1020210082727A