          return Break.move_cost(s, gold) + Break.label_cost(s, gold, label)
  
      @staticmethod
      cdef inline int move_cost(StateClass s, const GoldParseC* gold) nogil:
          # When we break, we can't reach any arcs between stack and buffer
          # So cost is number of deps between S0...Sn and B0...Nn
          cdef int cost = 0
          cdef int i, j, B_i, S_i
          for i in range(s.buffer_length()):
              B_i = s.B(i)
              for j in range(s.stack_depth()):
                  S_i = s.S(j)
                  cost += gold.heads[B_i] == S_i
                  cost += gold.heads[S_i] == B_i
          return cost
      
      @staticmethod
      cdef inline int label_cost(StateClass s, const GoldParseC* gold, int label) nogil:
          return 0
  
 
</s> remove         while st.stack_depth() >= 2 and st.has_head(st.S(0)):
            st.pop()
        if st.stack_depth() == 1:
            st.pop()
        else:
            st.unshift()
 </s> add         st.fast_forward() </s> remove             best = self.moves.best_gold(scores, stcls, gold)
 </s> add             try:
                best = self.moves.best_gold(scores, stcls, gold)
            except:
                history.append((self.moves.move_name(guess.move, guess.label), '!', stcls.print_state(words)))
                for i, word in enumerate(words):
                    print gold.orig_annot[i]
                print '\n'.join('\t'.join(s) for s in history)
                print words[gold.c.heads[stcls.S(0)]]
                print words[gold.c.heads[stcls.B(0)]]
                print push_cost(stcls, &gold.c, stcls.B(0))
                print arc_cost(stcls, &gold.c, stcls.S(0), stcls.B(0))
                self.moves.set_valid(self.moves._is_valid, stcls)
                raise
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
          return Break.move_cost(s, gold) + Break.label_cost(s, gold, label)
  
      @staticmethod
      cdef inline int move_cost(StateClass s, const GoldParseC* gold) nogil:
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
        # Check for sentence boundary --- if it's here, we can't have any deps
        # between stack and buffer, so rest of action is irrelevant.
        s0_root = _get_root(s.S(0), gold)
        b0_root = _get_root(s.B(0), gold)
        if s0_root == -1 or b0_root == -1 or s0_root != b0_root:
            return 0
        else:
            return 1
      
      @staticmethod
      cdef inline int label_cost(StateClass s, const GoldParseC* gold, int label) nogil:
          return 0
  
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 * Fixes to unshift/fast-forward strategy. Getting 91.55 greedy on NW dev, gold preproc 
spacy/syntax/arc_eager.pyx