8
$\begingroup$

I am researching Natural Language Processing (NLP) to develop an NL Question Answering system. The answering part is already done. So processing the question remains, along with the questions regarding the algorithms.

The final product should allow the user to ask a question in NL. The question then gets translated to an Multidimensional Expressions (MDX) query, which generates a script regarding the dimensions of the cube.

How can I translate a natural language question to an MDX query?

The outcome of the question is in the form of a calculation. For example

How many declarations were done by employee 1?

or

Give me the quantities for Sales.

$\endgroup$
2
  • 2
    $\begingroup$ First go through this question DataScience $\endgroup$
    – quintumnia
    Feb 4 '17 at 14:08
  • $\begingroup$ I'm voting to close this question as off-topic (see scope defined in help center). At present it would rather migrate to StackOverflow to get an answer. $\endgroup$ Feb 14 '17 at 3:22
5
$\begingroup$

You can use a component library which can help you to implement Natural language query builder in your application( the question part ) called Open Natural Language Processing Package , so you can definitely develop a module, by using existing modules of OpenNLP such as entity extraction, chunking and parsing.

According to wikipedia source ; it points out that as of 2001, Q&A applications typically includes "a question classifier module which determines the type of question and the type of answer," so "a multiagent question and answering architecture has been proposed, where each domain [or variable] is represented by an agent which tries to answer questions, taking into account its specific knowledge."

But it still need some effort to build a NLgenerators inline with databases , for the answer query and also is the link to help you on how you can work with Compositional Semantic Parsing on Semi-Structured Tables

Hope this can give you some insight.

$\endgroup$
1
  • $\begingroup$ The original version of this answer was just copied and pasted from one or more answers from here. Copy-and-paste answers are not allowed on this site, unless you give proper attribution and make it clear what has been copied. I will leave this comment here until I or someone else can review that all the info in this answer has not been copied/plagiarised. $\endgroup$
    – nbro
    Jan 26 at 15:25
0
$\begingroup$

This is a hard problem to solve, and the best approach depends very much on the scope of your task. If you have a small database table with a limited number of columns, you might get away with some basic pattern matching techniques. If it is more complex than that, you might have to do a full-scale syntactic analysis of the question. This also depends on the variations of possible question types.

Assuming a limited set of variables and variants, you could set up something like:

How many X did Y produce/How many X were done by Y/What is the number of X for Y

where you have two variables to fill from the pattern, which you then use in your query:

select sum(X) where producer == Y

(Or whatever format your query has).

The advantage of this is that you don't need to be a linguistics expert to maintain/expand the system, and you can just add more patterns to it if necessary. You might have to map some terms onto synonyms to get the right column headings/labels out of it. But this approach is not very hard to implement, and you should have a basic system up and running fairly quickly. You then have to see/test what questions your users are asking, and expand the pattern inventory accordingly.

The disadvantage is that you might end up with a long list of patterns, and there could be some which are conflicting, ie the same pattern with different variables will ask for a different kind of result. If that turns out to be a problem, you might have to look for a more powerful approach.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.