CA3099828C

Systems and methods for translating natural language sentences into database queries

Abstract

Described systems and methods allow an automatic translation from a natural language (e.g., English) into an artificial language such as a structured query language (SQL). In some embodiments, a translator module includes an encoder component and a decoder component, both components comprising recurrent neural networks. Training the translator module comprises two stages. A first stage trains the translator module to produce artificial language (AL) output when presented with an AL input. For instance, the translator is first trained to reproduce an AL input. A second stage of training comprises training the translator to produce AL output when presented with a natural language (NL) input.

CA3099828C, drawing sheet 1
Sheet 1 of 11

Term

12.8 yearsleft in the term

Expires 25 June 2039.

  1. Priority
  2. Filed
  3. Granted
  4. Today
  5. Expires

17 claims: 4 independent, 13 dependent

  1. 1
    A method comprising employing at least one hardware processor of the computer system to:execute an artificial language (AL) encoder and a decoder coupled to the AL encoder, the AL encoder configured to receive a first input array comprising a representation of an input AL sentence formulated in an artificial language, and in response, to produce a first internal array, the decoder configured to receive the first internal array and in response, to produce a first output array comprising a representation of a first output AL sentence formulated in the artificial language;in response to providing the first input array to the AL encoder, determine a first similarity score indicative of a degree of similarity between the input AL sentence and the first output AL sentence;adjust a first set of parameters of the decoder according to the first similarity score to improve a match between AL encoder inputs and decoder outputs;determine whether a first stage training termination condition is satisfied;in response to determining whether the first stage training termination condition is satisfied, if the first stage training termination condition is satisfied, execute a natural language (NL) encoder configured to receive a second input array comprising a representation of an input NL sentence formulated in a natural language, and in response, to output a second internal array to the decoder;determine a second output array produced by the decoder in response to receiving the second internal array, the second output array comprising a representation of a second output AL sentence formulated in the artificial language;determine a second similarity score indicative of a degree of similarity between the second output AL sentence and a target AL sentence comprising a translation of the input NL sentence into the artificial language;and CA 03099828 2020-11-09 WO 2020/002309 PCT/EP2019/066794 adjust a second set of parameters of the NL encoder according to the second similarity score to improve a match between decoder outputs and target outputs representing respective translations into the artificial language of inputs received by the NL encoder.
  2. 9
    A computer system comprising at least one hardware processor and a memory, the at least one hardware processor configured to:execute an AL encoder and a decoder coupled to the AL encoder, the AL encoder configured to receive a first input array comprising a representation of an input AL sentence formulated in an artificial language, and in response, to produce a first internal array, the decoder configured to receive the first internal array and in response, to produce a first output array comprising a representation of a first output AL sentence formulated in the artificial language;in response to providing the first input array to the AL encoder, determine a first similarity score indicative of a degree of similarity between the input AL sentence and the first output AL sentence;adjust a first set of parameters of the decoder according to the first similarity score to improve a match between AL encoder inputs and decoder outputs;determine whether a first stage training termination condition is satisfied;in response to determining whether the first stage training termination condition is satisfied, if the first stage training termination condition is satisfied, execute a NL encoder configured to receive a second input array comprising a representation of an input NL sentence formulated in a natural language, and in response, to output a second internal array to the decoder;determine a second output array produced by the decoder in response to receiving the second internal array, the second output array comprising a representation of a second output AL sentence formulated in the artificial language;determine a second similarity score indicative of a degree of similarity between the second output AL sentence and a target AL sentence comprising a translation of the input NL sentence into the artificial language;and CA 03099828 2020-11-09 WO 2020/002309 PCT/EP2019/066794 adjust a second set of parameters of the NL encoder according to the second similarity score to improve a match between decoder outputs and target outputs representing respective translations into the artificial language of inputs received by the NL encoder.
  3. 16
    17. A non-transitory computer-readable medium storing instructions which, when executed by a first hardware processor of a first computer system, cause the first computer system to form a trained translator module comprising a NL encoder and a decoder connected to the NL encoder, wherein training the translator module comprises employing a second hardware processor of a second computer system to:couple the decoder to an AL encoder configured to receive a first input array comprising a representation of an input AL sentence formulated in an artificial language, and in response, to produce a first internal array, the AL encoder coupled to the decoder so that the decoder receives the first internal array and in response, produces a first output array comprising a representation of a first output AL sentence formulated in the artificial language;in response to providing the first input array to the AL encoder, determine a first similarity score indicative of a degree of similarity between the input AL sentence and the first output AL sentence;adjust a first set of parameters of the decoder according to the first similarity score to improve a match between AL encoder inputs and decoder outputs;determine whether a first stage training termination condition is satisfied;in response to determining whether the first stage training termination condition is satisfied, if the first stage training termination condition is satisfied, couple the NL encoder to the decoder so that the NL encoder receives a second input array comprising a representation of an input NL sentence formulated in a natural language, and in response, outputs a second internal array to the decoder;determine a second output array produced by the decoder in response to receiving the second internal array, the second output array comprising a representation of a second output AL sentence formulated in the artificial language;CA 03099828 2020-11-09 WO 2020/002309 PCT/EP2019/066794 determine a second similarity score indicative of a degree of similarity between the second output AL sentence and a target AL sentence comprising a translation of the input NL sentence into the artificial language;and adjust a second set of parameters of the NL encoder according to the second similarity score to improve a match between decoder outputs and target outputs representing respective translations into the artificial language of inputs received by the NL encoder.
  4. 17
    18. A computer system comprising a first hardware processor configured to execute a trained translator module comprising a NL encoder and a decoder connected to the NL encoder, wherein training the translator module comprises employing a second hardware processor of a second computer system to:couple the decoder to an AL encoder configured to receive a first input array comprising a representation of an input AL sentence formulated in an artificial language, and in response, to produce a first internal array, the AL encoder coupled to the decoder so that the decoder receives the first internal array and in response, produces a first output array comprising a representation of a first output AL sentence formulated in the artificial language;in response to providing the first input array to the AL encoder, determine a first similarity score indicative of a degree of similarity between the input AL sentence and the first output AL sentence;adjust a first set of parameters of the decoder according to the first similarity score to improve a match between AL encoder inputs and decoder outputs;determine whether a first stage training termination condition is satisfied;in response to determining whether the first stage training termination condition is satisfied, if the first stage training termination condition is satisfied, couple the NL encoder to the decoder so that the NL encoder receives a second input array comprising a representation of an input NL sentence formulated in a natural language, and in response, outputs a second internal array to the decoder;CA 03099828 2020-11-09 WO 2020/002309 PCT/EP2019/066794 determine a second output array produced by the decoder in response to receiving the second internal array, the second output array comprising a representation of a second output AL sentence formulated in the artificial language;determine a second similarity score indicative of a degree of similarity between the second output AL sentence and a target AL sentence comprising a translation of the input NL sentence into the artificial language;and adjust a second set of parameters of the NL encoder according to the second similarity score to improve a match between decoder outputs and target outputs representing respective translations into the artificial language of inputs received by the NL encoder.