  import json
  import sys
  
  from cymem.cymem cimport Pool, Address
  from murmurhash.mrmr cimport hash64
  from thinc.typedefs cimport weight_t, class_t, feat_t, atom_t, hash_t
  from thinc.linear.avgtron cimport AveragedPerceptron
 
</s> remove import nonproj
 </s> add from .syntax import nonproj </s> remove     def _find_new_head(self, rootid, tokenid, headlabel, heads, labels, spans=None):
 </s> add     @classmethod
    def _find_new_head(cls, token, headlabel): </s> remove         if not spans:
            spans = self._make_span_index(heads)
        queue = spans.get(rootid,[])
        queue.remove(tokenid) # don't search in the subtree of the nonproj arc
 </s> add         queue = [token.head] </s> remove         newheads, newlabels = copy(heads), copy(labels)
        spans = None
        for tokenid, head in enumerate(heads):
            if labels[tokenid].find('||') != -1:
                newlabel,_,headlabel = labels[tokenid].partition('||')
                newhead = self._find_new_head(head,tokenid,headlabel,heads,labels,spans=spans)
                newheads[tokenid] = newhead
                newlabels[tokenid] = newlabel
        return newheads, newlabels


    def _decorate(self, heads, proj_heads, labels):
 </s> add         parse = tokens.to_array([HEAD, DEP])
        labels = [ tokens.vocab.strings[int(p[1])] for p in parse ]
        for token in tokens:
            if cls.is_decorated(token.dep_):
                newlabel,headlabel = cls.decompose(token.dep_)
                newhead = cls._find_new_head(token,headlabel)
                parse[token.i,1] = tokens.vocab.strings[newlabel]
                parse[token.i,0] = newhead.i - token.i
        tokens.from_array([HEAD, DEP],parse)


    @classmethod
    def _decorate(cls, heads, proj_heads, labels):
from .nonproj import PseudoProjectivity
  import json
  import sys
from .nonproj import PseudoProjectivity
  
  from cymem.cymem cimport Pool, Address
  from murmurhash.mrmr cimport hash64
  from thinc.typedefs cimport weight_t, class_t, feat_t, atom_t, hash_t
  from thinc.linear.avgtron cimport AveragedPerceptron
keep add keep keep keep keep keep
 integrated pseudo-projective parsing into parser

- nonproj.pyx holds a class PseudoProjectivity which currently holds
  all functionality to implement Nivre & Nilsson 2005's pseudo-projective
  parsing using the HEAD decoration scheme
- changed lefts/rights in Token to account for possible non-projective
  structures 
spacy/syntax/parser.pyx