def METHOD_NAME(
    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