class_docstr: Named Entity Recognition pipeline using any `ModelForTokenClassification`. See the [named entity recognition
  examples](../task_summary#named-entity-recognition) for more information.
  
  This token recognition pipeline can currently be loaded from [`pipeline`] using the following task identifier:
  `"ner"` (for predicting the classes of tokens in a sequence: person, organisation, location or miscellaneous).
  
  The models that this pipeline can use are models that have been fine-tuned on a token classification task. See the
  up-to-date list of available models on
  [huggingface.co/models](https://huggingface.co/models?filter=token-classification).
class_docstr_tok: ["Named","Entity","Recognition","pipeline","using","any","`","ModelForTokenClassification","`",".","See","the","[","named","entity","recognition","examples","]","(","..","\/task_summary","#","named-entity-recognition",")","for","more","information",".","This","token","recognition","pipeline","can","currently","be","loaded","from","[","`","pipeline","`","]","using","the","following","task","identifier",":","`","``","ner","''","`","(","for","predicting","the","classes","of","tokens","in","a","sequence",":","person",",","organisation",",","location","or","miscellaneous",")",".","The","models","that","this","pipeline","can","use","are","models","that","have","been","fine-tuned","on","a","token","classification","task",".","See","the","up-to-date","list","of","available","models","on","[","huggingface.co\/models","]","(","https",":","\/\/huggingface.co\/models","?","filter=token-classification",")","."]
docstr: Group together the adjacent tokens with the same entity predicted.
  
  Args:
      entities (`dict`): The entities predicted by the pipeline.
docstr_tok: ["Group","together","the","adjacent","tokens","with","the","same","entity","predicted",".","Args",":","entities","(","`","dict","`",")",":","The","entities","predicted","by","the","pipeline","."]
code: def group_sub_entities(self, entities: List[dict]) -> dict:
      """
      Group together the adjacent tokens with the same entity predicted.
  
      Args:
          entities (`dict`): The entities predicted by the pipeline.
      """
      # Get the first entity in the entity group
      entity = entities[0]["entity"].split("-")[-1]
      scores = np.nanmean([entity["score"] for entity in entities])
      tokens = [entity["word"] for entity in entities]
  
      entity_group = {
          "entity_group": entity,
          "score": np.mean(scores),
          "word": self.tokenizer.convert_tokens_to_string(tokens),
          "start": entities[0]["start"],
          "end": entities[-1]["end"],
      }
      return entity_group
  
imports: import types
  import warnings
  from typing import List, Optional, Tuple, Union
  import numpy
  from ..models.bert.tokenization_bert import BasicTokenizer
  from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available
  from .base import PIPELINE_INIT_ARGS, ArgumentHandler, Dataset, Pipeline
label_desc: Use image node_id 11 for calling the TokenClassificationPipeline obj's underlying member method code with example usage: obj.group_sub_entities(entities) and returns: entity_group