1

I have a NLP (natural language processing application) running that gives me a tree of the parsed sentence, the questions is then how should I proceed with that.

What is the time
\-SBAR - Suborginate clause
  |-WHNP - Wh-noun phrase
  | \-WP - Wh-pronoun
  |  \-What
  \-S - Simple declarative clause
   \-VP - Verb phrase
     |-VBZ - Verb, 3rd person singular present
     | \-is
     \-NP - Noun phrase
       |-DT - Determiner
       | \-the
       \-NN - Noun, singular or mass
         \-time

the application has a build in javascript interpreter, and was trying to make the phrase in to a simple function such as

function getReply() {
   return Resource.Time();
}

in basic terms, what = request = create function, is would be the returned object, and the time would reference the time, now it would be easy just to make a simple parser for that but then we also have what is the time now, or do you know what time it is. I need it to be able to be further developed based on the english language as the project will grow.

the source is C# .Net 4.5

thanks in advance.

  • If you are asking how to identify semantically equivalent questions like "what is the time?" and "do you know what time it is?", then it is a fairly difficult problem. solving the general case will require quite a bit of research effort (before the actual deployable coding work starts). – Chthonic Project Feb 03 '14 at 01:38
  • Yes, I am rewritting a AIML based AI engine, that has been in development for 2+ years, the problem is research is all that has been done, however i am still unable to see what the best way to tackle this would be. – Theodor Solbjørg Feb 03 '14 at 01:40
  • Thanks for the prompt reply. I will try my best to answer. I doubt any answer on SO will be able to provide a good solution to this problem in its generality, but for simple queries, let me try to help :) – Chthonic Project Feb 03 '14 at 01:47
  • Thanks, anything that will kick start it will be good, since it has to have a stable foundation upon which it is based. – Theodor Solbjørg Feb 03 '14 at 02:46
  • The answer to the question "natural language query processing" is "madly violet". But seriously, what is your question in the first place? – greenoldman Feb 03 '14 at 07:27

1 Answers1

1

As far as I can see, using dependency parse trees will be more helpful. Often, the number of ways a question is asked is limited (I mean statistically significant variations are limited ... there will probably be corner cases that people ordinarily do not use), and are expressed through words like who, what, when, where, why and how.

Dependency parsing will enable you to extract the nominal subject and the direct as well as indirect objects in a query. Typically, these will express the basic intent of the query. Consider the example of tow equivalent queries:

  1. What is the time?
  2. Do you know what the time is?

Their dependency parse structures are as follows:

root(ROOT-0, What-1)
cop(What-1, is-2)
det(time-4, the-3)
nsubj(What-1, time-4)

and

aux(know-3, Do-1)
nsubj(know-3, you-2)
root(ROOT-0, know-3)
dobj(is-7, what-4)
det(time-6, the-5)
nsubj(is-7, time-6)
ccomp(know-3, is-7)

Both are what-queries, and both contain "time" as a nominal subject. The latter also contains "you" as a nominal subject, but I think expressions like "do you know", "can you please tell me", etc. can be removed based on heuristics.

You will find the Stanford Parser helpful for this approach. They also have this online demo, if you want to see some more examples at work.

Chthonic Project
  • 8,216
  • 1
  • 43
  • 92
  • thanks, im not using the standford parser but a modified/rewritten OpenNLP, but you did spark an idea, which i can query in to. – Theodor Solbjørg Feb 10 '14 at 09:27
  • OpenNLP, I am afraid, does not have dependency parsing. [The answer here](http://stackoverflow.com/questions/5556778/opennlp-is-there-a-way-to-get-the-subject-of-a-sentence-using-opennlp) confirms my fear. – Chthonic Project Feb 10 '14 at 14:24
  • Sorry, ment SharpNLP which is a translation of OpenNLP, but i believe it does. if not, just an extra task on the list. – Theodor Solbjørg Feb 10 '14 at 16:01
  • Haha, i know, I wanted something simple that i could work from, call it a barebone, as in this question, just need a place to start from. – Theodor Solbjørg Feb 11 '14 at 08:55