# Buggy code
def _get_processed_message_tokens_by_attribute(
    self, message: "Message", attribute: Text = TEXT_ATTRIBUTE
) -> List[Text]:
    """Get processed text of attribute of a message"""

    if message.get(attribute) is None:
        # return empty string since sklearn countvectorizer does not like None
        # object while training and predicting
        return [""]

    tokens = self._get_message_tokens_by_attribute(message, attribute)
    tokens = self._process_tokens(tokens, attribute)
    tokens = self._replace_with_oov_token(tokens, attribute)

    return tokens


# Traceback (ValueError)
Traceback (most recent call last):
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\saurabhd\AppData\Local\Programs\Python\Python36\Scripts\rasa.exe\__main__.py", line 7, in <module>
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\__main__.py", line 76, in main
cmdline_arguments.func(cmdline_arguments)
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\cli\train.py", line 76, in train
kwargs=extract_additional_arguments(args),
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\train.py", line 46, in train
kwargs=kwargs,
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\asyncio\base_events.py", line 484, in run_until_complete
return future.result()
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\train.py", line 97, in train_async
kwargs,
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\train.py", line 184, in _train_async_internal
kwargs=kwargs,
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\train.py", line 241, in _do_training
persist_nlu_training_data=persist_nlu_training_data,
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\train.py", line 470, in _train_nlu_with_validated_data
persist_nlu_training_data=persist_nlu_training_data,
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\nlu\train.py", line 86, in train
interpreter = trainer.train(training_data, **kwargs)
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\nlu\model.py", line 191, in train
updates = component.train(working_data, self.config, **context)
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\nlu\featurizers\sparse_featurizer\regex_featurizer.py", line 67, in train
self._text_features_with_regex(example, attribute)
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\nlu\featurizers\sparse_featurizer\regex_featurizer.py", line 76, in _text_features_with_regex
message, extras, feature_name=SPARSE_FEATURE_NAMES[attribute]
File "c:\users\saurabhd\appdata\local\programs\python\python36\lib\site-packages\rasa\nlu\featurizers\featurizer.py", line 67, in _combine_with_existing_sparse_features
f"Cannot concatenate sparse features as sequence dimension does not "
ValueError: Cannot concatenate sparse features as sequence dimension does not match: 7 != 1. Make sure to set 'return_sequence' to the same value for all your featurizers.

# Fixed code
def _get_processed_message_tokens_by_attribute(
    self, message: "Message", attribute: Text = TEXT_ATTRIBUTE
) -> List[Text]:
    """Get processed text of attribute of a message"""

    if message.get(attribute) is None:
        # return empty list since sklearn countvectorizer does not like None
        # object while training and predicting
        return []

    tokens = self._get_message_tokens_by_attribute(message, attribute)
    tokens = self._process_tokens(tokens, attribute)
    tokens = self._replace_with_oov_token(tokens, attribute)

    return tokens