def _create_model_data(self, training_data: List[Message], label_id_dict: Optional[Dict[(Text, int)]]=None, label_attribute: Optional[Text]=None, training: bool=True) -> RasaModelData:
    'Prepare data for training and create a RasaModelData object.'
    from rasa.utils.tensorflow import model_data_utils
    attributes_to_consider = [TEXT]
    if (training and self.component_config[INTENT_CLASSIFICATION]):
        attributes_to_consider.append(label_attribute)
    if (training and self.component_config[ENTITY_RECOGNITION] and self._entity_tag_specs):
        attributes_to_consider.append(ENTITIES)
    if (training and (label_attribute is not None)):
        training_data = [example for example in training_data if (label_attribute in example.data)]
    training_data = [message for message in training_data if message.features_present(attribute=TEXT, featurizers=self.component_config.get(FEATURIZERS))]
    if (not training_data):
        return RasaModelData()
    (features_for_examples, sparse_feature_sizes) = model_data_utils.featurize_training_examples(training_data, attributes_to_consider, entity_tag_specs=self._entity_tag_specs, featurizers=self.component_config[FEATURIZERS], bilou_tagging=self.component_config[BILOU_FLAG])
    (attribute_data, _) = model_data_utils.convert_to_data_format(features_for_examples, consider_dialogue_dimension=False)
    model_data = RasaModelData(label_key=self.label_key, label_sub_key=self.label_sub_key)
    model_data.add_data(attribute_data)
    model_data.add_lengths(TEXT, SEQUENCE_LENGTH, TEXT, SEQUENCE)
    sparse_feature_sizes = self._remove_label_sparse_feature_sizes(sparse_feature_sizes=sparse_feature_sizes, label_attribute=label_attribute)
    model_data.add_sparse_feature_sizes(sparse_feature_sizes)
    self._add_label_features(model_data, training_data, label_attribute, label_id_dict, training)
    model_data.sort()
    return model_data
Prepare data for training and create a RasaModelData object.
def _create_model_data(self, training_data: List[Message], label_id_dict: Optional[Dict[(Text, int)]]=None, label_attribute: Optional[Text]=None, training: bool=True) -> RasaModelData:
    
    from rasa.utils.tensorflow import model_data_utils
    attributes_to_consider = [TEXT]
    if (training and self.component_config[INTENT_CLASSIFICATION]):
        attributes_to_consider.append(label_attribute)
    if (training and self.component_config[ENTITY_RECOGNITION] and self._entity_tag_specs):
        attributes_to_consider.append(ENTITIES)
    if (training and (label_attribute is not None)):
        training_data = [example for example in training_data if (label_attribute in example.data)]
    training_data = [message for message in training_data if message.features_present(attribute=TEXT, featurizers=self.component_config.get(FEATURIZERS))]
    if (not training_data):
        return RasaModelData()
    (features_for_examples, sparse_feature_sizes) = model_data_utils.featurize_training_examples(training_data, attributes_to_consider, entity_tag_specs=self._entity_tag_specs, featurizers=self.component_config[FEATURIZERS], bilou_tagging=self.component_config[BILOU_FLAG])
    (attribute_data, _) = model_data_utils.convert_to_data_format(features_for_examples, consider_dialogue_dimension=False)
    model_data = RasaModelData(label_key=self.label_key, label_sub_key=self.label_sub_key)
    model_data.add_data(attribute_data)
    model_data.add_lengths(TEXT, SEQUENCE_LENGTH, TEXT, SEQUENCE)
    sparse_feature_sizes = self._remove_label_sparse_feature_sizes(sparse_feature_sizes=sparse_feature_sizes, label_attribute=label_attribute)
    model_data.add_sparse_feature_sizes(sparse_feature_sizes)
    self._add_label_features(model_data, training_data, label_attribute, label_id_dict, training)
    model_data.sort()
    return model_data