class_docstr: Prepare NER data for the model specified by "prefix".
docstr: Process one NER sample's label and text features.
  New rules can be added if necessary.
  
  Parameters
  ----------
  all_features
      All features including text and ner annotations.
  feature_modalities
      The modality of the feature columns.
  
  Returns
  -------
  A dictionary containing one NER sample's features and/or labels.
docstr_tok: ["Process","one","NER","sample","'s","label","and","text","features",".","New","rules","can","be","added","if","necessary",".","Parameters","--","--","--","--","--","all_features","All","features","including","text","and","ner","annotations",".","feature_modalities","The","modality","of","the","feature","columns",".","Returns","--","--","--","-","A","dictionary","containing","one","NER","sample","'s","features","and\/or","labels","."]
code: def process_ner(
      self,
      all_features: Dict[str, Union[int, float, list]],
      feature_modalities: Dict[str, Union[int, float, list]],
      is_training: bool,
  ) -> Dict:
      """
      Process one NER sample's label and text features.
      New rules can be added if necessary.
  
      Parameters
      ----------
      all_features
          All features including text and ner annotations.
      feature_modalities
          The modality of the feature columns.
  
      Returns
      -------
      A dictionary containing one NER sample's features and/or labels.
      """
      ret = {}
      # overwrite model_max_length for standalone checkpoints if it's not specified.
      if (
          self.max_len is not None
          and self.tokenizer.model_max_length > 10**6
      ):
          self.tokenizer.model_max_length = self.max_len
      text_column, annotation_column = None, None
      for column_name, column_modality in feature_modalities.items():
          if column_modality.startswith((TEXT_NER, TEXT)):
              text_column = column_name
          if column_modality == NER_ANNOTATION:
              annotation_column = column_name
  
      ner_text = all_features[text_column]
      if is_training or annotation_column is not None:
          ner_annotation = all_features[annotation_column]
          (
              label,
              col_tokens,
              token_to_word_mappings,
              word_offsets,
          ) = process_ner_annotations(
              ner_annotation, ner_text, self.entity_map, self.tokenizer
          )
          ret.update({self.label_key: label})
      else:
          (
              col_tokens,
              token_to_word_mappings,
              word_offsets,
          ) = tokenize_ner_text(ner_text, self.tokenizer)
          ret.update({self.label_key: np.array([], dtype=np.int32)})
  
      ret.update(
          {
              self.text_token_ids_key: np.array(
                  col_tokens.input_ids, dtype=np.int32
              ),
              self.text_valid_length_key: sum(
                  col_tokens.attention_mask
              ),
              self.text_segment_ids_key: np.array(
                  col_tokens.token_type_ids, dtype=np.int32
              ),
              self.text_token_word_mapping_key: token_to_word_mappings,
              self.text_word_offsets_key: word_offsets,
          }
      )
  
      return ret
  
file_path: autogluon/multimodal/src/autogluon/multimodal/data/process_ner.py
imports: import logging
  import os
  import warnings
  from typing import Any, Dict, List, Optional, Union
  import numpy
  from nptyping import NDArray
  from omegaconf import DictConfig
  from torch import nn
  from ..constants import AUTOMM, NER_ANNOTATION, NER_TEXT, TEXT, TEXT_NER
  from .collator import PadCollator, StackCollator
  from .utils import process_ner_annotations, tokenize_ner_text
label_desc: Use image node_id 3 for calling the NerProcessor obj's underlying member method code with example usage: obj.process_ner(all_features, feature_modalities, is_training) and returns: ret