Natural Language to Structured Queries

Natural Language to Structured Queries

"What was total profit in California last March? and which products were selling the most?"

Fairly innocuous questions right? But to convert them into a structured query that machines understand and respond to is not straight forward. Generating structured query from natural language has been researched for a long time. Modern packages like NLTK in Python make it easier. But they don’t give you a plug and play solution. The most promising open source framework I’ve seen is Quepy: A Python framework to transform natural language questions to queries. But that requires a lot of further development.

We (at G-Square Solutions) have built an in-house tool to convert natural language into SQL-like structured queries. We use a combination of several techniques to achieve this. Some of them are:

  1. Using NLP techniques identify named entities
  2. Using NLP to classify phrases into different parts of speech
  3. Learning from the data on what are various fields on which questions can be asked
  4. Using machine learning on user generated questions to predict associations between words and sequence of words in a query.
  5. Some bit of hard-coding :)

Some amount of application specific customization is also required in most cases. For example if your queries are of the type “who is the president of Zambia” a particular approach needs to be taken whereas if the queries are of the type “What is the total sales for G-Square in India in 2010” a different approach needs to be taken. First case is a simple information retrieval, in the second case there is some amount of aggregation/analytics also required. Another type of querying could be a simple question like "How is business doing in New York?". A lot of contextualization needs to be built in to understand such questions and respond.

要查看或添加评论,请登录

Gopi Krishna Suvanam的更多文章

  • The Hidden Risks of Over-investment in AI Infrastructure

    The Hidden Risks of Over-investment in AI Infrastructure

    The $500 billion investment in AI Infra definitely looks exciting. But.

    2 条评论
  • The Good, the Bad and the Ugly of ChatGPT

    The Good, the Bad and the Ugly of ChatGPT

    To the uninitiated, ChatGPT is the viral product of the organization OpenAI. It is an AI base chat-bot that interacts…

    2 条评论
  • Transfer Learning: The Future of AI

    Transfer Learning: The Future of AI

    End to end learning is paradigm in machine learning where an algorithm takes inputs and desired actions, to learn a…

    2 条评论
  • Limitations of End-to-End Learning

    Limitations of End-to-End Learning

    (Originally posted as an answer to a Quora question here: https://www.quora.

    1 条评论
  • Value per person is more important

    Value per person is more important

    There has been a mad rush to become the next big thing from eCommerce to social media to SaaS. In this rush, startups…

    1 条评论
  • Neat Learning vs Deep Learning

    Neat Learning vs Deep Learning

    AI world used to have two camps: neats and scruffies. The neats wanted AI solutions to be, well, 'neat'.

    1 条评论
  • Online Learning (by Machines)

    Online Learning (by Machines)

    Most ML methods are applied in a batch process mode. So for example in a simple ML model let’s say we want to learn…

  • Primitives for AI

    Primitives for AI

    I want to explore more structural thoughts in this article. Let’s say I want to build a financial market prediction…

    2 条评论
  • Machine Learning on Small Datasets

    Machine Learning on Small Datasets

    You may be wondering what the image above the title has to do with machine learning. We will get there by the end of…

    4 条评论
  • Can financial markets be predicted? - Brief note for beginners

    Can financial markets be predicted? - Brief note for beginners

    There are lot of concepts at play here. Let me highlight a few.

社区洞察

其他会员也浏览了