class_docstr: Label Encoder for the named entity recognition task.
class_docstr_tok: ["Label","Encoder","for","the","named","entity","recognition","task","."]
docstr: Extract the annotations, check the unique entity groups, and build entity to index mappings.
docstr_tok: ["Extract","the","annotations",",","check","the","unique","entity","groups",",","and","build","entity","to","index","mappings","."]
code: def fit(self, y: pd.Series, x: pd.Series):
      """
      Extract the annotations, check the unique entity groups, and build entity to index mappings.
      """
      _, entity_groups = self.extract_ner_annotations(y)
      self.unique_entity_groups = self.ner_special_tags + entity_groups
      self.entity_map = {
          entity: index
          for index, entity in enumerate(self.unique_entity_groups)
      }
      self.config.entity_map = self.entity_map
      self.inverse_entity_map = {
          index: entity
          for index, entity in enumerate(self.unique_entity_groups)
      }
      logger.debug(f"Unique entity groups in the data: {entity_groups}")
  
imports: import json
  import logging
  import re
  from typing import Any, Dict, List, Optional, Union
  import jsonschema
  import numpy
  import pandas
  from omegaconf import DictConfig, OmegaConf
  from sklearn.preprocessing import LabelEncoder
  from ..constants import AUTOMM, END_OFFSET, ENTITY_GROUP, NER_ANNOTATION, PROBABILITY, START_OFFSET
label_desc: Use image node_id 2 for calling the NerLabelEncoder obj's underlying member method code with example usage: obj.fit(y, x) without return types