IP Library Granted Patent US 10,691,685
Granted Patent B2
US 10,691,685 · App. 15/721,705 · Granted Jun 23, 2020

Converting natural language input to structured queries

Inventors: Vishal Verma (Mountain View, CA); Gang Xiang (Santa Clara, CA); Vishnu Konda (Campbell, CA); Chetan V. Kale (Sunnyvale, CA)
Assignee: Apple Inc.
G06F16/24522G06F16/248G06F16/2468G06F16/3329G06F16/3334G06F16/3344G06F40/211G06F40/295G06F40/30G06F40/44G06N3/0427G06N3/0436G06N3/0445G06N3/0454G06N5/022
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 10,691,685
App. No.
15/721,705
Granted
Jun 23, 2020
Kind
B2
Abstract

The subject technology provides for converting natural language input to structured queries. The subject technology receives a user input query in a natural language format. The subject technology determines scores for candidate entities derived from the user input query. The subject technology selects an entity with a highest score among the candidate entities, and converts, using a context-free grammar, the user input query to a structured query based at least in part on the selected entity. The subject technology classifies the structured query to an expected answer type, the expected answer type corresponding to a type of an expected answer of the structured query. The subject technology queries a database based on the expected answer type and the structured query, the database including information corresponding to a knowledge graph. The subject technology provides, for display, an answer to the user input query based on a result of querying the database.

Claims (67)

1. A method comprising:

receiving a user input query, the user input query being in a natural language format;

determining scores for candidate entities derived from the user input query, the scores being based at least in part on historical statistical information corresponding to the candidate entities;

selecting an entity with a highest score among the candidate entities;

applying a context-free grammar to the user input query along with an indication of the selected entity to generate a structured query;

classifying the structured query to an expected answer type, the expected answer type corresponding to a type of an expected answer of the structured query;

querying a database based on the expected answer type and the structured query; and

providing, for display, an answer to the user input query based on a result of querying the database.

2. The method of claim 1 , wherein determining scores for candidate entities further comprises:

assigning respective probabilities for each word or combination of words from the user input query, the respective probabilities indicating a likelihood of each word or combination of words corresponding to a particular candidate entity.

3. The method of claim 1 , wherein the database comprises information corresponding to a knowledge graph and applying the context-free grammar to the user input query is further based on fuzzy matching of information from the knowledge graph to determine at least a portion of the structured query.

4. The method of claim 3 , wherein fuzzy matching of data of information from the knowledge graph further comprises:

determining a particular node in the knowledge graph corresponding to the selected entity;

selecting an edge connecting the particular node to a second node, the edge representing a particular property associated with the selected entity;

determining words that have a semantic relationship with respect to the particular property;

determining that a particular word from the user input query is similar to a respective word from the determined semantic relationship words for the particular property; and

providing a mapping of the particular word to the particular property of the edge.

5. The method of claim 1 , wherein applying the context-free grammar to the user input query along with the indication of the selected entity to generate the structured query further comprises:

removing a particular word from the user input query, the particular word corresponding to an extra token in the user input query; and

determining whether remaining words from the user input query match a particular rule provided by the context-free grammar.

6. The method of claim 1 , further comprising:

selecting a second entity among the candidate entities;

applying the context-free grammar to the user input query along with an indication of the selected second entity to generate a second structured query;

discarding, based on domain knowledge, the second structured query for querying the database based on the selected second entity; and

in response to the discarding, selecting the structured query for querying the database.

7. The method of claim 6 , wherein the domain knowledge is based at least in part on statistics indicating a frequency of particular input queries for particular properties of respective entities.

8. The method of claim 1 , wherein providing, for display, the answer to the user input query is based on a domain of the expected answer of the structured query.

9. The method of claim 1 , wherein the expected answer type corresponds to at least one of a category, topic, or format for a query response to the structured query.

10. A device comprising;

at least one memory; and

at least one processor configured to:

receive a user input query, the user input query being in a natural language format;

