0

I am trying to detect whether the sentence I have is a question or no.

I started by thinking about writing keywords, then look-up everytime for those keywords. But I don't think that's enough.

qWords= ["what","when","where","how"]    

def isQuestion(w):
    return any(item for item in w.split(" ") if item.lower() in qWords)

Is there any way to get insight from a question, like extracting places, times ... etc

sentence= "What is the weather in London today". 
  • It's a question
  • Asking about weather
  • Place: London
  • Time: today

If I train words by simply looking in senetence for key words. I would face problem like:

 "The rainy weather, is what I love most about London"

Is there any recommended approach! or Should I try to train all the words like I did in this simple example for both places, times, .. If it's the case, where can I find data set of these words.

user3378649
  • 5,154
  • 14
  • 52
  • 76
  • 1
    You can also try to analyze the word order. – Danil Gaponov Oct 30 '14 at 14:16
  • 2
    hi! there's several questions around a few of the topics you mention. questions detection ([1](http://stackoverflow.com/questions/3573872/how-to-find-out-if-a-sentence-is-a-question-interrogative), [2](http://stackoverflow.com/questions/4083060/determine-if-a-sentence-is-an-inquiry), [3](http://www.quora.com/Natural-Language-Processing/Whats-the-best-way-to-detect-if-a-piece-of-text-is-interrogative)), time detection ([4](http://stackoverflow.com/questions/9294926/how-does-apple-find-dates-times-and-addresses-in-emails)). Please try to narrow down your question to something more specific! – arturomp Oct 30 '14 at 17:04

0 Answers0