0

I am trying to transform English statements into SQL queries.
e.g. How many products were created last year?

This should get transformed to
select count(*) from products where manufacturing date between 1/1/2015 and 31/12/2015

I am not able to understand how to map the verb "created" to "manufacturing date" attribute in my table. I am using Stanford core nlp suite to parse my statement. I am also using wordnet taxonomies with JWI framework.

I have tried to map the verbs to the attributes by defining simple rules. But it is not a very generic approach, since I can not know all the verbs in advance. Is there any better way to achieve this?

I would appreciate any help in this regard.

  • 1
    You may want to take a look at Sempre (https://github.com/percyliang/sempre) -- in general, semantic parsing is trying to solve exactly these types of problems. – Gabor Angeli Jun 09 '16 at 18:36
  • I did take a look at SemPre which I found very neat for my needs. I am writing Java code to get started. But I am not able to find any javadoc or any entry point for the code apart from Linux command line interface. I want to develop it on Windows using Java. Any pointers ? – Narendra Kulkarni Jun 21 '16 at 07:36

1 Answers1

0

I know this would require a tool change, but I would reccommend checking out Adapt by Mycroft AI.

It is a very straightforward intent parser which transforms user input into a json semantic representation.

For example:

Input: "Put on my Joan Jett Pandora station."

JSON:
{
    "confidence": 0.61,
    "target": null,
    "Artist": "joan jett",
    "intent_type": "MusicIntent",
    "MusicVerb": "put on",
    "MusicKeyword": "pandora"
}

It looks like the rules are very easy to specify and expand so you would just need to build out your rules and then have whatever tool you want process the JSON and send the SQL query.

evan.oman
  • 5,922
  • 22
  • 43