title: Negation and dependency parsing with spaCy
body: <p>Sentiment words behave very differently when under the semantic scope of negation. I want to use a slightly modified version of <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.202.6418&amp;rep=rep1&amp;type=pdf" rel="noreferrer">Das and Chen (2001)</a>
  They detect words such as <em>no</em>, <em>not</em>, and <em>never</em> and then append a "neg"-suffix to every word appearing between a negation and a clause-level punctuation mark. 
  I want to create something similar with dependency parsing from spaCy.</p>
  
  <pre><code>import spacy
  from spacy import displacy
  
  nlp = spacy.load('en')
  doc = nlp(u'$AAPL is óóóóópen to ‘Talk’ about patents with GOOG definitely not the treatment #samsung got:-) heh')
  
  options = {'compact': True, 'color': 'black', 'font': 'Arial'}
  displacy.serve(doc, style='dep', options=options)
  </code></pre>
  
  <p>Visualized dependency paths:</p>
  
  <p><a href="https://i.stack.imgur.com/ENG1j.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/ENG1j.jpg" alt="enter image description here"></a></p>
  
  <p>Nicely, there exists a negation modifier in the dependency tag scheme; <code>NEG</code></p>
  
  <p>In order to identify negation I use the following:</p>
  
  <pre><code> negation = [tok for tok in doc if tok.dep_ == 'neg']
  </code></pre>
  
  <p>Now I want to retrieve the scope of the negations.</p>
  
  <pre><code>import spacy
  from spacy import displacy
  import pandas as pd
  
  nlp = spacy.load("en_core_web_sm")
  doc = nlp(u'AAPL is óóóóópen to Talk about patents with GOOG definitely not the treatment got')
  
  print('DEPENDENCY RELATIONS')
  print('Key: ')
  print('TEXT, DEP, HEAD_TEXT, HEAD_POS, CHILDREN')
  
  for token in doc:
      print(token.text, token.dep_, token.head.text, token.head.pos_,
        [child for child in token.children])
  </code></pre>
  
  <p>This gives the following output:</p>
  
  <pre><code>DEPENDENCY RELATIONS
  Key: 
  TEXT, DEP, HEAD_TEXT, HEAD_POS, CHILDREN
  AAPL nsubj is VERB []
  is ROOT is VERB [AAPL, óóóóópen, got]
  óóóóópen acomp is VERB [to]
  to prep óóóóópen ADJ [Talk]
  Talk pobj to ADP [about, definitely]
  about prep Talk NOUN [patents]
  patents pobj about ADP [with]
  with prep patents NOUN [GOOG]
  GOOG pobj with ADP []
  definitely advmod Talk NOUN []
  not neg got VERB []
  the det treatment NOUN []
  treatment nsubj got VERB [the]
  got conj is VERB [not, treatment]
  </code></pre>
  
  <p>How to filter out only the token.head.text of <em>not</em>, so <code>got</code> and it's locating?
  Can someone help me out? </p>