def _extract_features(self, message: Message, attribute: Text) -> Dict[(Text, Union[(scipy.sparse.spmatrix, np.ndarray)])]:
    (sparse_sequence_features, sparse_sentence_features) = message.get_sparse_features(attribute, self.component_config[FEATURIZERS])
    (dense_sequence_features, dense_sentence_features) = message.get_dense_features(attribute, self.component_config[FEATURIZERS])
    if ((dense_sequence_features is not None) and (sparse_sequence_features is not None)):
        if (dense_sequence_features.features.shape[0] != sparse_sequence_features.features.shape[0]):
            raise ValueError(f"Sequence dimensions for sparse and dense sequence features don't coincide in '{message.get(TEXT)}'for attribute '{attribute}'.")
    if ((dense_sentence_features is not None) and (sparse_sentence_features is not None)):
        if (dense_sentence_features.features.shape[0] != sparse_sentence_features.features.shape[0]):
            raise ValueError(f"Sequence dimensions for sparse and dense sentence features don't coincide in '{message.get(TEXT)}'for attribute '{attribute}'.")
    if ((self.component_config[NUM_TRANSFORMER_LAYERS] == 0) and (not self.component_config[ENTITY_RECOGNITION]) and (attribute not in [INTENT, INTENT_RESPONSE_KEY])):
        sparse_sequence_features = None
        dense_sequence_features = None
    out = {}
    if (sparse_sentence_features is not None):
        out[f'{SPARSE}_{SENTENCE}'] = sparse_sentence_features.features
    if (sparse_sequence_features is not None):
        out[f'{SPARSE}_{SEQUENCE}'] = sparse_sequence_features.features
    if (dense_sentence_features is not None):
        out[f'{DENSE}_{SENTENCE}'] = dense_sentence_features.features
    if (dense_sequence_features is not None):
        out[f'{DENSE}_{SEQUENCE}'] = dense_sequence_features.features
    return out
def _extract_features(self, message: Message, attribute: Text) -> Dict[(Text, Union[(scipy.sparse.spmatrix, np.ndarray)])]:
    (sparse_sequence_features, sparse_sentence_features) = message.get_sparse_features(attribute, self.component_config[FEATURIZERS])
    (dense_sequence_features, dense_sentence_features) = message.get_dense_features(attribute, self.component_config[FEATURIZERS])
    if ((dense_sequence_features is not None) and (sparse_sequence_features is not None)):
        if (dense_sequence_features.features.shape[0] != sparse_sequence_features.features.shape[0]):
            raise ValueError(f"Sequence dimensions for sparse and dense sequence features don't coincide in '{message.get(TEXT)}'for attribute '{attribute}'.")
    if ((dense_sentence_features is not None) and (sparse_sentence_features is not None)):
        if (dense_sentence_features.features.shape[0] != sparse_sentence_features.features.shape[0]):
            raise ValueError(f"Sequence dimensions for sparse and dense sentence features don't coincide in '{message.get(TEXT)}'for attribute '{attribute}'.")
    if ((self.component_config[NUM_TRANSFORMER_LAYERS] == 0) and (not self.component_config[ENTITY_RECOGNITION]) and (attribute not in [INTENT, INTENT_RESPONSE_KEY])):
        sparse_sequence_features = None
        dense_sequence_features = None
    out = {}
    if (sparse_sentence_features is not None):
        out[f'{SPARSE}_{SENTENCE}'] = sparse_sentence_features.features
    if (sparse_sequence_features is not None):
        out[f'{SPARSE}_{SEQUENCE}'] = sparse_sequence_features.features
    if (dense_sentence_features is not None):
        out[f'{DENSE}_{SENTENCE}'] = dense_sentence_features.features
    if (dense_sequence_features is not None):
        out[f'{DENSE}_{SEQUENCE}'] = dense_sequence_features.features
    return out