class_docstr: Named Entity Recognition pipeline using any `ModelForTokenClassification`. See the [named entity recognition
  examples](../task_summary#named-entity-recognition) for more information.
  
  Example:
  
  ```python
  >>> from transformers import pipeline
  
  >>> token_classifier = pipeline(model="Jean-Baptiste/camembert-ner", aggregation_strategy="simple")
  >>> sentence = "Je m'appelle jean-baptiste et je vis à montréal"
  >>> tokens = token_classifier(sentence)
  >>> tokens
  [{'entity_group': 'PER', 'score': 0.9931, 'word': 'jean-baptiste', 'start': 12, 'end': 26}, {'entity_group': 'LOC', 'score': 0.998, 'word': 'montréal', 'start': 38, 'end': 47}]
  
  >>> token = tokens[0]
  >>> # Start and end provide an easy way to highlight words in the original text.
  >>> sentence[token["start"] : token["end"]]
  ' jean-baptiste'
  
  >>> # Some models use the same idea to do part of speech.
  >>> syntaxer = pipeline(model="vblagoje/bert-english-uncased-finetuned-pos", aggregation_strategy="simple")
  >>> syntaxer("My name is Sarah and I live in London")
  [{'entity_group': 'PRON', 'score': 0.999, 'word': 'my', 'start': 0, 'end': 2}, {'entity_group': 'NOUN', 'score': 0.997, 'word': 'name', 'start': 3, 'end': 7}, {'entity_group': 'AUX', 'score': 0.994, 'word': 'is', 'start': 8, 'end': 10}, {'entity_group': 'PROPN', 'score': 0.999, 'word': 'sarah', 'start': 11, 'end': 16}, {'entity_group': 'CCONJ', 'score': 0.999, 'word': 'and', 'start': 17, 'end': 20}, {'entity_group': 'PRON', 'score': 0.999, 'word': 'i', 'start': 21, 'end': 22}, {'entity_group': 'VERB', 'score': 0.998, 'word': 'live', 'start': 23, 'end': 27}, {'entity_group': 'ADP', 'score': 0.999, 'word': 'in', 'start': 28, 'end': 30}, {'entity_group': 'PROPN', 'score': 0.999, 'word': 'london', 'start': 31, 'end': 37}]
  ```
  
  Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)
  
  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",".","Example",":","``","`","python",">",">",">","from","transformers","import","pipeline",">",">",">","token_classifier","=","pipeline","(","model=","''","Jean-Baptiste\/camembert-ner","''",",","aggregation_strategy=","''","simple","''",")",">",">",">","sentence","=","``","Je","m'appelle","jean-baptiste","et","je","vis","\u00e0","montr\u00e9al","''",">",">",">","tokens","=","token_classifier","(","sentence",")",">",">",">","tokens","[","{","'entity_group","'",":","'PER","'",",","'score","'",":","0.9931",",","'word","'",":","'jean-baptiste","'",",","'start","'",":","12",",","'end","'",":","26","}",",","{","'entity_group","'",":","'LOC","'",",","'score","'",":","0.998",",","'word","'",":","'montr\u00e9al","'",",","'start","'",":","38",",","'end","'",":","47","}","]",">",">",">","token","=","tokens","[","0","]",">",">",">","#","Start","and","end","provide","an","easy","way","to","highlight","words","in","the","original","text",".",">",">",">","sentence","[","token","[","``","start","''","]",":","token","[","``","end","''","]","]","'","jean-baptiste'",">",">",">","#","Some","models","use","the","same","idea","to","do","part","of","speech",".",">",">",">","syntaxer","=","pipeline","(","model=","''","vblagoje\/bert-english-uncased-finetuned-pos","''",",","aggregation_strategy=","''","simple","''",")",">",">",">","syntaxer","(","``","My","name","is","Sarah","and","I","live","in","London","''",")","[","{","'entity_group","'",":","'PRON","'",",","'score","'",":","0.999",",","'word","'",":","'my","'",",","'start","'",":","0",",","'end","'",":","2","}",",","{","'entity_group","'",":","'NOUN","'",",","'score","'",":","0.997",",","'word","'",":","'name","'",",","'start","'",":","3",",","'end","'",":","7","}",",","{","'entity_group","'",":","'AUX","'",",","'score","'",":","0.994",",","'word","'",":","'is","'",",","'start","'",":","8",",","'end","'",":","10","}",",","{","'entity_group","'",":","'PROPN","'",",","'score","'",":","0.999",",","'word","'",":","'sarah","'",",","'start","'",":","11",",","'end","'",":","16","}",",","{","'entity_group","'",":","'CCONJ","'",",","'score","'",":","0.999",",","'word","'",":","'and","'",",","'start","'",":","17",",","'end","'",":","20","}",",","{","'entity_group","'",":","'PRON","'",",","'score","'",":","0.999",",","'word","'",":","'","i","'",",","'start","'",":","21",",","'end","'",":","22","}",",","{","'entity_group","'",":","'VERB","'",",","'score","'",":","0.998",",","'word","'",":","'live","'",",","'start","'",":","23",",","'end","'",":","27","}",",","{","'entity_group","'",":","'ADP","'",",","'score","'",":","0.999",",","'word","'",":","'in","'",",","'start","'",":","28",",","'end","'",":","30","}",",","{","'entity_group","'",":","'PROPN","'",",","'score","'",":","0.999",",","'word","'",":","'london","'",",","'start","'",":","31",",","'end","'",":","37","}","]","``","`","Learn","more","about","the","basics","of","using","a","pipeline","in","the","[","pipeline","tutorial","]","(","..","\/pipeline_tutorial",")","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",")","."]
code: def aggregate(
      self,
      pre_entities: List[dict],
      aggregation_strategy: AggregationStrategy,
  ) -> List[dict]:
      if aggregation_strategy in {
          AggregationStrategy.NONE,
          AggregationStrategy.SIMPLE,
      }:
          entities = []
          for pre_entity in pre_entities:
              entity_idx = pre_entity["scores"].argmax()
              score = pre_entity["scores"][entity_idx]
              entity = {
                  "entity": self.model.config.id2label[entity_idx],
                  "score": score,
                  "index": pre_entity["index"],
                  "word": pre_entity["word"],
                  "start": pre_entity["start"],
                  "end": pre_entity["end"],
              }
              entities.append(entity)
      else:
          entities = self.aggregate_words(
              pre_entities, aggregation_strategy
          )
  
      if aggregation_strategy == AggregationStrategy.NONE:
          return entities
      return self.group_entities(entities)
  
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, ChunkPipeline, Dataset
label_desc: Use image node_id 9 for calling the TokenClassificationPipeline obj's underlying member method code with example usage: obj.aggregate(pre_entities, aggregation_strategy) and returns: self, entities