Patent ID: 11768831

Abstract:
A natural language query to domain-specific language query (NLQ-to-DSLQ) translation system includes a language model and a domain-specific language (DSL) parser that constrains the output of the language model to a DSL, such as structured query language (SQL). At each decoding step, the language model generates a predicted next token for each of a set of potential translations of a NLQ. The DSL parser evaluates each of the potential translations at each decoding step based on a set of stored DSL rules, which define valid terminology, syntax, grammar, and/or other constraints of the DSL. The DSL parser may reject and remove from consideration partial potential translations that are invalid or receive a low parsing score, such that the language model only continues to generate new tokens at the next decoding step for partial potential translations that are determined to be valid and/or sufficiently high scoring.