def enrich_sentences_with_NLP(self, all_sentences):
if not self.has_NLP_support():<EOL><INDENT>raise NotImplementedError(<EOL>f"<STR_LIT>"<EOL>)<EOL><DEDENT>if len(all_sentences) == <NUM_LIT:0>:<EOL><INDENT>return  <EOL><DEDENT>if self.model.has_pipe("<STR_LIT>"):<EOL><INDENT>self.model.remove_pipe("<STR_LIT>")<EOL>self.logger.debug(<EOL>f"<STR_LIT>"<EOL>f"<STR_LIT>"<EOL>)<EOL><DEDENT>if self.model.has_pipe("<STR_LIT>"):<EOL><INDENT>self.model.remove_pipe(name="<STR_LIT>")<EOL><DEDENT>self.model.add_pipe(<EOL>set_custom_boundary, before="<STR_LIT>", name="<STR_LIT>"<EOL>)<EOL>sentence_batches = self._split_sentences_by_char_limit(<EOL>all_sentences, self.model.max_length<EOL>)<EOL>for sentence_batch in sentence_batches:<EOL><INDENT>custom_tokenizer = TokenPreservingTokenizer(self.model.vocab)<EOL>doc = custom_tokenizer(sentence_batch)<EOL>doc.user_data = sentence_batch<EOL>for name, proc in self.model.pipeline:  <EOL><INDENT>doc = proc(doc)<EOL><DEDENT>try:<EOL><INDENT>assert doc.is_parsed<EOL><DEDENT>except Exception:<EOL><INDENT>self.logger.exception(f"<STR_LIT>")<EOL><DEDENT>for sent, current_sentence_obj in zip(doc.sents, sentence_batch):<EOL><INDENT>parts = defaultdict(list)<EOL>for i, token in enumerate(sent):<EOL><INDENT>parts["<STR_LIT>"].append(token.lemma_)<EOL>parts["<STR_LIT>"].append(token.tag_)<EOL>parts["<STR_LIT>"].append(<EOL>token.ent_type_ if token.ent_type_ else "<STR_LIT:O>"<EOL>)<EOL>head_idx = (<EOL><NUM_LIT:0> if token.head is token else token.head.i - sent[<NUM_LIT:0>].i + <NUM_LIT:1><EOL>)<EOL>parts["<STR_LIT>"].append(head_idx)<EOL>parts["<STR_LIT>"].append(token.dep_)<EOL><DEDENT>current_sentence_obj.pos_tags = parts["<STR_LIT>"]<EOL>current_sentence_obj.lemmas = parts["<STR_LIT>"]<EOL>current_sentence_obj.ner_tags = parts["<STR_LIT>"]<EOL>current_sentence_obj.dep_parents = parts["<STR_LIT>"]<EOL>current_sentence_obj.dep_labels = parts["<STR_LIT>"]<EOL>yield current_sentence_obj<EOL><DEDENT><DEDENT>
Enrich a list of fonduer Sentence objects with NLP features. We merge
and process the text of all Sentences for higher efficiency.

:param all_sentences: List of fonduer Sentence objects for one document
:return: