          for action in self.moves.action_types:
              added = self.moves.add_action(action, label)
              if added:
                  resized = True
          if resized and "nr_class" in self.cfg:
              self.cfg["nr_class"] = self.moves.n_moves
          if self.model not in (True, False, None) and resized:
              self.model.resize_output(self.moves.n_moves)
  
      def add_multitask_objective(self, target):
 
</s> remove         if self.model not in (True, False, None) and resized:
 </s> add         if self.model not in (True, False, None): </s> remove         for entry in patterns:
            label = entry["label"]
            if "id" in entry:
                label = self._create_label(label, entry["id"])
            pattern = entry["pattern"]
            if isinstance(pattern, basestring_):
                self.phrase_patterns[label].append(self.nlp(pattern))
            elif isinstance(pattern, list):
                self.token_patterns[label].append(pattern)
            else:
                raise ValueError(Errors.E097.format(pattern=pattern))
        for label, patterns in self.token_patterns.items():
            self.matcher.add(label, None, *patterns)
        for label, patterns in self.phrase_patterns.items():
            self.phrase_matcher.add(label, None, *patterns)
 </s> add         # disable the nlp components after this one in case they hadn't been initialized / deserialised yet
        try:
            current_index = self.nlp.pipe_names.index(self.name)
            subsequent_pipes = [pipe for pipe in self.nlp.pipe_names[current_index + 1:]]
        except ValueError:
            subsequent_pipes = []
        with self.nlp.disable_pipes(*subsequent_pipes):
            for entry in patterns:
                label = entry["label"]
                if "id" in entry:
                    label = self._create_label(label, entry["id"])
                pattern = entry["pattern"]
                if isinstance(pattern, basestring_):
                    self.phrase_patterns[label].append(self.nlp(pattern))
                elif isinstance(pattern, list):
                    self.token_patterns[label].append(pattern)
                else:
                    raise ValueError(Errors.E097.format(pattern=pattern))
            for label, patterns in self.token_patterns.items():
                self.matcher.add(label, None, *patterns)
            for label, patterns in self.phrase_patterns.items():
                self.phrase_matcher.add(label, None, *patterns) </s> remove         self.model.resize_output(self.moves.n_moves)
 </s> add         self._resize() </s> remove             return self.moves.init_batch(docs)
 </s> add             result = self.moves.init_batch(docs)
            self._resize()
            return result
        if resized:
            self._resize()

    def _resize(self):
        if "nr_class" in self.cfg:
          for action in self.moves.action_types:
              added = self.moves.add_action(action, label)
              if added:
                  resized = True
        if resized:
            self._resize()

    def _resize(self):
        if "nr_class" in self.cfg:
              self.cfg["nr_class"] = self.moves.n_moves
          if self.model not in (True, False, None) and resized:
              self.model.resize_output(self.moves.n_moves)
  
      def add_multitask_objective(self, target):
keep keep keep keep replace keep keep keep keep keep
 Ensure the NER remains consistent after resizing (#4330)

* test and fix for second bug of issue 4042

* fix for first bug in 4042

* crashing test for Issue 4313

* forgot one instance of resize

* remove prints

* undo uncomment

* delete test for 4313 (uses third party lib)

* add fix for Issue 4313

* unit test for 4313 
spacy/syntax/nn_parser.pyx