Search code examples
pythonnlpdynamically-generatednlp-question-answeringnlg

Ask dynamic questions for information acquisition


I am developing a chatbot that asks the user the information that is not there in the database.

Consider the database has 40 details for every person: Name, Age, Fav food, Fav Restaurant, Fav city, Reason for Fav City, Four the most liked things in the city,etc.

So, the questions can be "What is our name?" "Why do you like Paris?" "Name four places in Paris that you like the most?"

etc.

I want these questions to be generated by the bot on the fly but have no idea how to formulate these questions in English. Any help or direction (research papers/libraries/codes, etc) would be appreciated.


Solution

  • Natural Language Generation is a broad field. If you have a (not only finite but also) small enough set of possible questions, you could use canned text, which means that you prepare template strings that you enrich with the necessary information from the database, e.g.

    "why do you like {}?"format("Paris"). 
    

    This is not the most elegant way, but definitely a method often applied in NLP Systems. Alternatively, you have to build the full pipeline of Content determination, Text planning, micro planning and then surface realisation. The first means that you determine the content of your question, e.g. "reasons for liking paris". The middle concepts mean building a HPSG-like structure that reveals the constituent-structure of your expression, semantic roles, arguments of the verb, adjuncts etc. Surface realisation can be done unsing simpleNLG or another tool of your choice/platform. Both ways are possible for online generation, but the first is definitely less work. For a good scientific overview: https://arxiv.org/pdf/1703.09902.pdf