# US 2024/0176805 A1 · Systems and methods for semantic parsing with primitive level enumeration

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2024/0176805 A1
- Document ID: US20240176805A1
- Status: Published application
- Kind: A1
- Application number: 18/059,691
- Filed: 2022-11-29
- Published: 2024-05-30
- Earliest claimed: 2022-11-29
- Assignees: Salesforce, Inc.
- Inventors: Ye LIU; Semih YAVUZ; Yingbo ZHOU; Rui MENG
- Web page: https://patentgrep.com/patent/US20240176805A1

## CPC

- G06F 16/3329: Natural language query formulation
- G06F 16/3344: {using natural language analysis}
- G06F 40/205: Parsing
- G06F 40/295: Named entity recognition
- G06F 40/30: Semantic analysis
- G06F 40/40: Processing or translation of natural language (natural language analysis G06F40/20; semantic analysis G06F40/30)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Embodiments described herein provide a semantic parsing framework which may be referred to as Uni-Parser. The Uni-Parser framework may be applied to question answering on both knowledge bases and databases. The three main stages of the Uni-Parser framework are enumeration, ranking, and generation. At the enumeration stage, primitives are enumerated based on matching the question to the data structure. After enumerating primitives, the Uni-Parser framework may rank the primitives used a trained ranker model. The top ranked primitives may then be used as inputs to a generator which is a learned sequence to sequence model which produces a logical form.

## Claims

### Claim 1

A method of generating for a natural language question a logical form that is executable on a database or a knowledge base, the method comprising:
receiving, via a communication interface, the natural language question;
identifying, via a named entity recognition procedure, a first entity from the natural language question;
enumerating, by an enumerator based on the first entity, a plurality of primitives indicative of entities or entity relations in the database or the knowledge base;
ranking, by a ranker module, the plurality of primitives based on their respective relevance to the natural language question;
selecting a subset of top-ranked primitives based on the ranking;
generating, by a generator, the logical form that is executable on the database or the knowledge base based on the natural language question and the subset of the plurality of primitives;
transmitting, via the communication interface, the logical form to a database system or a knowledge base system; and
receiving, via the communication interface, a query result in response to the natural language question based on the logical form.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
identifying a starting knowledge base entity based on matching the starting knowledge base entity with the first entity from the natural language question.

### Claim 3 (depends on 2)

The method of claim 2, wherein the plurality of primitives includes:
one or more primitives of the knowledge base which are one hop from the starting knowledge base entity; and
one or more primitives of the knowledge base which are two hops from the starting knowledge base entity.

### Claim 4 (depends on 1)

The method of claim 1, wherein the plurality of primitives includes:
column names of tables in the database; and
a cell value of the database identified by matching the cell value with the first entity from the natural language question.

### Claim 5 (depends on 1)

The method of claim 1, further comprising:
providing, by the enumerator to the ranker module, the plurality of primitives respectively concatenated with the natural language question and a special token identifying a class of primitive.

### Claim 6 (depends on 1)

The method of claim 1, wherein the ranker module is trained to minimize a contrastive loss, wherein the contrastive loss is based on a positive primitive sample extracted from a ground-truth logical form, and a negative primitive sample.

### Claim 7 (depends on 6)

The method of claim 6, wherein the negative primitive sample is selected from the primitives connected in the knowledge base to a first hop entity extracted from the ground-truth logical form.

### Claim 8 (depends on 6)

The method of claim 6, wherein the negative primitive sample is selected by selecting a cell value in the same table and column as a cell value extracted from the ground-truth logical form.

### Claim 9

A system for generating for a natural language question a logical form that is executable on a database or a knowledge base, the system comprising:
a memory that stores the database or the knowledge base and a plurality of processor-executable instructions;
a communication interface that receives the natural language question; and
one or more hardware processors that read and execute the plurality of processor-executable instructions from the memory to perform operations comprising:
identifying, via a named entity recognition procedure, a first entity from the natural language question;
enumerating, by an enumerator based on the first entity, a plurality of primitives indicative of entities or entity relations in the database or the knowledge base;
ranking, by a ranker module, the plurality of primitives based on their respective relevance to the natural language question;
selecting a subset of top-ranked primitives based on the ranking;
generating, by a generator, the logical form that is executable on the database or the knowledge base based on the natural language question and the subset of the plurality of primitives;
transmitting, via the communication interface, the logical form to a database system or a knowledge base system; and
receiving, via the communication interface, a query result in response to the natural language question based on the logical form.

### Claim 10 (depends on 9)

The system of claim 9, the operations further comprising:
identifying a starting knowledge base entity based on matching the starting knowledge base entity with the first entity from the natural language question.

### Claim 11 (depends on 10)

The system of claim 10, wherein the plurality of primitives includes:
one or more primitives of the knowledge base which are one hop from the starting knowledge base entity; and
one or more primitives of the knowledge base which are two hops from the starting knowledge base entity.

### Claim 12 (depends on 9)

The system of claim 9, wherein the plurality of primitives includes:
column names of tables in the database; and
a cell value of the database identified by matching the cell value with the first entity from the natural language question.

### Claim 13 (depends on 9)

The system of claim 9, the operations further comprising:
providing, by the enumerator to the ranker module, the plurality of primitives respectively concatenated with the natural language question and a special token identifying a class of primitive.

### Claim 14 (depends on 9)

The system of claim 9, wherein the ranker module is trained to minimize a contrastive loss, wherein the contrastive loss is based on a positive primitive sample extracted from a ground-truth logical form, and a negative primitive sample.

### Claim 15 (depends on 14)

The system of claim 14, wherein the negative primitive sample is selected from the primitives connected in the knowledge base to a first hop entity extracted from the ground-truth logical form.

### Claim 16 (depends on 14)

The system of claim 14, wherein the negative primitive sample is selected by selecting a cell value in the same table and column as a cell value extracted from the ground-truth logical form.

### Claim 17

A non-transitory machine-readable medium comprising a plurality of machine-executable instructions which, when executed by one or more processors, are adapted to cause the one or more processors to perform operations comprising:
receiving, via a communication interface, a natural language question;
identifying, via a named entity recognition procedure, a first entity from the natural language question;
enumerating, by an enumerator based on the first entity, a plurality of primitives indicative of entities or entity relations in a database or a knowledge base;
ranking, by a ranker module, the plurality of primitives based on their respective relevance to the natural language question;
selecting a subset of top-ranked primitives based on the ranking;
generating, by a generator, a logical form that is executable on the database or the knowledge base based on the natural language question and the subset of the plurality of primitives;
transmitting, via the communication interface, the logical form to a database system or a knowledge base system; and
receiving, via the communication interface, a query result in response to the natural language question based on the logical form.

### Claim 18 (depends on 17)

The non-transitory machine-readable medium of claim 17, the operations further comprising:
identifying a starting knowledge base entity based on matching the starting knowledge base entity with the first entity from the natural language question.

### Claim 19 (depends on 18)

The non-transitory machine-readable medium of claim 18, wherein the plurality of primitives includes:
one or more primitives of the knowledge base which are one hop from the starting knowledge base entity; and
one or more primitives of the knowledge base which are two hops from the starting knowledge base entity.

### Claim 20 (depends on 17)

The non-transitory machine-readable medium of claim 17, wherein the plurality of primitives includes:
column names of tables in the database; and
a cell value of the database identified by matching the cell value with the first entity from the natural language question.