convert, using a context-free grammar, the user input query to a structured query based at least in part on an entity selected from the user input query;

classify the structured query to an expected answer type, the expected answer type corresponding to a type of an expected answer of the structured query;

query a database based on the expected answer type and the structured query; and

provide, for display, an answer to the user input query based on a result of querying the database.

11. The device of claim 10 , wherein the at least one processor is further configured to:

assign respective probabilities for each word or combination of words from the user input query, the respective probabilities indicating a likelihood of each word or combination of words corresponding to a particular candidate entity.

12. The device of claim 10 , wherein the database comprises information corresponding to a knowledge graph and the at least one processor is configured to convert, using the context-free grammar, the user input query based on fuzzy matching of information from the knowledge graph to determine at least a portion of the structured query.

13. The device of claim 12 , wherein the at least one processor is further configured to:

determine a particular node in the knowledge graph corresponding to the selected entity;

select an edge connecting the particular node to a second node, the edge representing a particular property associated with the selected entity;

determine words that have a semantic relationship with respect to the particular property;

determine that a particular word from the user input query is similar to a respective word from the determined semantic relationship words for the particular property; and

provide a mapping of the particular word to the particular property of the edge.

14. The device of claim 10 , wherein the at least one processor is further configured to:

remove a particular word from the user input query, the particular word corresponding to an extra token in the user input query; and

determine whether remaining words from the user input query match a particular rule provided by the context-free grammar.

15. The device of claim 10 , wherein the at least one processor is further configured to:

select a second entity from the user input query;

apply the context-free grammar to the user input query along with an indication of the selected second entity to generate a second structured query;

discard, based on domain knowledge, the second structured query for querying the database based on the selected second entity; and

in response to the discarding, select the structured query for querying the database.

16. The device of claim 15 , wherein the domain knowledge is based at least in part on statistics indicating a frequency of particular input queries for particular properties of respective entities.

17. The device of claim 10 , wherein the at least one processor is further configured to provide, for display, the answer to the user input query is based on a domain of the expected answer of the structured query.

18. The device of claim 10 , wherein the expected answer type corresponds to at least one of a category, topic, or format for a query response to the structured query.

19. A computer program product comprising code stored in a non-transitory computer-readable storage medium, the code comprising:

code to receive a user input query;

code to determine scores for candidate entities derived from the user input query, the scores being based at least in part on historical statistical information corresponding to the candidate entities;

code to select an entity with a highest score among the candidate entities;

code to convert, using a context-free grammar, the user input query to a structured query based at least in part on the selected entity;

code to query a database based on the structured query, the database including information corresponding to associations between entities; and

code to provide, for display, an answer to the user input query based on a result of querying the database.

20. The computer program product of claim 19 , wherein the code to determine scores for candidate entities further comprises:

code to assign respective probabilities for each word or combination of words from the user input query, the respective probabilities indicating a likelihood of each word or combination of words corresponding to a particular candidate entity.

21. The computer program product of claim 19 , wherein the information corresponding to associations between entities comprises a knowledge graph and the code to convert, using the context-free grammar, the user input query to the structured query comprises to code to convert, using the context-free grammar, the user input query to the structured query based at least in part on fuzzy matching of information from the knowledge graph to determine at least a portion of the structured query.

22. The computer program product of claim 19 , wherein the code to convert, using the context-free grammar, the user input query to the structured query comprises code to convert, using the context-free grammar, the user input query to the structured query based at least in part on fuzzy matching of the information corresponding to the associations between the entities to determine at least a portion of the structured query.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Oct 2, 2017
From: VERMA, VISHAL; XIANG, GANG; KONDA, VISHNU; KALE, CHETAN V.
To: APPLE INC.
Reel/Frame 043759/0860 →
Continuity (2)
Provisional Application 62514832 · Jun 3, 2017
Related Publication 20180349377A1 · Dec 6, 2018
Cited By (3)
US 12,475,114 US 12,694,453 US 12,705,433