class_docstr: A class for writing training data to a file.
docstr: Pre-processes training data examples by removing not trainable entities.
docstr_tok: ["Pre-processes","training","data","examples","by","removing","not","trainable","entities","."]
code: def prepare_training_examples(
      training_data: "TrainingData",
  ) -> Dict[Text, List[Union[Dict, Text]]]:
      """Pre-processes training data examples by removing not trainable entities."""
      import rasa.shared.nlu.training_data.util as rasa_nlu_training_data_utils
  
      training_examples: Dict[
          Text, List[Union[Dict, Text]]
      ] = OrderedDict()
  
      # Sort by intent while keeping basic intent order
      for example in [
          e.as_dict_nlu() for e in training_data.training_examples
      ]:
          if not example.get(INTENT):
              continue
          rasa_nlu_training_data_utils.remove_untrainable_entities_from(
              example
          )
          intent = example[INTENT]
          training_examples.setdefault(intent, [])
          training_examples[intent].append(example)
  
      return training_examples
  
imports: import abc
  import json
  from collections import OrderedDict
  from pathlib import Path
  import rasa.shared.nlu.training_data.util
  from rasa.shared.constants import INTENT_MESSAGE_PREFIX
  from rasa.shared.nlu.constants import INTENT, ENTITY_ATTRIBUTE_VALUE, ENTITY_ATTRIBUTE_START, ENTITY_ATTRIBUTE_END, ENTITY_ATTRIBUTE_TYPE, ENTITY_ATTRIBUTE_GROUP, ENTITY_ATTRIBUTE_ROLE
  import rasa.shared.utils.io
  import typing
  from typing import Text, Dict, Any, Union, List
  from collections import defaultdict
label_desc: Use image node_id 3 for calling the TrainingDataWriter obj's underlying member method code with example usage: obj.prepare_training_examples(training_data) and returns: training_examples