  
          # Add 'RIGHT_ATTRS' to self._patterns[key]
          _patterns = [[[pat["RIGHT_ATTRS"]] for pat in pattern] for pattern in patterns]
          self._patterns[key].extend(_patterns)
  
          # Add each node pattern of all the input patterns individually to the
          # matcher. This enables only a single instance of Matcher to be used.
          # Multiple adds are required to track each node pattern.
 
</s> remove         for i, current_patterns in enumerate(_patterns):
 </s> add         for i, current_patterns in enumerate(_patterns, start=pattern_offset): </s> remove         self._tokens_to_key.pop(key)
 </s> add         for mklist in self._tokens_to_key.pop(key):
            for mkey in mklist:
                self._matcher.remove(mkey)
        pattern_offset = len(self._patterns[key])
  
          # Add 'RIGHT_ATTRS' to self._patterns[key]
          _patterns = [[[pat["RIGHT_ATTRS"]] for pat in pattern] for pattern in patterns]
        pattern_offset = len(self._patterns[key])
          self._patterns[key].extend(_patterns)
  
          # Add each node pattern of all the input patterns individually to the
          # matcher. This enables only a single instance of Matcher to be used.
          # Multiple adds are required to track each node pattern.
keep keep add keep keep keep keep keep
 Fix Dependency Matcher Ordering Issue (#9337)

* Fix inconsistency

This makes the failing test pass, so that behavior is consistent whether
patterns are added in one call or two.

The issue is that the hash for patterns depended on the index of the
pattern in the list of current patterns, not the list of total patterns,
so a second call would get identical match ids.

* Add illustrative test case

* Add failing test for remove case

Patterns are not removed from the internal matcher on calls to remove,
which causes spurious weird matches (or misses).

* Fix removal issue

Remove patterns from the internal matcher.

* Check that the single add call also gets no matches 
spacy/matcher/dependencymatcher.pyx