title: Is there a reasonably accurate heuristic for detecting the subject and object of an English sentence?
body: <p>I realize that flawlessly separating subject noun phrases and object noun phrases from a sentence is an open research problem and is not easily explained here, but is there a smart way of doing this (assuming I already have a POS-tagged sentence) which works for most sentences, or at least relatively simple ones? I know that simply assuming the first noun phrase is the subject is a pretty good approximation, but in sentences beginning with prepositional phrases (e.g., "Across the clearing and through the stream ran the frightened deer."), this fails. Ideally, I'd like something which also recognizes the subject in this case.</p>
  
  <p>For reference, that example sentence gives the following parse tree with the Stanford Parser:</p>
  
  <p><code>[ROOT [S [PP [IN Across] [NP [NP [DT the] [NN clearing] ] [CC and] [NP [IN through] ] ] ] [NP [DT the] [NN stream] ] [VP [VBD ran] [NP [DT the] [ADJP [JJ frightened] ] [NNS deer] ] ] [. .] ] ]</code></p>
  
  <p>My current strategy is as follows:</p>
  
  <ol>
  <li><p>Subject: Do a BFS on the tree, looking for the first NP.</p></li>
  <li><p>Verb: Do a BFS on the tree, looking for the first VP. On this subtree, do a BFS looking for a VB(D|G|N|P|Z).</p></li>
  <li><p>Object: Do a BFS on the VP subtree found above, looking for a NP.</p></li>
  </ol>
  
  <p>This strategy results in the following for my example:
  <code>SUBJECT: (NP (DT the) (NN stream) ) , VERB: (VBD ran) , OBJECT: (NP (DT the) (ADJP (JJ frightened) ) (NNS deer) )</code>.</p>
  
  <p>If possible, I'd like to modify my strategy to not fail on these cases, and eventually even more complicated cases.</p>