title: Can I find subject from Spacy Dependency tree using NLTK in python?
body: <p>I want to find the <strong>subject</strong> from a sentence using <code>Spacy</code>. The code below is working fine and giving a <strong>dependency tree</strong>.</p>
  
  <pre><code>import spacy
  from nltk import Tree
  
  en_nlp = spacy.load('en')
  
  doc = en_nlp("The quick brown fox jumps over the lazy dog.")
  
  def to_nltk_tree(node):
      if node.n_lefts + node.n_rights &gt; 0:
          return Tree(node.orth_, [to_nltk_tree(child) for child in node.children])
      else:
          return node.orth_
  
  
  [to_nltk_tree(sent.root).pretty_print() for sent in doc.sents]
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/OhAFy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OhAFy.png" alt="enter image description here"></a></p>
  
  <p>From this dependency tree code, Can I find the <strong>subject</strong> of this sentence?</p>